IRequest.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Ryujinx.Core.OsHle.Handles;
  2. using Ryujinx.Core.OsHle.Ipc;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace Ryujinx.Core.OsHle.Services.Nifm
  6. {
  7. class IRequest : IpcService, IDisposable
  8. {
  9. private Dictionary<int, ServiceProcessRequest> m_Commands;
  10. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  11. private KEvent Event;
  12. public IRequest()
  13. {
  14. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  15. {
  16. { 0, GetRequestState },
  17. { 1, GetResult },
  18. { 2, GetSystemEventReadableHandles }
  19. };
  20. Event = new KEvent();
  21. }
  22. public long GetRequestState(ServiceCtx Context)
  23. {
  24. Context.ResponseData.Write(0);
  25. //Todo: Stub
  26. return 0;
  27. }
  28. public long GetResult(ServiceCtx Context)
  29. {
  30. //Todo: Stub
  31. return 0;
  32. }
  33. //GetSystemEventReadableHandles() -> (KObject, KObject)
  34. public long GetSystemEventReadableHandles(ServiceCtx Context)
  35. {
  36. //FIXME: Is this supposed to return 2 events?
  37. int Handle = Context.Process.HandleTable.OpenHandle(Event);
  38. Context.Response.HandleDesc = IpcHandleDesc.MakeMove(Handle);
  39. return 0;
  40. }
  41. public void Dispose()
  42. {
  43. Dispose(true);
  44. }
  45. protected virtual void Dispose(bool Disposing)
  46. {
  47. if (Disposing)
  48. {
  49. Event.Dispose();
  50. }
  51. }
  52. }
  53. }