IRequest.cs 2.2 KB

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