Refactoring result codes (#731)

* refactoring result codes

- Add a main enum who can handle some orphalin result codes and the default `ResultCode.Success` one.
- Add sub-enum by services when it's needed.
- Remove some empty line.
- Recast all service calls to ResultCode.
- Remove some unneeded static declaration.
- Delete unused `NvHelper` class.

* NvResult is back

* Fix
This commit is contained in:
Ac_K 2019-07-14 21:04:38 +02:00 committed by gdkchan
parent 4926f6523d
commit 4ad3936afd
147 changed files with 1413 additions and 1477 deletions

View file

@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
[Command(0)]
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
public long Read(ServiceCtx context)
public ResultCode Read(ServiceCtx context)
{
long bufferPosition = context.Request.ReceiveBuff[0].Position;
long bufferLen = context.Request.ReceiveBuff[0].Size;
@ -41,12 +41,12 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
}
catch (HorizonResultException ex)
{
return ex.ResultValue.Value;
return (ResultCode)ex.ResultValue.Value;
}
context.ResponseData.Write((long)readCount);
return 0;
return ResultCode.Success;
}
private void WriteDirectoryEntry(ServiceCtx context, long position, LibHac.Fs.DirectoryEntry entry)
@ -67,7 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
[Command(1)]
// GetEntryCount() -> u64
public long GetEntryCount(ServiceCtx context)
public ResultCode GetEntryCount(ServiceCtx context)
{
try
{
@ -75,10 +75,10 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
}
catch (HorizonResultException ex)
{
return ex.ResultValue.Value;
return (ResultCode)ex.ResultValue.Value;
}
return 0;
return ResultCode.Success;
}
}
}