IPsmServer.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Ryujinx.Common.Logging;
  2. namespace Ryujinx.HLE.HOS.Services.Ptm.Psm
  3. {
  4. [Service("psm")]
  5. class IPsmServer : IpcService
  6. {
  7. public IPsmServer(ServiceCtx context) { }
  8. [CommandHipc(0)]
  9. // GetBatteryChargePercentage() -> u32
  10. public static ResultCode GetBatteryChargePercentage(ServiceCtx context)
  11. {
  12. int chargePercentage = 100;
  13. context.ResponseData.Write(chargePercentage);
  14. Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargePercentage });
  15. return ResultCode.Success;
  16. }
  17. [CommandHipc(1)]
  18. // GetChargerType() -> u32
  19. public static ResultCode GetChargerType(ServiceCtx context)
  20. {
  21. ChargerType chargerType = ChargerType.ChargerOrDock;
  22. context.ResponseData.Write((int)chargerType);
  23. Logger.Stub?.PrintStub(LogClass.ServicePsm, new { chargerType });
  24. return ResultCode.Success;
  25. }
  26. [CommandHipc(7)]
  27. // OpenSession() -> IPsmSession
  28. public ResultCode OpenSession(ServiceCtx context)
  29. {
  30. MakeObject(context, new IPsmSession(context.Device.System));
  31. return ResultCode.Success;
  32. }
  33. }
  34. }