1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-13 16:56:40 +00:00
Ryujinx/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs
Ac_K 560ccbeb2d Refactoring commands handling (#728)
* Refactoring commands handling

- Use Reflection to handle commands ID.
- Add all symbols (from SwIPC so not all time accurate).
- Re-sort some services commands methods.
- Some cleanup.
- Keep some empty constructor for consistency.

* Fix order in IProfile
2019-07-11 22:13:43 -03:00

72 lines
No EOL
1.8 KiB
C#

using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
private KEvent _stateChangedEvent;
public ILibraryAppletAccessor(Horizon system)
{
_stateChangedEvent = new KEvent(system);
}
[Command(0)]
// GetAppletStateChangedEvent() -> handle<copy>
public long GetAppletStateChangedEvent(ServiceCtx context)
{
_stateChangedEvent.ReadableEvent.Signal();
if (context.Process.HandleTable.GenerateHandle(_stateChangedEvent.ReadableEvent, out int handle) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
Logger.PrintStub(LogClass.ServiceAm);
return 0;
}
[Command(10)]
// Start()
public long Start(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
}
[Command(30)]
// GetResult()
public long GetResult(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
}
[Command(100)]
// PushInData(object<nn::am::service::IStorage>)
public long PushInData(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
return 0;
}
[Command(101)]
// PopOutData() -> object<nn::am::service::IStorage>
public long PopOutData(ServiceCtx context)
{
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
return 0;
}
}
}