From 3ae1763efa61510c830eba0312e1d64c29c26ece Mon Sep 17 00:00:00 2001 From: Thog Date: Tue, 1 Oct 2019 21:19:05 +0200 Subject: [PATCH] Address comments --- .../Services/Time/Clock/LocalSystemClockContextWriter.cs | 1 + .../Services/Time/Clock/NetworkSystemClockContextWriter.cs | 1 + Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockCore.cs | 2 +- Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs | 4 +--- Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs | 7 ++++--- .../HOS/Services/Time/StaticService/ISteadyClock.cs | 2 +- .../Services/Time/StaticService/ITimeZoneServiceForGlue.cs | 6 +++--- Ryujinx.HLE/HOS/Services/Time/TimeManager.cs | 5 ----- .../HOS/Services/Time/TimeZone/TimeZoneContentManager.cs | 4 +++- 9 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/LocalSystemClockContextWriter.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/LocalSystemClockContextWriter.cs index d91084f852..fb7ebdc5b6 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/LocalSystemClockContextWriter.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/LocalSystemClockContextWriter.cs @@ -12,6 +12,7 @@ protected override ResultCode Update() { _sharedMemory.UpdateLocalSystemClockContext(_context); + return ResultCode.Success; } } diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/NetworkSystemClockContextWriter.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/NetworkSystemClockContextWriter.cs index c47203538c..36468ec141 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/NetworkSystemClockContextWriter.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/NetworkSystemClockContextWriter.cs @@ -12,6 +12,7 @@ protected override ResultCode Update() { _sharedMemory.UpdateNetworkSystemClockContext(_context); + return ResultCode.Success; } } diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockCore.cs index 75c71663d6..865b1c0982 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockCore.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/SystemClockCore.cs @@ -54,7 +54,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock SystemClockContext clockContext = new SystemClockContext() { - Offset = posixTime - currentTimePoint.TimePoint, + Offset = posixTime - currentTimePoint.TimePoint, SteadyTimePoint = currentTimePoint }; diff --git a/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs b/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs index feb8bc56d5..fe4950ba02 100644 --- a/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs +++ b/Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs @@ -121,9 +121,7 @@ namespace Ryujinx.HLE.HOS.Services.Time { if (!NxSettings.Settings.TryGetValue("time!standard_user_clock_initial_year", out object standardUserSystemClockInitialYear)) { - // Fallback if not found in settings (nintendo actually abort here) - standardUserSystemClockInitialYear = 2019; - //throw new System.InvalidOperationException("standard_user_clock_initial_year isn't defined in system settings!"); + throw new System.InvalidOperationException("standard_user_clock_initial_year isn't defined in system settings!"); } context.ResponseData.Write((int)standardUserSystemClockInitialYear); diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs index b3352f20dd..a897b3f78f 100644 --- a/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs @@ -102,6 +102,7 @@ namespace Ryujinx.HLE.HOS.Services.Time public ResultCode SetupStandardUserSystemClock(ServiceCtx context) { bool isAutomaticCorrectionEnabled = context.RequestData.ReadBoolean(); + context.RequestData.BaseStream.Position += 7; SteadyClockTimePoint steadyClockTimePoint = context.RequestData.ReadStruct(); @@ -196,7 +197,7 @@ namespace Ryujinx.HLE.HOS.Services.Time public ResultCode GetAlarmRegistrationEvent(ServiceCtx context) { // TODO - return ResultCode.NotImplemented; + throw new ServiceNotImplementedException(context); } [Command(201)] @@ -204,7 +205,7 @@ namespace Ryujinx.HLE.HOS.Services.Time public ResultCode UpdateSteadyAlarms(ServiceCtx context) { // TODO - return ResultCode.NotImplemented; + throw new ServiceNotImplementedException(context); } [Command(202)] @@ -212,7 +213,7 @@ namespace Ryujinx.HLE.HOS.Services.Time public ResultCode TryGetNextSteadyClockAlarmSnapshot(ServiceCtx context) { // TODO - return ResultCode.NotImplemented; + throw new ServiceNotImplementedException(context); } } } diff --git a/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs index c830bb4b80..bf6a4fd10d 100644 --- a/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs +++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ISteadyClock.cs @@ -7,7 +7,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService { private SteadyClockCore _steadyClock; private bool _writePermission; - private bool _bypassUninitializedClock; + private bool _bypassUninitializedClock; public ISteadyClock(SteadyClockCore steadyClock, bool writePermission, bool bypassUninitializedClock) { diff --git a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs index f718c58dcd..7acb025726 100644 --- a/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs +++ b/Ryujinx.HLE/HOS/Services/Time/StaticService/ITimeZoneServiceForGlue.cs @@ -9,9 +9,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.StaticService { class ITimeZoneServiceForGlue : IpcService { - private TimeZoneContentManager _timeZoneContentManager; - private ITimeZoneServiceForPsc _inner; - private bool _writePermission; + private TimeZoneContentManager _timeZoneContentManager; + private ITimeZoneServiceForPsc _inner; + private bool _writePermission; public ITimeZoneServiceForGlue(TimeZoneContentManager timeZoneContentManager, bool writePermission) { diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs index 17a9f4c55d..dcc981695b 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs @@ -117,7 +117,6 @@ namespace Ryujinx.HLE.HOS.Services.Time StandardLocalSystemClock.MarkInitialized(); // TODO: propagate IPC late binding of "time:s" and "time:p" - } public void SetupStandardNetworkSystemClock(SystemClockContext clockContext, TimeSpanType sufficientAccuracy) @@ -133,7 +132,6 @@ namespace Ryujinx.HLE.HOS.Services.Time StandardNetworkSystemClock.MarkInitialized(); // TODO: propagate IPC late binding of "time:s" and "time:p" - } public void SetupTimeZoneManager(string locationName, SteadyClockTimePoint timeZoneUpdatedTimePoint, uint totalLocationNameCount, UInt128 timeZoneRuleVersion, Stream timeZoneBinaryStream) @@ -149,7 +147,6 @@ namespace Ryujinx.HLE.HOS.Services.Time TimeZone.Manager.MarkInitialized(); // TODO: propagate IPC late binding of "time:s" and "time:p" - } public void SetupEphemeralNetworkSystemClock() @@ -158,7 +155,6 @@ namespace Ryujinx.HLE.HOS.Services.Time EphemeralNetworkSystemClock.MarkInitialized(); // TODO: propagate IPC late binding of "time:s" and "time:p" - } public void SetupStandardUserSystemClock(KThread thread, bool isAutomaticCorrectionEnabled, SteadyClockTimePoint steadyClockTimePoint) @@ -174,7 +170,6 @@ namespace Ryujinx.HLE.HOS.Services.Time SharedMemory.SetAutomaticCorrectionEnabled(isAutomaticCorrectionEnabled); // TODO: propagate IPC late binding of "time:s" and "time:p" - } public void SetStandardSteadyClockRtcOffset(KThread thread, TimeSpanType rtcOffset) diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs index f0cf977d01..878bf07fd0 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneContentManager.cs @@ -87,6 +87,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone return true; } } + return false; } @@ -152,8 +153,9 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone using (IStorage ncaFileStream = new LocalStorage(_device.FileSystem.SwitchPathToSystemPath(GetTimeZoneBinaryTitleContentPath()), FileAccess.Read, FileMode.Open)) { - Nca nca = new Nca(_device.System.KeySet, ncaFileStream); + Nca nca = new Nca(_device.System.KeySet, ncaFileStream); IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel); + timeZoneBinaryStream = romfs.OpenFile($"zoneinfo/{locationName}", OpenMode.Read).AsStream(); }