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

@ -1,31 +1,13 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Mm
{
[Service("mm:u")]
class IRequest : IpcService
{
private Dictionary<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
public IRequest(ServiceCtx context)
{
_commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, InitializeOld },
{ 1, FinalizeOld },
{ 2, SetAndWaitOld },
{ 3, GetOld },
{ 4, Initialize },
{ 5, Finalize },
{ 6, SetAndWait },
{ 7, Get }
};
}
public IRequest(ServiceCtx context) { }
[Command(0)]
// InitializeOld(u32, u32, u32)
public long InitializeOld(ServiceCtx context)
{
@ -38,6 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(1)]
// FinalizeOld(u32)
public long FinalizeOld(ServiceCtx context)
{
@ -48,6 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(2)]
// SetAndWaitOld(u32, u32, u32)
public long SetAndWaitOld(ServiceCtx context)
{
@ -59,6 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(3)]
// GetOld(u32) -> u32
public long GetOld(ServiceCtx context)
{
@ -71,6 +56,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(4)]
// Initialize()
public long Initialize(ServiceCtx context)
{
@ -79,6 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(5)]
// Finalize(u32)
public long Finalize(ServiceCtx context)
{
@ -89,6 +76,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(6)]
// SetAndWait(u32, u32, u32)
public long SetAndWait(ServiceCtx context)
{
@ -101,6 +89,7 @@ namespace Ryujinx.HLE.HOS.Services.Mm
return 0;
}
[Command(7)]
// Get(u32) -> u32
public long Get(ServiceCtx context)
{