IRequest.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using Ryujinx.Common.Logging;
  2. using Ryujinx.HLE.HOS.Ipc;
  3. using Ryujinx.HLE.HOS.Kernel.Common;
  4. using Ryujinx.HLE.HOS.Kernel.Threading;
  5. using System;
  6. namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService
  7. {
  8. class IRequest : IpcService
  9. {
  10. private KEvent _event0;
  11. private KEvent _event1;
  12. private uint _version;
  13. public IRequest(Horizon system, uint version)
  14. {
  15. _event0 = new KEvent(system);
  16. _event1 = new KEvent(system);
  17. _version = version;
  18. }
  19. [Command(0)]
  20. // GetRequestState() -> u32
  21. public ResultCode GetRequestState(ServiceCtx context)
  22. {
  23. context.ResponseData.Write(1);
  24. Logger.PrintStub(LogClass.ServiceNifm);
  25. return ResultCode.Success;
  26. }
  27. [Command(1)]
  28. // GetResult()
  29. public ResultCode GetResult(ServiceCtx context)
  30. {
  31. Logger.PrintStub(LogClass.ServiceNifm);
  32. return ResultCode.Success;
  33. }
  34. [Command(2)]
  35. // GetSystemEventReadableHandles() -> (handle<copy>, handle<copy>)
  36. public ResultCode GetSystemEventReadableHandles(ServiceCtx context)
  37. {
  38. if (context.Process.HandleTable.GenerateHandle(_event0.ReadableEvent, out int handle0) != KernelResult.Success)
  39. {
  40. throw new InvalidOperationException("Out of handles!");
  41. }
  42. if (context.Process.HandleTable.GenerateHandle(_event1.ReadableEvent, out int handle1) != KernelResult.Success)
  43. {
  44. throw new InvalidOperationException("Out of handles!");
  45. }
  46. context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle0, handle1);
  47. return ResultCode.Success;
  48. }
  49. [Command(3)]
  50. // Cancel()
  51. public ResultCode Cancel(ServiceCtx context)
  52. {
  53. Logger.PrintStub(LogClass.ServiceNifm);
  54. return ResultCode.Success;
  55. }
  56. [Command(4)]
  57. // Submit()
  58. public ResultCode Submit(ServiceCtx context)
  59. {
  60. Logger.PrintStub(LogClass.ServiceNifm);
  61. return ResultCode.Success;
  62. }
  63. [Command(11)]
  64. // SetConnectionConfirmationOption(i8)
  65. public ResultCode SetConnectionConfirmationOption(ServiceCtx context)
  66. {
  67. Logger.PrintStub(LogClass.ServiceNifm);
  68. return ResultCode.Success;
  69. }
  70. }
  71. }