mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-15 23:17:58 -05:00
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:
@ -12,7 +12,8 @@ namespace Service::APM {
|
||||
|
||||
class ISession final : public ServiceFramework<ISession> {
|
||||
public:
|
||||
ISession(Controller& controller) : ServiceFramework("ISession"), controller(controller) {
|
||||
explicit ISession(Core::System& system_, Controller& controller_)
|
||||
: ServiceFramework{system_, "ISession"}, controller{controller_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
|
||||
{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
|
||||
@ -50,8 +51,9 @@ private:
|
||||
Controller& controller;
|
||||
};
|
||||
|
||||
APM::APM(std::shared_ptr<Module> apm, Controller& controller, const char* name)
|
||||
: ServiceFramework(name), apm(std::move(apm)), controller(controller) {
|
||||
APM::APM(Core::System& system_, std::shared_ptr<Module> apm_, Controller& controller_,
|
||||
const char* name)
|
||||
: ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &APM::OpenSession, "OpenSession"},
|
||||
{1, &APM::GetPerformanceMode, "GetPerformanceMode"},
|
||||
@ -67,7 +69,7 @@ void APM::OpenSession(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<ISession>(controller);
|
||||
rb.PushIpcInterface<ISession>(system, controller);
|
||||
}
|
||||
|
||||
void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
|
||||
@ -77,7 +79,8 @@ void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) {
|
||||
rb.PushEnum(controller.GetCurrentPerformanceMode());
|
||||
}
|
||||
|
||||
APM_Sys::APM_Sys(Controller& controller) : ServiceFramework{"apm:sys"}, controller(controller) {
|
||||
APM_Sys::APM_Sys(Core::System& system_, Controller& controller_)
|
||||
: ServiceFramework{system_, "apm:sys"}, controller{controller_} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "RequestPerformanceMode"},
|
||||
@ -101,7 +104,7 @@ void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<ISession>(controller);
|
||||
rb.PushIpcInterface<ISession>(system, controller);
|
||||
}
|
||||
|
||||
void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) {
|
||||
|
Reference in New Issue
Block a user