diff options
| author | 2020-11-26 15:19:08 -0500 | |
|---|---|---|
| committer | 2020-11-26 20:03:11 -0500 | |
| commit | 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch) | |
| tree | 3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/usb | |
| parent | Merge pull request #4975 from comex/invalid-syncpoint-id (diff) | |
| download | yuzu-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.cpp | 39 | ||||
| -rw-r--r-- | src/core/hle/service/usb/usb.h | 6 |
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 | ||
| 16 | class IDsInterface final : public ServiceFramework<IDsInterface> { | 16 | class IDsInterface final : public ServiceFramework<IDsInterface> { |
| 17 | public: | 17 | public: |
| 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 | ||
| 41 | class USB_DS final : public ServiceFramework<USB_DS> { | 41 | class USB_DS final : public ServiceFramework<USB_DS> { |
| 42 | public: | 42 | public: |
| 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 | ||
| 66 | class IClientEpSession final : public ServiceFramework<IClientEpSession> { | 66 | class IClientEpSession final : public ServiceFramework<IClientEpSession> { |
| 67 | public: | 67 | public: |
| 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 | ||
| 87 | class IClientIfSession final : public ServiceFramework<IClientIfSession> { | 88 | class IClientIfSession final : public ServiceFramework<IClientIfSession> { |
| 88 | public: | 89 | public: |
| 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 | ||
| 109 | class USB_HS final : public ServiceFramework<USB_HS> { | 111 | class USB_HS final : public ServiceFramework<USB_HS> { |
| 110 | public: | 112 | public: |
| 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 | ||
| 130 | class IPdSession final : public ServiceFramework<IPdSession> { | 132 | class IPdSession final : public ServiceFramework<IPdSession> { |
| 131 | public: | 133 | public: |
| 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 | ||
| 149 | class USB_PD final : public ServiceFramework<USB_PD> { | 151 | class USB_PD final : public ServiceFramework<USB_PD> { |
| 150 | public: | 152 | public: |
| 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 | ||
| 171 | class IPdCradleSession final : public ServiceFramework<IPdCradleSession> { | 173 | class IPdCradleSession final : public ServiceFramework<IPdCradleSession> { |
| 172 | public: | 174 | public: |
| 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 | ||
| 192 | class USB_PD_C final : public ServiceFramework<USB_PD_C> { | 195 | class USB_PD_C final : public ServiceFramework<USB_PD_C> { |
| 193 | public: | 196 | public: |
| 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 | ||
| 214 | class USB_PM final : public ServiceFramework<USB_PM> { | 217 | class USB_PM final : public ServiceFramework<USB_PM> { |
| 215 | public: | 218 | public: |
| 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 | ||
| 232 | void InstallInterfaces(SM::ServiceManager& sm) { | 235 | void 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 | ||
| 7 | namespace Core { | ||
| 8 | class System; | ||
| 9 | } | ||
| 10 | |||
| 7 | namespace Service::SM { | 11 | namespace Service::SM { |
| 8 | class ServiceManager; | 12 | class ServiceManager; |
| 9 | } | 13 | } |
| 10 | 14 | ||
| 11 | namespace Service::USB { | 15 | namespace Service::USB { |
| 12 | 16 | ||
| 13 | void InstallInterfaces(SM::ServiceManager& sm); | 17 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); |
| 14 | 18 | ||
| 15 | } // namespace Service::USB | 19 | } // namespace Service::USB |