diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/time/time.cpp | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index f77cdbb43..7197ca30f 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -5,8 +5,9 @@ #include "core/core.h" #include "core/core_timing.h" #include "core/hardware_properties.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/kernel.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/server_manager.h" #include "core/hle/service/time/time.h" #include "core/hle/service/time/time_interface.h" #include "core/hle/service/time/time_manager.h" @@ -33,7 +34,7 @@ public: } private: - void GetCurrentTime(Kernel::HLERequestContext& ctx) { + void GetCurrentTime(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); if (!clock_core.IsInitialized()) { @@ -54,7 +55,7 @@ private: rb.Push<s64>(posix_time); } - void GetSystemClockContext(Kernel::HLERequestContext& ctx) { + void GetSystemClockContext(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); if (!clock_core.IsInitialized()) { @@ -97,7 +98,7 @@ public: } private: - void GetCurrentTimePoint(Kernel::HLERequestContext& ctx) { + void GetCurrentTimePoint(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); if (!clock_core.IsInitialized()) { @@ -177,7 +178,7 @@ Result Module::Interface::GetClockSnapshotFromSystemClockContextInternal( return ResultSuccess; } -void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetStandardUserSystemClock(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -185,7 +186,7 @@ void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ct system); } -void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetStandardNetworkSystemClock(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -193,14 +194,14 @@ void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& system); } -void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetStandardSteadyClock(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface<ISteadyClock>(system.GetTimeManager().GetStandardSteadyClockCore(), system); } -void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetTimeZoneService(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -208,7 +209,7 @@ void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { system.GetTimeManager().GetTimeZoneContentManager()); } -void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetStandardLocalSystemClock(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -216,8 +217,7 @@ void Module::Interface::GetStandardLocalSystemClock(Kernel::HLERequestContext& c system); } -void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient( - Kernel::HLERequestContext& ctx) { +void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); auto& clock_core{system.GetTimeManager().GetStandardNetworkSystemClockCore()}; IPC::ResponseBuilder rb{ctx, 3}; @@ -225,7 +225,7 @@ void Module::Interface::IsStandardNetworkSystemClockAccuracySufficient( rb.Push<u32>(clock_core.IsStandardNetworkSystemClockAccuracySufficient(system)); } -void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx) { +void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); auto& steady_clock_core{system.GetTimeManager().GetStandardSteadyClockCore()}; @@ -240,8 +240,8 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe const auto current_time_point{steady_clock_core.GetCurrentTimePoint(system)}; if (current_time_point.clock_source_id == context.steady_time_point.clock_source_id) { - const auto ticks{Clock::TimeSpanType::FromTicks(system.CoreTiming().GetClockTicks(), - Core::Hardware::CNTFREQ)}; + const auto ticks{Clock::TimeSpanType::FromTicks<Core::Hardware::CNTFREQ>( + system.CoreTiming().GetClockTicks())}; const s64 base_time_point{context.offset + current_time_point.time_point - ticks.ToSeconds()}; IPC::ResponseBuilder rb{ctx, (sizeof(s64) / 4) + 2}; @@ -254,7 +254,7 @@ void Module::Interface::CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERe rb.Push(ERROR_TIME_MISMATCH); } -void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetClockSnapshot(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto type{rp.PopEnum<Clock::TimeType>()}; @@ -295,7 +295,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetClockSnapshotFromSystemClockContext(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto type{rp.PopEnum<Clock::TimeType>()}; @@ -321,8 +321,7 @@ void Module::Interface::GetClockSnapshotFromSystemClockContext(Kernel::HLEReques rb.Push(ResultSuccess); } -void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( - Kernel::HLERequestContext& ctx) { +void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); Clock::ClockSnapshot snapshot_a; @@ -349,7 +348,7 @@ void Module::Interface::CalculateStandardUserSystemClockDifferenceByUser( rb.PushRaw(time_span_type.nanoseconds); } -void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { +void Module::Interface::CalculateSpanBetween(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); Clock::ClockSnapshot snapshot_a; @@ -384,7 +383,7 @@ void Module::Interface::CalculateSpanBetween(Kernel::HLERequestContext& ctx) { rb.PushRaw(time_span_type.nanoseconds); } -void Module::Interface::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) { +void Module::Interface::GetSharedMemoryNativeHandle(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); @@ -397,11 +396,17 @@ Module::Interface::Interface(std::shared_ptr<Module> module_, Core::System& syst Module::Interface::~Interface() = default; -void InstallInterfaces(Core::System& system) { +void LoopProcess(Core::System& system) { + auto server_manager = std::make_unique<ServerManager>(system); auto module{std::make_shared<Module>()}; - std::make_shared<Time>(module, system, "time:a")->InstallAsService(system.ServiceManager()); - std::make_shared<Time>(module, system, "time:s")->InstallAsService(system.ServiceManager()); - std::make_shared<Time>(module, system, "time:u")->InstallAsService(system.ServiceManager()); + + server_manager->RegisterNamedService("time:a", + std::make_shared<Time>(module, system, "time:a")); + server_manager->RegisterNamedService("time:s", + std::make_shared<Time>(module, system, "time:s")); + server_manager->RegisterNamedService("time:u", + std::make_shared<Time>(module, system, "time:u")); + ServerManager::RunServer(std::move(server_manager)); } } // namespace Service::Time |