Rename IStaticService and add glue's IStaticService
This commit is contained in:
parent
4fca3839ca
commit
9fba0659d6
6 changed files with 190 additions and 12 deletions
|
@ -1704,6 +1704,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings
|
||||||
{ "time!standard_steady_clock_test_offset_minutes", 0 },
|
{ "time!standard_steady_clock_test_offset_minutes", 0 },
|
||||||
{ "time!standard_steady_clock_rtc_update_interval_minutes", 5 },
|
{ "time!standard_steady_clock_rtc_update_interval_minutes", 5 },
|
||||||
{ "time!standard_network_clock_sufficient_accuracy_minutes", 43200 },
|
{ "time!standard_network_clock_sufficient_accuracy_minutes", 43200 },
|
||||||
|
{ "time!standard_user_clock_initial_year", 2019 },
|
||||||
{ "usb!usb30_force_enabled", false },
|
{ "usb!usb30_force_enabled", false },
|
||||||
{ "wlan_debug!skip_wlan_boot", false }
|
{ "wlan_debug!skip_wlan_boot", false }
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,8 +5,6 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
class StandardSteadyClockCore : SteadyClockCore
|
class StandardSteadyClockCore : SteadyClockCore
|
||||||
{
|
{
|
||||||
private TimeSpanType _setupValue;
|
private TimeSpanType _setupValue;
|
||||||
// TODO: move this to glue when we will have psc fully done
|
|
||||||
private ResultCode _setupResultCode;
|
|
||||||
private TimeSpanType _testOffset;
|
private TimeSpanType _testOffset;
|
||||||
private TimeSpanType _internalOffset;
|
private TimeSpanType _internalOffset;
|
||||||
private TimeSpanType _cachedRawTimePoint;
|
private TimeSpanType _cachedRawTimePoint;
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
||||||
|
|
||||||
public virtual void SetTestOffset(TimeSpanType testOffset) {}
|
public virtual void SetTestOffset(TimeSpanType testOffset) {}
|
||||||
|
|
||||||
public virtual ResultCode GetRtcValue(out ulong rtcValue)
|
public ResultCode GetRtcValue(out ulong rtcValue)
|
||||||
{
|
{
|
||||||
rtcValue = 0;
|
rtcValue = 0;
|
||||||
|
|
||||||
|
|
181
Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs
Normal file
181
Ryujinx.HLE/HOS/Services/Time/IStaticServiceForGlue.cs
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
using Ryujinx.Common;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Pcv.Bpc;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Settings;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
|
{
|
||||||
|
[Service("time:a", TimePermissions.Admin)]
|
||||||
|
[Service("time:r", TimePermissions.Repair)]
|
||||||
|
[Service("time:u", TimePermissions.User)]
|
||||||
|
class IStaticServiceForGlue : IpcService
|
||||||
|
{
|
||||||
|
private IStaticServiceForPsc _inner;
|
||||||
|
private TimePermissions _permissions;
|
||||||
|
|
||||||
|
public IStaticServiceForGlue(ServiceCtx context, TimePermissions permissions)
|
||||||
|
{
|
||||||
|
_permissions = permissions;
|
||||||
|
_inner = new IStaticServiceForPsc(context, permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(0)]
|
||||||
|
// GetStandardUserSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
|
public ResultCode GetStandardUserSystemClock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetStandardUserSystemClock(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(1)]
|
||||||
|
// GetStandardNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
|
public ResultCode GetStandardNetworkSystemClock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetStandardNetworkSystemClock(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(2)]
|
||||||
|
// GetStandardSteadyClock() -> object<nn::timesrv::detail::service::ISteadyClock>
|
||||||
|
public ResultCode GetStandardSteadyClock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetStandardSteadyClock(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(3)]
|
||||||
|
// GetTimeZoneService() -> object<nn::timesrv::detail::service::ITimeZoneService>
|
||||||
|
public ResultCode GetTimeZoneService(ServiceCtx context)
|
||||||
|
{
|
||||||
|
// TODO: ITimeZoneService is wrapped, apply 9.0.0 ITimeZoneService separation.
|
||||||
|
return _inner.GetTimeZoneService(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(4)]
|
||||||
|
// GetStandardLocalSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
|
public ResultCode GetStandardLocalSystemClock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetStandardLocalSystemClock(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(5)] // 4.0.0+
|
||||||
|
// GetEphemeralNetworkSystemClock() -> object<nn::timesrv::detail::service::ISystemClock>
|
||||||
|
public ResultCode GetEphemeralNetworkSystemClock(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetEphemeralNetworkSystemClock(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(20)] // 6.0.0+
|
||||||
|
// GetSharedMemoryNativeHandle() -> handle<copy>
|
||||||
|
public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetSharedMemoryNativeHandle(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(50)] // 4.0.0+
|
||||||
|
// SetStandardSteadyClockInternalOffset(nn::TimeSpanType internal_offset)
|
||||||
|
public ResultCode SetStandardSteadyClockInternalOffset(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if ((_permissions & TimePermissions.BypassUninitialized) == 0)
|
||||||
|
{
|
||||||
|
return ResultCode.PermissionDenied;
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeSpanType internalOffset = context.RequestData.ReadStruct<TimeSpanType>();
|
||||||
|
|
||||||
|
// TODO: set:sys SetExternalSteadyClockInternalOffset(internalOffset.ToSeconds())
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(51)] // 9.0.0+
|
||||||
|
// GetStandardSteadyClockRtcValue() -> u64
|
||||||
|
public ResultCode GetStandardSteadyClockRtcValue(ServiceCtx context)
|
||||||
|
{
|
||||||
|
ResultCode result = (ResultCode)IRtcManager.GetExternalRtcValue(out ulong rtcValue);
|
||||||
|
|
||||||
|
if (result == ResultCode.Success)
|
||||||
|
{
|
||||||
|
context.ResponseData.Write(rtcValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(100)]
|
||||||
|
// IsStandardUserSystemClockAutomaticCorrectionEnabled() -> bool
|
||||||
|
public ResultCode IsStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.IsStandardUserSystemClockAutomaticCorrectionEnabled(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(101)]
|
||||||
|
// SetStandardUserSystemClockAutomaticCorrectionEnabled(b8)
|
||||||
|
public ResultCode SetStandardUserSystemClockAutomaticCorrectionEnabled(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.SetStandardUserSystemClockAutomaticCorrectionEnabled(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(102)] // 5.0.0+
|
||||||
|
// GetStandardUserSystemClockInitialYear() -> u32
|
||||||
|
public ResultCode GetStandardUserSystemClockInitialYear(ServiceCtx context)
|
||||||
|
{
|
||||||
|
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!");
|
||||||
|
}
|
||||||
|
|
||||||
|
context.ResponseData.Write((int)standardUserSystemClockInitialYear);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(200)] // 3.0.0+
|
||||||
|
// IsStandardNetworkSystemClockAccuracySufficient() -> bool
|
||||||
|
public ResultCode IsStandardNetworkSystemClockAccuracySufficient(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.IsStandardNetworkSystemClockAccuracySufficient(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(201)] // 6.0.0+
|
||||||
|
// GetStandardUserSystemClockAutomaticCorrectionUpdatedTime() -> nn::time::SteadyClockTimePoint
|
||||||
|
public ResultCode GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetStandardUserSystemClockAutomaticCorrectionUpdatedTime(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(300)] // 4.0.0+
|
||||||
|
// CalculateMonotonicSystemClockBaseTimePoint(nn::time::SystemClockContext) -> s64
|
||||||
|
public ResultCode CalculateMonotonicSystemClockBaseTimePoint(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.CalculateMonotonicSystemClockBaseTimePoint(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(400)] // 4.0.0+
|
||||||
|
// GetClockSnapshot(u8) -> buffer<nn::time::sf::ClockSnapshot, 0x1a>
|
||||||
|
public ResultCode GetClockSnapshot(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetClockSnapshot(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(401)] // 4.0.0+
|
||||||
|
// GetClockSnapshotFromSystemClockContext(u8, nn::time::SystemClockContext, nn::time::SystemClockContext) -> buffer<nn::time::sf::ClockSnapshot, 0x1a>
|
||||||
|
public ResultCode GetClockSnapshotFromSystemClockContext(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.GetClockSnapshotFromSystemClockContext(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(500)] // 4.0.0+
|
||||||
|
// CalculateStandardUserSystemClockDifferenceByUser(buffer<nn::time::sf::ClockSnapshot, 0x19>, buffer<nn::time::sf::ClockSnapshot, 0x19>) -> nn::TimeSpanType
|
||||||
|
public ResultCode CalculateStandardUserSystemClockDifferenceByUser(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.CalculateStandardUserSystemClockDifferenceByUser(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Command(501)] // 4.0.0+
|
||||||
|
// CalculateSpanBetween(buffer<nn::time::sf::ClockSnapshot, 0x19>, buffer<nn::time::sf::ClockSnapshot, 0x19>) -> nn::TimeSpanType
|
||||||
|
public ResultCode CalculateSpanBetween(ServiceCtx context)
|
||||||
|
{
|
||||||
|
return _inner.CalculateSpanBetween(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,20 +12,18 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time
|
namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
{
|
{
|
||||||
//[Service("time:a", TimePermissions.Admin)]
|
|
||||||
[Service("time:s", TimePermissions.System)]
|
[Service("time:s", TimePermissions.System)]
|
||||||
//[Service("time:u", TimePermissions.User)]
|
|
||||||
[Service("time:su", TimePermissions.SystemUpdate)]
|
[Service("time:su", TimePermissions.SystemUpdate)]
|
||||||
class IStaticService : IpcService
|
class IStaticServiceForPsc : IpcService
|
||||||
{
|
{
|
||||||
private TimeManager _timeManager;
|
private TimeManager _timeManager;
|
||||||
private TimePermissions _permissions;
|
private TimePermissions _permissions;
|
||||||
|
|
||||||
private int _timeSharedMemoryNativeHandle = 0;
|
private int _timeSharedMemoryNativeHandle = 0;
|
||||||
|
|
||||||
public IStaticService(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) {}
|
public IStaticServiceForPsc(ServiceCtx context, TimePermissions permissions) : this(TimeManager.Instance, permissions) {}
|
||||||
|
|
||||||
public IStaticService(TimeManager manager, TimePermissions permissions)
|
public IStaticServiceForPsc(TimeManager manager, TimePermissions permissions)
|
||||||
{
|
{
|
||||||
_permissions = permissions;
|
_permissions = permissions;
|
||||||
_timeManager = manager;
|
_timeManager = manager;
|
|
@ -24,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetUserStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
// GetUserStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
||||||
public ResultCode GetUserStaticService(ServiceCtx context)
|
public ResultCode GetUserStaticService(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IStaticService(_timeManager, TimePermissions.User));
|
MakeObject(context, new IStaticServiceForPsc(_timeManager, TimePermissions.User));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetAdminStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
// GetAdminStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
||||||
public ResultCode GetAdminStaticService(ServiceCtx context)
|
public ResultCode GetAdminStaticService(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IStaticService(_timeManager, TimePermissions.Admin));
|
MakeObject(context, new IStaticServiceForPsc(_timeManager, TimePermissions.Admin));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetRepairStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
// GetRepairStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
||||||
public ResultCode GetRepairStaticService(ServiceCtx context)
|
public ResultCode GetRepairStaticService(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IStaticService(_timeManager, TimePermissions.Repair));
|
MakeObject(context, new IStaticServiceForPsc(_timeManager, TimePermissions.Repair));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
// GetManufactureStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
// GetManufactureStaticService() -> object<nn::timesrv::detail::service::IStaticService>
|
||||||
public ResultCode GetManufactureStaticService(ServiceCtx context)
|
public ResultCode GetManufactureStaticService(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IStaticService(_timeManager, TimePermissions.Manufacture));
|
MakeObject(context, new IStaticServiceForPsc(_timeManager, TimePermissions.Manufacture));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue