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
This commit is contained in:
Ac_K 2019-07-12 03:13:43 +02:00 committed by gdkchan
parent f723f6f39a
commit 560ccbeb2d
99 changed files with 1035 additions and 1983 deletions

View file

@ -3,32 +3,20 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
private KEvent _stateChangedEvent;
public ILibraryAppletAccessor(Horizon system)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, GetAppletStateChangedEvent },
{ 10, Start },
{ 30, GetResult },
{ 100, PushInData },
{ 101, PopOutData }
};
_stateChangedEvent = new KEvent(system);
}
[Command(0)]
// GetAppletStateChangedEvent() -> handle<copy>
public long GetAppletStateChangedEvent(ServiceCtx context)
{
_stateChangedEvent.ReadableEvent.Signal();
@ -45,6 +33,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
[Command(10)]
// Start()
public long Start(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@ -52,6 +42,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
[Command(30)]
// GetResult()
public long GetResult(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@ -59,6 +51,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
[Command(100)]
// PushInData(object<nn::am::service::IStorage>)
public long PushInData(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@ -66,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
[Command(101)]
// PopOutData() -> object<nn::am::service::IStorage>
public long PopOutData(ServiceCtx context)
{
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));