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,7 +3,6 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.Input;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
{
@ -12,35 +11,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
{
private int _irsensorSharedMemoryHandle = 0;
private Dictionary<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public IIrSensorServer(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
{ 302, ActivateIrsensor },
{ 303, DeactivateIrsensor },
{ 304, GetIrsensorSharedMemoryHandle },
//{ 305, StopImageProcessor },
//{ 306, RunMomentProcessor },
//{ 307, RunClusteringProcessor },
//{ 308, RunImageTransferProcessor },
//{ 309, GetImageTransferProcessorState },
//{ 310, RunTeraPluginProcessor },
{ 311, GetNpadIrCameraHandle },
//{ 312, RunPointingProcessor },
//{ 313, SuspendImageProcessor },
//{ 314, CheckFirmwareVersion }, // 3.0.0+
//{ 315, SetFunctionLevel }, // 4.0.0+
//{ 316, RunImageTransferExProcessor }, // 4.0.0+
//{ 317, RunIrLedProcessor }, // 4.0.0+
//{ 318, StopImageProcessorAsync }, // 4.0.0+
{ 319, ActivateIrsensorWithFunctionLevel }, // 4.0.0+
};
}
public IIrSensorServer(ServiceCtx context) { }
[Command(302)]
// ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
public long ActivateIrsensor(ServiceCtx context)
{
@ -51,6 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
return 0;
}
[Command(303)]
// DeactivateIrsensor(nn::applet::AppletResourceUserId, pid)
public long DeactivateIrsensor(ServiceCtx context)
{
@ -61,6 +35,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
return 0;
}
[Command(304)]
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy>
public long GetIrsensorSharedMemoryHandle(ServiceCtx context)
{
@ -77,6 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
return 0;
}
[Command(311)]
// GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle
public long GetNpadIrCameraHandle(ServiceCtx context)
{
@ -99,6 +75,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
return 0;
}
[Command(319)] // 4.0.0+
// ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid)
public long ActivateIrsensorWithFunctionLevel(ServiceCtx context)
{