ISelfController.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.HOS.Kernel;
  3. using Ryujinx.HLE.Logging;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.HLE.HOS.Services.Am
  6. {
  7. class ISelfController : IpcService
  8. {
  9. private Dictionary<int, ServiceProcessRequest> m_Commands;
  10. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  11. private KEvent LaunchableEvent;
  12. public ISelfController()
  13. {
  14. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  15. {
  16. { 0, Exit },
  17. { 1, LockExit },
  18. { 2, UnlockExit },
  19. { 9, GetLibraryAppletLaunchableEvent },
  20. { 10, SetScreenShotPermission },
  21. { 11, SetOperationModeChangedNotification },
  22. { 12, SetPerformanceModeChangedNotification },
  23. { 13, SetFocusHandlingMode },
  24. { 14, SetRestartMessageEnabled },
  25. { 16, SetOutOfFocusSuspendingEnabled },
  26. { 19, SetScreenShotImageOrientation },
  27. { 50, SetHandlesRequestToDisplay }
  28. };
  29. LaunchableEvent = new KEvent();
  30. }
  31. public long Exit(ServiceCtx Context)
  32. {
  33. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  34. return 0;
  35. }
  36. public long LockExit(ServiceCtx Context)
  37. {
  38. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  39. return 0;
  40. }
  41. public long UnlockExit(ServiceCtx Context)
  42. {
  43. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  44. return 0;
  45. }
  46. public long GetLibraryAppletLaunchableEvent(ServiceCtx Context)
  47. {
  48. LaunchableEvent.WaitEvent.Set();
  49. int Handle = Context.Process.HandleTable.OpenHandle(LaunchableEvent);
  50. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  51. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  52. return 0;
  53. }
  54. public long SetScreenShotPermission(ServiceCtx Context)
  55. {
  56. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  57. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  58. return 0;
  59. }
  60. public long SetOperationModeChangedNotification(ServiceCtx Context)
  61. {
  62. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  63. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  64. return 0;
  65. }
  66. public long SetPerformanceModeChangedNotification(ServiceCtx Context)
  67. {
  68. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  69. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  70. return 0;
  71. }
  72. public long SetFocusHandlingMode(ServiceCtx Context)
  73. {
  74. bool Flag1 = Context.RequestData.ReadByte() != 0 ? true : false;
  75. bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
  76. bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
  77. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  78. return 0;
  79. }
  80. public long SetRestartMessageEnabled(ServiceCtx Context)
  81. {
  82. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  83. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  84. return 0;
  85. }
  86. public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context)
  87. {
  88. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  89. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  90. return 0;
  91. }
  92. public long SetScreenShotImageOrientation(ServiceCtx Context)
  93. {
  94. int Orientation = Context.RequestData.ReadInt32();
  95. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  96. return 0;
  97. }
  98. public long SetHandlesRequestToDisplay(ServiceCtx Context)
  99. {
  100. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  101. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  102. return 0;
  103. }
  104. }
  105. }