summaryrefslogtreecommitdiff
path: root/src/core/hle/service/glue
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/glue
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/glue')
-rw-r--r--src/core/hle/service/glue/arp.cpp13
-rw-r--r--src/core/hle/service/glue/arp.h6
-rw-r--r--src/core/hle/service/glue/bgtc.cpp4
-rw-r--r--src/core/hle/service/glue/bgtc.h8
-rw-r--r--src/core/hle/service/glue/glue.cpp4
5 files changed, 19 insertions, 16 deletions
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp
index c6252ff89..fc77e7286 100644
--- a/src/core/hle/service/glue/arp.cpp
+++ b/src/core/hle/service/glue/arp.cpp
@@ -33,8 +33,8 @@ std::optional<u64> GetTitleIDForProcessID(const Core::System& system, u64 proces
33} 33}
34} // Anonymous namespace 34} // Anonymous namespace
35 35
36ARP_R::ARP_R(const Core::System& system, const ARPManager& manager) 36ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_)
37 : ServiceFramework{"arp:r"}, system(system), manager(manager) { 37 : ServiceFramework{system_, "arp:r"}, manager{manager_} {
38 // clang-format off 38 // clang-format off
39 static const FunctionInfo functions[] = { 39 static const FunctionInfo functions[] = {
40 {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"}, 40 {0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"},
@@ -152,8 +152,9 @@ class IRegistrar final : public ServiceFramework<IRegistrar> {
152 152
153public: 153public:
154 explicit IRegistrar( 154 explicit IRegistrar(
155 Core::System& system_,
155 std::function<ResultCode(u64, ApplicationLaunchProperty, std::vector<u8>)> issuer) 156 std::function<ResultCode(u64, ApplicationLaunchProperty, std::vector<u8>)> issuer)
156 : ServiceFramework{"IRegistrar"}, issue_process_id(std::move(issuer)) { 157 : ServiceFramework{system_, "IRegistrar"}, issue_process_id{std::move(issuer)} {
157 // clang-format off 158 // clang-format off
158 static const FunctionInfo functions[] = { 159 static const FunctionInfo functions[] = {
159 {0, &IRegistrar::Issue, "Issue"}, 160 {0, &IRegistrar::Issue, "Issue"},
@@ -237,8 +238,8 @@ private:
237 std::vector<u8> control; 238 std::vector<u8> control;
238}; 239};
239 240
240ARP_W::ARP_W(const Core::System& system, ARPManager& manager) 241ARP_W::ARP_W(Core::System& system_, ARPManager& manager_)
241 : ServiceFramework{"arp:w"}, system(system), manager(manager) { 242 : ServiceFramework{system_, "arp:w"}, manager{manager_} {
242 // clang-format off 243 // clang-format off
243 static const FunctionInfo functions[] = { 244 static const FunctionInfo functions[] = {
244 {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"}, 245 {0, &ARP_W::AcquireRegistrar, "AcquireRegistrar"},
@@ -255,7 +256,7 @@ void ARP_W::AcquireRegistrar(Kernel::HLERequestContext& ctx) {
255 LOG_DEBUG(Service_ARP, "called"); 256 LOG_DEBUG(Service_ARP, "called");
256 257
257 registrar = std::make_shared<IRegistrar>( 258 registrar = std::make_shared<IRegistrar>(
258 [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) { 259 system, [this](u64 process_id, ApplicationLaunchProperty launch, std::vector<u8> control) {
259 const auto res = GetTitleIDForProcessID(system, process_id); 260 const auto res = GetTitleIDForProcessID(system, process_id);
260 if (!res.has_value()) { 261 if (!res.has_value()) {
261 return ERR_NOT_REGISTERED; 262 return ERR_NOT_REGISTERED;
diff --git a/src/core/hle/service/glue/arp.h b/src/core/hle/service/glue/arp.h
index d5f8a7e7a..34b412e26 100644
--- a/src/core/hle/service/glue/arp.h
+++ b/src/core/hle/service/glue/arp.h
@@ -13,7 +13,7 @@ class IRegistrar;
13 13
14class ARP_R final : public ServiceFramework<ARP_R> { 14class ARP_R final : public ServiceFramework<ARP_R> {
15public: 15public:
16 explicit ARP_R(const Core::System& system, const ARPManager& manager); 16 explicit ARP_R(Core::System& system_, const ARPManager& manager_);
17 ~ARP_R() override; 17 ~ARP_R() override;
18 18
19private: 19private:
@@ -22,20 +22,18 @@ private:
22 void GetApplicationControlProperty(Kernel::HLERequestContext& ctx); 22 void GetApplicationControlProperty(Kernel::HLERequestContext& ctx);
23 void GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx); 23 void GetApplicationControlPropertyWithApplicationId(Kernel::HLERequestContext& ctx);
24 24
25 const Core::System& system;
26 const ARPManager& manager; 25 const ARPManager& manager;
27}; 26};
28 27
29class ARP_W final : public ServiceFramework<ARP_W> { 28class ARP_W final : public ServiceFramework<ARP_W> {
30public: 29public:
31 explicit ARP_W(const Core::System& system, ARPManager& manager); 30 explicit ARP_W(Core::System& system_, ARPManager& manager_);
32 ~ARP_W() override; 31 ~ARP_W() override;
33 32
34private: 33private:
35 void AcquireRegistrar(Kernel::HLERequestContext& ctx); 34 void AcquireRegistrar(Kernel::HLERequestContext& ctx);
36 void DeleteProperties(Kernel::HLERequestContext& ctx); 35 void DeleteProperties(Kernel::HLERequestContext& ctx);
37 36
38 const Core::System& system;
39 ARPManager& manager; 37 ARPManager& manager;
40 std::shared_ptr<IRegistrar> registrar; 38 std::shared_ptr<IRegistrar> registrar;
41}; 39};
diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp
index cd89d088f..a478b68e1 100644
--- a/src/core/hle/service/glue/bgtc.cpp
+++ b/src/core/hle/service/glue/bgtc.cpp
@@ -6,7 +6,7 @@
6 6
7namespace Service::Glue { 7namespace Service::Glue {
8 8
9BGTC_T::BGTC_T() : ServiceFramework{"bgtc:t"} { 9BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} {
10 // clang-format off 10 // clang-format off
11 static const FunctionInfo functions[] = { 11 static const FunctionInfo functions[] = {
12 {1, nullptr, "NotifyTaskStarting"}, 12 {1, nullptr, "NotifyTaskStarting"},
@@ -31,7 +31,7 @@ BGTC_T::BGTC_T() : ServiceFramework{"bgtc:t"} {
31 31
32BGTC_T::~BGTC_T() = default; 32BGTC_T::~BGTC_T() = default;
33 33
34BGTC_SC::BGTC_SC() : ServiceFramework{"bgtc:sc"} { 34BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} {
35 // clang-format off 35 // clang-format off
36 static const FunctionInfo functions[] = { 36 static const FunctionInfo functions[] = {
37 {1, nullptr, "GetState"}, 37 {1, nullptr, "GetState"},
diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h
index 81844f03e..906116ba6 100644
--- a/src/core/hle/service/glue/bgtc.h
+++ b/src/core/hle/service/glue/bgtc.h
@@ -6,17 +6,21 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::Glue { 13namespace Service::Glue {
10 14
11class BGTC_T final : public ServiceFramework<BGTC_T> { 15class BGTC_T final : public ServiceFramework<BGTC_T> {
12public: 16public:
13 BGTC_T(); 17 explicit BGTC_T(Core::System& system_);
14 ~BGTC_T() override; 18 ~BGTC_T() override;
15}; 19};
16 20
17class BGTC_SC final : public ServiceFramework<BGTC_SC> { 21class BGTC_SC final : public ServiceFramework<BGTC_SC> {
18public: 22public:
19 BGTC_SC(); 23 explicit BGTC_SC(Core::System& system_);
20 ~BGTC_SC() override; 24 ~BGTC_SC() override;
21}; 25};
22 26
diff --git a/src/core/hle/service/glue/glue.cpp b/src/core/hle/service/glue/glue.cpp
index c728e815c..4eafbe5fa 100644
--- a/src/core/hle/service/glue/glue.cpp
+++ b/src/core/hle/service/glue/glue.cpp
@@ -18,8 +18,8 @@ void InstallInterfaces(Core::System& system) {
18 ->InstallAsService(system.ServiceManager()); 18 ->InstallAsService(system.ServiceManager());
19 19
20 // BackGround Task Controller 20 // BackGround Task Controller
21 std::make_shared<BGTC_T>()->InstallAsService(system.ServiceManager()); 21 std::make_shared<BGTC_T>(system)->InstallAsService(system.ServiceManager());
22 std::make_shared<BGTC_SC>()->InstallAsService(system.ServiceManager()); 22 std::make_shared<BGTC_SC>(system)->InstallAsService(system.ServiceManager());
23} 23}
24 24
25} // namespace Service::Glue 25} // namespace Service::Glue