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

@ -188,7 +188,7 @@ void SET::GetKeyCodeMap2(Kernel::HLERequestContext& ctx) {
GetKeyCodeMapImpl(ctx);
}
SET::SET() : ServiceFramework("set") {
SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SET::GetLanguageCode, "GetLanguageCode"},

View file

@ -6,6 +6,10 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Set {
/// This is "nn::settings::LanguageCode", which is a NUL-terminated string stored in a u64.
@ -32,7 +36,7 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
class SET final : public ServiceFramework<SET> {
public:
explicit SET();
explicit SET(Core::System& system_);
~SET() override;
private:

View file

@ -6,7 +6,7 @@
namespace Service::Set {
SET_CAL::SET_CAL() : ServiceFramework("set:cal") {
SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetBluetoothBdAddress"},

View file

@ -6,11 +6,15 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Set {
class SET_CAL final : public ServiceFramework<SET_CAL> {
public:
explicit SET_CAL();
explicit SET_CAL(Core::System& system_);
~SET_CAL() override;
};

View file

@ -6,7 +6,7 @@
namespace Service::Set {
SET_FD::SET_FD() : ServiceFramework("set:fd") {
SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
// clang-format off
static const FunctionInfo functions[] = {
{2, nullptr, "SetSettingsItemValue"},

View file

@ -6,11 +6,15 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Set {
class SET_FD final : public ServiceFramework<SET_FD> {
public:
explicit SET_FD();
explicit SET_FD(Core::System& system_);
~SET_FD() override;
};

View file

@ -103,7 +103,7 @@ void SET_SYS::SetColorSetId(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS);
}
SET_SYS::SET_SYS() : ServiceFramework("set:sys") {
SET_SYS::SET_SYS(Core::System& system_) : ServiceFramework{system_, "set:sys"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "SetLanguageCode"},

View file

@ -6,11 +6,15 @@
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::Set {
class SET_SYS final : public ServiceFramework<SET_SYS> {
public:
explicit SET_SYS();
explicit SET_SYS(Core::System& system_);
~SET_SYS() override;
private:

View file

@ -7,14 +7,15 @@
#include "core/hle/service/set/set_fd.h"
#include "core/hle/service/set/set_sys.h"
#include "core/hle/service/set/settings.h"
#include "core/hle/service/sm/sm.h"
namespace Service::Set {
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<SET>()->InstallAsService(service_manager);
std::make_shared<SET_CAL>()->InstallAsService(service_manager);
std::make_shared<SET_FD>()->InstallAsService(service_manager);
std::make_shared<SET_SYS>()->InstallAsService(service_manager);
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
std::make_shared<SET>(system)->InstallAsService(service_manager);
std::make_shared<SET_CAL>(system)->InstallAsService(service_manager);
std::make_shared<SET_FD>(system)->InstallAsService(service_manager);
std::make_shared<SET_SYS>(system)->InstallAsService(service_manager);
}
} // namespace Service::Set

View file

@ -4,11 +4,17 @@
#pragma once
#include "core/hle/service/service.h"
namespace Core {
class System;
}
namespace Service::SM {
class ServiceManager;
}
namespace Service::Set {
/// Registers all Settings services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager);
void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
} // namespace Service::Set