2018-10-21 02:01:22 -04:00
|
|
|
|
using Ryujinx.Common.Logging;
|
|
|
|
|
|
2019-09-18 20:45:11 -04:00
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Ptm.Psm
|
2018-10-21 02:01:22 -04:00
|
|
|
|
{
|
2019-07-10 11:59:54 -04:00
|
|
|
|
[Service("psm")]
|
2018-10-21 02:01:22 -04:00
|
|
|
|
class IPsmServer : IpcService
|
|
|
|
|
{
|
2019-07-11 21:13:43 -04:00
|
|
|
|
public IPsmServer(ServiceCtx context) { }
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2023-04-14 19:00:34 -04:00
|
|
|
|
[CommandCmif(0)]
|
2018-10-21 02:01:22 -04:00
|
|
|
|
// GetBatteryChargePercentage() -> u32
|
2019-07-14 15:04:38 -04:00
|
|
|
|
public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
|
2018-10-21 02:01:22 -04:00
|
|
|
|
{
|
2018-12-06 06:16:24 -05:00
|
|
|
|
int chargePercentage = 100;
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2018-12-06 06:16:24 -05:00
|
|
|
|
context.ResponseData.Write(chargePercentage);
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2020-08-03 19:32:53 -04:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargePercentage });
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2019-07-14 15:04:38 -04:00
|
|
|
|
return ResultCode.Success;
|
2018-10-21 02:01:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 19:00:34 -04:00
|
|
|
|
[CommandCmif(1)]
|
2018-10-21 02:01:22 -04:00
|
|
|
|
// GetChargerType() -> u32
|
2019-07-14 15:04:38 -04:00
|
|
|
|
public static ResultCode GetChargerType(ServiceCtx context)
|
2018-10-21 02:01:22 -04:00
|
|
|
|
{
|
2019-01-10 19:11:46 -05:00
|
|
|
|
ChargerType chargerType = ChargerType.ChargerOrDock;
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2019-01-10 19:11:46 -05:00
|
|
|
|
context.ResponseData.Write((int)chargerType);
|
|
|
|
|
|
2020-08-03 19:32:53 -04:00
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargerType });
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2019-07-14 15:04:38 -04:00
|
|
|
|
return ResultCode.Success;
|
2018-10-21 02:01:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 19:00:34 -04:00
|
|
|
|
[CommandCmif(7)]
|
2018-10-21 02:01:22 -04:00
|
|
|
|
// OpenSession() -> IPsmSession
|
2019-07-14 15:04:38 -04:00
|
|
|
|
public ResultCode OpenSession(ServiceCtx context)
|
2018-10-21 02:01:22 -04:00
|
|
|
|
{
|
2018-12-06 06:16:24 -05:00
|
|
|
|
MakeObject(context, new IPsmSession(context.Device.System));
|
2018-10-21 02:01:22 -04:00
|
|
|
|
|
2019-07-14 15:04:38 -04:00
|
|
|
|
return ResultCode.Success;
|
2018-10-21 02:01:22 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|