ISelfController.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using Ryujinx.HLE.Logging;
  2. using Ryujinx.HLE.OsHle.Handles;
  3. using Ryujinx.HLE.OsHle.Ipc;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.HLE.OsHle.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. { 50, SetHandlesRequestToDisplay }
  27. };
  28. LaunchableEvent = new KEvent();
  29. }
  30. public long Exit(ServiceCtx Context)
  31. {
  32. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  33. return 0;
  34. }
  35. public long LockExit(ServiceCtx Context)
  36. {
  37. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  38. return 0;
  39. }
  40. public long UnlockExit(ServiceCtx Context)
  41. {
  42. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  43. return 0;
  44. }
  45. public long GetLibraryAppletLaunchableEvent(ServiceCtx Context)
  46. {
  47. LaunchableEvent.WaitEvent.Set();
  48. int Handle = Context.Process.HandleTable.OpenHandle(LaunchableEvent);
  49. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  50. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  51. return 0;
  52. }
  53. public long SetScreenShotPermission(ServiceCtx Context)
  54. {
  55. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  56. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  57. return 0;
  58. }
  59. public long SetOperationModeChangedNotification(ServiceCtx Context)
  60. {
  61. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  62. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  63. return 0;
  64. }
  65. public long SetPerformanceModeChangedNotification(ServiceCtx Context)
  66. {
  67. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  68. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  69. return 0;
  70. }
  71. public long SetFocusHandlingMode(ServiceCtx Context)
  72. {
  73. bool Flag1 = Context.RequestData.ReadByte() != 0 ? true : false;
  74. bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
  75. bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
  76. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  77. return 0;
  78. }
  79. public long SetRestartMessageEnabled(ServiceCtx Context)
  80. {
  81. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  82. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  83. return 0;
  84. }
  85. public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context)
  86. {
  87. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  88. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  89. return 0;
  90. }
  91. public long SetHandlesRequestToDisplay(ServiceCtx Context)
  92. {
  93. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  94. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  95. return 0;
  96. }
  97. }
  98. }