IRequest.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.HOS.Kernel;
  3. using Ryujinx.HLE.Logging;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.HLE.HOS.Services.Nifm
  7. {
  8. class IRequest : IpcService, IDisposable
  9. {
  10. private Dictionary<int, ServiceProcessRequest> m_Commands;
  11. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  12. private KEvent Event0;
  13. private KEvent Event1;
  14. public IRequest()
  15. {
  16. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  17. {
  18. { 0, GetRequestState },
  19. { 1, GetResult },
  20. { 2, GetSystemEventReadableHandles },
  21. { 3, Cancel },
  22. { 4, Submit },
  23. { 11, SetConnectionConfirmationOption }
  24. };
  25. Event0 = new KEvent();
  26. Event1 = new KEvent();
  27. }
  28. public long GetRequestState(ServiceCtx Context)
  29. {
  30. Context.ResponseData.Write(1);
  31. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  32. return 0;
  33. }
  34. public long GetResult(ServiceCtx Context)
  35. {
  36. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  37. return 0;
  38. }
  39. public long GetSystemEventReadableHandles(ServiceCtx Context)
  40. {
  41. int Handle0 = Context.Process.HandleTable.OpenHandle(Event0);
  42. int Handle1 = Context.Process.HandleTable.OpenHandle(Event1);
  43. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle0, Handle1);
  44. return 0;
  45. }
  46. public long Cancel(ServiceCtx Context)
  47. {
  48. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  49. return 0;
  50. }
  51. public long Submit(ServiceCtx Context)
  52. {
  53. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  54. return 0;
  55. }
  56. public long SetConnectionConfirmationOption(ServiceCtx Context)
  57. {
  58. Context.Device.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  59. return 0;
  60. }
  61. public void Dispose()
  62. {
  63. Dispose(true);
  64. }
  65. protected virtual void Dispose(bool Disposing)
  66. {
  67. if (Disposing)
  68. {
  69. Event0.Dispose();
  70. Event1.Dispose();
  71. }
  72. }
  73. }
  74. }