IRequest.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Ryujinx.HLE.Logging;
  2. using Ryujinx.HLE.OsHle.Handles;
  3. using Ryujinx.HLE.OsHle.Ipc;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.HLE.OsHle.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 Event;
  13. public IRequest()
  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. Event = new KEvent();
  25. }
  26. public long GetRequestState(ServiceCtx Context)
  27. {
  28. Context.ResponseData.Write(0);
  29. Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  30. return 0;
  31. }
  32. public long GetResult(ServiceCtx Context)
  33. {
  34. Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  35. return 0;
  36. }
  37. //GetSystemEventReadableHandles() -> (KObject, KObject)
  38. public long GetSystemEventReadableHandles(ServiceCtx Context)
  39. {
  40. //FIXME: Is this supposed to return 2 events?
  41. int Handle = Context.Process.HandleTable.OpenHandle(Event);
  42. Context.Response.HandleDesc = IpcHandleDesc.MakeMove(Handle);
  43. return 0;
  44. }
  45. public long Cancel(ServiceCtx Context)
  46. {
  47. Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  48. return 0;
  49. }
  50. public long Submit(ServiceCtx Context)
  51. {
  52. Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  53. return 0;
  54. }
  55. public long SetConnectionConfirmationOption(ServiceCtx Context)
  56. {
  57. Context.Ns.Log.PrintStub(LogClass.ServiceNifm, "Stubbed.");
  58. return 0;
  59. }
  60. public void Dispose()
  61. {
  62. Dispose(true);
  63. }
  64. protected virtual void Dispose(bool Disposing)
  65. {
  66. if (Disposing)
  67. {
  68. Event.Dispose();
  69. }
  70. }
  71. }
  72. }