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,5 +1,4 @@
using LibHac;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
using System.Text;
@ -9,27 +8,17 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
private const int DirectoryEntrySize = 0x310;
private Dictionary<int, ServiceProcessRequest> _commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
private IEnumerator<LibHac.Fs.DirectoryEntry> _enumerator;
private LibHac.Fs.IDirectory _baseDirectory;
public IDirectory(LibHac.Fs.IDirectory directory)
{
_commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, Read },
{ 1, GetEntryCount }
};
_baseDirectory = directory;
_enumerator = directory.Read().GetEnumerator();
_enumerator = directory.Read().GetEnumerator();
}
[Command(0)]
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
public long Read(ServiceCtx context)
{
@ -76,6 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
context.Memory.WriteInt64(position + 0x308, entry.Size);
}
[Command(1)]
// GetEntryCount() -> u64
public long GetEntryCount(ServiceCtx context)
{