diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/time/time.cpp | 49 | ||||
-rw-r--r-- | src/core/hle/service/time/time.h | 27 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_service.cpp | 14 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_service.h | 12 |
4 files changed, 53 insertions, 49 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index f77cdbb43..868be60c5 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()}; @@ -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 diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h index 76a46cfc7..b2d754ef3 100644 --- a/src/core/hle/service/time/time.h +++ b/src/core/hle/service/time/time.h @@ -22,18 +22,18 @@ public: const char* name); ~Interface() override; - void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); - void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx); - void GetStandardSteadyClock(Kernel::HLERequestContext& ctx); - void GetTimeZoneService(Kernel::HLERequestContext& ctx); - void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx); - void IsStandardNetworkSystemClockAccuracySufficient(Kernel::HLERequestContext& ctx); - void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx); - void GetClockSnapshot(Kernel::HLERequestContext& ctx); - void GetClockSnapshotFromSystemClockContext(Kernel::HLERequestContext& ctx); - void CalculateStandardUserSystemClockDifferenceByUser(Kernel::HLERequestContext& ctx); - void CalculateSpanBetween(Kernel::HLERequestContext& ctx); - void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx); + void GetStandardUserSystemClock(HLERequestContext& ctx); + void GetStandardNetworkSystemClock(HLERequestContext& ctx); + void GetStandardSteadyClock(HLERequestContext& ctx); + void GetTimeZoneService(HLERequestContext& ctx); + void GetStandardLocalSystemClock(HLERequestContext& ctx); + void IsStandardNetworkSystemClockAccuracySufficient(HLERequestContext& ctx); + void CalculateMonotonicSystemClockBaseTimePoint(HLERequestContext& ctx); + void GetClockSnapshot(HLERequestContext& ctx); + void GetClockSnapshotFromSystemClockContext(HLERequestContext& ctx); + void CalculateStandardUserSystemClockDifferenceByUser(HLERequestContext& ctx); + void CalculateSpanBetween(HLERequestContext& ctx); + void GetSharedMemoryNativeHandle(HLERequestContext& ctx); private: Result GetClockSnapshotFromSystemClockContextInternal( @@ -46,7 +46,6 @@ public: }; }; -/// Registers all Time services with the specified service manager. -void InstallInterfaces(Core::System& system); +void LoopProcess(Core::System& system); } // namespace Service::Time diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp index 961040bfc..cda8d8343 100644 --- a/src/core/hle/service/time/time_zone_service.cpp +++ b/src/core/hle/service/time/time_zone_service.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/logging/log.h" -#include "core/hle/ipc_helpers.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/time/time_zone_content_manager.h" #include "core/hle/service/time/time_zone_service.h" #include "core/hle/service/time/time_zone_types.h" @@ -28,7 +28,7 @@ ITimeZoneService::ITimeZoneService(Core::System& system_, RegisterHandlers(functions); } -void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::GetDeviceLocationName(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); TimeZone::LocationName location_name{}; @@ -45,7 +45,7 @@ void ITimeZoneService::GetDeviceLocationName(Kernel::HLERequestContext& ctx) { rb.PushRaw(location_name); } -void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::LoadTimeZoneRule(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto raw_location_name{rp.PopRaw<std::array<u8, 0x24>>()}; @@ -77,7 +77,7 @@ void ITimeZoneService::LoadTimeZoneRule(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::ToCalendarTime(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto posix_time{rp.Pop<s64>()}; @@ -101,7 +101,7 @@ void ITimeZoneService::ToCalendarTime(Kernel::HLERequestContext& ctx) { rb.PushRaw(calendar_info); } -void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::ToCalendarTimeWithMyRule(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto posix_time{rp.Pop<s64>()}; @@ -122,7 +122,7 @@ void ITimeZoneService::ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx) rb.PushRaw(calendar_info); } -void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::ToPosixTime(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::RequestParser rp{ctx}; @@ -147,7 +147,7 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { rb.PushRaw<u32>(1); // Number of times we're returning } -void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { +void ITimeZoneService::ToPosixTimeWithMyRule(HLERequestContext& ctx) { LOG_DEBUG(Service_Time, "called"); IPC::RequestParser rp{ctx}; diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h index f151f4b56..ea83b5714 100644 --- a/src/core/hle/service/time/time_zone_service.h +++ b/src/core/hle/service/time/time_zone_service.h @@ -21,12 +21,12 @@ public: TimeZone::TimeZoneContentManager& time_zone_manager_); private: - void GetDeviceLocationName(Kernel::HLERequestContext& ctx); - void LoadTimeZoneRule(Kernel::HLERequestContext& ctx); - void ToCalendarTime(Kernel::HLERequestContext& ctx); - void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx); - void ToPosixTime(Kernel::HLERequestContext& ctx); - void ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx); + void GetDeviceLocationName(HLERequestContext& ctx); + void LoadTimeZoneRule(HLERequestContext& ctx); + void ToCalendarTime(HLERequestContext& ctx); + void ToCalendarTimeWithMyRule(HLERequestContext& ctx); + void ToPosixTime(HLERequestContext& ctx); + void ToPosixTimeWithMyRule(HLERequestContext& ctx); private: TimeZone::TimeZoneContentManager& time_zone_content_manager; |