IRequest.cs 2.3 KB

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