IHomeMenuFunctions.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Ryujinx.HLE.HOS.Ipc;
  2. using Ryujinx.HLE.HOS.Kernel;
  3. using Ryujinx.HLE.Logging;
  4. using System;
  5. using System.Collections.Generic;
  6. namespace Ryujinx.HLE.HOS.Services.Am
  7. {
  8. class IHomeMenuFunctions : IpcService
  9. {
  10. private Dictionary<int, ServiceProcessRequest> m_Commands;
  11. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  12. private KEvent ChannelEvent;
  13. public IHomeMenuFunctions(Horizon System)
  14. {
  15. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  16. {
  17. { 10, RequestToGetForeground },
  18. { 21, GetPopFromGeneralChannelEvent }
  19. };
  20. //ToDo: Signal this Event somewhere in future.
  21. ChannelEvent = new KEvent(System);
  22. }
  23. public long RequestToGetForeground(ServiceCtx Context)
  24. {
  25. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  26. return 0;
  27. }
  28. public long GetPopFromGeneralChannelEvent(ServiceCtx Context)
  29. {
  30. if (Context.Process.HandleTable.GenerateHandle(ChannelEvent.ReadableEvent, out int Handle) != KernelResult.Success)
  31. {
  32. throw new InvalidOperationException("Out of handles!");
  33. }
  34. Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
  35. Context.Device.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
  36. return 0;
  37. }
  38. }
  39. }