ISelfController.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. { 1, LockExit },
  17. { 9, GetLibraryAppletLaunchableEvent },
  18. { 10, SetScreenShotPermission },
  19. { 11, SetOperationModeChangedNotification },
  20. { 12, SetPerformanceModeChangedNotification },
  21. { 13, SetFocusHandlingMode },
  22. { 14, SetRestartMessageEnabled },
  23. { 16, SetOutOfFocusSuspendingEnabled },
  24. { 50, SetHandlesRequestToDisplay }
  25. };
  26. LaunchableEvent = new KEvent();
  27. }
  28. public long LockExit(ServiceCtx Context)
  29. {
  30. return 0;
  31. }
  32. public long GetLibraryAppletLaunchableEvent(ServiceCtx Context)
  33. {
  34. LaunchableEvent.WaitEvent.Set();
  35. int Handle = Context.Process.HandleTable.OpenHandle(LaunchableEvent);
  36. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  37. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  38. return 0;
  39. }
  40. public long SetScreenShotPermission(ServiceCtx Context)
  41. {
  42. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  43. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  44. return 0;
  45. }
  46. public long SetOperationModeChangedNotification(ServiceCtx Context)
  47. {
  48. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  49. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  50. return 0;
  51. }
  52. public long SetPerformanceModeChangedNotification(ServiceCtx Context)
  53. {
  54. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  55. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  56. return 0;
  57. }
  58. public long SetFocusHandlingMode(ServiceCtx Context)
  59. {
  60. bool Flag1 = Context.RequestData.ReadByte() != 0 ? true : false;
  61. bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
  62. bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
  63. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  64. return 0;
  65. }
  66. public long SetRestartMessageEnabled(ServiceCtx Context)
  67. {
  68. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  69. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  70. return 0;
  71. }
  72. public long SetOutOfFocusSuspendingEnabled(ServiceCtx Context)
  73. {
  74. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  75. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  76. return 0;
  77. }
  78. public long SetHandlesRequestToDisplay(ServiceCtx Context)
  79. {
  80. bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
  81. Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  82. return 0;
  83. }
  84. }
  85. }