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
|
@ -16,7 +16,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
[Command(0)]
|
||||
// GetBatteryChargePercentage() -> u32
|
||||
public static long GetBatteryChargePercentage(ServiceCtx context)
|
||||
public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
|
||||
{
|
||||
int chargePercentage = 100;
|
||||
|
||||
|
@ -24,12 +24,12 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
Logger.PrintStub(LogClass.ServicePsm, new { chargePercentage });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(1)]
|
||||
// GetChargerType() -> u32
|
||||
public static long GetChargerType(ServiceCtx context)
|
||||
public static ResultCode GetChargerType(ServiceCtx context)
|
||||
{
|
||||
ChargerType chargerType = ChargerType.ChargerOrDock;
|
||||
|
||||
|
@ -37,16 +37,16 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
Logger.PrintStub(LogClass.ServicePsm, new { chargerType });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(7)]
|
||||
// OpenSession() -> IPsmSession
|
||||
public long OpenSession(ServiceCtx context)
|
||||
public ResultCode OpenSession(ServiceCtx context)
|
||||
{
|
||||
MakeObject(context, new IPsmSession(context.Device.System));
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
[Command(0)]
|
||||
// BindStateChangeEvent() -> KObject
|
||||
public long BindStateChangeEvent(ServiceCtx context)
|
||||
public ResultCode BindStateChangeEvent(ServiceCtx context)
|
||||
{
|
||||
if (_stateChangeEventHandle == -1)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
if (resultCode != KernelResult.Success)
|
||||
{
|
||||
return (long)resultCode;
|
||||
return (ResultCode)resultCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,12 +34,12 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
Logger.PrintStub(LogClass.ServicePsm);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(1)]
|
||||
// UnbindStateChangeEvent()
|
||||
public long UnbindStateChangeEvent(ServiceCtx context)
|
||||
public ResultCode UnbindStateChangeEvent(ServiceCtx context)
|
||||
{
|
||||
if (_stateChangeEventHandle != -1)
|
||||
{
|
||||
|
@ -49,40 +49,40 @@ namespace Ryujinx.HLE.HOS.Services.Psm
|
|||
|
||||
Logger.PrintStub(LogClass.ServicePsm);
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(2)]
|
||||
// SetChargerTypeChangeEventEnabled(u8)
|
||||
public long SetChargerTypeChangeEventEnabled(ServiceCtx context)
|
||||
public ResultCode SetChargerTypeChangeEventEnabled(ServiceCtx context)
|
||||
{
|
||||
bool chargerTypeChangeEventEnabled = context.RequestData.ReadBoolean();
|
||||
|
||||
Logger.PrintStub(LogClass.ServicePsm, new { chargerTypeChangeEventEnabled });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(3)]
|
||||
// SetPowerSupplyChangeEventEnabled(u8)
|
||||
public long SetPowerSupplyChangeEventEnabled(ServiceCtx context)
|
||||
public ResultCode SetPowerSupplyChangeEventEnabled(ServiceCtx context)
|
||||
{
|
||||
bool powerSupplyChangeEventEnabled = context.RequestData.ReadBoolean();
|
||||
|
||||
Logger.PrintStub(LogClass.ServicePsm, new { powerSupplyChangeEventEnabled });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(4)]
|
||||
// SetBatteryVoltageStateChangeEventEnabled(u8)
|
||||
public long SetBatteryVoltageStateChangeEventEnabled(ServiceCtx context)
|
||||
public ResultCode SetBatteryVoltageStateChangeEventEnabled(ServiceCtx context)
|
||||
{
|
||||
bool batteryVoltageStateChangeEventEnabled = context.RequestData.ReadBoolean();
|
||||
|
||||
Logger.PrintStub(LogClass.ServicePsm, new { batteryVoltageStateChangeEventEnabled });
|
||||
|
||||
return 0;
|
||||
return ResultCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue