summaryrefslogtreecommitdiff
path: root/src/core/hle/service/time
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/time
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/time')
-rw-r--r--src/core/hle/service/time/interface.cpp2
-rw-r--r--src/core/hle/service/time/time.cpp18
-rw-r--r--src/core/hle/service/time/time.h4
-rw-r--r--src/core/hle/service/time/time_zone_service.cpp5
-rw-r--r--src/core/hle/service/time/time_zone_service.h7
5 files changed, 21 insertions, 15 deletions
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp
index ba8fd6152..a01d9e0ff 100644
--- a/src/core/hle/service/time/interface.cpp
+++ b/src/core/hle/service/time/interface.cpp
@@ -7,7 +7,7 @@
7namespace Service::Time { 7namespace Service::Time {
8 8
9Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* name) 9Time::Time(std::shared_ptr<Module> module, Core::System& system, const char* name)
10 : Module::Interface(std::move(module), system, name) { 10 : Interface(std::move(module), system, name) {
11 // clang-format off 11 // clang-format off
12 static const FunctionInfo functions[] = { 12 static const FunctionInfo functions[] = {
13 {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"}, 13 {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"},
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp
index 7d0474e0b..7b7ac282d 100644
--- a/src/core/hle/service/time/time.cpp
+++ b/src/core/hle/service/time/time.cpp
@@ -21,8 +21,8 @@ namespace Service::Time {
21 21
22class ISystemClock final : public ServiceFramework<ISystemClock> { 22class ISystemClock final : public ServiceFramework<ISystemClock> {
23public: 23public:
24 explicit ISystemClock(Clock::SystemClockCore& clock_core, Core::System& system) 24 explicit ISystemClock(Clock::SystemClockCore& clock_core_, Core::System& system_)
25 : ServiceFramework("ISystemClock"), clock_core{clock_core}, system{system} { 25 : ServiceFramework{system_, "ISystemClock"}, clock_core{clock_core_} {
26 // clang-format off 26 // clang-format off
27 static const FunctionInfo functions[] = { 27 static const FunctionInfo functions[] = {
28 {0, &ISystemClock::GetCurrentTime, "GetCurrentTime"}, 28 {0, &ISystemClock::GetCurrentTime, "GetCurrentTime"},
@@ -82,13 +82,12 @@ private:
82 } 82 }
83 83
84 Clock::SystemClockCore& clock_core; 84 Clock::SystemClockCore& clock_core;
85 Core::System& system;
86}; 85};
87 86
88class ISteadyClock final : public ServiceFramework<ISteadyClock> { 87class ISteadyClock final : public ServiceFramework<ISteadyClock> {
89public: 88public:
90 explicit ISteadyClock(Clock::SteadyClockCore& clock_core, Core::System& system) 89 explicit ISteadyClock(Clock::SteadyClockCore& clock_core_, Core::System& system_)
91 : ServiceFramework("ISteadyClock"), clock_core{clock_core}, system{system} { 90 : ServiceFramework{system_, "ISteadyClock"}, clock_core{clock_core_} {
92 static const FunctionInfo functions[] = { 91 static const FunctionInfo functions[] = {
93 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, 92 {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"},
94 {2, nullptr, "GetTestOffset"}, 93 {2, nullptr, "GetTestOffset"},
@@ -119,7 +118,6 @@ private:
119 } 118 }
120 119
121 Clock::SteadyClockCore& clock_core; 120 Clock::SteadyClockCore& clock_core;
122 Core::System& system;
123}; 121};
124 122
125ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal( 123ResultCode Module::Interface::GetClockSnapshotFromSystemClockContextInternal(
@@ -206,7 +204,8 @@ void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) {
206 LOG_DEBUG(Service_Time, "called"); 204 LOG_DEBUG(Service_Time, "called");
207 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 205 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
208 rb.Push(RESULT_SUCCESS); 206 rb.Push(RESULT_SUCCESS);
209 rb.PushIpcInterface<ITimeZoneService>(system.GetTimeManager().GetTimeZoneContentManager()); 207 rb.PushIpcInterface<ITimeZoneService>(system,
208 system.GetTimeManager().GetTimeZoneContentManager());
210} 209}
211 210
212void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { 211void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) {
@@ -375,8 +374,9 @@ void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& c
375 rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem())); 374 rb.PushCopyObjects(SharedFrom(&system.Kernel().GetTimeSharedMem()));
376} 375}
377 376
378Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) 377Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& system_,
379 : ServiceFramework(name), module{std::move(module)}, system{system} {} 378 const char* name)
379 : ServiceFramework{system_, name}, module{std::move(module_)} {}
380 380
381Module::Interface::~Interface() = default; 381Module::Interface::~Interface() = default;
382 382
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 49f4aac0a..975a8ae5b 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -20,7 +20,8 @@ public:
20 20
21 class Interface : public ServiceFramework<Interface> { 21 class Interface : public ServiceFramework<Interface> {
22 public: 22 public:
23 explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); 23 explicit Interface(std::shared_ptr<Module> module_, Core::System& system_,
24 const char* name);
24 ~Interface() override; 25 ~Interface() override;
25 26
26 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 27 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
@@ -44,7 +45,6 @@ public:
44 45
45 protected: 46 protected:
46 std::shared_ptr<Module> module; 47 std::shared_ptr<Module> module;
47 Core::System& system;
48 }; 48 };
49}; 49};
50 50
diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp
index ff3a10b3e..25cecbc83 100644
--- a/src/core/hle/service/time/time_zone_service.cpp
+++ b/src/core/hle/service/time/time_zone_service.cpp
@@ -10,8 +10,9 @@
10 10
11namespace Service::Time { 11namespace Service::Time {
12 12
13ITimeZoneService ::ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_content_manager) 13ITimeZoneService ::ITimeZoneService(Core::System& system_,
14 : ServiceFramework("ITimeZoneService"), time_zone_content_manager{time_zone_content_manager} { 14 TimeZone::TimeZoneContentManager& time_zone_manager_)
15 : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} {
15 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
16 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, 17 {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"},
17 {1, nullptr, "SetDeviceLocationName"}, 18 {1, nullptr, "SetDeviceLocationName"},
diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h
index cb495748b..2c9b97603 100644
--- a/src/core/hle/service/time/time_zone_service.h
+++ b/src/core/hle/service/time/time_zone_service.h
@@ -6,6 +6,10 @@
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::Time { 13namespace Service::Time {
10 14
11namespace TimeZone { 15namespace TimeZone {
@@ -14,7 +18,8 @@ class TimeZoneContentManager;
14 18
15class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { 19class ITimeZoneService final : public ServiceFramework<ITimeZoneService> {
16public: 20public:
17 explicit ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_manager); 21 explicit ITimeZoneService(Core::System& system_,
22 TimeZone::TimeZoneContentManager& time_zone_manager_);
18 23
19private: 24private:
20 void GetDeviceLocationName(Kernel::HLERequestContext& ctx); 25 void GetDeviceLocationName(Kernel::HLERequestContext& ctx);