service: Eliminate usages of the global system instance

Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
This commit is contained in:
Lioncash
2020-11-26 15:19:08 -05:00
parent 322349e8cc
commit 1a954b2a59
222 changed files with 1221 additions and 907 deletions

View File

@ -18,7 +18,8 @@
namespace Service::NS {
IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} {
IAccountProxyInterface::IAccountProxyInterface(Core::System& system_)
: ServiceFramework{system_, "IAccountProxyInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "CreateUserAccount"},
@ -31,7 +32,7 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro
IAccountProxyInterface::~IAccountProxyInterface() = default;
IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_)
: ServiceFramework{"IApplicationManagerInterface"}, system{system_} {
: ServiceFramework{system_, "IApplicationManagerInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "ListApplicationRecord"},
@ -428,8 +429,8 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag
return MakeResult(static_cast<u64>(*language_code));
}
IApplicationVersionInterface::IApplicationVersionInterface()
: ServiceFramework{"IApplicationVersionInterface"} {
IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_)
: ServiceFramework{system_, "IApplicationVersionInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetLaunchRequiredVersion"},
@ -449,8 +450,8 @@ IApplicationVersionInterface::IApplicationVersionInterface()
IApplicationVersionInterface::~IApplicationVersionInterface() = default;
IContentManagementInterface::IContentManagementInterface()
: ServiceFramework{"IContentManagementInterface"} {
IContentManagementInterface::IContentManagementInterface(Core::System& system_)
: ServiceFramework{system_, "IContentManagementInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{11, nullptr, "CalculateApplicationOccupiedSize"},
@ -469,7 +470,8 @@ IContentManagementInterface::IContentManagementInterface()
IContentManagementInterface::~IContentManagementInterface() = default;
IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} {
IDocumentInterface::IDocumentInterface(Core::System& system_)
: ServiceFramework{system_, "IDocumentInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{21, nullptr, "GetApplicationContentPath"},
@ -483,7 +485,8 @@ IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"
IDocumentInterface::~IDocumentInterface() = default;
IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} {
IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_)
: ServiceFramework{system_, "IDownloadTaskInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{701, nullptr, "ClearTaskStatusList"},
@ -503,7 +506,8 @@ IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTa
IDownloadTaskInterface::~IDownloadTaskInterface() = default;
IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterface"} {
IECommerceInterface::IECommerceInterface(Core::System& system_)
: ServiceFramework{system_, "IECommerceInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "RequestLinkDevice"},
@ -521,8 +525,8 @@ IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterfa
IECommerceInterface::~IECommerceInterface() = default;
IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface()
: ServiceFramework{"IFactoryResetInterface"} {
IFactoryResetInterface::IFactoryResetInterface(Core::System& system_)
: ServiceFramework{system_, "IFactoryResetInterface"} {
// clang-format off
static const FunctionInfo functions[] = {
{100, nullptr, "ResetToFactorySettings"},
@ -540,7 +544,7 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface()
IFactoryResetInterface::~IFactoryResetInterface() = default;
NS::NS(const char* name, Core::System& system_) : ServiceFramework{name}, system{system_} {
NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} {
// clang-format off
static const FunctionInfo functions[] = {
{7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"},
@ -565,7 +569,7 @@ std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface
class NS_DEV final : public ServiceFramework<NS_DEV> {
public:
explicit NS_DEV() : ServiceFramework{"ns:dev"} {
explicit NS_DEV(Core::System& system_) : ServiceFramework{system_, "ns:dev"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "LaunchProgram"},
@ -592,7 +596,8 @@ public:
class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> {
public:
explicit ISystemUpdateControl() : ServiceFramework{"ISystemUpdateControl"} {
explicit ISystemUpdateControl(Core::System& system_)
: ServiceFramework{system_, "ISystemUpdateControl"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "HasDownloaded"},
@ -627,7 +632,7 @@ public:
class NS_SU final : public ServiceFramework<NS_SU> {
public:
explicit NS_SU() : ServiceFramework{"ns:su"} {
explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetBackgroundNetworkUpdateState"},
@ -659,13 +664,13 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<ISystemUpdateControl>();
rb.PushIpcInterface<ISystemUpdateControl>(system);
}
};
class NS_VM final : public ServiceFramework<NS_VM> {
public:
explicit NS_VM() : ServiceFramework{"ns:vm"} {
explicit NS_VM(Core::System& system_) : ServiceFramework{system_, "ns:vm"} {
// clang-format off
static const FunctionInfo functions[] = {
{1200, nullptr, "NeedsUpdateVulnerability"},
@ -686,9 +691,9 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager);
std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager);
std::make_shared<NS_DEV>()->InstallAsService(service_manager);
std::make_shared<NS_SU>()->InstallAsService(service_manager);
std::make_shared<NS_VM>()->InstallAsService(service_manager);
std::make_shared<NS_DEV>(system)->InstallAsService(service_manager);
std::make_shared<NS_SU>(system)->InstallAsService(service_manager);
std::make_shared<NS_VM>(system)->InstallAsService(service_manager);
std::make_shared<PL_U>(system)->InstallAsService(service_manager);
}