1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-09-22 06:53:30 +01:00
Ryujinx/Ryujinx.HLE/HOS/Services/Time/ISteadyClock.cs
Ac_K 560ccbeb2d Refactoring commands handling (#728)
* Refactoring commands handling

- Use Reflection to handle commands ID.
- Add all symbols (from SwIPC so not all time accurate).
- Re-sort some services commands methods.
- Some cleanup.
- Keep some empty constructor for consistency.

* Fix order in IProfile
2019-07-11 22:13:43 -03:00

46 lines
1.1 KiB
C#

using System;
namespace Ryujinx.HLE.HOS.Services.Time
{
class ISteadyClock : IpcService
{
private ulong _testOffset;
public ISteadyClock()
{
_testOffset = 0;
}
[Command(0)]
// GetCurrentTimePoint() -> nn::time::SteadyClockTimePoint
public long GetCurrentTimePoint(ServiceCtx context)
{
context.ResponseData.Write((long)(System.Diagnostics.Process.GetCurrentProcess().StartTime - DateTime.Now).TotalSeconds);
for (int i = 0; i < 0x10; i++)
{
context.ResponseData.Write((byte)0);
}
return 0;
}
[Command(1)]
// GetTestOffset() -> nn::TimeSpanType
public long GetTestOffset(ServiceCtx context)
{
context.ResponseData.Write(_testOffset);
return 0;
}
[Command(2)]
// SetTestOffset(nn::TimeSpanType)
public long SetTestOffset(ServiceCtx context)
{
_testOffset = context.RequestData.ReadUInt64();
return 0;
}
}
}