ILibraryAppletAccessor.cs 1.9 KB

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