IHomeMenuFunctions.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
  7. {
  8. class IHomeMenuFunctions : IpcService
  9. {
  10. private KEvent _channelEvent;
  11. public IHomeMenuFunctions(Horizon system)
  12. {
  13. // TODO: Signal this Event somewhere in future.
  14. _channelEvent = new KEvent(system.KernelContext);
  15. }
  16. [Command(10)]
  17. // RequestToGetForeground()
  18. public ResultCode RequestToGetForeground(ServiceCtx context)
  19. {
  20. Logger.Stub?.PrintStub(LogClass.ServiceAm);
  21. return ResultCode.Success;
  22. }
  23. [Command(21)]
  24. // GetPopFromGeneralChannelEvent() -> handle<copy>
  25. public ResultCode GetPopFromGeneralChannelEvent(ServiceCtx context)
  26. {
  27. if (context.Process.HandleTable.GenerateHandle(_channelEvent.ReadableEvent, out int handle) != KernelResult.Success)
  28. {
  29. throw new InvalidOperationException("Out of handles!");
  30. }
  31. context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
  32. Logger.Stub?.PrintStub(LogClass.ServiceAm);
  33. return ResultCode.Success;
  34. }
  35. }
  36. }