ILibraryAppletAccessor.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using Ryujinx.Common.Logging;
  2. using Ryujinx.HLE.HOS.Ipc;
  3. using Ryujinx.HLE.HOS.Kernel;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.HLE.HOS.Services.Am
  7. {
  8. class ILibraryAppletAccessor : IpcService
  9. {
  10. private Dictionary<int, ServiceProcessRequest> m_Commands;
  11. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  12. private KEvent StateChangedEvent;
  13. public ILibraryAppletAccessor(Horizon System)
  14. {
  15. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  16. {
  17. { 0, GetAppletStateChangedEvent },
  18. { 10, Start },
  19. { 30, GetResult },
  20. { 100, PushInData },
  21. { 101, PopOutData }
  22. };
  23. StateChangedEvent = new KEvent(System);
  24. }
  25. public long GetAppletStateChangedEvent(ServiceCtx Context)
  26. {
  27. StateChangedEvent.ReadableEvent.Signal();
  28. if (Context.Process.HandleTable.GenerateHandle(StateChangedEvent.ReadableEvent, out int Handle) != KernelResult.Success)
  29. {
  30. throw new InvalidOperationException("Out of handles!");
  31. }
  32. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  33. Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
  34. return 0;
  35. }
  36. public long Start(ServiceCtx Context)
  37. {
  38. Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
  39. return 0;
  40. }
  41. public long GetResult(ServiceCtx Context)
  42. {
  43. Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
  44. return 0;
  45. }
  46. public long PushInData(ServiceCtx Context)
  47. {
  48. Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
  49. return 0;
  50. }
  51. public long PopOutData(ServiceCtx Context)
  52. {
  53. MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
  54. return 0;
  55. }
  56. }
  57. }