early-access version 4107

This commit is contained in:
pineappleEA 2024-02-01 22:50:36 +01:00
parent 2e96c99ad6
commit 71a56797a3
32 changed files with 101 additions and 92 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4106. This is the source code for early-access 4107.
## Legal Notice ## Legal Notice

View file

@ -200,7 +200,7 @@ Result StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
} }
Result StaticService::CalculateMonotonicSystemClockBaseTimePoint( Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(
Out<s64> out_time, Service::PSC::Time::SystemClockContext& context) { Out<s64> out_time, const Service::PSC::Time::SystemClockContext& context) {
SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); });
R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context)); R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context));
@ -216,8 +216,8 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot,
Result StaticService::GetClockSnapshotFromSystemClockContext( Result StaticService::GetClockSnapshotFromSystemClockContext(
Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot,
Service::PSC::Time::SystemClockContext& user_context, const Service::PSC::Time::SystemClockContext& user_context,
Service::PSC::Time::SystemClockContext& network_context) { const Service::PSC::Time::SystemClockContext& network_context) {
SCOPE_EXIT({ SCOPE_EXIT({
LOG_DEBUG(Service_Time, LOG_DEBUG(Service_Time,
"called. type={} out_snapshot={} user_context={} network_context={}", type, "called. type={} out_snapshot={} user_context={} network_context={}", type,

View file

@ -58,12 +58,12 @@ public:
Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point); Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
Result CalculateMonotonicSystemClockBaseTimePoint( Result CalculateMonotonicSystemClockBaseTimePoint(
Out<s64> out_time, Service::PSC::Time::SystemClockContext& context); Out<s64> out_time, const Service::PSC::Time::SystemClockContext& context);
Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type); Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type);
Result GetClockSnapshotFromSystemClockContext( Result GetClockSnapshotFromSystemClockContext(
Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot,
Service::PSC::Time::SystemClockContext& user_context, const Service::PSC::Time::SystemClockContext& user_context,
Service::PSC::Time::SystemClockContext& network_context); const Service::PSC::Time::SystemClockContext& network_context);
Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference, Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference,
InClockSnapshot a, InClockSnapshot b); InClockSnapshot a, InClockSnapshot b);
Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b); Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b);

View file

@ -62,7 +62,8 @@ Result TimeZoneService::GetDeviceLocationName(
R_RETURN(m_wrapped_service->GetDeviceLocationName(out_location_name)); 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); LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); 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)); 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); LOG_DEBUG(Service_Time, "called. name={}", name);
std::scoped_lock l{m_mutex}; std::scoped_lock l{m_mutex};
@ -139,7 +141,8 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime(
} }
Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule(
Service::PSC::Time::LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) { const Service::PSC::Time::LocationName& location_name,
InBuffer<BufferAttr_HipcAutoSelect> binary) {
LOG_DEBUG(Service_Time, "called. location_name={}", location_name); LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied);

View file

@ -46,18 +46,20 @@ public:
~TimeZoneService() override; ~TimeZoneService() override;
Result GetDeviceLocationName(Out<Service::PSC::Time::LocationName> out_location_name); Result GetDeviceLocationName(Out<Service::PSC::Time::LocationName> out_location_name);
Result SetDeviceLocationName(Service::PSC::Time::LocationName& location_name); Result SetDeviceLocationName(const Service::PSC::Time::LocationName& location_name);
Result GetTotalLocationNameCount(Out<u32> out_count); Result GetTotalLocationNameCount(Out<u32> out_count);
Result LoadLocationNameList( Result LoadLocationNameList(
Out<u32> out_count, Out<u32> out_count,
OutArray<Service::PSC::Time::LocationName, BufferAttr_HipcMapAlias> out_names, u32 index); OutArray<Service::PSC::Time::LocationName, BufferAttr_HipcMapAlias> 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<Service::PSC::Time::RuleVersion> out_rule_version); Result GetTimeZoneRuleVersion(Out<Service::PSC::Time::RuleVersion> out_rule_version);
Result GetDeviceLocationNameAndUpdatedTime( Result GetDeviceLocationNameAndUpdatedTime(
Out<Service::PSC::Time::LocationName> location_name, Out<Service::PSC::Time::LocationName> location_name,
Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point); Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
Result SetDeviceLocationNameWithTimeZoneRule(Service::PSC::Time::LocationName& location_name, Result SetDeviceLocationNameWithTimeZoneRule(
InBuffer<BufferAttr_HipcAutoSelect> binary); const Service::PSC::Time::LocationName& location_name,
InBuffer<BufferAttr_HipcAutoSelect> binary);
Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary);
Result GetDeviceLocationNameOperationEventReadableHandle( Result GetDeviceLocationNameOperationEventReadableHandle(
OutCopyHandle<Kernel::KReadableEvent> out_event); OutCopyHandle<Kernel::KReadableEvent> out_event);

View file

@ -98,7 +98,7 @@ void GetTimeZoneBinaryVersionPath(std::string& out_path) {
out_path = "/version.txt"; 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) { if (g_time_zone_binary_mount_result != ResultSuccess) {
return; return;
} }
@ -106,7 +106,7 @@ void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName
out_path = fmt::format("/zoneinfo/{}", name.data()); 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{}; std::string path{};
GetTimeZoneZonePath(path, name); GetTimeZoneZonePath(path, name);
@ -155,7 +155,7 @@ Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version) {
} }
Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size, Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size,
Service::PSC::Time::LocationName& name) { const Service::PSC::Time::LocationName& name) {
std::string path{}; std::string path{};
GetTimeZoneZonePath(path, name); GetTimeZoneZonePath(path, name);

View file

@ -19,12 +19,12 @@ void ResetTimeZoneBinary();
Result MountTimeZoneBinary(Core::System& system); Result MountTimeZoneBinary(Core::System& system);
void GetTimeZoneBinaryListPath(std::string& out_path); void GetTimeZoneBinaryListPath(std::string& out_path);
void GetTimeZoneBinaryVersionPath(std::string& out_path); void GetTimeZoneBinaryVersionPath(std::string& out_path);
void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name); void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name);
bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name); bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name);
u32 GetTimeZoneCount(); u32 GetTimeZoneCount();
Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version); Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version);
Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size, Result GetTimeZoneRule(std::span<const u8>& out_rule, size_t& out_rule_size,
Service::PSC::Time::LocationName& name); const Service::PSC::Time::LocationName& name);
Result GetTimeZoneLocationList(u32& out_count, Result GetTimeZoneLocationList(u32& out_count,
std::span<Service::PSC::Time::LocationName> out_names, std::span<Service::PSC::Time::LocationName> out_names,
size_t max_names, u32 index); size_t max_names, u32 index);

View file

@ -126,7 +126,7 @@ public:
R_THROW(ResultUnknown); R_THROW(ResultUnknown);
} }
Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory>& tmem, Result LoadPlugin(u64 tmem_size, InCopyHandle<Kernel::KTransferMemory> tmem,
InBuffer<BufferAttr_HipcMapAlias> nrr, InBuffer<BufferAttr_HipcMapAlias> nrr,
InBuffer<BufferAttr_HipcMapAlias> nro) { InBuffer<BufferAttr_HipcMapAlias> nro) {
if (!tmem) { if (!tmem) {
@ -268,9 +268,9 @@ public:
private: private:
Result CreateJitEnvironment(Out<SharedPointer<IJitEnvironment>> out_jit_environment, Result CreateJitEnvironment(Out<SharedPointer<IJitEnvironment>> out_jit_environment,
u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess>& process, u64 rx_size, u64 ro_size, InCopyHandle<Kernel::KProcess> process,
InCopyHandle<Kernel::KCodeMemory>& rx_mem, InCopyHandle<Kernel::KCodeMemory> rx_mem,
InCopyHandle<Kernel::KCodeMemory>& ro_mem) { InCopyHandle<Kernel::KCodeMemory> ro_mem) {
if (!process) { if (!process) {
LOG_ERROR(Service_JIT, "process is null"); LOG_ERROR(Service_JIT, "process is null");
R_THROW(ResultUnknown); R_THROW(ResultUnknown);

View file

@ -189,7 +189,7 @@ private:
R_RETURN(manager->Move(metadata, new_index, create_id)); 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"); LOG_INFO(Service_Mii, "called");
R_UNLESS(is_system, ResultPermissionDenied); R_UNLESS(is_system, ResultPermissionDenied);

View file

@ -22,7 +22,7 @@ LocalSystemClockContextWriter::LocalSystemClockContextWriter(Core::System& syste
SharedMemory& shared_memory) SharedMemory& shared_memory)
: m_system{system}, m_shared_memory{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) { if (m_in_use) {
R_SUCCEED_IF(context == m_context); R_SUCCEED_IF(context == m_context);
m_context = context; m_context = context;
@ -43,7 +43,7 @@ NetworkSystemClockContextWriter::NetworkSystemClockContextWriter(Core::System& s
SystemClockCore& system_clock) SystemClockCore& system_clock)
: m_system{system}, m_shared_memory{shared_memory}, m_system_clock{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{}; s64 time{};
[[maybe_unused]] auto res = m_system_clock.GetCurrentTime(&time); [[maybe_unused]] auto res = m_system_clock.GetCurrentTime(&time);
@ -66,7 +66,7 @@ EphemeralNetworkSystemClockContextWriter::EphemeralNetworkSystemClockContextWrit
Core::System& system) Core::System& system)
: m_system{system} {} : m_system{system} {}
Result EphemeralNetworkSystemClockContextWriter::Write(SystemClockContext& context) { Result EphemeralNetworkSystemClockContextWriter::Write(const SystemClockContext& context) {
if (m_in_use) { if (m_in_use) {
R_SUCCEED_IF(context == m_context); R_SUCCEED_IF(context == m_context);
m_context = context; m_context = context;

View file

@ -24,7 +24,7 @@ private:
public: public:
virtual ~ContextWriter() = default; virtual ~ContextWriter() = default;
virtual Result Write(SystemClockContext& context) = 0; virtual Result Write(const SystemClockContext& context) = 0;
void SignalAllNodes(); void SignalAllNodes();
void Link(OperationEvent& operation_event); void Link(OperationEvent& operation_event);
@ -37,7 +37,7 @@ class LocalSystemClockContextWriter : public ContextWriter {
public: public:
explicit LocalSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory); explicit LocalSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory);
Result Write(SystemClockContext& context) override; Result Write(const SystemClockContext& context) override;
private: private:
Core::System& m_system; Core::System& m_system;
@ -52,7 +52,7 @@ public:
explicit NetworkSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory, explicit NetworkSystemClockContextWriter(Core::System& system, SharedMemory& shared_memory,
SystemClockCore& system_clock); SystemClockCore& system_clock);
Result Write(SystemClockContext& context) override; Result Write(const SystemClockContext& context) override;
private: private:
Core::System& m_system; Core::System& m_system;
@ -67,7 +67,7 @@ class EphemeralNetworkSystemClockContextWriter : public ContextWriter {
public: public:
EphemeralNetworkSystemClockContextWriter(Core::System& system); EphemeralNetworkSystemClockContextWriter(Core::System& system);
Result Write(SystemClockContext& context) override; Result Write(const SystemClockContext& context) override;
private: private:
Core::System& m_system; Core::System& m_system;

View file

@ -5,7 +5,7 @@
namespace Service::PSC::Time { namespace Service::PSC::Time {
void StandardLocalSystemClockCore::Initialize(SystemClockContext& context, s64 time) { void StandardLocalSystemClockCore::Initialize(const SystemClockContext& context, s64 time) {
SteadyClockTimePoint time_point{}; SteadyClockTimePoint time_point{};
if (GetCurrentTimePoint(time_point) == ResultSuccess && if (GetCurrentTimePoint(time_point) == ResultSuccess &&
context.steady_time_point.IdMatches(time_point)) { context.steady_time_point.IdMatches(time_point)) {

View file

@ -17,7 +17,7 @@ public:
: SystemClockCore{steady_clock} {} : SystemClockCore{steady_clock} {}
~StandardLocalSystemClockCore() override = default; ~StandardLocalSystemClockCore() override = default;
void Initialize(SystemClockContext& context, s64 time); void Initialize(const SystemClockContext& context, s64 time);
}; };
} // namespace Service::PSC::Time } // namespace Service::PSC::Time

View file

@ -5,7 +5,7 @@
namespace Service::PSC::Time { namespace Service::PSC::Time {
void StandardNetworkSystemClockCore::Initialize(SystemClockContext& context, s64 accuracy) { void StandardNetworkSystemClockCore::Initialize(const SystemClockContext& context, s64 accuracy) {
if (SetContextAndWrite(context) != ResultSuccess) { if (SetContextAndWrite(context) != ResultSuccess) {
LOG_ERROR(Service_Time, "Failed to SetContext"); LOG_ERROR(Service_Time, "Failed to SetContext");
} }

View file

@ -19,7 +19,7 @@ public:
: SystemClockCore{steady_clock} {} : SystemClockCore{steady_clock} {}
~StandardNetworkSystemClockCore() override = default; ~StandardNetworkSystemClockCore() override = default;
void Initialize(SystemClockContext& context, s64 accuracy); void Initialize(const SystemClockContext& context, s64 accuracy);
bool IsAccuracySufficient(); bool IsAccuracySufficient();
private: private:

View file

@ -46,7 +46,7 @@ Result StandardUserSystemClockCore::GetContext(SystemClockContext& out_context)
R_RETURN(m_local_system_clock.GetContext(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); R_RETURN(ResultNotImplemented);
} }

View file

@ -36,7 +36,7 @@ public:
Result SetAutomaticCorrection(bool automatic_correction); Result SetAutomaticCorrection(bool automatic_correction);
Result GetContext(SystemClockContext& out_context) const override; Result GetContext(SystemClockContext& out_context) const override;
Result SetContext(SystemClockContext& context) override; Result SetContext(const SystemClockContext& context) override;
Result GetTimePoint(SteadyClockTimePoint& out_time_point); Result GetTimePoint(SteadyClockTimePoint& out_time_point);
void SetTimePointAndSignal(SteadyClockTimePoint& time_point); void SetTimePointAndSignal(SteadyClockTimePoint& time_point);

View file

@ -51,12 +51,12 @@ Result SystemClockCore::GetContext(SystemClockContext& out_context) const {
R_SUCCEED(); R_SUCCEED();
} }
Result SystemClockCore::SetContext(SystemClockContext& context) { Result SystemClockCore::SetContext(const SystemClockContext& context) {
m_context = context; m_context = context;
R_SUCCEED(); R_SUCCEED();
} }
Result SystemClockCore::SetContextAndWrite(SystemClockContext& context) { Result SystemClockCore::SetContextAndWrite(const SystemClockContext& context) {
R_TRY(SetContext(context)); R_TRY(SetContext(context));
if (m_context_writer) { if (m_context_writer) {

View file

@ -41,8 +41,8 @@ public:
} }
virtual Result GetContext(SystemClockContext& out_context) const; virtual Result GetContext(SystemClockContext& out_context) const;
virtual Result SetContext(SystemClockContext& context); virtual Result SetContext(const SystemClockContext& context);
Result SetContextAndWrite(SystemClockContext& context); Result SetContextAndWrite(const SystemClockContext& context);
void LinkOperationEvent(OperationEvent& operation_event); void LinkOperationEvent(OperationEvent& operation_event);

View file

@ -78,8 +78,9 @@ Result ServiceManager::GetStaticServiceAsServiceManager(OutInterface<StaticServi
} }
Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected, Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
Common::UUID& clock_source_id, s64 rtc_offset, const Common::UUID& clock_source_id,
s64 internal_offset, s64 test_offset) { s64 rtc_offset, s64 internal_offset,
s64 test_offset) {
LOG_DEBUG(Service_Time, LOG_DEBUG(Service_Time,
"called. is_rtc_reset_detected={} clock_source_id={} rtc_offset={} " "called. is_rtc_reset_detected={} clock_source_id={} rtc_offset={} "
"internal_offset={} test_offset={}", "internal_offset={} test_offset={}",
@ -102,7 +103,8 @@ Result ServiceManager::SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
R_SUCCEED(); R_SUCCEED();
} }
Result ServiceManager::SetupStandardLocalSystemClockCore(SystemClockContext& context, s64 time) { Result ServiceManager::SetupStandardLocalSystemClockCore(const SystemClockContext& context,
s64 time) {
LOG_DEBUG(Service_Time, LOG_DEBUG(Service_Time,
"called. context={} context.steady_time_point.clock_source_id={} time={}", context, "called. context={} context.steady_time_point.clock_source_id={} time={}", context,
context.steady_time_point.clock_source_id.RawString(), time); context.steady_time_point.clock_source_id.RawString(), time);
@ -114,7 +116,7 @@ Result ServiceManager::SetupStandardLocalSystemClockCore(SystemClockContext& con
R_SUCCEED(); R_SUCCEED();
} }
Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& context, Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext context,
s64 accuracy) { s64 accuracy) {
LOG_DEBUG(Service_Time, "called. context={} steady_time_point.clock_source_id={} accuracy={}", LOG_DEBUG(Service_Time, "called. context={} steady_time_point.clock_source_id={} accuracy={}",
context, context.steady_time_point.clock_source_id.RawString(), accuracy); context, context.steady_time_point.clock_source_id.RawString(), accuracy);
@ -131,7 +133,7 @@ Result ServiceManager::SetupStandardNetworkSystemClockCore(SystemClockContext& c
} }
Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correction, Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correction,
SteadyClockTimePoint& time_point) { SteadyClockTimePoint time_point) {
LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}", LOG_DEBUG(Service_Time, "called. automatic_correction={} time_point={} clock_source_id={}",
automatic_correction, time_point, time_point.clock_source_id.RawString()); automatic_correction, time_point, time_point.clock_source_id.RawString());
@ -144,9 +146,9 @@ Result ServiceManager::SetupStandardUserSystemClockCore(bool automatic_correctio
R_SUCCEED(); R_SUCCEED();
} }
Result ServiceManager::SetupTimeZoneServiceCore(LocationName& name, RuleVersion& rule_version, Result ServiceManager::SetupTimeZoneServiceCore(const LocationName& name,
u32 location_count, const RuleVersion& rule_version, u32 location_count,
SteadyClockTimePoint& time_point, const SteadyClockTimePoint& time_point,
InBuffer<BufferAttr_HipcAutoSelect> rule_buffer) { InBuffer<BufferAttr_HipcAutoSelect> rule_buffer) {
LOG_DEBUG(Service_Time, LOG_DEBUG(Service_Time,
"called. name={} rule_version={} location_count={} time_point={} " "called. name={} rule_version={} location_count={} time_point={} "

View file

@ -34,14 +34,15 @@ public:
Result GetStaticServiceAsAdmin(OutInterface<StaticService> out_service); Result GetStaticServiceAsAdmin(OutInterface<StaticService> out_service);
Result GetStaticServiceAsRepair(OutInterface<StaticService> out_service); Result GetStaticServiceAsRepair(OutInterface<StaticService> out_service);
Result GetStaticServiceAsServiceManager(OutInterface<StaticService> out_service); Result GetStaticServiceAsServiceManager(OutInterface<StaticService> out_service);
Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected, Common::UUID& clock_source_id, Result SetupStandardSteadyClockCore(bool is_rtc_reset_detected,
s64 rtc_offset, s64 internal_offset, s64 test_offset); const Common::UUID& clock_source_id, s64 rtc_offset,
Result SetupStandardLocalSystemClockCore(SystemClockContext& context, s64 time); s64 internal_offset, s64 test_offset);
Result SetupStandardNetworkSystemClockCore(SystemClockContext& context, s64 accuracy); Result SetupStandardLocalSystemClockCore(const SystemClockContext& context, s64 time);
Result SetupStandardNetworkSystemClockCore(SystemClockContext context, s64 accuracy);
Result SetupStandardUserSystemClockCore(bool automatic_correction, Result SetupStandardUserSystemClockCore(bool automatic_correction,
SteadyClockTimePoint& time_point); SteadyClockTimePoint time_point);
Result SetupTimeZoneServiceCore(LocationName& name, RuleVersion& rule_version, Result SetupTimeZoneServiceCore(const LocationName& name, const RuleVersion& rule_version,
u32 location_count, SteadyClockTimePoint& time_point, u32 location_count, const SteadyClockTimePoint& time_point,
InBuffer<BufferAttr_HipcAutoSelect> rule_buffer); InBuffer<BufferAttr_HipcAutoSelect> rule_buffer);
Result SetupEphemeralNetworkSystemClockCore(); Result SetupEphemeralNetworkSystemClockCore();
Result GetStandardLocalClockOperationEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); Result GetStandardLocalClockOperationEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);

View file

@ -51,11 +51,11 @@ SharedMemory::SharedMemory(Core::System& system)
std::memset(m_shared_memory_ptr, 0, sizeof(*m_shared_memory_ptr)); 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); 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); 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}); {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); WriteToLockFreeAtomicType(&m_shared_memory_ptr->continuous_adjustment_time_points, time_point);
} }

View file

@ -54,10 +54,10 @@ public:
return m_k_shared_memory; return m_k_shared_memory;
} }
void SetLocalSystemContext(SystemClockContext& context); void SetLocalSystemContext(const SystemClockContext& context);
void SetNetworkSystemContext(SystemClockContext& context); void SetNetworkSystemContext(const SystemClockContext& context);
void SetSteadyClockTimePoint(ClockSourceId clock_source_id, s64 time_diff); 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 SetAutomaticCorrection(bool automatic_correction);
void UpdateBaseTime(s64 time); void UpdateBaseTime(s64 time);

View file

@ -198,8 +198,8 @@ Result StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
R_SUCCEED(); R_SUCCEED();
} }
Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time, Result StaticService::CalculateMonotonicSystemClockBaseTimePoint(
SystemClockContext& context) { Out<s64> out_time, const SystemClockContext& context) {
SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); });
R_UNLESS(m_time->m_standard_steady_clock.IsInitialized(), ResultClockUninitialized); 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)); R_RETURN(GetClockSnapshotImpl(out_snapshot, user_context, network_context, type));
} }
Result StaticService::GetClockSnapshotFromSystemClockContext(TimeType type, Result StaticService::GetClockSnapshotFromSystemClockContext(
OutClockSnapshot out_snapshot, TimeType type, OutClockSnapshot out_snapshot, const SystemClockContext& user_context,
SystemClockContext& user_context, const SystemClockContext& network_context) {
SystemClockContext& network_context) {
SCOPE_EXIT({ SCOPE_EXIT({
LOG_DEBUG(Service_Time, LOG_DEBUG(Service_Time,
"called. type={} user_context={} network_context={} out_snapshot={}", type, "called. type={} user_context={} network_context={} out_snapshot={}", type,
@ -294,8 +293,9 @@ Result StaticService::CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a,
} }
Result StaticService::GetClockSnapshotImpl(OutClockSnapshot out_snapshot, Result StaticService::GetClockSnapshotImpl(OutClockSnapshot out_snapshot,
SystemClockContext& user_context, const SystemClockContext& user_context,
SystemClockContext& network_context, TimeType type) { const SystemClockContext& network_context,
TimeType type) {
out_snapshot->user_context = user_context; out_snapshot->user_context = user_context;
out_snapshot->network_context = network_context; out_snapshot->network_context = network_context;

View file

@ -55,18 +55,19 @@ public:
Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(
Out<SteadyClockTimePoint> out_time_point); Out<SteadyClockTimePoint> out_time_point);
Result CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time, Result CalculateMonotonicSystemClockBaseTimePoint(Out<s64> out_time,
SystemClockContext& context); const SystemClockContext& context);
Result GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType type); Result GetClockSnapshot(OutClockSnapshot out_snapshot, TimeType type);
Result GetClockSnapshotFromSystemClockContext(TimeType type, OutClockSnapshot out_snapshot, Result GetClockSnapshotFromSystemClockContext(TimeType type, OutClockSnapshot out_snapshot,
SystemClockContext& user_context, const SystemClockContext& user_context,
SystemClockContext& network_context); const SystemClockContext& network_context);
Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference, Result CalculateStandardUserSystemClockDifferenceByUser(Out<s64> out_difference,
InClockSnapshot a, InClockSnapshot b); InClockSnapshot a, InClockSnapshot b);
Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b); Result CalculateSpanBetween(Out<s64> out_time, InClockSnapshot a, InClockSnapshot b);
private: private:
Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot, SystemClockContext& user_context, Result GetClockSnapshotImpl(OutClockSnapshot out_snapshot,
SystemClockContext& network_context, TimeType type); const SystemClockContext& user_context,
const SystemClockContext& network_context, TimeType type);
Core::System& m_system; Core::System& m_system;
StaticServiceSetupInfo m_setup_info; StaticServiceSetupInfo m_setup_info;

View file

@ -53,7 +53,7 @@ Result SystemClock::GetSystemClockContext(Out<SystemClockContext> out_context) {
R_RETURN(m_clock_core.GetContext(*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); LOG_DEBUG(Service_Time, "called. context={}", context);
R_UNLESS(m_can_write_clock, ResultPermissionDenied); R_UNLESS(m_can_write_clock, ResultPermissionDenied);

View file

@ -26,7 +26,7 @@ public:
Result GetCurrentTime(Out<s64> out_time); Result GetCurrentTime(Out<s64> out_time);
Result SetCurrentTime(s64 time); Result SetCurrentTime(s64 time);
Result GetSystemClockContext(Out<SystemClockContext> out_context); Result GetSystemClockContext(Out<SystemClockContext> out_context);
Result SetSystemClockContext(SystemClockContext& context); Result SetSystemClockContext(const SystemClockContext& context);
Result GetOperationEventReadableHandle(OutCopyHandle<Kernel::KReadableEvent> out_event); Result GetOperationEventReadableHandle(OutCopyHandle<Kernel::KReadableEvent> out_event);
private: private:

View file

@ -55,7 +55,7 @@ constexpr bool GetTimeZoneTime(s64& out_time, const Tz::Rule& rule, s64 time, s3
} }
} // namespace } // namespace
void TimeZone::SetTimePoint(SteadyClockTimePoint& time_point) { void TimeZone::SetTimePoint(const SteadyClockTimePoint& time_point) {
std::scoped_lock l{m_mutex}; std::scoped_lock l{m_mutex};
m_steady_clock_time_point = time_point; m_steady_clock_time_point = time_point;
} }
@ -65,7 +65,7 @@ void TimeZone::SetTotalLocationNameCount(u32 count) {
m_total_location_name_count = 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}; std::scoped_lock l{m_mutex};
m_rule_version = rule_version; 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)); R_RETURN(ToCalendarTimeImpl(calendar_time, calendar_additional, time, m_my_rule));
} }
Result TimeZone::ParseBinary(LocationName& name, std::span<const u8> binary) { Result TimeZone::ParseBinary(const LocationName& name, std::span<const u8> binary) {
std::scoped_lock l{m_mutex}; std::scoped_lock l{m_mutex};
Tz::Rule tmp_rule{}; Tz::Rule tmp_rule{};

View file

@ -23,9 +23,9 @@ public:
m_initialized = true; m_initialized = true;
} }
void SetTimePoint(SteadyClockTimePoint& time_point); void SetTimePoint(const SteadyClockTimePoint& time_point);
void SetTotalLocationNameCount(u32 count); void SetTotalLocationNameCount(u32 count);
void SetRuleVersion(RuleVersion& rule_version); void SetRuleVersion(const RuleVersion& rule_version);
Result GetLocationName(LocationName& out_name); Result GetLocationName(LocationName& out_name);
Result GetTotalLocationCount(u32& out_count); Result GetTotalLocationCount(u32& out_count);
Result GetRuleVersion(RuleVersion& out_rule_version); Result GetRuleVersion(RuleVersion& out_rule_version);
@ -36,7 +36,7 @@ public:
const Tz::Rule& rule); const Tz::Rule& rule);
Result ToCalendarTimeWithMyRule(CalendarTime& calendar_time, Result ToCalendarTimeWithMyRule(CalendarTime& calendar_time,
CalendarAdditionalInfo& calendar_additional, s64 time); CalendarAdditionalInfo& calendar_additional, s64 time);
Result ParseBinary(LocationName& name, std::span<const u8> binary); Result ParseBinary(const LocationName& name, std::span<const u8> binary);
Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary); Result ParseBinaryInto(Tz::Rule& out_rule, std::span<const u8> binary);
Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count, Result ToPosixTime(u32& out_count, std::span<s64> out_times, size_t out_times_max_count,
const CalendarTime& calendar, const Tz::Rule& rule); const CalendarTime& calendar, const Tz::Rule& rule);

View file

@ -42,7 +42,7 @@ Result TimeZoneService::GetDeviceLocationName(Out<LocationName> out_location_nam
R_RETURN(m_time_zone.GetLocationName(*out_location_name)); 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!"); LOG_DEBUG(Service_Time, "called. This function is not implemented!");
R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied);
@ -62,7 +62,7 @@ Result TimeZoneService::LoadLocationNameList(
R_RETURN(ResultNotImplemented); 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!"); LOG_DEBUG(Service_Time, "called. This function is not implemented!");
R_RETURN(ResultNotImplemented); R_RETURN(ResultNotImplemented);
@ -86,7 +86,7 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime(
} }
Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule(
LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) { const LocationName& location_name, InBuffer<BufferAttr_HipcAutoSelect> binary) {
LOG_DEBUG(Service_Time, "called. location_name={}", location_name); LOG_DEBUG(Service_Time, "called. location_name={}", location_name);
R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied); R_UNLESS(m_can_write_timezone_device_location, ResultPermissionDenied);

View file

@ -31,16 +31,16 @@ public:
~TimeZoneService() override = default; ~TimeZoneService() override = default;
Result GetDeviceLocationName(Out<LocationName> out_location_name); Result GetDeviceLocationName(Out<LocationName> out_location_name);
Result SetDeviceLocationName(LocationName& location_name); Result SetDeviceLocationName(const LocationName& location_name);
Result GetTotalLocationNameCount(Out<u32> out_count); Result GetTotalLocationNameCount(Out<u32> out_count);
Result LoadLocationNameList(Out<u32> out_count, Result LoadLocationNameList(Out<u32> out_count,
OutArray<LocationName, BufferAttr_HipcMapAlias> out_names, OutArray<LocationName, BufferAttr_HipcMapAlias> out_names,
u32 index); u32 index);
Result LoadTimeZoneRule(OutRule out_rule, LocationName& location_name); Result LoadTimeZoneRule(OutRule out_rule, const LocationName& location_name);
Result GetTimeZoneRuleVersion(Out<RuleVersion> out_rule_version); Result GetTimeZoneRuleVersion(Out<RuleVersion> out_rule_version);
Result GetDeviceLocationNameAndUpdatedTime(Out<LocationName> location_name, Result GetDeviceLocationNameAndUpdatedTime(Out<LocationName> location_name,
Out<SteadyClockTimePoint> out_time_point); Out<SteadyClockTimePoint> out_time_point);
Result SetDeviceLocationNameWithTimeZoneRule(LocationName& location_name, Result SetDeviceLocationNameWithTimeZoneRule(const LocationName& location_name,
InBuffer<BufferAttr_HipcAutoSelect> binary); InBuffer<BufferAttr_HipcAutoSelect> binary);
Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer<BufferAttr_HipcAutoSelect> binary);
Result GetDeviceLocationNameOperationEventReadableHandle( Result GetDeviceLocationNameOperationEventReadableHandle(

View file

@ -549,13 +549,13 @@ public:
} }
Result RegisterProcessHandle(ClientProcessId client_pid, Result RegisterProcessHandle(ClientProcessId client_pid,
InCopyHandle<Kernel::KProcess>& process) { InCopyHandle<Kernel::KProcess> process) {
// Register the process. // Register the process.
R_RETURN(m_ro->RegisterProcess(std::addressof(m_context_id), process.Get(), *client_pid)); 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, Result RegisterProcessModuleInfo(ClientProcessId client_pid, u64 nrr_address, u64 nrr_size,
InCopyHandle<Kernel::KProcess>& process) { InCopyHandle<Kernel::KProcess> process) {
// Validate the process. // Validate the process.
R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid)); R_TRY(m_ro->ValidateProcess(m_context_id, *client_pid));