ServiceTime.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using Ryujinx.Core.OsHle.Ipc;
  2. using System.Collections.Generic;
  3. using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
  4. namespace Ryujinx.Core.OsHle.IpcServices.Time
  5. {
  6. class ServiceTime : IIpcService
  7. {
  8. private Dictionary<int, ServiceProcessRequest> m_Commands;
  9. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  10. public ServiceTime()
  11. {
  12. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  13. {
  14. { 0, GetStandardUserSystemClock },
  15. { 1, GetStandardNetworkSystemClock },
  16. { 2, GetStandardSteadyClock },
  17. { 3, GetTimeZoneService },
  18. { 4, GetStandardLocalSystemClock }
  19. };
  20. }
  21. public long GetStandardUserSystemClock(ServiceCtx Context)
  22. {
  23. MakeObject(Context, new ISystemClock(SystemClockType.User));
  24. return 0;
  25. }
  26. public long GetStandardNetworkSystemClock(ServiceCtx Context)
  27. {
  28. MakeObject(Context, new ISystemClock(SystemClockType.Network));
  29. return 0;
  30. }
  31. public long GetStandardSteadyClock(ServiceCtx Context)
  32. {
  33. MakeObject(Context, new ISteadyClock());
  34. return 0;
  35. }
  36. public long GetTimeZoneService(ServiceCtx Context)
  37. {
  38. MakeObject(Context, new ITimeZoneService());
  39. return 0;
  40. }
  41. public long GetStandardLocalSystemClock(ServiceCtx Context)
  42. {
  43. MakeObject(Context, new ISystemClock(SystemClockType.Local));
  44. return 0;
  45. }
  46. }
  47. }