Address comments
This commit is contained in:
parent
d936731a5e
commit
8df181e031
4 changed files with 132 additions and 128 deletions
|
@ -33,7 +33,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetStandardUserSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
// GetStandardUserSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
public ResultCode GetStandardUserSystemClock(ServiceCtx context)
|
public ResultCode GetStandardUserSystemClock(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ISystemClock(_timeManager.StandardUserSystemClock, (_permissions & TimePermissions.UserSystemClockWritableMask) != 0, (_permissions & TimePermissions.BypassUninitialized) != 0));
|
MakeObject(context, new ISystemClock(_timeManager.StandardUserSystemClock,
|
||||||
|
(_permissions & TimePermissions.UserSystemClockWritableMask) != 0,
|
||||||
|
(_permissions & TimePermissions.BypassUninitialized) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +44,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetStandardNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
// GetStandardNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
public ResultCode GetStandardNetworkSystemClock(ServiceCtx context)
|
public ResultCode GetStandardNetworkSystemClock(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ISystemClock(_timeManager.StandardNetworkSystemClock, (_permissions & TimePermissions.NetworkSystemClockWritableMask) != 0, (_permissions & TimePermissions.BypassUninitialized) != 0));
|
MakeObject(context, new ISystemClock(_timeManager.StandardNetworkSystemClock,
|
||||||
|
(_permissions & TimePermissions.NetworkSystemClockWritableMask) != 0,
|
||||||
|
(_permissions & TimePermissions.BypassUninitialized) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +55,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetStandardSteadyClock() -> object<nn::timesrv::detail::service::ISteadyClock>
|
// GetStandardSteadyClock() -> object<nn::timesrv::detail::service::ISteadyClock>
|
||||||
public ResultCode GetStandardSteadyClock(ServiceCtx context)
|
public ResultCode GetStandardSteadyClock(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ISteadyClock(_timeManager.StandardSteadyClock, (_permissions & TimePermissions.SteadyClockWritableMask) != 0, (_permissions & TimePermissions.BypassUninitialized) != 0));
|
MakeObject(context, new ISteadyClock(_timeManager.StandardSteadyClock,
|
||||||
|
(_permissions & TimePermissions.SteadyClockWritableMask) != 0,
|
||||||
|
(_permissions & TimePermissions.BypassUninitialized) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +66,8 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetTimeZoneService() -> object<nn::timesrv::detail::service::ITimeZoneService>
|
// GetTimeZoneService() -> object<nn::timesrv::detail::service::ITimeZoneService>
|
||||||
public ResultCode GetTimeZoneService(ServiceCtx context)
|
public ResultCode GetTimeZoneService(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ITimeZoneServiceForPsc(_timeManager.TimeZone.Manager, (_permissions & TimePermissions.TimeZoneWritableMask) != 0));
|
MakeObject(context, new ITimeZoneServiceForPsc(_timeManager.TimeZone.Manager,
|
||||||
|
(_permissions & TimePermissions.TimeZoneWritableMask) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +76,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetStandardLocalSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
// GetStandardLocalSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
public ResultCode GetStandardLocalSystemClock(ServiceCtx context)
|
public ResultCode GetStandardLocalSystemClock(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ISystemClock(_timeManager.StandardLocalSystemClock, (_permissions & TimePermissions.LocalSystemClockWritableMask) != 0, (_permissions & TimePermissions.BypassUninitialized) != 0));
|
MakeObject(context, new ISystemClock(_timeManager.StandardLocalSystemClock,
|
||||||
|
(_permissions & TimePermissions.LocalSystemClockWritableMask) != 0,
|
||||||
|
(_permissions & TimePermissions.BypassUninitialized) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +87,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetEphemeralNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
// GetEphemeralNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
public ResultCode GetEphemeralNetworkSystemClock(ServiceCtx context)
|
public ResultCode GetEphemeralNetworkSystemClock(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new ISystemClock(_timeManager.StandardNetworkSystemClock, (_permissions & TimePermissions.NetworkSystemClockWritableMask) != 0, (_permissions & TimePermissions.BypassUninitialized) != 0));
|
MakeObject(context, new ISystemClock(_timeManager.StandardNetworkSystemClock,
|
||||||
|
(_permissions & TimePermissions.NetworkSystemClockWritableMask) != 0,
|
||||||
|
(_permissions & TimePermissions.BypassUninitialized) != 0));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,17 +26,17 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public StandardSteadyClockCore StandardSteadyClock { get; private set; }
|
public StandardSteadyClockCore StandardSteadyClock { get; }
|
||||||
public TickBasedSteadyClockCore TickBasedSteadyClock { get; private set; }
|
public TickBasedSteadyClockCore TickBasedSteadyClock { get; }
|
||||||
public StandardLocalSystemClockCore StandardLocalSystemClock { get; private set; }
|
public StandardLocalSystemClockCore StandardLocalSystemClock { get; }
|
||||||
public StandardNetworkSystemClockCore StandardNetworkSystemClock { get; private set; }
|
public StandardNetworkSystemClockCore StandardNetworkSystemClock { get; }
|
||||||
public StandardUserSystemClockCore StandardUserSystemClock { get; private set; }
|
public StandardUserSystemClockCore StandardUserSystemClock { get; }
|
||||||
public TimeZoneContentManager TimeZone { get; private set; }
|
public TimeZoneContentManager TimeZone { get; }
|
||||||
public EphemeralNetworkSystemClockCore EphemeralNetworkSystemClock { get; private set; }
|
public EphemeralNetworkSystemClockCore EphemeralNetworkSystemClock { get; }
|
||||||
public TimeSharedMemory SharedMemory { get; private set; }
|
public TimeSharedMemory SharedMemory { get; }
|
||||||
public LocalSystemClockContextWriter LocalClockContextWriter { get; private set; }
|
public LocalSystemClockContextWriter LocalClockContextWriter { get; }
|
||||||
public NetworkSystemClockContextWriter NetworkClockContextWriter { get; private set; }
|
public NetworkSystemClockContextWriter NetworkClockContextWriter { get; }
|
||||||
public EphemeralNetworkSystemClockContextWriter EphemeralClockContextWriter { get; private set; }
|
public EphemeralNetworkSystemClockContextWriter EphemeralClockContextWriter { get; }
|
||||||
|
|
||||||
// TODO: 9.0.0+ power states and alarms
|
// TODO: 9.0.0+ power states and alarms
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
long objectOffset = indexOffset + 4 + padding + (index & 1) * Marshal.SizeOf<T>();
|
long objectOffset = indexOffset + 4 + padding + (index & 1) * Marshal.SizeOf<T>();
|
||||||
|
|
||||||
result = _device.Memory.ReadStruct<T>(objectOffset);
|
result = _device.Memory.ReadStruct<T>(objectOffset);
|
||||||
|
|
||||||
Thread.MemoryBarrier();
|
Thread.MemoryBarrier();
|
||||||
|
|
||||||
possiblyNewIndex = _device.Memory.ReadUInt32(indexOffset);
|
possiblyNewIndex = _device.Memory.ReadUInt32(indexOffset);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
|
||||||
using static Ryujinx.HLE.HOS.Services.Time.TimeZone.TimeZoneRule;
|
using static Ryujinx.HLE.HOS.Services.Time.TimeZone.TimeZoneRule;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
|
@ -37,22 +36,22 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
|
|
||||||
public bool IsInitialized()
|
public bool IsInitialized()
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
bool res;
|
||||||
|
|
||||||
bool res = _isInitialized;
|
lock (_lock)
|
||||||
|
{
|
||||||
Monitor.Exit(_lock);
|
res = _isInitialized;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkInitialized()
|
public void MarkInitialized()
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode GetDeviceLocationName(out string deviceLocationName)
|
public ResultCode GetDeviceLocationName(out string deviceLocationName)
|
||||||
|
@ -61,15 +60,14 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
|
|
||||||
deviceLocationName = null;
|
deviceLocationName = null;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
deviceLocationName = _deviceLocationName;
|
deviceLocationName = _deviceLocationName;
|
||||||
result = ResultCode.Success;
|
result = ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -78,8 +76,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result = ResultCode.TimeZoneConversionFailed;
|
ResultCode result = ResultCode.TimeZoneConversionFailed;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
bool timeZoneConversionSuccess = TimeZone.ParseTimeZoneBinary(out TimeZoneRule rules, timeZoneBinaryStream);
|
bool timeZoneConversionSuccess = TimeZone.ParseTimeZoneBinary(out TimeZoneRule rules, timeZoneBinaryStream);
|
||||||
|
|
||||||
if (timeZoneConversionSuccess)
|
if (timeZoneConversionSuccess)
|
||||||
|
@ -88,19 +86,17 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
_myRules = rules;
|
_myRules = rules;
|
||||||
result = ResultCode.Success;
|
result = ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTotalLocationNameCount(uint totalLocationNameCount)
|
public void SetTotalLocationNameCount(uint totalLocationNameCount)
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
_totalLocationNameCount = totalLocationNameCount;
|
_totalLocationNameCount = totalLocationNameCount;
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode GetTotalLocationNameCount(out uint totalLocationNameCount)
|
public ResultCode GetTotalLocationNameCount(out uint totalLocationNameCount)
|
||||||
|
@ -109,15 +105,14 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
|
|
||||||
totalLocationNameCount = 0;
|
totalLocationNameCount = 0;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
totalLocationNameCount = _totalLocationNameCount;
|
totalLocationNameCount = _totalLocationNameCount;
|
||||||
result = ResultCode.Success;
|
result = ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -126,15 +121,14 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result = ResultCode.UninitializedClock;
|
ResultCode result = ResultCode.UninitializedClock;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized || bypassUninitialized)
|
if (_isInitialized || bypassUninitialized)
|
||||||
{
|
{
|
||||||
_timeZoneUpdateTimePoint = timeZoneUpdatedTimePoint;
|
_timeZoneUpdateTimePoint = timeZoneUpdatedTimePoint;
|
||||||
result = ResultCode.Success;
|
result = ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -143,8 +137,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result;
|
ResultCode result;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
timeZoneUpdatedTimePoint = _timeZoneUpdateTimePoint;
|
timeZoneUpdatedTimePoint = _timeZoneUpdateTimePoint;
|
||||||
|
@ -155,8 +149,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
timeZoneUpdatedTimePoint = SteadyClockTimePoint.GetRandom();
|
timeZoneUpdatedTimePoint = SteadyClockTimePoint.GetRandom();
|
||||||
result = ResultCode.UninitializedClock;
|
result = ResultCode.UninitializedClock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -165,33 +158,33 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result = ResultCode.Success;
|
ResultCode result = ResultCode.Success;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
bool timeZoneConversionSuccess = TimeZone.ParseTimeZoneBinary(out outRules, timeZoneBinaryStream);
|
bool timeZoneConversionSuccess = TimeZone.ParseTimeZoneBinary(out outRules, timeZoneBinaryStream);
|
||||||
|
|
||||||
if (!timeZoneConversionSuccess)
|
if (!timeZoneConversionSuccess)
|
||||||
{
|
{
|
||||||
result = ResultCode.TimeZoneConversionFailed;
|
result = ResultCode.TimeZoneConversionFailed;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTimeZoneRuleVersion(UInt128 timeZoneRuleVersion)
|
public void SetTimeZoneRuleVersion(UInt128 timeZoneRuleVersion)
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
_timeZoneRuleVersion = timeZoneRuleVersion;
|
_timeZoneRuleVersion = timeZoneRuleVersion;
|
||||||
Monitor.Exit(_lock);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode GetTimeZoneRuleVersion(out UInt128 timeZoneRuleVersion)
|
public ResultCode GetTimeZoneRuleVersion(out UInt128 timeZoneRuleVersion)
|
||||||
{
|
{
|
||||||
ResultCode result;
|
ResultCode result;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
timeZoneRuleVersion = _timeZoneRuleVersion;
|
timeZoneRuleVersion = _timeZoneRuleVersion;
|
||||||
|
@ -202,8 +195,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
timeZoneRuleVersion = new UInt128();
|
timeZoneRuleVersion = new UInt128();
|
||||||
result = ResultCode.UninitializedClock;
|
result = ResultCode.UninitializedClock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -212,8 +204,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result;
|
ResultCode result;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
result = ToCalendarTime(_myRules, time, out calendar);
|
result = ToCalendarTime(_myRules, time, out calendar);
|
||||||
|
@ -223,19 +215,19 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
calendar = new CalendarInfo();
|
calendar = new CalendarInfo();
|
||||||
result = ResultCode.UninitializedClock;
|
result = ResultCode.UninitializedClock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar)
|
public ResultCode ToCalendarTime(TimeZoneRule rules, long time, out CalendarInfo calendar)
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
ResultCode result;
|
||||||
|
|
||||||
ResultCode result = TimeZone.ToCalendarTime(rules, time, out calendar);
|
lock (_lock)
|
||||||
|
{
|
||||||
Monitor.Exit(_lock);
|
result = TimeZone.ToCalendarTime(rules, time, out calendar);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -244,8 +236,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
{
|
{
|
||||||
ResultCode result;
|
ResultCode result;
|
||||||
|
|
||||||
Monitor.Enter(_lock);
|
lock (_lock)
|
||||||
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
{
|
{
|
||||||
result = ToPosixTime(_myRules, calendarTime, out posixTime);
|
result = ToPosixTime(_myRules, calendarTime, out posixTime);
|
||||||
|
@ -255,19 +247,19 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
|
||||||
posixTime = 0;
|
posixTime = 0;
|
||||||
result = ResultCode.UninitializedClock;
|
result = ResultCode.UninitializedClock;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Monitor.Exit(_lock);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime)
|
public ResultCode ToPosixTime(TimeZoneRule rules, CalendarTime calendarTime, out long posixTime)
|
||||||
{
|
{
|
||||||
Monitor.Enter(_lock);
|
ResultCode result;
|
||||||
|
|
||||||
ResultCode result = TimeZone.ToPosixTime(rules, calendarTime, out posixTime);
|
lock (_lock)
|
||||||
|
{
|
||||||
Monitor.Exit(_lock);
|
result = TimeZone.ToPosixTime(rules, calendarTime, out posixTime);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue