diff options
| author | 2019-09-21 19:35:01 +1000 | |
|---|---|---|
| committer | 2019-09-22 16:38:02 +1000 | |
| commit | 2c6e4ce0ad367f63d2203b6a21e1cf244f344efb (patch) | |
| tree | 9122f151a6cd888b08edf31dfa5bb1b3cfbaa8d8 /src | |
| parent | Rebase (diff) | |
| download | yuzu-2c6e4ce0ad367f63d2203b6a21e1cf244f344efb.tar.gz yuzu-2c6e4ce0ad367f63d2203b6a21e1cf244f344efb.tar.xz yuzu-2c6e4ce0ad367f63d2203b6a21e1cf244f344efb.zip | |
Deglobalize System: Time
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/time/interface.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/time/interface.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/time/time.h | 4 |
4 files changed, 21 insertions, 14 deletions
diff --git a/src/core/hle/service/time/interface.cpp b/src/core/hle/service/time/interface.cpp index 1030185e0..9565e7de5 100644 --- a/src/core/hle/service/time/interface.cpp +++ b/src/core/hle/service/time/interface.cpp | |||
| @@ -7,8 +7,8 @@ | |||
| 7 | namespace Service::Time { | 7 | namespace Service::Time { |
| 8 | 8 | ||
| 9 | Time::Time(std::shared_ptr<Module> time, std::shared_ptr<SharedMemory> shared_memory, | 9 | Time::Time(std::shared_ptr<Module> time, std::shared_ptr<SharedMemory> shared_memory, |
| 10 | const char* name) | 10 | Core::System& system, const char* name) |
| 11 | : Module::Interface(std::move(time), std::move(shared_memory), name) { | 11 | : Module::Interface(std::move(time), std::move(shared_memory), system, name) { |
| 12 | // clang-format off | 12 | // clang-format off |
| 13 | static const FunctionInfo functions[] = { | 13 | static const FunctionInfo functions[] = { |
| 14 | {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"}, | 14 | {0, &Time::GetStandardUserSystemClock, "GetStandardUserSystemClock"}, |
diff --git a/src/core/hle/service/time/interface.h b/src/core/hle/service/time/interface.h index bdf0883e2..5c63a07f4 100644 --- a/src/core/hle/service/time/interface.h +++ b/src/core/hle/service/time/interface.h | |||
| @@ -13,7 +13,7 @@ class SharedMemory; | |||
| 13 | class Time final : public Module::Interface { | 13 | class Time final : public Module::Interface { |
| 14 | public: | 14 | public: |
| 15 | explicit Time(std::shared_ptr<Module> time, std::shared_ptr<SharedMemory> shared_memory, | 15 | explicit Time(std::shared_ptr<Module> time, std::shared_ptr<SharedMemory> shared_memory, |
| 16 | const char* name); | 16 | Core::System& system, const char* name); |
| 17 | ~Time() override; | 17 | ~Time() override; |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index ae6446204..1b9ab8401 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp | |||
| @@ -126,8 +126,8 @@ private: | |||
| 126 | 126 | ||
| 127 | class ISteadyClock final : public ServiceFramework<ISteadyClock> { | 127 | class ISteadyClock final : public ServiceFramework<ISteadyClock> { |
| 128 | public: | 128 | public: |
| 129 | ISteadyClock(std::shared_ptr<SharedMemory> shared_memory) | 129 | ISteadyClock(std::shared_ptr<SharedMemory> shared_memory, Core::System& system) |
| 130 | : ServiceFramework("ISteadyClock"), shared_memory(shared_memory) { | 130 | : ServiceFramework("ISteadyClock"), shared_memory(shared_memory), system(system) { |
| 131 | static const FunctionInfo functions[] = { | 131 | static const FunctionInfo functions[] = { |
| 132 | {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, | 132 | {0, &ISteadyClock::GetCurrentTimePoint, "GetCurrentTimePoint"}, |
| 133 | }; | 133 | }; |
| @@ -150,12 +150,13 @@ private: | |||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | SteadyClockTimePoint GetCurrentTimePoint() const { | 152 | SteadyClockTimePoint GetCurrentTimePoint() const { |
| 153 | const auto& core_timing = Core::System::GetInstance().CoreTiming(); | 153 | const auto& core_timing = system.CoreTiming(); |
| 154 | const auto ms = Core::Timing::CyclesToMs(core_timing.GetTicks()); | 154 | const auto ms = Core::Timing::CyclesToMs(core_timing.GetTicks()); |
| 155 | return {static_cast<u64_le>(ms.count() / 1000), {}}; | 155 | return {static_cast<u64_le>(ms.count() / 1000), {}}; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | std::shared_ptr<SharedMemory> shared_memory; | 158 | std::shared_ptr<SharedMemory> shared_memory; |
| 159 | Core::System& system; | ||
| 159 | }; | 160 | }; |
| 160 | 161 | ||
| 161 | class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { | 162 | class ITimeZoneService final : public ServiceFramework<ITimeZoneService> { |
| @@ -290,7 +291,7 @@ void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { | |||
| 290 | 291 | ||
| 291 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 292 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 292 | rb.Push(RESULT_SUCCESS); | 293 | rb.Push(RESULT_SUCCESS); |
| 293 | rb.PushIpcInterface<ISteadyClock>(shared_memory); | 294 | rb.PushIpcInterface<ISteadyClock>(shared_memory, system); |
| 294 | } | 295 | } |
| 295 | 296 | ||
| 296 | void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { | 297 | void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { |
| @@ -325,7 +326,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { | |||
| 325 | return; | 326 | return; |
| 326 | } | 327 | } |
| 327 | 328 | ||
| 328 | const auto& core_timing = Core::System::GetInstance().CoreTiming(); | 329 | const auto& core_timing = system.CoreTiming(); |
| 329 | const auto ms = Core::Timing::CyclesToMs(core_timing.GetTicks()); | 330 | const auto ms = Core::Timing::CyclesToMs(core_timing.GetTicks()); |
| 330 | const SteadyClockTimePoint steady_clock_time_point{static_cast<u64_le>(ms.count() / 1000), {}}; | 331 | const SteadyClockTimePoint steady_clock_time_point{static_cast<u64_le>(ms.count() / 1000), {}}; |
| 331 | 332 | ||
| @@ -407,8 +408,10 @@ void Module::Interface::SetStandardUserSystemClockAutomaticCorrectionEnabled( | |||
| 407 | } | 408 | } |
| 408 | 409 | ||
| 409 | Module::Interface::Interface(std::shared_ptr<Module> time, | 410 | Module::Interface::Interface(std::shared_ptr<Module> time, |
| 410 | std::shared_ptr<SharedMemory> shared_memory, const char* name) | 411 | std::shared_ptr<SharedMemory> shared_memory, Core::System& system, |
| 411 | : ServiceFramework(name), time(std::move(time)), shared_memory(std::move(shared_memory)) {} | 412 | const char* name) |
| 413 | : ServiceFramework(name), time(std::move(time)), shared_memory(std::move(shared_memory)), | ||
| 414 | system(system) {} | ||
| 412 | 415 | ||
| 413 | Module::Interface::~Interface() = default; | 416 | Module::Interface::~Interface() = default; |
| 414 | 417 | ||
| @@ -416,9 +419,11 @@ void InstallInterfaces(Core::System& system) { | |||
| 416 | auto time = std::make_shared<Module>(); | 419 | auto time = std::make_shared<Module>(); |
| 417 | auto shared_mem = std::make_shared<SharedMemory>(system); | 420 | auto shared_mem = std::make_shared<SharedMemory>(system); |
| 418 | 421 | ||
| 419 | std::make_shared<Time>(time, shared_mem, "time:a")->InstallAsService(system.ServiceManager()); | 422 | std::make_shared<Time>(time, shared_mem, system, "time:a") |
| 420 | std::make_shared<Time>(time, shared_mem, "time:s")->InstallAsService(system.ServiceManager()); | 423 | ->InstallAsService(system.ServiceManager()); |
| 421 | std::make_shared<Time>(std::move(time), shared_mem, "time:u") | 424 | std::make_shared<Time>(time, shared_mem, system, "time:s") |
| 425 | ->InstallAsService(system.ServiceManager()); | ||
| 426 | std::make_shared<Time>(std::move(time), shared_mem, system, "time:u") | ||
| 422 | ->InstallAsService(system.ServiceManager()); | 427 | ->InstallAsService(system.ServiceManager()); |
| 423 | } | 428 | } |
| 424 | 429 | ||
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index e0708f856..c32d32860 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h | |||
| @@ -80,7 +80,8 @@ public: | |||
| 80 | class Interface : public ServiceFramework<Interface> { | 80 | class Interface : public ServiceFramework<Interface> { |
| 81 | public: | 81 | public: |
| 82 | explicit Interface(std::shared_ptr<Module> time, | 82 | explicit Interface(std::shared_ptr<Module> time, |
| 83 | std::shared_ptr<SharedMemory> shared_memory, const char* name); | 83 | std::shared_ptr<SharedMemory> shared_memory, Core::System& system, |
| 84 | const char* name); | ||
| 84 | ~Interface() override; | 85 | ~Interface() override; |
| 85 | 86 | ||
| 86 | void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); | 87 | void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); |
| @@ -97,6 +98,7 @@ public: | |||
| 97 | protected: | 98 | protected: |
| 98 | std::shared_ptr<Module> time; | 99 | std::shared_ptr<Module> time; |
| 99 | std::shared_ptr<SharedMemory> shared_memory; | 100 | std::shared_ptr<SharedMemory> shared_memory; |
| 101 | Core::System& system; | ||
| 100 | }; | 102 | }; |
| 101 | }; | 103 | }; |
| 102 | 104 | ||