2020-07-27 01:04:08 +02:00
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
|
using Ryujinx.HLE.HOS.Ipc;
|
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
|
|
|
using Ryujinx.HLE.HOS.Services.Nim.ShopServiceAccessServerInterface.ShopServiceAccessServer.ShopServiceAccessor;
|
2023-01-04 23:15:45 +01:00
|
|
|
|
using Ryujinx.Horizon.Common;
|
2020-07-27 01:04:08 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Nim.ShopServiceAccessServerInterface.ShopServiceAccessServer
|
|
|
|
|
{
|
|
|
|
|
class IShopServiceAccessor : IpcService
|
|
|
|
|
{
|
|
|
|
|
private readonly KEvent _event;
|
|
|
|
|
|
2020-12-02 00:23:43 +01:00
|
|
|
|
private int _eventHandle;
|
|
|
|
|
|
2020-07-27 01:04:08 +02:00
|
|
|
|
public IShopServiceAccessor(Horizon system)
|
|
|
|
|
{
|
|
|
|
|
_event = new KEvent(system.KernelContext);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-15 01:00:34 +02:00
|
|
|
|
[CommandCmif(0)]
|
2020-07-27 01:04:08 +02:00
|
|
|
|
// CreateAsyncInterface(u64) -> (handle<copy>, object<nn::ec::IShopServiceAsync>)
|
|
|
|
|
public ResultCode CreateAsyncInterface(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
MakeObject(context, new IShopServiceAsync());
|
|
|
|
|
|
2020-12-02 00:23:43 +01:00
|
|
|
|
if (_eventHandle == 0)
|
2020-07-27 01:04:08 +02:00
|
|
|
|
{
|
2023-01-04 23:15:45 +01:00
|
|
|
|
if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out _eventHandle) != Result.Success)
|
2020-12-02 00:23:43 +01:00
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Out of handles!");
|
|
|
|
|
}
|
2020-07-27 01:04:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 00:23:43 +01:00
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_eventHandle);
|
2020-07-27 01:04:08 +02:00
|
|
|
|
|
2020-08-04 01:32:53 +02:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceNim);
|
2020-07-27 01:04:08 +02:00
|
|
|
|
|
|
|
|
|
return ResultCode.Success;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|