summaryrefslogtreecommitdiff
path: root/src/core/hle/service/usb
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/usb
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/usb')
-rw-r--r--src/core/hle/service/usb/usb.cpp39
-rw-r--r--src/core/hle/service/usb/usb.h6
2 files changed, 26 insertions, 19 deletions
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp
index d033f8603..579de83e4 100644
--- a/src/core/hle/service/usb/usb.cpp
+++ b/src/core/hle/service/usb/usb.cpp
@@ -15,7 +15,7 @@ namespace Service::USB {
15 15
16class IDsInterface final : public ServiceFramework<IDsInterface> { 16class IDsInterface final : public ServiceFramework<IDsInterface> {
17public: 17public:
18 explicit IDsInterface() : ServiceFramework{"IDsInterface"} { 18 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, nullptr, "GetDsEndpoint"}, 21 {0, nullptr, "GetDsEndpoint"},
@@ -40,7 +40,7 @@ public:
40 40
41class USB_DS final : public ServiceFramework<USB_DS> { 41class USB_DS final : public ServiceFramework<USB_DS> {
42public: 42public:
43 explicit USB_DS() : ServiceFramework{"usb:ds"} { 43 explicit USB_DS(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {
44 // clang-format off 44 // clang-format off
45 static const FunctionInfo functions[] = { 45 static const FunctionInfo functions[] = {
46 {0, nullptr, "BindDevice"}, 46 {0, nullptr, "BindDevice"},
@@ -65,7 +65,8 @@ public:
65 65
66class IClientEpSession final : public ServiceFramework<IClientEpSession> { 66class IClientEpSession final : public ServiceFramework<IClientEpSession> {
67public: 67public:
68 explicit IClientEpSession() : ServiceFramework{"IClientEpSession"} { 68 explicit IClientEpSession(Core::System& system_)
69 : ServiceFramework{system_, "IClientEpSession"} {
69 // clang-format off 70 // clang-format off
70 static const FunctionInfo functions[] = { 71 static const FunctionInfo functions[] = {
71 {0, nullptr, "Open"}, 72 {0, nullptr, "Open"},
@@ -86,7 +87,8 @@ public:
86 87
87class IClientIfSession final : public ServiceFramework<IClientIfSession> { 88class IClientIfSession final : public ServiceFramework<IClientIfSession> {
88public: 89public:
89 explicit IClientIfSession() : ServiceFramework{"IClientIfSession"} { 90 explicit IClientIfSession(Core::System& system_)
91 : ServiceFramework{system_, "IClientIfSession"} {
90 // clang-format off 92 // clang-format off
91 static const FunctionInfo functions[] = { 93 static const FunctionInfo functions[] = {
92 {0, nullptr, "Unknown0"}, 94 {0, nullptr, "Unknown0"},
@@ -108,7 +110,7 @@ public:
108 110
109class USB_HS final : public ServiceFramework<USB_HS> { 111class USB_HS final : public ServiceFramework<USB_HS> {
110public: 112public:
111 explicit USB_HS() : ServiceFramework{"usb:hs"} { 113 explicit USB_HS(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {
112 // clang-format off 114 // clang-format off
113 static const FunctionInfo functions[] = { 115 static const FunctionInfo functions[] = {
114 {0, nullptr, "BindClientProcess"}, 116 {0, nullptr, "BindClientProcess"},
@@ -129,7 +131,7 @@ public:
129 131
130class IPdSession final : public ServiceFramework<IPdSession> { 132class IPdSession final : public ServiceFramework<IPdSession> {
131public: 133public:
132 explicit IPdSession() : ServiceFramework{"IPdSession"} { 134 explicit IPdSession(Core::System& system_) : ServiceFramework{system_, "IPdSession"} {
133 // clang-format off 135 // clang-format off
134 static const FunctionInfo functions[] = { 136 static const FunctionInfo functions[] = {
135 {0, nullptr, "BindNoticeEvent"}, 137 {0, nullptr, "BindNoticeEvent"},
@@ -148,7 +150,7 @@ public:
148 150
149class USB_PD final : public ServiceFramework<USB_PD> { 151class USB_PD final : public ServiceFramework<USB_PD> {
150public: 152public:
151 explicit USB_PD() : ServiceFramework{"usb:pd"} { 153 explicit USB_PD(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {
152 // clang-format off 154 // clang-format off
153 static const FunctionInfo functions[] = { 155 static const FunctionInfo functions[] = {
154 {0, &USB_PD::GetPdSession, "GetPdSession"}, 156 {0, &USB_PD::GetPdSession, "GetPdSession"},
@@ -164,13 +166,14 @@ private:
164 166
165 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 167 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
166 rb.Push(RESULT_SUCCESS); 168 rb.Push(RESULT_SUCCESS);
167 rb.PushIpcInterface<IPdSession>(); 169 rb.PushIpcInterface<IPdSession>(system);
168 } 170 }
169}; 171};
170 172
171class IPdCradleSession final : public ServiceFramework<IPdCradleSession> { 173class IPdCradleSession final : public ServiceFramework<IPdCradleSession> {
172public: 174public:
173 explicit IPdCradleSession() : ServiceFramework{"IPdCradleSession"} { 175 explicit IPdCradleSession(Core::System& system_)
176 : ServiceFramework{system_, "IPdCradleSession"} {
174 // clang-format off 177 // clang-format off
175 static const FunctionInfo functions[] = { 178 static const FunctionInfo functions[] = {
176 {0, nullptr, "VdmUserWrite"}, 179 {0, nullptr, "VdmUserWrite"},
@@ -191,7 +194,7 @@ public:
191 194
192class USB_PD_C final : public ServiceFramework<USB_PD_C> { 195class USB_PD_C final : public ServiceFramework<USB_PD_C> {
193public: 196public:
194 explicit USB_PD_C() : ServiceFramework{"usb:pd:c"} { 197 explicit USB_PD_C(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {
195 // clang-format off 198 // clang-format off
196 static const FunctionInfo functions[] = { 199 static const FunctionInfo functions[] = {
197 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"}, 200 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"},
@@ -205,7 +208,7 @@ private:
205 void GetPdCradleSession(Kernel::HLERequestContext& ctx) { 208 void GetPdCradleSession(Kernel::HLERequestContext& ctx) {
206 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 209 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
207 rb.Push(RESULT_SUCCESS); 210 rb.Push(RESULT_SUCCESS);
208 rb.PushIpcInterface<IPdCradleSession>(); 211 rb.PushIpcInterface<IPdCradleSession>(system);
209 212
210 LOG_DEBUG(Service_USB, "called"); 213 LOG_DEBUG(Service_USB, "called");
211 } 214 }
@@ -213,7 +216,7 @@ private:
213 216
214class USB_PM final : public ServiceFramework<USB_PM> { 217class USB_PM final : public ServiceFramework<USB_PM> {
215public: 218public:
216 explicit USB_PM() : ServiceFramework{"usb:pm"} { 219 explicit USB_PM(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {
217 // clang-format off 220 // clang-format off
218 static const FunctionInfo functions[] = { 221 static const FunctionInfo functions[] = {
219 {0, nullptr, "Unknown0"}, 222 {0, nullptr, "Unknown0"},
@@ -229,12 +232,12 @@ public:
229 } 232 }
230}; 233};
231 234
232void InstallInterfaces(SM::ServiceManager& sm) { 235void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
233 std::make_shared<USB_DS>()->InstallAsService(sm); 236 std::make_shared<USB_DS>(system)->InstallAsService(sm);
234 std::make_shared<USB_HS>()->InstallAsService(sm); 237 std::make_shared<USB_HS>(system)->InstallAsService(sm);
235 std::make_shared<USB_PD>()->InstallAsService(sm); 238 std::make_shared<USB_PD>(system)->InstallAsService(sm);
236 std::make_shared<USB_PD_C>()->InstallAsService(sm); 239 std::make_shared<USB_PD_C>(system)->InstallAsService(sm);
237 std::make_shared<USB_PM>()->InstallAsService(sm); 240 std::make_shared<USB_PM>(system)->InstallAsService(sm);
238} 241}
239 242
240} // namespace Service::USB 243} // namespace Service::USB
diff --git a/src/core/hle/service/usb/usb.h b/src/core/hle/service/usb/usb.h
index 970a11fe8..fc366df34 100644
--- a/src/core/hle/service/usb/usb.h
+++ b/src/core/hle/service/usb/usb.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::USB { 15namespace Service::USB {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::USB 19} // namespace Service::USB