summaryrefslogtreecommitdiff
path: root/src/core/hle/service/ldr
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-26 15:19:08 -0500
committerGravatar Lioncash2020-11-26 20:03:11 -0500
commit1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch)
tree3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/ldr
parentMerge pull request #4975 from comex/invalid-syncpoint-id (diff)
downloadyuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip
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.
Diffstat (limited to 'src/core/hle/service/ldr')
-rw-r--r--src/core/hle/service/ldr/ldr.cpp15
-rw-r--r--src/core/hle/service/ldr/ldr.h4
2 files changed, 11 insertions, 8 deletions
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 65c209725..fff68326b 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -115,7 +115,7 @@ static_assert(sizeof(NROInfo) == 0x60, "NROInfo has invalid size.");
115 115
116class DebugMonitor final : public ServiceFramework<DebugMonitor> { 116class DebugMonitor final : public ServiceFramework<DebugMonitor> {
117public: 117public:
118 explicit DebugMonitor() : ServiceFramework{"ldr:dmnt"} { 118 explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "ldr:dmnt"} {
119 // clang-format off 119 // clang-format off
120 static const FunctionInfo functions[] = { 120 static const FunctionInfo functions[] = {
121 {0, nullptr, "AddProcessToDebugLaunchQueue"}, 121 {0, nullptr, "AddProcessToDebugLaunchQueue"},
@@ -130,7 +130,7 @@ public:
130 130
131class ProcessManager final : public ServiceFramework<ProcessManager> { 131class ProcessManager final : public ServiceFramework<ProcessManager> {
132public: 132public:
133 explicit ProcessManager() : ServiceFramework{"ldr:pm"} { 133 explicit ProcessManager(Core::System& system_) : ServiceFramework{system_, "ldr:pm"} {
134 // clang-format off 134 // clang-format off
135 static const FunctionInfo functions[] = { 135 static const FunctionInfo functions[] = {
136 {0, nullptr, "CreateProcess"}, 136 {0, nullptr, "CreateProcess"},
@@ -147,7 +147,7 @@ public:
147 147
148class Shell final : public ServiceFramework<Shell> { 148class Shell final : public ServiceFramework<Shell> {
149public: 149public:
150 explicit Shell() : ServiceFramework{"ldr:shel"} { 150 explicit Shell(Core::System& system_) : ServiceFramework{system_, "ldr:shel"} {
151 // clang-format off 151 // clang-format off
152 static const FunctionInfo functions[] = { 152 static const FunctionInfo functions[] = {
153 {0, nullptr, "AddProcessToLaunchQueue"}, 153 {0, nullptr, "AddProcessToLaunchQueue"},
@@ -161,7 +161,7 @@ public:
161 161
162class RelocatableObject final : public ServiceFramework<RelocatableObject> { 162class RelocatableObject final : public ServiceFramework<RelocatableObject> {
163public: 163public:
164 explicit RelocatableObject(Core::System& system) : ServiceFramework{"ldr:ro"}, system(system) { 164 explicit RelocatableObject(Core::System& system_) : ServiceFramework{system_, "ldr:ro"} {
165 // clang-format off 165 // clang-format off
166 static const FunctionInfo functions[] = { 166 static const FunctionInfo functions[] = {
167 {0, &RelocatableObject::LoadNro, "LoadNro"}, 167 {0, &RelocatableObject::LoadNro, "LoadNro"},
@@ -639,13 +639,12 @@ private:
639 Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size) && 639 Common::Is4KBAligned(header.segment_headers[RO_INDEX].memory_size) &&
640 Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size); 640 Common::Is4KBAligned(header.segment_headers[DATA_INDEX].memory_size);
641 } 641 }
642 Core::System& system;
643}; 642};
644 643
645void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 644void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
646 std::make_shared<DebugMonitor>()->InstallAsService(sm); 645 std::make_shared<DebugMonitor>(system)->InstallAsService(sm);
647 std::make_shared<ProcessManager>()->InstallAsService(sm); 646 std::make_shared<ProcessManager>(system)->InstallAsService(sm);
648 std::make_shared<Shell>()->InstallAsService(sm); 647 std::make_shared<Shell>(system)->InstallAsService(sm);
649 std::make_shared<RelocatableObject>(system)->InstallAsService(sm); 648 std::make_shared<RelocatableObject>(system)->InstallAsService(sm);
650} 649}
651 650
diff --git a/src/core/hle/service/ldr/ldr.h b/src/core/hle/service/ldr/ldr.h
index 7ac8c0b65..104fc15c5 100644
--- a/src/core/hle/service/ldr/ldr.h
+++ b/src/core/hle/service/ldr/ldr.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}