summaryrefslogtreecommitdiff
path: root/src/core/hle/service/ncm
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/ncm
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/ncm')
-rw-r--r--src/core/hle/service/ncm/ncm.cpp20
-rw-r--r--src/core/hle/service/ncm/ncm.h6
2 files changed, 16 insertions, 10 deletions
diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp
index e38dea1f4..b8d627ca8 100644
--- a/src/core/hle/service/ncm/ncm.cpp
+++ b/src/core/hle/service/ncm/ncm.cpp
@@ -14,8 +14,8 @@ namespace Service::NCM {
14 14
15class ILocationResolver final : public ServiceFramework<ILocationResolver> { 15class ILocationResolver final : public ServiceFramework<ILocationResolver> {
16public: 16public:
17 explicit ILocationResolver(FileSys::StorageId id) 17 explicit ILocationResolver(Core::System& system_, FileSys::StorageId id)
18 : ServiceFramework{"ILocationResolver"}, storage(id) { 18 : ServiceFramework{system_, "ILocationResolver"}, storage{id} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "ResolveProgramPath"}, 21 {0, nullptr, "ResolveProgramPath"},
@@ -50,7 +50,8 @@ private:
50 50
51class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> { 51class IRegisteredLocationResolver final : public ServiceFramework<IRegisteredLocationResolver> {
52public: 52public:
53 explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { 53 explicit IRegisteredLocationResolver(Core::System& system_)
54 : ServiceFramework{system_, "IRegisteredLocationResolver"} {
54 // clang-format off 55 // clang-format off
55 static const FunctionInfo functions[] = { 56 static const FunctionInfo functions[] = {
56 {0, nullptr, "ResolveProgramPath"}, 57 {0, nullptr, "ResolveProgramPath"},
@@ -72,7 +73,8 @@ public:
72 73
73class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> { 74class IAddOnContentLocationResolver final : public ServiceFramework<IAddOnContentLocationResolver> {
74public: 75public:
75 explicit IAddOnContentLocationResolver() : ServiceFramework{"IAddOnContentLocationResolver"} { 76 explicit IAddOnContentLocationResolver(Core::System& system_)
77 : ServiceFramework{system_, "IAddOnContentLocationResolver"} {
76 // clang-format off 78 // clang-format off
77 static const FunctionInfo functions[] = { 79 static const FunctionInfo functions[] = {
78 {0, nullptr, "ResolveAddOnContentPath"}, 80 {0, nullptr, "ResolveAddOnContentPath"},
@@ -89,7 +91,7 @@ public:
89 91
90class LR final : public ServiceFramework<LR> { 92class LR final : public ServiceFramework<LR> {
91public: 93public:
92 explicit LR() : ServiceFramework{"lr"} { 94 explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} {
93 // clang-format off 95 // clang-format off
94 static const FunctionInfo functions[] = { 96 static const FunctionInfo functions[] = {
95 {0, nullptr, "OpenLocationResolver"}, 97 {0, nullptr, "OpenLocationResolver"},
@@ -105,7 +107,7 @@ public:
105 107
106class NCM final : public ServiceFramework<NCM> { 108class NCM final : public ServiceFramework<NCM> {
107public: 109public:
108 explicit NCM() : ServiceFramework{"ncm"} { 110 explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} {
109 // clang-format off 111 // clang-format off
110 static const FunctionInfo functions[] = { 112 static const FunctionInfo functions[] = {
111 {0, nullptr, "CreateContentStorage"}, 113 {0, nullptr, "CreateContentStorage"},
@@ -130,9 +132,9 @@ public:
130 } 132 }
131}; 133};
132 134
133void InstallInterfaces(SM::ServiceManager& sm) { 135void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
134 std::make_shared<LR>()->InstallAsService(sm); 136 std::make_shared<LR>(system)->InstallAsService(sm);
135 std::make_shared<NCM>()->InstallAsService(sm); 137 std::make_shared<NCM>(system)->InstallAsService(sm);
136} 138}
137 139
138} // namespace Service::NCM 140} // namespace Service::NCM
diff --git a/src/core/hle/service/ncm/ncm.h b/src/core/hle/service/ncm/ncm.h
index 7bc8518a6..ee01eddc0 100644
--- a/src/core/hle/service/ncm/ncm.h
+++ b/src/core/hle/service/ncm/ncm.h
@@ -4,12 +4,16 @@
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}
10 14
11namespace Service::NCM { 15namespace Service::NCM {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::NCM 19} // namespace Service::NCM