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:
parent
4926f6523d
commit
4ad3936afd
147 changed files with 1413 additions and 1477 deletions
|
@ -38,4 +38,4 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
Right = 1 << 4,
|
||||
Invalid = 1 << 5
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,4 +18,4 @@
|
|||
Standard,
|
||||
Tight
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,4 +26,4 @@
|
|||
public float AmplitudeHigh;
|
||||
public float FrequencyHigh;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,11 +6,11 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
|
||||
[Command(0)]
|
||||
// ActivateVibrationDevice(nn::hid::VibrationDeviceHandle)
|
||||
public long ActivateVibrationDevice(ServiceCtx context)
|
||||
public ResultCode ActivateVibrationDevice(ServiceCtx context)
|
||||
{
|
||||
int vibrationDeviceHandle = context.RequestData.ReadInt32();
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
|
||||
[Command(0)]
|
||||
// GetSharedMemoryHandle() -> handle<copy>
|
||||
public long GetSharedMemoryHandle(ServiceCtx context)
|
||||
public ResultCode GetSharedMemoryHandle(ServiceCtx context)
|
||||
{
|
||||
if (context.Process.HandleTable.GenerateHandle(_hidSharedMem, out int handle) != KernelResult.Success)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
|
|||
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(handle);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -15,29 +15,29 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|||
|
||||
[Command(302)]
|
||||
// ActivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
||||
public long ActivateIrsensor(ServiceCtx context)
|
||||
public ResultCode ActivateIrsensor(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(303)]
|
||||
// DeactivateIrsensor(nn::applet::AppletResourceUserId, pid)
|
||||
public long DeactivateIrsensor(ServiceCtx context)
|
||||
public ResultCode DeactivateIrsensor(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(304)]
|
||||
// GetIrsensorSharedMemoryHandle(nn::applet::AppletResourceUserId, pid) -> handle<copy>
|
||||
public long GetIrsensorSharedMemoryHandle(ServiceCtx context)
|
||||
public ResultCode GetIrsensorSharedMemoryHandle(ServiceCtx context)
|
||||
{
|
||||
if (_irsensorSharedMemoryHandle == 0)
|
||||
{
|
||||
|
@ -49,12 +49,12 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|||
|
||||
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_irsensorSharedMemoryHandle);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(311)]
|
||||
// GetNpadIrCameraHandle(u32) -> nn::irsensor::IrCameraHandle
|
||||
public long GetNpadIrCameraHandle(ServiceCtx context)
|
||||
public ResultCode GetNpadIrCameraHandle(ServiceCtx context)
|
||||
{
|
||||
NpadIdType npadIdType = (NpadIdType)context.RequestData.ReadUInt32();
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|||
npadIdType != NpadIdType.Unknown &&
|
||||
npadIdType != NpadIdType.Handheld)
|
||||
{
|
||||
return ErrorCode.MakeError(ErrorModule.Irsensor, IrsError.NpadIdOutOfRange);
|
||||
return ResultCode.NpadIdOutOfRange;
|
||||
}
|
||||
|
||||
HidControllerId irCameraHandle = HidUtils.GetIndexFromNpadIdType(npadIdType);
|
||||
|
@ -70,21 +70,21 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
|||
context.ResponseData.Write((int)irCameraHandle);
|
||||
|
||||
// NOTE: If the irCameraHandle pointer is null this error is returned, Doesn't occur in our case.
|
||||
// return ErrorCode.MakeError(ErrorModule.Irsensor, IrsError.HandlePointerIsNull);
|
||||
// return ResultCode.HandlePointerIsNull;
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(319)] // 4.0.0+
|
||||
// ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid)
|
||||
public long ActivateIrsensorWithFunctionLevel(ServiceCtx context)
|
||||
public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context)
|
||||
{
|
||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
||||
long packedFunctionLevel = context.RequestData.ReadInt64();
|
||||
|
||||
Logger.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, packedFunctionLevel });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
{
|
||||
static class IrsError
|
||||
{
|
||||
public const int HandlePointerIsNull = 212;
|
||||
public const int NpadIdOutOfRange = 709;
|
||||
}
|
||||
}
|
13
Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs
Normal file
13
Ryujinx.HLE/HOS/Services/Hid/Irs/ResultCode.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace Ryujinx.HLE.HOS.Services.Hid.Irs
|
||||
{
|
||||
public enum ResultCode
|
||||
{
|
||||
ModuleId = 205,
|
||||
ErrorCodeShift = 9,
|
||||
|
||||
Success = 0,
|
||||
|
||||
HandlePointerIsNull = (212 << ErrorCodeShift) | ModuleId,
|
||||
NpadIdOutOfRange = (709 << ErrorCodeShift) | ModuleId
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue