IHomeMenuFunctions.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 IHomeMenuFunctions : IpcService
  9. {
  10. private Dictionary<int, ServiceProcessRequest> _commands;
  11. public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
  12. private KEvent _channelEvent;
  13. public IHomeMenuFunctions(Horizon system)
  14. {
  15. _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. Logger.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. Logger.PrintStub(LogClass.ServiceAm, "Stubbed.");
  36. return 0;
  37. }
  38. }
  39. }