From 35e3c6802832f7396a04603edca9434acc6d3972 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 30 Jan 2024 02:27:27 -0500 Subject: service: use const references for input raw data --- src/core/hle/service/glue/time/static.cpp | 6 +++--- src/core/hle/service/glue/time/static.h | 6 +++--- src/core/hle/service/glue/time/time_zone.cpp | 9 ++++++--- src/core/hle/service/glue/time/time_zone.h | 10 ++++++---- src/core/hle/service/glue/time/time_zone_binary.cpp | 6 +++--- src/core/hle/service/glue/time/time_zone_binary.h | 6 +++--- src/core/hle/service/jit/jit.cpp | 8 ++++---- src/core/hle/service/mii/mii.cpp | 2 +- .../hle/service/psc/time/clocks/context_writers.cpp | 6 +++--- src/core/hle/service/psc/time/clocks/context_writers.h | 8 ++++---- .../time/clocks/standard_local_system_clock_core.cpp | 2 +- .../psc/time/clocks/standard_local_system_clock_core.h | 2 +- .../time/clocks/standard_network_system_clock_core.cpp | 2 +- .../time/clocks/standard_network_system_clock_core.h | 2 +- .../time/clocks/standard_user_system_clock_core.cpp | 2 +- .../psc/time/clocks/standard_user_system_clock_core.h | 2 +- .../hle/service/psc/time/clocks/system_clock_core.cpp | 4 ++-- .../hle/service/psc/time/clocks/system_clock_core.h | 4 ++-- src/core/hle/service/psc/time/service_manager.cpp | 18 ++++++++++-------- src/core/hle/service/psc/time/service_manager.h | 15 ++++++++------- src/core/hle/service/psc/time/shared_memory.cpp | 6 +++--- src/core/hle/service/psc/time/shared_memory.h | 6 +++--- src/core/hle/service/psc/time/static.cpp | 16 ++++++++-------- src/core/hle/service/psc/time/static.h | 11 ++++++----- src/core/hle/service/psc/time/system_clock.cpp | 2 +- src/core/hle/service/psc/time/system_clock.h | 2 +- src/core/hle/service/psc/time/time_zone.cpp | 6 +++--- src/core/hle/service/psc/time/time_zone.h | 6 +++--- src/core/hle/service/psc/time/time_zone_service.cpp | 6 +++--- src/core/hle/service/psc/time/time_zone_service.h | 6 +++--- src/core/hle/service/ro/ro.cpp | 4 ++-- 31 files changed, 100 insertions(+), 91 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp index f56db76e1..f8c1218f3 100644 --- a/src/core/hle/service/glue/time/static.cpp +++ b/src/core/hle/service/glue/time/static.cpp @@ -200,7 +200,7 @@ Result StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( } Result StaticService::CalculateMonotonicSystemClockBaseTimePoint( - Out out_time, Service::PSC::Time::SystemClockContext& context) { + Out out_time, const Service::PSC::Time::SystemClockContext& context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context)); @@ -216,8 +216,8 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot, Result StaticService::GetClockSnapshotFromSystemClockContext( Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, - Service::PSC::Time::SystemClockContext& user_context, - Service::PSC::Time::SystemClockContext& network_context) { + const Service::PSC::Time::SystemClockContext& user_context, + const Service::PSC::Time::SystemClockContext& network_context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. type={} out_snapshot={} user_context={} network_context={}", type, diff --git a/src/core/hle/service/glue/time/static.h b/src/core/hle/service/glue/time/static.h index d3cc0fdd6..5d3623182 100644 --- a/src/core/hle/service/glue/time/static.h +++ b/src/core/hle/service/glue/time/static.h @@ -58,12 +58,12 @@ public: Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( Out out_time_point); Result CalculateMonotonicSystemClockBaseTimePoint( - Out out_time, Service::PSC::Time::SystemClockContext& context); + Out out_time, const Service::PSC::Time::SystemClockContext& context); Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type); Result GetClockSnapshotFromSystemClockContext( Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, - Service::PSC::Time::SystemClockContext& user_context, - Service::PSC::Time::SystemClockContext& network_context); + const Service::PSC::Time::SystemClockContext& user_context, + const Service::PSC::Time::SystemClockContext& network_context); Result CalculateStandardUserSystemClockDifferenceByUser(Out out_difference, InClockSnapshot a, InClockSnapshot b); Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 98d928697..36f163419 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp @@ -62,7 +62,8 @@ Result TimeZoneService::GetDeviceLocationName( R_RETURN(m_wrapped_service->GetDeviceLocationName(out_location_name)); } -Result TimeZoneService::SetDeviceLocationName(Service::PSC::Time::LocationName& location_name) { +Result TimeZoneService::SetDeviceLocationName( + const Service::PSC::Time::LocationName& location_name) { LOG_DEBUG(Service_Time, "called. location_name={}", location_name); R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); @@ -110,7 +111,8 @@ Result TimeZoneService::LoadLocationNameList( R_RETURN(GetTimeZoneLocationList(*out_count, out_names, out_names.size(), index)); } -Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& name) { +Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, + const Service::PSC::Time::LocationName& name) { LOG_DEBUG(Service_Time, "called. name={}", name); std::scoped_lock l{m_mutex}; @@ -139,7 +141,8 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime( } Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( - Service::PSC::Time::LocationName& location_name, InBuffer binary) { + const Service::PSC::Time::LocationName& location_name, + InBuffer binary) { LOG_DEBUG(Service_Time, "called. location_name={}", location_name); R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index 9c1530966..beb54ddde 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h @@ -46,18 +46,20 @@ public: ~TimeZoneService() override; Result GetDeviceLocationName(Out out_location_name); - Result SetDeviceLocationName(Service::PSC::Time::LocationName& location_name); + Result SetDeviceLocationName(const Service::PSC::Time::LocationName& location_name); Result GetTotalLocationNameCount(Out out_count); Result LoadLocationNameList( Out out_count, OutArray out_names, u32 index); - Result LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& location_name); + Result LoadTimeZoneRule(OutRule out_rule, + const Service::PSC::Time::LocationName& location_name); Result GetTimeZoneRuleVersion(Out out_rule_version); Result GetDeviceLocationNameAndUpdatedTime( Out location_name, Out out_time_point); - Result SetDeviceLocationNameWithTimeZoneRule(Service::PSC::Time::LocationName& location_name, - InBuffer binary); + Result SetDeviceLocationNameWithTimeZoneRule( + const Service::PSC::Time::LocationName& location_name, + InBuffer binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer binary); Result GetDeviceLocationNameOperationEventReadableHandle( OutCopyHandle out_event); diff --git a/src/core/hle/service/glue/time/time_zone_binary.cpp b/src/core/hle/service/glue/time/time_zone_binary.cpp index cc50b6b7b..d5f7ca3d2 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.cpp +++ b/src/core/hle/service/glue/time/time_zone_binary.cpp @@ -98,7 +98,7 @@ void GetTimeZoneBinaryVersionPath(std::string& out_path) { out_path = "/version.txt"; } -void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name) { +void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name) { if (g_time_zone_binary_mount_result != ResultSuccess) { return; } @@ -106,7 +106,7 @@ void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName out_path = fmt::format("/zoneinfo/{}", name.data()); } -bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name) { +bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name) { std::string path{}; GetTimeZoneZonePath(path, name); @@ -155,7 +155,7 @@ Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version) { } Result GetTimeZoneRule(std::span& out_rule, size_t& out_rule_size, - Service::PSC::Time::LocationName& name) { + const Service::PSC::Time::LocationName& name) { std::string path{}; GetTimeZoneZonePath(path, name); diff --git a/src/core/hle/service/glue/time/time_zone_binary.h b/src/core/hle/service/glue/time/time_zone_binary.h index 461f4577e..9d0a8dfe9 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.h +++ b/src/core/hle/service/glue/time/time_zone_binary.h @@ -19,12 +19,12 @@ void ResetTimeZoneBinary(); Result MountTimeZoneBinary(Core::System& system); void GetTimeZoneBinaryListPath(std::string& out_path); void GetTimeZoneBinaryVersionPath(std::string& out_path); -void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name); -bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name); +void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name); +bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name); u32 GetTimeZoneCount(); Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version); Result GetTimeZoneRule(std::span& out_rule, size_t& out_rule_size, - Service::PSC::Time::LocationName& name); + const Service::PSC::Time::LocationName& name); Result GetTimeZoneLocationList(u32& out_count, std::span out_names, size_t max_names, u32 index); diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp index 1f2cbcb61..4941a71a0 100644 --- a/src/core/hle/service/jit/jit.cpp +++ b/src/core/hle/service/jit/jit.cpp @@ -126,7 +126,7 @@ public: R_THROW(ResultUnknown); } - Result LoadPlugin(u64 tmem_size, InCopyHandle& tmem, + Result LoadPlugin(u64 tmem_size, InCopyHandle tmem, InBuffer nrr, InBuffer nro) { if (!tmem) { @@ -268,9 +268,9 @@ public: private: Result CreateJitEnvironment(Out> out_jit_environment, - u64 rx_size, u64 ro_size, InCopyHandle& process, - InCopyHandle& rx_mem, - InCopyHandle& ro_mem) { + u64 rx_size, u64 ro_size, InCopyHandle process, + InCopyHandle rx_mem, + InCopyHandle ro_mem) { if (!process) { LOG_ERROR(Service_JIT, "process is null"); R_THROW(ResultUnknown); diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp index efb7f6e32..0086f82c5 100644 --- a/src/core/hle/service/mii/mii.cpp +++ b/src/core/hle/service/mii/mii.cpp @@ -189,7 +189,7 @@ private: R_RETURN(manager->Move(metadata, new_index, create_id)); } - Result AddOrReplace(StoreData& store_data) { + Result AddOrReplace(const StoreData& store_data) { LOG_INFO(Service_Mii, "called"); R_UNLESS(is_system, ResultPermissionDenied); diff --git a/src/core/hle/service/psc/time/clocks/context_writers.cpp b/src/core/hle/service/psc/time/clocks/context_writers.cpp index ac8700f76..a44486b43 100644 --- a/src/core/hle/service/psc/time/clocks/context_writers.cpp +++ b/src/core/hle/service/psc/time/clocks/context_writers.cpp @@ -22,7 +22,7 @@ LocalSystemClockContextWriter::LocalSystemClockContextWriter(Core::System& syste SharedMemory& shared_memory) : m_system{system}, m_shared_memory{shared_memory} {} -Result LocalSystemClockContextWriter::Write(SystemClockContext& context) { +Result LocalSystemClockContextWriter::Write(const SystemClockContext& context) { if (m_in_use) { R_SUCCEED_IF(context == m_context); m_context = context; @@ -43,7 +43,7 @@ NetworkSystemClockContextWriter::NetworkSystemClockContextWriter(Core::System& s SystemClockCore& system_clock) : m_system{system}, m_shared_memory{shared_memory}, m_system_clock{system_clock} {} -Result NetworkSystemClockContextWriter::Write(SystemClockContext& context) { +Result NetworkSystemClockContextWriter::Write(const SystemClockContext& context) { s64 time{}; [[maybe_unused]] auto res = m_system_clock.GetCurrentTime(&time); @@ -66,7 +66,7 @@ EphemeralNetworkSystemClockContextWriter::EphemeralNetworkSystemClockContextWrit Core::System& system) : m_system{system} {} -Result EphemeralNetworkSystemClockContextWriter::Write(SystemClockContext& context) { +Result EphemeralNetworkSystemClockContextWriter::Write(const SystemClockContext& context) { if (m_in_use) { R_SUCCEED_IF(context == m_context); m_context = context; diff --git a/src/core/hle/service/psc/time/clocks/context_writers.h b/src/core/hle/service/psc/time/clocks/context_writers.h index afd3725d4..6643fc9f2 100644 --- a/src/core/hle/service/psc/time/clocks/context_writers.h +++ b/src/core/hle/service/psc/time/clocks/context_writers.h @@ -24,7 +24,7 @@ private: public: virtual ~ContextWriter() = default; - virtual Result Write(SystemClockContext& context) = 0; + virtual Result Write(const SystemClockContext& context) = 0; void SignalAllNodes(); void Link(OperationEvent& operation_event); @@ -37,7 +37,7 @@ class LocalSystemClockContextWriter : public ContextWriter { public: explicit LocalSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory); - Result Write(SystemClockContext& context) override; + Result Write(const SystemClockContext& context) override; private: Core::System& m_system; @@ -52,7 +52,7 @@ public: explicit NetworkSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory, SystemClockCore& system_clock); - Result Write(SystemClockContext& context) override; + Result Write(const SystemClockContext& context) override; private: Core::System& m_system; @@ -67,7 +67,7 @@ class EphemeralNetworkSystemClockContextWriter : public ContextWriter { public: EphemeralNetworkSystemClockContextWriter(Core::System& system); - Result Write(SystemClockContext& context) override; + Result Write(const SystemClockContext& context) override; private: Core::System& m_system; diff --git a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp index 36dca6689..6a74d4594 100644 --- a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp @@ -5,7 +5,7 @@ namespace Service::PSC::Time { -void StandardLocalSystemClockCore::Initialize(SystemClockContext& context, s64 time) { +void StandardLocalSystemClockCore::Initialize(const SystemClockContext& context, s64 time) { SteadyClockTimePoint time_point{}; if (GetCurrentTimePoint(time_point) == ResultSuccess && context.steady_time_point.IdMatches(time_point)) { diff --git a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h index 176ba3e94..5722d8e96 100644 --- a/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h @@ -17,7 +17,7 @@ public: : SystemClockCore{steady_clock} {} ~StandardLocalSystemClockCore() override = default; - void Initialize(SystemClockContext& context, s64 time); + void Initialize(const SystemClockContext& context, s64 time); }; } // namespace Service::PSC::Time diff --git a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp index 8d6cb7db1..6938d369f 100644 --- a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp @@ -5,7 +5,7 @@ namespace Service::PSC::Time { -void StandardNetworkSystemClockCore::Initialize(SystemClockContext& context, s64 accuracy) { +void StandardNetworkSystemClockCore::Initialize(const SystemClockContext& context, s64 accuracy) { if (SetContextAndWrite(context) != ResultSuccess) { LOG_ERROR(Service_Time, "Failed to SetContext"); } diff --git a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h index 933d2c8e3..bfafc7d71 100644 --- a/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h @@ -19,7 +19,7 @@ public: : SystemClockCore{steady_clock} {} ~StandardNetworkSystemClockCore() override = default; - void Initialize(SystemClockContext& context, s64 accuracy); + void Initialize(const SystemClockContext& context, s64 accuracy); bool IsAccuracySufficient(); private: diff --git a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.cpp index 9e9be05d6..31ed27396 100644 --- a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.cpp @@ -46,7 +46,7 @@ Result StandardUserSystemClockCore::GetContext(SystemClockContext& out_context) R_RETURN(m_local_system_clock.GetContext(out_context)); } -Result StandardUserSystemClockCore::SetContext(SystemClockContext& context) { +Result StandardUserSystemClockCore::SetContext(const SystemClockContext& context) { R_RETURN(ResultNotImplemented); } diff --git a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h index a7fe7648d..32b8bc3bc 100644 --- a/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h @@ -36,7 +36,7 @@ public: Result SetAutomaticCorrection(bool automatic_correction); Result GetContext(SystemClockContext& out_context) const override; - Result SetContext(SystemClockContext& context) override; + Result SetContext(const SystemClockContext& context) override; Result GetTimePoint(SteadyClockTimePoint& out_time_point); void SetTimePointAndSignal(SteadyClockTimePoint& time_point); diff --git a/src/core/hle/service/psc/time/clocks/system_clock_core.cpp b/src/core/hle/service/psc/time/clocks/system_clock_core.cpp index c507ef517..2b7466831 100644 --- a/src/core/hle/service/psc/time/clocks/system_clock_core.cpp +++ b/src/core/hle/service/psc/time/clocks/system_clock_core.cpp @@ -51,12 +51,12 @@ Result SystemClockCore::GetContext(SystemClockContext& out_context) const { R_SUCCEED(); } -Result SystemClockCore::SetContext(SystemClockContext& context) { +Result SystemClockCore::SetContext(const SystemClockContext& context) { m_context = context; R_SUCCEED(); } -Result SystemClockCore::SetContextAndWrite(SystemClockContext& context) { +Result SystemClockCore::SetContextAndWrite(const SystemClockContext& context) { R_TRY(SetContext(context)); if (m_context_writer) { diff --git a/src/core/hle/service/psc/time/clocks/system_clock_core.h b/src/core/hle/service/psc/time/clocks/system_clock_core.h index 73811712e..0b928432f 100644 --- a/src/core/hle/service/psc/time/clocks/system_clock_core.h +++ b/src/core/hle/service/psc/time/clocks/system_clock_core.h @@ -41,8 +41,8 @@ public: } virtual Result GetContext(SystemClockContext& out_context) const; - virtual Result SetContext(SystemClockContext& context); - Result SetContextAndWrite(SystemClockContext& context); + virtual Result SetContext(const SystemClockContext& context); + Result SetContextAndWrite(const SystemClockContext& context); void LinkOperationEvent(OperationEvent& operation_event); diff --git a/src/core/hle/service/psc/time/service_manager.cpp b/src/core/hle/service/psc/time/service_manager.cpp index 4e1643fcb..ed9fb32cd 100644 --- a/src/core/hle/service/psc/time/service_manager.cpp +++ b/src/core/hle/service/psc/time/service_manager.cpp @@ -78,8 +78,9 @@ Result ServiceManager::GetStaticServiceAsServiceManager(OutInterface rule_buffer) { LOG_DEBUG(Service_Time, "called. name={} rule_version={} location_count={} time_point={} " diff --git a/src/core/hle/service/psc/time/service_manager.h b/src/core/hle/service/psc/time/service_manager.h index 25d361d4f..22720e161 100644 --- a/src/core/hle/service/psc/time/service_manager.h +++ b/src/core/hle/service/psc/time/service_manager.h @@ -34,14 +34,15 @@ public: Result GetStaticServiceAsAdmin(OutInterface out_service); Result GetStaticServiceAsRepair(OutInterface out_service); Result GetStaticServiceAsServiceManager(OutInterface out_service); - Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected, Common::UUID& clock_source_id, - s64 rtc_offset, s64 internal_offset, s64 test_offset); - Result SetupStandardLocalSystemClockCore(SystemClockContext& context, s64 time); - Result SetupStandardNetworkSystemClockCore(SystemClockContext& context, s64 accuracy); + Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected, + const Common::UUID& clock_source_id, s64 rtc_offset, + s64 internal_offset, s64 test_offset); + Result SetupStandardLocalSystemClockCore(const SystemClockContext& context, s64 time); + Result SetupStandardNetworkSystemClockCore(SystemClockContext context, s64 accuracy); Result SetupStandardUserSystemClockCore(bool automatic_correction, - SteadyClockTimePoint& time_point); - Result SetupTimeZoneServiceCore(LocationName& name, RuleVersion& rule_version, - u32 location_count, SteadyClockTimePoint& time_point, + SteadyClockTimePoint time_point); + Result SetupTimeZoneServiceCore(const LocationName& name, const RuleVersion& rule_version, + u32 location_count, const SteadyClockTimePoint& time_point, InBuffer rule_buffer); Result SetupEphemeralNetworkSystemClockCore(); Result GetStandardLocalClockOperationEvent(OutCopyHandle out_event); diff --git a/src/core/hle/service/psc/time/shared_memory.cpp b/src/core/hle/service/psc/time/shared_memory.cpp index defaceebe..adef6bcd8 100644 --- a/src/core/hle/service/psc/time/shared_memory.cpp +++ b/src/core/hle/service/psc/time/shared_memory.cpp @@ -51,11 +51,11 @@ SharedMemory::SharedMemory(Core::System& system) std::memset(m_shared_memory_ptr, 0, sizeof(*m_shared_memory_ptr)); } -void SharedMemory::SetLocalSystemContext(SystemClockContext& context) { +void SharedMemory::SetLocalSystemContext(const SystemClockContext& context) { WriteToLockFreeAtomicType(&m_shared_memory_ptr->local_system_clock_contexts, context); } -void SharedMemory::SetNetworkSystemContext(SystemClockContext& context) { +void SharedMemory::SetNetworkSystemContext(const SystemClockContext& context) { WriteToLockFreeAtomicType(&m_shared_memory_ptr->network_system_clock_contexts, context); } @@ -64,7 +64,7 @@ void SharedMemory::SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 ti {time_point, clock_source_id}); } -void SharedMemory::SetContinuousAdjustment(ContinuousAdjustmentTimePoint& time_point) { +void SharedMemory::SetContinuousAdjustment(const ContinuousAdjustmentTimePoint& time_point) { WriteToLockFreeAtomicType(&m_shared_memory_ptr->continuous_adjustment_time_points, time_point); } diff --git a/src/core/hle/service/psc/time/shared_memory.h b/src/core/hle/service/psc/time/shared_memory.h index f9bf97d5c..b7bd00fc1 100644 --- a/src/core/hle/service/psc/time/shared_memory.h +++ b/src/core/hle/service/psc/time/shared_memory.h @@ -54,10 +54,10 @@ public: return m_k_shared_memory; } - void SetLocalSystemContext(SystemClockContext& context); - void SetNetworkSystemContext(SystemClockContext& context); + void SetLocalSystemContext(const SystemClockContext& context); + void SetNetworkSystemContext(const SystemClockContext& context); void SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 time_diff); - void SetContinuousAdjustment(ContinuousAdjustmentTimePoint& time_point); + void SetContinuousAdjustment(const ContinuousAdjustmentTimePoint& time_point); void SetAutomaticCorrection(bool automatic_correction); void UpdateBaseTime(s64 time); diff --git a/src/core/hle/service/psc/time/static.cpp b/src/core/hle/service/psc/time/static.cpp index 3ca3311af..24b85cc61 100644 --- a/src/core/hle/service/psc/time/static.cpp +++ b/src/core/hle/service/psc/time/static.cpp @@ -198,8 +198,8 @@ Result StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( R_SUCCEED(); } -Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(Out out_time, - SystemClockContext& context) { +Result StaticService::CalculateMonotonicSystemClockBaseTimePoint( + Out out_time, const SystemClockContext& context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); R_UNLESS(m_time->m_standard_steady_clock.IsInitialized(), ResultClockUninitialized); @@ -231,10 +231,9 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType t R_RETURN(GetClockSnapshotImpl(out_snapshot, user_context, network_context, type)); } -Result StaticService::GetClockSnapshotFromSystemClockContext(TimeType type, - OutClockSnapshot out_snapshot, - SystemClockContext& user_context, - SystemClockContext& network_context) { +Result StaticService::GetClockSnapshotFromSystemClockContext( + TimeType type, OutClockSnapshot out_snapshot, const SystemClockContext& user_context, + const SystemClockContext& network_context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. type={} user_context={} network_context={} out_snapshot={}", type, @@ -294,8 +293,9 @@ Result StaticService::CalculateSpanBetween(Out out_time, InClockSnapshot a, } Result StaticService::GetClockSnapshotImpl(OutClockSnapshot out_snapshot, - SystemClockContext& user_context, - SystemClockContext& network_context, TimeType type) { + const SystemClockContext& user_context, + const SystemClockContext& network_context, + TimeType type) { out_snapshot->user_context = user_context; out_snapshot->network_context = network_context; diff --git a/src/core/hle/service/psc/time/static.h b/src/core/hle/service/psc/time/static.h index 120bab259..e11db8093 100644 --- a/src/core/hle/service/psc/time/static.h +++ b/src/core/hle/service/psc/time/static.h @@ -55,18 +55,19 @@ public: Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( Out out_time_point); Result CalculateMonotonicSystemClockBaseTimePoint(Out out_time, - SystemClockContext& context); + const SystemClockContext& context); Result GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType type); Result GetClockSnapshotFromSystemClockContext(TimeType type, OutClockSnapshot out_snapshot, - SystemClockContext& user_context, - SystemClockContext& network_context); + const SystemClockContext& user_context, + const SystemClockContext& network_context); Result CalculateStandardUserSystemClockDifferenceByUser(Out out_difference, InClockSnapshot a, InClockSnapshot b); Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); private: - Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, SystemClockContext& user_context, - SystemClockContext& network_context, TimeType type); + Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, + const SystemClockContext& user_context, + const SystemClockContext& network_context, TimeType type); Core::System& m_system; StaticServiceSetupInfo m_setup_info; diff --git a/src/core/hle/service/psc/time/system_clock.cpp b/src/core/hle/service/psc/time/system_clock.cpp index 0695502d5..b4e9264d8 100644 --- a/src/core/hle/service/psc/time/system_clock.cpp +++ b/src/core/hle/service/psc/time/system_clock.cpp @@ -53,7 +53,7 @@ Result SystemClock::GetSystemClockContext(Out out_context) { R_RETURN(m_clock_core.GetContext(*out_context)); } -Result SystemClock::SetSystemClockContext(SystemClockContext& context) { +Result SystemClock::SetSystemClockContext(const SystemClockContext& context) { LOG_DEBUG(Service_Time, "called. context={}", context); R_UNLESS(m_can_write_clock, ResultPermissionDenied); diff --git a/src/core/hle/service/psc/time/system_clock.h b/src/core/hle/service/psc/time/system_clock.h index b40d73595..3c11fb2f8 100644 --- a/src/core/hle/service/psc/time/system_clock.h +++ b/src/core/hle/service/psc/time/system_clock.h @@ -26,7 +26,7 @@ public: Result GetCurrentTime(Out out_time); Result SetCurrentTime(s64 time); Result GetSystemClockContext(Out out_context); - Result SetSystemClockContext(SystemClockContext& context); + Result SetSystemClockContext(const SystemClockContext& context); Result GetOperationEventReadableHandle(OutCopyHandle out_event); private: diff --git a/src/core/hle/service/psc/time/time_zone.cpp b/src/core/hle/service/psc/time/time_zone.cpp index cc855c763..81bfb9092 100644 --- a/src/core/hle/service/psc/time/time_zone.cpp +++ b/src/core/hle/service/psc/time/time_zone.cpp @@ -55,7 +55,7 @@ constexpr bool GetTimeZoneTime(s64& out_time, const Tz::Rule& rule, s64 time, s3 } } // namespace -void TimeZone::SetTimePoint(SteadyClockTimePoint& time_point) { +void TimeZone::SetTimePoint(const SteadyClockTimePoint& time_point) { std::scoped_lock l{m_mutex}; m_steady_clock_time_point = time_point; } @@ -65,7 +65,7 @@ void TimeZone::SetTotalLocationNameCount(u32 count) { m_total_location_name_count = count; } -void TimeZone::SetRuleVersion(RuleVersion& rule_version) { +void TimeZone::SetRuleVersion(const RuleVersion& rule_version) { std::scoped_lock l{m_mutex}; m_rule_version = rule_version; } @@ -123,7 +123,7 @@ Result TimeZone::ToCalendarTimeWithMyRule(CalendarTime& calendar_time, R_RETURN(ToCalendarTimeImpl(calendar_time, calendar_additional, time, m_my_rule)); } -Result TimeZone::ParseBinary(LocationName& name, std::span binary) { +Result TimeZone::ParseBinary(const LocationName& name, std::span binary) { std::scoped_lock l{m_mutex}; Tz::Rule tmp_rule{}; diff --git a/src/core/hle/service/psc/time/time_zone.h b/src/core/hle/service/psc/time/time_zone.h index 6248e45f9..0e4ed6ed0 100644 --- a/src/core/hle/service/psc/time/time_zone.h +++ b/src/core/hle/service/psc/time/time_zone.h @@ -23,9 +23,9 @@ public: m_initialized = true; } - void SetTimePoint(SteadyClockTimePoint& time_point); + void SetTimePoint(const SteadyClockTimePoint& time_point); void SetTotalLocationNameCount(u32 count); - void SetRuleVersion(RuleVersion& rule_version); + void SetRuleVersion(const RuleVersion& rule_version); Result GetLocationName(LocationName& out_name); Result GetTotalLocationCount(u32& out_count); Result GetRuleVersion(RuleVersion& out_rule_version); @@ -36,7 +36,7 @@ public: const Tz::Rule& rule); Result ToCalendarTimeWithMyRule(CalendarTime& calendar_time, CalendarAdditionalInfo& calendar_additional, s64 time); - Result ParseBinary(LocationName& name, std::span binary); + Result ParseBinary(const LocationName& name, std::span binary); Result ParseBinaryInto(Tz::Rule& out_rule, std::span binary); Result ToPosixTime(u32& out_count, std::span out_times, size_t out_times_max_count, const CalendarTime& calendar, const Tz::Rule& rule); diff --git a/src/core/hle/service/psc/time/time_zone_service.cpp b/src/core/hle/service/psc/time/time_zone_service.cpp index eb81f5b03..2f80030a4 100644 --- a/src/core/hle/service/psc/time/time_zone_service.cpp +++ b/src/core/hle/service/psc/time/time_zone_service.cpp @@ -42,7 +42,7 @@ Result TimeZoneService::GetDeviceLocationName(Out out_location_nam R_RETURN(m_time_zone.GetLocationName(*out_location_name)); } -Result TimeZoneService::SetDeviceLocationName(LocationName& location_name) { +Result TimeZoneService::SetDeviceLocationName(const LocationName& location_name) { LOG_DEBUG(Service_Time, "called. This function is not implemented!"); R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); @@ -62,7 +62,7 @@ Result TimeZoneService::LoadLocationNameList( R_RETURN(ResultNotImplemented); } -Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, LocationName& location_name) { +Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, const LocationName& location_name) { LOG_DEBUG(Service_Time, "called. This function is not implemented!"); R_RETURN(ResultNotImplemented); @@ -86,7 +86,7 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime( } Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( - LocationName& location_name, InBuffer binary) { + const LocationName& location_name, InBuffer binary) { LOG_DEBUG(Service_Time, "called. location_name={}", location_name); R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); diff --git a/src/core/hle/service/psc/time/time_zone_service.h b/src/core/hle/service/psc/time/time_zone_service.h index 6eb9ddc4b..79b6073e5 100644 --- a/src/core/hle/service/psc/time/time_zone_service.h +++ b/src/core/hle/service/psc/time/time_zone_service.h @@ -31,16 +31,16 @@ public: ~TimeZoneService() override = default; Result GetDeviceLocationName(Out out_location_name); - Result SetDeviceLocationName(LocationName& location_name); + Result SetDeviceLocationName(const LocationName& location_name); Result GetTotalLocationNameCount(Out out_count); Result LoadLocationNameList(Out out_count, OutArray out_names, u32 index); - Result LoadTimeZoneRule(OutRule out_rule, LocationName& location_name); + Result LoadTimeZoneRule(OutRule out_rule, const LocationName& location_name); Result GetTimeZoneRuleVersion(Out out_rule_version); Result GetDeviceLocationNameAndUpdatedTime(Out location_name, Out out_time_point); - Result SetDeviceLocationNameWithTimeZoneRule(LocationName& location_name, + Result SetDeviceLocationNameWithTimeZoneRule(const LocationName& location_name, InBuffer binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer binary); Result GetDeviceLocationNameOperationEventReadableHandle( diff --git a/src/core/hle/service/ro/ro.cpp b/src/core/hle/service/ro/ro.cpp index 51196170a..3d3ad2d62 100644 --- a/src/core/hle/service/ro/ro.cpp +++ b/src/core/hle/service/ro/ro.cpp @@ -549,13 +549,13 @@ public: } Result RegisterProcessHandle(ClientProcessId client_pid, - InCopyHandle& process) { + InCopyHandle process) { // Register the process. R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.Get(), *client_pid)); } Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size, - InCopyHandle& process) { + InCopyHandle process) { // Validate the process. R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); -- cgit v1.2.3