From 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 26 Nov 2020 15:19:08 -0500 Subject: 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. --- src/core/hle/service/caps/caps.cpp | 14 +++++++------- src/core/hle/service/caps/caps.h | 6 +++++- src/core/hle/service/caps/caps_a.cpp | 5 +++-- src/core/hle/service/caps/caps_a.h | 6 +++++- src/core/hle/service/caps/caps_c.cpp | 5 +++-- src/core/hle/service/caps/caps_c.h | 6 +++++- src/core/hle/service/caps/caps_sc.cpp | 2 +- src/core/hle/service/caps/caps_sc.h | 6 +++--- src/core/hle/service/caps/caps_ss.cpp | 2 +- src/core/hle/service/caps/caps_ss.h | 6 +++--- src/core/hle/service/caps/caps_su.cpp | 2 +- src/core/hle/service/caps/caps_su.h | 6 +++++- src/core/hle/service/caps/caps_u.cpp | 6 +++--- src/core/hle/service/caps/caps_u.h | 6 +++++- 14 files changed, 50 insertions(+), 28 deletions(-) (limited to 'src/core/hle/service/caps') diff --git a/src/core/hle/service/caps/caps.cpp b/src/core/hle/service/caps/caps.cpp index ba5749b84..5b7fe8e9b 100644 --- a/src/core/hle/service/caps/caps.cpp +++ b/src/core/hle/service/caps/caps.cpp @@ -13,13 +13,13 @@ namespace Service::Capture { -void InstallInterfaces(SM::ServiceManager& sm) { - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); } } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps.h b/src/core/hle/service/caps/caps.h index b8c67b6e2..3c4290c88 100644 --- a/src/core/hle/service/caps/caps.h +++ b/src/core/hle/service/caps/caps.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::SM { class ServiceManager; } @@ -87,6 +91,6 @@ static_assert(sizeof(ApplicationAlbumFileEntry) == 0x30, "ApplicationAlbumFileEntry has incorrect size."); /// Registers all Capture services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); } // namespace Service::Capture diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp index a0a3b2ae3..1fe4f0e14 100644 --- a/src/core/hle/service/caps/caps_a.cpp +++ b/src/core/hle/service/caps/caps_a.cpp @@ -8,7 +8,8 @@ namespace Service::Capture { class IAlbumAccessorSession final : public ServiceFramework { public: - explicit IAlbumAccessorSession() : ServiceFramework{"IAlbumAccessorSession"} { + explicit IAlbumAccessorSession(Core::System& system_) + : ServiceFramework{system_, "IAlbumAccessorSession"} { // clang-format off static const FunctionInfo functions[] = { {2001, nullptr, "OpenAlbumMovieReadStream"}, @@ -26,7 +27,7 @@ public: } }; -CAPS_A::CAPS_A() : ServiceFramework("caps:a") { +CAPS_A::CAPS_A(Core::System& system_) : ServiceFramework{system_, "caps:a"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetAlbumFileCount"}, diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h index cb93aad5b..389cc6dbe 100644 --- a/src/core/hle/service/caps/caps_a.h +++ b/src/core/hle/service/caps/caps_a.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Kernel { class HLERequestContext; } @@ -14,7 +18,7 @@ namespace Service::Capture { class CAPS_A final : public ServiceFramework { public: - explicit CAPS_A(); + explicit CAPS_A(Core::System& system_); ~CAPS_A() override; }; diff --git a/src/core/hle/service/caps/caps_c.cpp b/src/core/hle/service/caps/caps_c.cpp index a0ee116fa..45c1c9d30 100644 --- a/src/core/hle/service/caps/caps_c.cpp +++ b/src/core/hle/service/caps/caps_c.cpp @@ -10,7 +10,8 @@ namespace Service::Capture { class IAlbumControlSession final : public ServiceFramework { public: - explicit IAlbumControlSession() : ServiceFramework{"IAlbumControlSession"} { + explicit IAlbumControlSession(Core::System& system_) + : ServiceFramework{system_, "IAlbumControlSession"} { // clang-format off static const FunctionInfo functions[] = { {2001, nullptr, "OpenAlbumMovieReadStream"}, @@ -44,7 +45,7 @@ public: } }; -CAPS_C::CAPS_C() : ServiceFramework("caps:c") { +CAPS_C::CAPS_C(Core::System& system_) : ServiceFramework{system_, "caps:c"} { // clang-format off static const FunctionInfo functions[] = { {1, nullptr, "CaptureRawImage"}, diff --git a/src/core/hle/service/caps/caps_c.h b/src/core/hle/service/caps/caps_c.h index b110301d4..c6d1dfdce 100644 --- a/src/core/hle/service/caps/caps_c.h +++ b/src/core/hle/service/caps/caps_c.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Kernel { class HLERequestContext; } @@ -14,7 +18,7 @@ namespace Service::Capture { class CAPS_C final : public ServiceFramework { public: - explicit CAPS_C(); + explicit CAPS_C(Core::System& system_); ~CAPS_C() override; private: diff --git a/src/core/hle/service/caps/caps_sc.cpp b/src/core/hle/service/caps/caps_sc.cpp index 822ee96c8..d91e18e80 100644 --- a/src/core/hle/service/caps/caps_sc.cpp +++ b/src/core/hle/service/caps/caps_sc.cpp @@ -6,7 +6,7 @@ namespace Service::Capture { -CAPS_SC::CAPS_SC() : ServiceFramework("caps:sc") { +CAPS_SC::CAPS_SC(Core::System& system_) : ServiceFramework{system_, "caps:sc"} { // clang-format off static const FunctionInfo functions[] = { {1, nullptr, "CaptureRawImage"}, diff --git a/src/core/hle/service/caps/caps_sc.h b/src/core/hle/service/caps/caps_sc.h index ac3e929ca..e79a33ee5 100644 --- a/src/core/hle/service/caps/caps_sc.h +++ b/src/core/hle/service/caps/caps_sc.h @@ -6,15 +6,15 @@ #include "core/hle/service/service.h" -namespace Kernel { -class HLERequestContext; +namespace Core { +class System; } namespace Service::Capture { class CAPS_SC final : public ServiceFramework { public: - explicit CAPS_SC(); + explicit CAPS_SC(Core::System& system_); ~CAPS_SC() override; }; diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index 24dc716e7..2b5314691 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -6,7 +6,7 @@ namespace Service::Capture { -CAPS_SS::CAPS_SS() : ServiceFramework("caps:ss") { +CAPS_SS::CAPS_SS(Core::System& system_) : ServiceFramework{system_, "caps:ss"} { // clang-format off static const FunctionInfo functions[] = { {201, nullptr, "SaveScreenShot"}, diff --git a/src/core/hle/service/caps/caps_ss.h b/src/core/hle/service/caps/caps_ss.h index 450686e4f..1816f7885 100644 --- a/src/core/hle/service/caps/caps_ss.h +++ b/src/core/hle/service/caps/caps_ss.h @@ -6,15 +6,15 @@ #include "core/hle/service/service.h" -namespace Kernel { -class HLERequestContext; +namespace Core { +class System; } namespace Service::Capture { class CAPS_SS final : public ServiceFramework { public: - explicit CAPS_SS(); + explicit CAPS_SS(Core::System& system_); ~CAPS_SS() override; }; diff --git a/src/core/hle/service/caps/caps_su.cpp b/src/core/hle/service/caps/caps_su.cpp index e386470f7..eae39eb7b 100644 --- a/src/core/hle/service/caps/caps_su.cpp +++ b/src/core/hle/service/caps/caps_su.cpp @@ -8,7 +8,7 @@ namespace Service::Capture { -CAPS_SU::CAPS_SU() : ServiceFramework("caps:su") { +CAPS_SU::CAPS_SU(Core::System& system_) : ServiceFramework{system_, "caps:su"} { // clang-format off static const FunctionInfo functions[] = { {32, &CAPS_SU::SetShimLibraryVersion, "SetShimLibraryVersion"}, diff --git a/src/core/hle/service/caps/caps_su.h b/src/core/hle/service/caps/caps_su.h index 62c9603a9..b366fdb13 100644 --- a/src/core/hle/service/caps/caps_su.h +++ b/src/core/hle/service/caps/caps_su.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Kernel { class HLERequestContext; } @@ -14,7 +18,7 @@ namespace Service::Capture { class CAPS_SU final : public ServiceFramework { public: - explicit CAPS_SU(); + explicit CAPS_SU(Core::System& system_); ~CAPS_SU() override; private: diff --git a/src/core/hle/service/caps/caps_u.cpp b/src/core/hle/service/caps/caps_u.cpp index f9479bdb3..842316a2e 100644 --- a/src/core/hle/service/caps/caps_u.cpp +++ b/src/core/hle/service/caps/caps_u.cpp @@ -12,8 +12,8 @@ namespace Service::Capture { class IAlbumAccessorApplicationSession final : public ServiceFramework { public: - explicit IAlbumAccessorApplicationSession() - : ServiceFramework{"IAlbumAccessorApplicationSession"} { + explicit IAlbumAccessorApplicationSession(Core::System& system_) + : ServiceFramework{system_, "IAlbumAccessorApplicationSession"} { // clang-format off static const FunctionInfo functions[] = { {2001, nullptr, "OpenAlbumMovieReadStream"}, @@ -28,7 +28,7 @@ public: } }; -CAPS_U::CAPS_U() : ServiceFramework("caps:u") { +CAPS_U::CAPS_U(Core::System& system_) : ServiceFramework{system_, "caps:u"} { // clang-format off static const FunctionInfo functions[] = { {32, &CAPS_U::SetShimLibraryVersion, "SetShimLibraryVersion"}, diff --git a/src/core/hle/service/caps/caps_u.h b/src/core/hle/service/caps/caps_u.h index 4b80f3156..e7e0d8775 100644 --- a/src/core/hle/service/caps/caps_u.h +++ b/src/core/hle/service/caps/caps_u.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Kernel { class HLERequestContext; } @@ -14,7 +18,7 @@ namespace Service::Capture { class CAPS_U final : public ServiceFramework { public: - explicit CAPS_U(); + explicit CAPS_U(Core::System& system_); ~CAPS_U() override; private: -- cgit v1.2.3