IRequest.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.Nifm
  6. {
  7. class IRequest : IpcService
  8. {
  9. private Dictionary<int, ServiceProcessRequest> m_Commands;
  10. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  11. private KEvent Event0;
  12. private KEvent Event1;
  13. public IRequest(Horizon System)
  14. {
  15. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  16. {
  17. { 0, GetRequestState },
  18. { 1, GetResult },
  19. { 2, GetSystemEventReadableHandles },
  20. { 3, Cancel },
  21. { 4, Submit },
  22. { 11, SetConnectionConfirmationOption }
  23. };
  24. Event0 = new KEvent(System);
  25. Event1 = new KEvent(System);
  26. }
  27. public long GetRequestState(ServiceCtx Context)
  28. {
  29. Context.ResponseData.Write(1);
  30. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  31. return 0;
  32. }
  33. public long GetResult(ServiceCtx Context)
  34. {
  35. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  36. return 0;
  37. }
  38. public long GetSystemEventReadableHandles(ServiceCtx Context)
  39. {
  40. int Handle0 = Context.Process.HandleTable.OpenHandle(Event0);
  41. int Handle1 = Context.Process.HandleTable.OpenHandle(Event1);
  42. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle0, Handle1);
  43. return 0;
  44. }
  45. public long Cancel(ServiceCtx Context)
  46. {
  47. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  48. return 0;
  49. }
  50. public long Submit(ServiceCtx Context)
  51. {
  52. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  53. return 0;
  54. }
  55. public long SetConnectionConfirmationOption(ServiceCtx Context)
  56. {
  57. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  58. return 0;
  59. }
  60. }
  61. }