IShopServiceAccessor.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 Ryujinx.HLE.HOS.Services.Nim.ShopServiceAccessServerInterface.ShopServiceAccessServer.ShopServiceAccessor;
  6. using System;
  7. namespace Ryujinx.HLE.HOS.Services.Nim.ShopServiceAccessServerInterface.ShopServiceAccessServer
  8. {
  9. class IShopServiceAccessor : IpcService
  10. {
  11. private readonly KEvent _event;
  12. public IShopServiceAccessor(Horizon system)
  13. {
  14. _event = new KEvent(system.KernelContext);
  15. }
  16. [Command(0)]
  17. // CreateAsyncInterface(u64) -> (handle<copy>, object<nn::ec::IShopServiceAsync>)
  18. public ResultCode CreateAsyncInterface(ServiceCtx context)
  19. {
  20. MakeObject(context, new IShopServiceAsync());
  21. if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success)
  22. {
  23. throw new InvalidOperationException("Out of handles!");
  24. }
  25. context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
  26. Logger.Stub?.PrintStub(LogClass.ServiceNim);
  27. return ResultCode.Success;
  28. }
  29. }
  30. }