summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando S2024-02-02 15:10:46 +0100
committerGravatar GitHub2024-02-02 15:10:46 +0100
commit6baf965777145fd9c76bd06a3c140afa46a50e87 (patch)
tree52a9b8ea293bb9b378e7e662b92e9c56d1f87d4c
parentMerge pull request #12845 from liamwhite/notif (diff)
parentservice: use const references for input raw data (diff)
downloadyuzu-6baf965777145fd9c76bd06a3c140afa46a50e87.tar.gz
yuzu-6baf965777145fd9c76bd06a3c140afa46a50e87.tar.xz
yuzu-6baf965777145fd9c76bd06a3c140afa46a50e87.zip
Merge pull request #12857 from liamwhite/const
service: use const references for input raw data
-rw-r--r--src/core/hle/service/glue/time/static.cpp6
-rw-r--r--src/core/hle/service/glue/time/static.h6
-rw-r--r--src/core/hle/service/glue/time/time_zone.cpp9
-rw-r--r--src/core/hle/service/glue/time/time_zone.h10
-rw-r--r--src/core/hle/service/glue/time/time_zone_binary.cpp6
-rw-r--r--src/core/hle/service/glue/time/time_zone_binary.h6
-rw-r--r--src/core/hle/service/jit/jit.cpp8
-rw-r--r--src/core/hle/service/mii/mii.cpp2
-rw-r--r--src/core/hle/service/psc/time/clocks/context_writers.cpp6
-rw-r--r--src/core/hle/service/psc/time/clocks/context_writers.h8
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.cpp2
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_local_system_clock_core.h2
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.cpp2
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_network_system_clock_core.h2
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.cpp2
-rw-r--r--src/core/hle/service/psc/time/clocks/standard_user_system_clock_core.h2
-rw-r--r--src/core/hle/service/psc/time/clocks/system_clock_core.cpp4
-rw-r--r--src/core/hle/service/psc/time/clocks/system_clock_core.h4
-rw-r--r--src/core/hle/service/psc/time/service_manager.cpp18
-rw-r--r--src/core/hle/service/psc/time/service_manager.h15
-rw-r--r--src/core/hle/service/psc/time/shared_memory.cpp6
-rw-r--r--src/core/hle/service/psc/time/shared_memory.h6
-rw-r--r--src/core/hle/service/psc/time/static.cpp16
-rw-r--r--src/core/hle/service/psc/time/static.h11
-rw-r--r--src/core/hle/service/psc/time/system_clock.cpp2
-rw-r--r--src/core/hle/service/psc/time/system_clock.h2
-rw-r--r--src/core/hle/service/psc/time/time_zone.cpp6
-rw-r--r--src/core/hle/service/psc/time/time_zone.h6
-rw-r--r--src/core/hle/service/psc/time/time_zone_service.cpp6
-rw-r--r--src/core/hle/service/psc/time/time_zone_service.h6
-rw-r--r--src/core/hle/service/ro/ro.cpp4
31 files changed, 100 insertions, 91 deletions
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(
200} 200}
201 201
202Result StaticService::CalculateMonotonicSystemClockBaseTimePoint( 202Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(
203 Out<s64> out_time, Service::PSC::Time::SystemClockContext& context) { 203 Out<s64> out_time, const Service::PSC::Time::SystemClockContext& context) {
204 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); 204 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); });
205 205
206 R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context)); 206 R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context));
@@ -216,8 +216,8 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot,
216 216
217Result StaticService::GetClockSnapshotFromSystemClockContext( 217Result StaticService::GetClockSnapshotFromSystemClockContext(
218 Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, 218 Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot,
219 Service::PSC::Time::SystemClockContext& user_context, 219 const Service::PSC::Time::SystemClockContext& user_context,
220 Service::PSC::Time::SystemClockContext& network_context) { 220 const Service::PSC::Time::SystemClockContext& network_context) {
221 SCOPE_EXIT({ 221 SCOPE_EXIT({
222 LOG_DEBUG(Service_Time, 222 LOG_DEBUG(Service_Time,
223 "called. type={} out_snapshot={} user_context={} network_context={}", type, 223 "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:
58 Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( 58 Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
59 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point); 59 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
60 Result CalculateMonotonicSystemClockBaseTimePoint( 60 Result CalculateMonotonicSystemClockBaseTimePoint(
61 Out<s64> out_time, Service::PSC::Time::SystemClockContext& context); 61 Out<s64> out_time, const Service::PSC::Time::SystemClockContext& context);
62 Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type); 62 Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type);
63 Result GetClockSnapshotFromSystemClockContext( 63 Result GetClockSnapshotFromSystemClockContext(
64 Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, 64 Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot,
65 Service::PSC::Time::SystemClockContext& user_context, 65 const Service::PSC::Time::SystemClockContext& user_context,
66 Service::PSC::Time::SystemClockContext& network_context); 66 const Service::PSC::Time::SystemClockContext& network_context);
67 Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference, 67 Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference,
68 InClockSnapshot a, InClockSnapshot b); 68 InClockSnapshot a, InClockSnapshot b);
69 Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b); 69 Result CalculateSpanBetween(Out<s64> 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(
62 R_RETURN(m_wrapped_service->GetDeviceLocationName(out_location_name)); 62 R_RETURN(m_wrapped_service->GetDeviceLocationName(out_location_name));
63} 63}
64 64
65Result TimeZoneService::SetDeviceLocationName(Service::PSC::Time::LocationName& location_name) { 65Result TimeZoneService::SetDeviceLocationName(
66 const Service::PSC::Time::LocationName& location_name) {
66 LOG_DEBUG(Service_Time, "called. location_name={}", location_name); 67 LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
67 68
68 R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); 69 R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied);
@@ -110,7 +111,8 @@ Result TimeZoneService::LoadLocationNameList(
110 R_RETURN(GetTimeZoneLocationList(*out_count, out_names, out_names.size(), index)); 111 R_RETURN(GetTimeZoneLocationList(*out_count, out_names, out_names.size(), index));
111} 112}
112 113
113Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& name) { 114Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule,
115 const Service::PSC::Time::LocationName& name) {
114 LOG_DEBUG(Service_Time, "called. name={}", name); 116 LOG_DEBUG(Service_Time, "called. name={}", name);
115 117
116 std::scoped_lock l{m_mutex}; 118 std::scoped_lock l{m_mutex};
@@ -139,7 +141,8 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime(
139} 141}
140 142
141Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( 143Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule(
142 Service::PSC::Time::LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) { 144 const Service::PSC::Time::LocationName& location_name,
145 InBuffer<BufferAttr_HipcAutoSelect> binary) {
143 LOG_DEBUG(Service_Time, "called. location_name={}", location_name); 146 LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
144 147
145 R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); 148 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:
46 ~TimeZoneService() override; 46 ~TimeZoneService() override;
47 47
48 Result GetDeviceLocationName(Out<Service::PSC::Time::LocationName> out_location_name); 48 Result GetDeviceLocationName(Out<Service::PSC::Time::LocationName> out_location_name);
49 Result SetDeviceLocationName(Service::PSC::Time::LocationName& location_name); 49 Result SetDeviceLocationName(const Service::PSC::Time::LocationName& location_name);
50 Result GetTotalLocationNameCount(Out<u32> out_count); 50 Result GetTotalLocationNameCount(Out<u32> out_count);
51 Result LoadLocationNameList( 51 Result LoadLocationNameList(
52 Out<u32> out_count, 52 Out<u32> out_count,
53 OutArray<Service::PSC::Time::LocationName, BufferAttr_HipcMapAlias> out_names, u32 index); 53 OutArray<Service::PSC::Time::LocationName, BufferAttr_HipcMapAlias> out_names, u32 index);
54 Result LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& location_name); 54 Result LoadTimeZoneRule(OutRule out_rule,
55 const Service::PSC::Time::LocationName& location_name);
55 Result GetTimeZoneRuleVersion(Out<Service::PSC::Time::RuleVersion> out_rule_version); 56 Result GetTimeZoneRuleVersion(Out<Service::PSC::Time::RuleVersion> out_rule_version);
56 Result GetDeviceLocationNameAndUpdatedTime( 57 Result GetDeviceLocationNameAndUpdatedTime(
57 Out<Service::PSC::Time::LocationName> location_name, 58 Out<Service::PSC::Time::LocationName> location_name,
58 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point); 59 Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
59 Result SetDeviceLocationNameWithTimeZoneRule(Service::PSC::Time::LocationName& location_name, 60 Result SetDeviceLocationNameWithTimeZoneRule(
60 InBuffer<BufferAttr_HipcAutoSelect> binary); 61 const Service::PSC::Time::LocationName& location_name,
62 InBuffer<BufferAttr_HipcAutoSelect> binary);
61 Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary); 63 Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary);
62 Result GetDeviceLocationNameOperationEventReadableHandle( 64 Result GetDeviceLocationNameOperationEventReadableHandle(
63 OutCopyHandle<Kernel::KReadableEvent> out_event); 65 OutCopyHandle<Kernel::KReadableEvent> 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) {
98 out_path = "/version.txt"; 98 out_path = "/version.txt";
99} 99}
100 100
101void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name) { 101void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name) {
102 if (g_time_zone_binary_mount_result != ResultSuccess) { 102 if (g_time_zone_binary_mount_result != ResultSuccess) {
103 return; 103 return;
104 } 104 }
@@ -106,7 +106,7 @@ void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName
106 out_path = fmt::format("/zoneinfo/{}", name.data()); 106 out_path = fmt::format("/zoneinfo/{}", name.data());
107} 107}
108 108
109bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name) { 109bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name) {
110 std::string path{}; 110 std::string path{};
111 GetTimeZoneZonePath(path, name); 111 GetTimeZoneZonePath(path, name);
112 112
@@ -155,7 +155,7 @@ Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version) {
155} 155}
156 156
157Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size, 157Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size,
158 Service::PSC::Time::LocationName& name) { 158 const Service::PSC::Time::LocationName& name) {
159 std::string path{}; 159 std::string path{};
160 GetTimeZoneZonePath(path, name); 160 GetTimeZoneZonePath(path, name);
161 161
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();
19Result MountTimeZoneBinary(Core::System& system); 19Result MountTimeZoneBinary(Core::System& system);
20void GetTimeZoneBinaryListPath(std::string& out_path); 20void GetTimeZoneBinaryListPath(std::string& out_path);
21void GetTimeZoneBinaryVersionPath(std::string& out_path); 21void GetTimeZoneBinaryVersionPath(std::string& out_path);
22void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name); 22void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name);
23bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name); 23bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name);
24u32 GetTimeZoneCount(); 24u32 GetTimeZoneCount();
25Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version); 25Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version);
26Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size, 26Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size,
27 Service::PSC::Time::LocationName& name); 27 const Service::PSC::Time::LocationName& name);
28Result GetTimeZoneLocationList(u32& out_count, 28Result GetTimeZoneLocationList(u32& out_count,
29 std::span<Service::PSC::Time::LocationName> out_names, 29 std::span<Service::PSC::Time::LocationName> out_names,
30 size_t max_names, u32 index); 30 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:
126 R_THROW(ResultUnknown); 126 R_THROW(ResultUnknown);
127 } 127 }
128 128
129 Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory>& tmem, 129 Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory> tmem,
130 InBuffer<BufferAttr_HipcMapAlias> nrr, 130 InBuffer<BufferAttr_HipcMapAlias> nrr,
131 InBuffer<BufferAttr_HipcMapAlias> nro) { 131 InBuffer<BufferAttr_HipcMapAlias> nro) {
132 if (!tmem) { 132 if (!tmem) {
@@ -268,9 +268,9 @@ public:
268 268
269private: 269private:
270 Result CreateJitEnvironment(Out<SharedPointer<IJitEnvironment>> out_jit_environment, 270 Result CreateJitEnvironment(Out<SharedPointer<IJitEnvironment>> out_jit_environment,
271 u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess>& process, 271 u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess> process,
272 InCopyHandle<Kernel::KCodeMemory>& rx_mem, 272 InCopyHandle<Kernel::KCodeMemory> rx_mem,
273 InCopyHandle<Kernel::KCodeMemory>& ro_mem) { 273 InCopyHandle<Kernel::KCodeMemory> ro_mem) {
274 if (!process) { 274 if (!process) {
275 LOG_ERROR(Service_JIT, "process is null"); 275 LOG_ERROR(Service_JIT, "process is null");
276 R_THROW(ResultUnknown); 276 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:
189 R_RETURN(manager->Move(metadata, new_index, create_id)); 189 R_RETURN(manager->Move(metadata, new_index, create_id));
190 } 190 }
191 191
192 Result AddOrReplace(StoreData& store_data) { 192 Result AddOrReplace(const StoreData& store_data) {
193 LOG_INFO(Service_Mii, "called"); 193 LOG_INFO(Service_Mii, "called");
194 R_UNLESS(is_system, ResultPermissionDenied); 194 R_UNLESS(is_system, ResultPermissionDenied);
195 195
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
22 SharedMemory& shared_memory) 22 SharedMemory& shared_memory)
23 : m_system{system}, m_shared_memory{shared_memory} {} 23 : m_system{system}, m_shared_memory{shared_memory} {}
24 24
25Result LocalSystemClockContextWriter::Write(SystemClockContext& context) { 25Result LocalSystemClockContextWriter::Write(const SystemClockContext& context) {
26 if (m_in_use) { 26 if (m_in_use) {
27 R_SUCCEED_IF(context == m_context); 27 R_SUCCEED_IF(context == m_context);
28 m_context = context; 28 m_context = context;
@@ -43,7 +43,7 @@ NetworkSystemClockContextWriter::NetworkSystemClockContextWriter(Core::System& s
43 SystemClockCore& system_clock) 43 SystemClockCore& system_clock)
44 : m_system{system}, m_shared_memory{shared_memory}, m_system_clock{system_clock} {} 44 : m_system{system}, m_shared_memory{shared_memory}, m_system_clock{system_clock} {}
45 45
46Result NetworkSystemClockContextWriter::Write(SystemClockContext& context) { 46Result NetworkSystemClockContextWriter::Write(const SystemClockContext& context) {
47 s64 time{}; 47 s64 time{};
48 [[maybe_unused]] auto res = m_system_clock.GetCurrentTime(&time); 48 [[maybe_unused]] auto res = m_system_clock.GetCurrentTime(&time);
49 49
@@ -66,7 +66,7 @@ EphemeralNetworkSystemClockContextWriter::EphemeralNetworkSystemClockContextWrit
66 Core::System& system) 66 Core::System& system)
67 : m_system{system} {} 67 : m_system{system} {}
68 68
69Result EphemeralNetworkSystemClockContextWriter::Write(SystemClockContext& context) { 69Result EphemeralNetworkSystemClockContextWriter::Write(const SystemClockContext& context) {
70 if (m_in_use) { 70 if (m_in_use) {
71 R_SUCCEED_IF(context == m_context); 71 R_SUCCEED_IF(context == m_context);
72 m_context = context; 72 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:
24public: 24public:
25 virtual ~ContextWriter() = default; 25 virtual ~ContextWriter() = default;
26 26
27 virtual Result Write(SystemClockContext& context) = 0; 27 virtual Result Write(const SystemClockContext& context) = 0;
28 void SignalAllNodes(); 28 void SignalAllNodes();
29 void Link(OperationEvent& operation_event); 29 void Link(OperationEvent& operation_event);
30 30
@@ -37,7 +37,7 @@ class LocalSystemClockContextWriter : public ContextWriter {
37public: 37public:
38 explicit LocalSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory); 38 explicit LocalSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory);
39 39
40 Result Write(SystemClockContext& context) override; 40 Result Write(const SystemClockContext& context) override;
41 41
42private: 42private:
43 Core::System& m_system; 43 Core::System& m_system;
@@ -52,7 +52,7 @@ public:
52 explicit NetworkSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory, 52 explicit NetworkSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory,
53 SystemClockCore& system_clock); 53 SystemClockCore& system_clock);
54 54
55 Result Write(SystemClockContext& context) override; 55 Result Write(const SystemClockContext& context) override;
56 56
57private: 57private:
58 Core::System& m_system; 58 Core::System& m_system;
@@ -67,7 +67,7 @@ class EphemeralNetworkSystemClockContextWriter : public ContextWriter {
67public: 67public:
68 EphemeralNetworkSystemClockContextWriter(Core::System& system); 68 EphemeralNetworkSystemClockContextWriter(Core::System& system);
69 69
70 Result Write(SystemClockContext& context) override; 70 Result Write(const SystemClockContext& context) override;
71 71
72private: 72private:
73 Core::System& m_system; 73 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 @@
5 5
6namespace Service::PSC::Time { 6namespace Service::PSC::Time {
7 7
8void StandardLocalSystemClockCore::Initialize(SystemClockContext& context, s64 time) { 8void StandardLocalSystemClockCore::Initialize(const SystemClockContext& context, s64 time) {
9 SteadyClockTimePoint time_point{}; 9 SteadyClockTimePoint time_point{};
10 if (GetCurrentTimePoint(time_point) == ResultSuccess && 10 if (GetCurrentTimePoint(time_point) == ResultSuccess &&
11 context.steady_time_point.IdMatches(time_point)) { 11 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:
17 : SystemClockCore{steady_clock} {} 17 : SystemClockCore{steady_clock} {}
18 ~StandardLocalSystemClockCore() override = default; 18 ~StandardLocalSystemClockCore() override = default;
19 19
20 void Initialize(SystemClockContext& context, s64 time); 20 void Initialize(const SystemClockContext& context, s64 time);
21}; 21};
22 22
23} // namespace Service::PSC::Time 23} // 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 @@
5 5
6namespace Service::PSC::Time { 6namespace Service::PSC::Time {
7 7
8void StandardNetworkSystemClockCore::Initialize(SystemClockContext& context, s64 accuracy) { 8void StandardNetworkSystemClockCore::Initialize(const SystemClockContext& context, s64 accuracy) {
9 if (SetContextAndWrite(context) != ResultSuccess) { 9 if (SetContextAndWrite(context) != ResultSuccess) {
10 LOG_ERROR(Service_Time, "Failed to SetContext"); 10 LOG_ERROR(Service_Time, "Failed to SetContext");
11 } 11 }
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:
19 : SystemClockCore{steady_clock} {} 19 : SystemClockCore{steady_clock} {}
20 ~StandardNetworkSystemClockCore() override = default; 20 ~StandardNetworkSystemClockCore() override = default;
21 21
22 void Initialize(SystemClockContext& context, s64 accuracy); 22 void Initialize(const SystemClockContext& context, s64 accuracy);
23 bool IsAccuracySufficient(); 23 bool IsAccuracySufficient();
24 24
25private: 25private:
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)
46 R_RETURN(m_local_system_clock.GetContext(out_context)); 46 R_RETURN(m_local_system_clock.GetContext(out_context));
47} 47}
48 48
49Result StandardUserSystemClockCore::SetContext(SystemClockContext& context) { 49Result StandardUserSystemClockCore::SetContext(const SystemClockContext& context) {
50 R_RETURN(ResultNotImplemented); 50 R_RETURN(ResultNotImplemented);
51} 51}
52 52
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:
36 Result SetAutomaticCorrection(bool automatic_correction); 36 Result SetAutomaticCorrection(bool automatic_correction);
37 37
38 Result GetContext(SystemClockContext& out_context) const override; 38 Result GetContext(SystemClockContext& out_context) const override;
39 Result SetContext(SystemClockContext& context) override; 39 Result SetContext(const SystemClockContext& context) override;
40 40
41 Result GetTimePoint(SteadyClockTimePoint& out_time_point); 41 Result GetTimePoint(SteadyClockTimePoint& out_time_point);
42 void SetTimePointAndSignal(SteadyClockTimePoint& time_point); 42 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 {
51 R_SUCCEED(); 51 R_SUCCEED();
52} 52}
53 53
54Result SystemClockCore::SetContext(SystemClockContext& context) { 54Result SystemClockCore::SetContext(const SystemClockContext& context) {
55 m_context = context; 55 m_context = context;
56 R_SUCCEED(); 56 R_SUCCEED();
57} 57}
58 58
59Result SystemClockCore::SetContextAndWrite(SystemClockContext& context) { 59Result SystemClockCore::SetContextAndWrite(const SystemClockContext& context) {
60 R_TRY(SetContext(context)); 60 R_TRY(SetContext(context));
61 61
62 if (m_context_writer) { 62 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:
41 } 41 }
42 42
43 virtual Result GetContext(SystemClockContext& out_context) const; 43 virtual Result GetContext(SystemClockContext& out_context) const;
44 virtual Result SetContext(SystemClockContext& context); 44 virtual Result SetContext(const SystemClockContext& context);
45 Result SetContextAndWrite(SystemClockContext& context); 45 Result SetContextAndWrite(const SystemClockContext& context);
46 46
47 void LinkOperationEvent(OperationEvent& operation_event); 47 void LinkOperationEvent(OperationEvent& operation_event);
48 48
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<StaticServi
78} 78}
79 79
80Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected, 80Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
81 Common::UUID& clock_source_id, s64 rtc_offset, 81 const Common::UUID& clock_source_id,
82 s64 internal_offset, s64 test_offset) { 82 s64 rtc_offset, s64 internal_offset,
83 s64 test_offset) {
83 LOG_DEBUG(Service_Time, 84 LOG_DEBUG(Service_Time,
84 "called. is_rtc_reset_detected={} clock_source_id={} rtc_offset={} " 85 "called. is_rtc_reset_detected={} clock_source_id={} rtc_offset={} "
85 "internal_offset={} test_offset={}", 86 "internal_offset={} test_offset={}",
@@ -102,7 +103,8 @@ Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
102 R_SUCCEED(); 103 R_SUCCEED();
103} 104}
104 105
105Result ServiceManager::SetupStandardLocalSystemClockCore(SystemClockContext& context, s64 time) { 106Result ServiceManager::SetupStandardLocalSystemClockCore(const SystemClockContext& context,
107 s64 time) {
106 LOG_DEBUG(Service_Time, 108 LOG_DEBUG(Service_Time,
107 "called. context={} context.steady_time_point.clock_source_id={} time={}", context, 109 "called. context={} context.steady_time_point.clock_source_id={} time={}", context,
108 context.steady_time_point.clock_source_id.RawString(), time); 110 context.steady_time_point.clock_source_id.RawString(), time);
@@ -114,7 +116,7 @@ Result ServiceManager::SetupStandardLocalSystemClockCore(SystemClockContext& con
114 R_SUCCEED(); 116 R_SUCCEED();
115} 117}
116 118
117Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& context, 119Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext context,
118 s64 accuracy) { 120 s64 accuracy) {
119 LOG_DEBUG(Service_Time, "called. context={} steady_time_point.clock_source_id={} accuracy={}", 121 LOG_DEBUG(Service_Time, "called. context={} steady_time_point.clock_source_id={} accuracy={}",
120 context, context.steady_time_point.clock_source_id.RawString(), accuracy); 122 context, context.steady_time_point.clock_source_id.RawString(), accuracy);
@@ -131,7 +133,7 @@ Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& c
131} 133}
132 134
133Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correction, 135Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correction,
134 SteadyClockTimePoint& time_point) { 136 SteadyClockTimePoint time_point) {
135 LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", 137 LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}",
136 automatic_correction, time_point, time_point.clock_source_id.RawString()); 138 automatic_correction, time_point, time_point.clock_source_id.RawString());
137 139
@@ -144,9 +146,9 @@ Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correctio
144 R_SUCCEED(); 146 R_SUCCEED();
145} 147}
146 148
147Result ServiceManager::SetupTimeZoneServiceCore(LocationName& name, RuleVersion& rule_version, 149Result ServiceManager::SetupTimeZoneServiceCore(const LocationName& name,
148 u32 location_count, 150 const RuleVersion& rule_version, u32 location_count,
149 SteadyClockTimePoint& time_point, 151 const SteadyClockTimePoint& time_point,
150 InBuffer<BufferAttr_HipcAutoSelect> rule_buffer) { 152 InBuffer<BufferAttr_HipcAutoSelect> rule_buffer) {
151 LOG_DEBUG(Service_Time, 153 LOG_DEBUG(Service_Time,
152 "called. name={} rule_version={} location_count={} time_point={} " 154 "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:
34 Result GetStaticServiceAsAdmin(OutInterface<StaticService> out_service); 34 Result GetStaticServiceAsAdmin(OutInterface<StaticService> out_service);
35 Result GetStaticServiceAsRepair(OutInterface<StaticService> out_service); 35 Result GetStaticServiceAsRepair(OutInterface<StaticService> out_service);
36 Result GetStaticServiceAsServiceManager(OutInterface<StaticService> out_service); 36 Result GetStaticServiceAsServiceManager(OutInterface<StaticService> out_service);
37 Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected, Common::UUID& clock_source_id, 37 Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
38 s64 rtc_offset, s64 internal_offset, s64 test_offset); 38 const Common::UUID& clock_source_id, s64 rtc_offset,
39 Result SetupStandardLocalSystemClockCore(SystemClockContext& context, s64 time); 39 s64 internal_offset, s64 test_offset);
40 Result SetupStandardNetworkSystemClockCore(SystemClockContext& context, s64 accuracy); 40 Result SetupStandardLocalSystemClockCore(const SystemClockContext& context, s64 time);
41 Result SetupStandardNetworkSystemClockCore(SystemClockContext context, s64 accuracy);
41 Result SetupStandardUserSystemClockCore(bool automatic_correction, 42 Result SetupStandardUserSystemClockCore(bool automatic_correction,
42 SteadyClockTimePoint& time_point); 43 SteadyClockTimePoint time_point);
43 Result SetupTimeZoneServiceCore(LocationName& name, RuleVersion& rule_version, 44 Result SetupTimeZoneServiceCore(const LocationName& name, const RuleVersion& rule_version,
44 u32 location_count, SteadyClockTimePoint& time_point, 45 u32 location_count, const SteadyClockTimePoint& time_point,
45 InBuffer<BufferAttr_HipcAutoSelect> rule_buffer); 46 InBuffer<BufferAttr_HipcAutoSelect> rule_buffer);
46 Result SetupEphemeralNetworkSystemClockCore(); 47 Result SetupEphemeralNetworkSystemClockCore();
47 Result GetStandardLocalClockOperationEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); 48 Result GetStandardLocalClockOperationEvent(OutCopyHandle<Kernel::KReadableEvent> 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)
51 std::memset(m_shared_memory_ptr, 0, sizeof(*m_shared_memory_ptr)); 51 std::memset(m_shared_memory_ptr, 0, sizeof(*m_shared_memory_ptr));
52} 52}
53 53
54void SharedMemory::SetLocalSystemContext(SystemClockContext& context) { 54void SharedMemory::SetLocalSystemContext(const SystemClockContext& context) {
55 WriteToLockFreeAtomicType(&m_shared_memory_ptr->local_system_clock_contexts, context); 55 WriteToLockFreeAtomicType(&m_shared_memory_ptr->local_system_clock_contexts, context);
56} 56}
57 57
58void SharedMemory::SetNetworkSystemContext(SystemClockContext& context) { 58void SharedMemory::SetNetworkSystemContext(const SystemClockContext& context) {
59 WriteToLockFreeAtomicType(&m_shared_memory_ptr->network_system_clock_contexts, context); 59 WriteToLockFreeAtomicType(&m_shared_memory_ptr->network_system_clock_contexts, context);
60} 60}
61 61
@@ -64,7 +64,7 @@ void SharedMemory::SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 ti
64 {time_point, clock_source_id}); 64 {time_point, clock_source_id});
65} 65}
66 66
67void SharedMemory::SetContinuousAdjustment(ContinuousAdjustmentTimePoint& time_point) { 67void SharedMemory::SetContinuousAdjustment(const ContinuousAdjustmentTimePoint& time_point) {
68 WriteToLockFreeAtomicType(&m_shared_memory_ptr->continuous_adjustment_time_points, time_point); 68 WriteToLockFreeAtomicType(&m_shared_memory_ptr->continuous_adjustment_time_points, time_point);
69} 69}
70 70
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:
54 return m_k_shared_memory; 54 return m_k_shared_memory;
55 } 55 }
56 56
57 void SetLocalSystemContext(SystemClockContext& context); 57 void SetLocalSystemContext(const SystemClockContext& context);
58 void SetNetworkSystemContext(SystemClockContext& context); 58 void SetNetworkSystemContext(const SystemClockContext& context);
59 void SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 time_diff); 59 void SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 time_diff);
60 void SetContinuousAdjustment(ContinuousAdjustmentTimePoint& time_point); 60 void SetContinuousAdjustment(const ContinuousAdjustmentTimePoint& time_point);
61 void SetAutomaticCorrection(bool automatic_correction); 61 void SetAutomaticCorrection(bool automatic_correction);
62 void UpdateBaseTime(s64 time); 62 void UpdateBaseTime(s64 time);
63 63
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(
198 R_SUCCEED(); 198 R_SUCCEED();
199} 199}
200 200
201Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time, 201Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(
202 SystemClockContext& context) { 202 Out<s64> out_time, const SystemClockContext& context) {
203 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); 203 SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); });
204 204
205 R_UNLESS(m_time->m_standard_steady_clock.IsInitialized(), ResultClockUninitialized); 205 R_UNLESS(m_time->m_standard_steady_clock.IsInitialized(), ResultClockUninitialized);
@@ -231,10 +231,9 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType t
231 R_RETURN(GetClockSnapshotImpl(out_snapshot, user_context, network_context, type)); 231 R_RETURN(GetClockSnapshotImpl(out_snapshot, user_context, network_context, type));
232} 232}
233 233
234Result StaticService::GetClockSnapshotFromSystemClockContext(TimeType type, 234Result StaticService::GetClockSnapshotFromSystemClockContext(
235 OutClockSnapshot out_snapshot, 235 TimeType type, OutClockSnapshot out_snapshot, const SystemClockContext& user_context,
236 SystemClockContext& user_context, 236 const SystemClockContext& network_context) {
237 SystemClockContext& network_context) {
238 SCOPE_EXIT({ 237 SCOPE_EXIT({
239 LOG_DEBUG(Service_Time, 238 LOG_DEBUG(Service_Time,
240 "called. type={} user_context={} network_context={} out_snapshot={}", type, 239 "called. type={} user_context={} network_context={} out_snapshot={}", type,
@@ -294,8 +293,9 @@ Result StaticService::CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a,
294} 293}
295 294
296Result StaticService::GetClockSnapshotImpl(OutClockSnapshot out_snapshot, 295Result StaticService::GetClockSnapshotImpl(OutClockSnapshot out_snapshot,
297 SystemClockContext& user_context, 296 const SystemClockContext& user_context,
298 SystemClockContext& network_context, TimeType type) { 297 const SystemClockContext& network_context,
298 TimeType type) {
299 out_snapshot->user_context = user_context; 299 out_snapshot->user_context = user_context;
300 out_snapshot->network_context = network_context; 300 out_snapshot->network_context = network_context;
301 301
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:
55 Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( 55 Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
56 Out<SteadyClockTimePoint> out_time_point); 56 Out<SteadyClockTimePoint> out_time_point);
57 Result CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time, 57 Result CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time,
58 SystemClockContext& context); 58 const SystemClockContext& context);
59 Result GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType type); 59 Result GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType type);
60 Result GetClockSnapshotFromSystemClockContext(TimeType type, OutClockSnapshot out_snapshot, 60 Result GetClockSnapshotFromSystemClockContext(TimeType type, OutClockSnapshot out_snapshot,
61 SystemClockContext& user_context, 61 const SystemClockContext& user_context,
62 SystemClockContext& network_context); 62 const SystemClockContext& network_context);
63 Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference, 63 Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference,
64 InClockSnapshot a, InClockSnapshot b); 64 InClockSnapshot a, InClockSnapshot b);
65 Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b); 65 Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b);
66 66
67private: 67private:
68 Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, SystemClockContext& user_context, 68 Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot,
69 SystemClockContext& network_context, TimeType type); 69 const SystemClockContext& user_context,
70 const SystemClockContext& network_context, TimeType type);
70 71
71 Core::System& m_system; 72 Core::System& m_system;
72 StaticServiceSetupInfo m_setup_info; 73 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<SystemClockContext> out_context) {
53 R_RETURN(m_clock_core.GetContext(*out_context)); 53 R_RETURN(m_clock_core.GetContext(*out_context));
54} 54}
55 55
56Result SystemClock::SetSystemClockContext(SystemClockContext& context) { 56Result SystemClock::SetSystemClockContext(const SystemClockContext& context) {
57 LOG_DEBUG(Service_Time, "called. context={}", context); 57 LOG_DEBUG(Service_Time, "called. context={}", context);
58 58
59 R_UNLESS(m_can_write_clock, ResultPermissionDenied); 59 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:
26 Result GetCurrentTime(Out<s64> out_time); 26 Result GetCurrentTime(Out<s64> out_time);
27 Result SetCurrentTime(s64 time); 27 Result SetCurrentTime(s64 time);
28 Result GetSystemClockContext(Out<SystemClockContext> out_context); 28 Result GetSystemClockContext(Out<SystemClockContext> out_context);
29 Result SetSystemClockContext(SystemClockContext& context); 29 Result SetSystemClockContext(const SystemClockContext& context);
30 Result GetOperationEventReadableHandle(OutCopyHandle<Kernel::KReadableEvent> out_event); 30 Result GetOperationEventReadableHandle(OutCopyHandle<Kernel::KReadableEvent> out_event);
31 31
32private: 32private:
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
55} 55}
56} // namespace 56} // namespace
57 57
58void TimeZone::SetTimePoint(SteadyClockTimePoint& time_point) { 58void TimeZone::SetTimePoint(const SteadyClockTimePoint& time_point) {
59 std::scoped_lock l{m_mutex}; 59 std::scoped_lock l{m_mutex};
60 m_steady_clock_time_point = time_point; 60 m_steady_clock_time_point = time_point;
61} 61}
@@ -65,7 +65,7 @@ void TimeZone::SetTotalLocationNameCount(u32 count) {
65 m_total_location_name_count = count; 65 m_total_location_name_count = count;
66} 66}
67 67
68void TimeZone::SetRuleVersion(RuleVersion& rule_version) { 68void TimeZone::SetRuleVersion(const RuleVersion& rule_version) {
69 std::scoped_lock l{m_mutex}; 69 std::scoped_lock l{m_mutex};
70 m_rule_version = rule_version; 70 m_rule_version = rule_version;
71} 71}
@@ -123,7 +123,7 @@ Result TimeZone::ToCalendarTimeWithMyRule(CalendarTime& calendar_time,
123 R_RETURN(ToCalendarTimeImpl(calendar_time, calendar_additional, time, m_my_rule)); 123 R_RETURN(ToCalendarTimeImpl(calendar_time, calendar_additional, time, m_my_rule));
124} 124}
125 125
126Result TimeZone::ParseBinary(LocationName& name, std::span<const u8> binary) { 126Result TimeZone::ParseBinary(const LocationName& name, std::span<const u8> binary) {
127 std::scoped_lock l{m_mutex}; 127 std::scoped_lock l{m_mutex};
128 128
129 Tz::Rule tmp_rule{}; 129 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:
23 m_initialized = true; 23 m_initialized = true;
24 } 24 }
25 25
26 void SetTimePoint(SteadyClockTimePoint& time_point); 26 void SetTimePoint(const SteadyClockTimePoint& time_point);
27 void SetTotalLocationNameCount(u32 count); 27 void SetTotalLocationNameCount(u32 count);
28 void SetRuleVersion(RuleVersion& rule_version); 28 void SetRuleVersion(const RuleVersion& rule_version);
29 Result GetLocationName(LocationName& out_name); 29 Result GetLocationName(LocationName& out_name);
30 Result GetTotalLocationCount(u32& out_count); 30 Result GetTotalLocationCount(u32& out_count);
31 Result GetRuleVersion(RuleVersion& out_rule_version); 31 Result GetRuleVersion(RuleVersion& out_rule_version);
@@ -36,7 +36,7 @@ public:
36 const Tz::Rule& rule); 36 const Tz::Rule& rule);
37 Result ToCalendarTimeWithMyRule(CalendarTime& calendar_time, 37 Result ToCalendarTimeWithMyRule(CalendarTime& calendar_time,
38 CalendarAdditionalInfo& calendar_additional, s64 time); 38 CalendarAdditionalInfo& calendar_additional, s64 time);
39 Result ParseBinary(LocationName& name, std::span<const u8> binary); 39 Result ParseBinary(const LocationName& name, std::span<const u8> binary);
40 Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); 40 Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary);
41 Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, 41 Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count,
42 const CalendarTime& calendar, const Tz::Rule& rule); 42 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<LocationName> out_location_nam
42 R_RETURN(m_time_zone.GetLocationName(*out_location_name)); 42 R_RETURN(m_time_zone.GetLocationName(*out_location_name));
43} 43}
44 44
45Result TimeZoneService::SetDeviceLocationName(LocationName& location_name) { 45Result TimeZoneService::SetDeviceLocationName(const LocationName& location_name) {
46 LOG_DEBUG(Service_Time, "called. This function is not implemented!"); 46 LOG_DEBUG(Service_Time, "called. This function is not implemented!");
47 47
48 R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); 48 R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied);
@@ -62,7 +62,7 @@ Result TimeZoneService::LoadLocationNameList(
62 R_RETURN(ResultNotImplemented); 62 R_RETURN(ResultNotImplemented);
63} 63}
64 64
65Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, LocationName& location_name) { 65Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, const LocationName& location_name) {
66 LOG_DEBUG(Service_Time, "called. This function is not implemented!"); 66 LOG_DEBUG(Service_Time, "called. This function is not implemented!");
67 67
68 R_RETURN(ResultNotImplemented); 68 R_RETURN(ResultNotImplemented);
@@ -86,7 +86,7 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime(
86} 86}
87 87
88Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( 88Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule(
89 LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) { 89 const LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) {
90 LOG_DEBUG(Service_Time, "called. location_name={}", location_name); 90 LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
91 91
92 R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); 92 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:
31 ~TimeZoneService() override = default; 31 ~TimeZoneService() override = default;
32 32
33 Result GetDeviceLocationName(Out<LocationName> out_location_name); 33 Result GetDeviceLocationName(Out<LocationName> out_location_name);
34 Result SetDeviceLocationName(LocationName& location_name); 34 Result SetDeviceLocationName(const LocationName& location_name);
35 Result GetTotalLocationNameCount(Out<u32> out_count); 35 Result GetTotalLocationNameCount(Out<u32> out_count);
36 Result LoadLocationNameList(Out<u32> out_count, 36 Result LoadLocationNameList(Out<u32> out_count,
37 OutArray<LocationName, BufferAttr_HipcMapAlias> out_names, 37 OutArray<LocationName, BufferAttr_HipcMapAlias> out_names,
38 u32 index); 38 u32 index);
39 Result LoadTimeZoneRule(OutRule out_rule, LocationName& location_name); 39 Result LoadTimeZoneRule(OutRule out_rule, const LocationName& location_name);
40 Result GetTimeZoneRuleVersion(Out<RuleVersion> out_rule_version); 40 Result GetTimeZoneRuleVersion(Out<RuleVersion> out_rule_version);
41 Result GetDeviceLocationNameAndUpdatedTime(Out<LocationName> location_name, 41 Result GetDeviceLocationNameAndUpdatedTime(Out<LocationName> location_name,
42 Out<SteadyClockTimePoint> out_time_point); 42 Out<SteadyClockTimePoint> out_time_point);
43 Result SetDeviceLocationNameWithTimeZoneRule(LocationName& location_name, 43 Result SetDeviceLocationNameWithTimeZoneRule(const LocationName& location_name,
44 InBuffer<BufferAttr_HipcAutoSelect> binary); 44 InBuffer<BufferAttr_HipcAutoSelect> binary);
45 Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary); 45 Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary);
46 Result GetDeviceLocationNameOperationEventReadableHandle( 46 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:
549 } 549 }
550 550
551 Result RegisterProcessHandle(ClientProcessId client_pid, 551 Result RegisterProcessHandle(ClientProcessId client_pid,
552 InCopyHandle<Kernel::KProcess>& process) { 552 InCopyHandle<Kernel::KProcess> process) {
553 // Register the process. 553 // Register the process.
554 R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.Get(), *client_pid)); 554 R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.Get(), *client_pid));
555 } 555 }
556 556
557 Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size, 557 Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size,
558 InCopyHandle<Kernel::KProcess>& process) { 558 InCopyHandle<Kernel::KProcess> process) {
559 // Validate the process. 559 // Validate the process.
560 R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); 560 R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid));
561 561