mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 08:28:40 +00:00
4ad3936afd
* 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
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using Ryujinx.Common.Logging;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Psm
|
|
{
|
|
[Service("psm")]
|
|
class IPsmServer : IpcService
|
|
{
|
|
enum ChargerType
|
|
{
|
|
None,
|
|
ChargerOrDock,
|
|
UsbC
|
|
}
|
|
|
|
public IPsmServer(ServiceCtx context) { }
|
|
|
|
[Command(0)]
|
|
// GetBatteryChargePercentage() -> u32
|
|
public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
|
|
{
|
|
int chargePercentage = 100;
|
|
|
|
context.ResponseData.Write(chargePercentage);
|
|
|
|
Logger.PrintStub(LogClass.ServicePsm, new { chargePercentage });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(1)]
|
|
// GetChargerType() -> u32
|
|
public static ResultCode GetChargerType(ServiceCtx context)
|
|
{
|
|
ChargerType chargerType = ChargerType.ChargerOrDock;
|
|
|
|
context.ResponseData.Write((int)chargerType);
|
|
|
|
Logger.PrintStub(LogClass.ServicePsm, new { chargerType });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[Command(7)]
|
|
// OpenSession() -> IPsmSession
|
|
public ResultCode OpenSession(ServiceCtx context)
|
|
{
|
|
MakeObject(context, new IPsmSession(context.Device.System));
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |