Implement basic psm service

- Add `IPsmServer`
- Stub `GetBatteryChargePercentage` & `GetChargerType`
This commit is contained in:
Ac_K 2018-10-21 01:12:30 +02:00
parent b5f7d8106b
commit be7bcf108f
3 changed files with 56 additions and 0 deletions

View file

@ -33,6 +33,7 @@ namespace Ryujinx.Common.Logging
ServicePctl,
ServicePl,
ServicePrepo,
ServicePsm,
ServiceSet,
ServiceSfdnsres,
ServiceSm,

View file

@ -0,0 +1,51 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Psm
{
class IPsmServer : IpcService
{
enum ChargerType : int
{
None,
ChargerOrDock,
UsbC
}
private Dictionary<int, ServiceProcessRequest> m_Commands;
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
public IPsmServer()
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetBatteryChargePercentage },
{ 1, GetChargerType }
};
}
// GetBatteryChargePercentage() -> u32
public static long GetBatteryChargePercentage(ServiceCtx Context)
{
int ChargePercentage = 100;
Context.ResponseData.Write(ChargePercentage);
Logger.PrintStub(LogClass.ServicePsm, $"Stubbed. ChargePercentage: {ChargePercentage}");
return 0;
}
// GetChargerType() -> u32
public static long GetChargerType(ServiceCtx Context)
{
Context.ResponseData.Write((int)ChargerType.ChargerOrDock);
Logger.PrintStub(LogClass.ServicePsm, $"Stubbed. ChargerType: {ChargerType.ChargerOrDock}");
return 0;
}
}
}

View file

@ -16,6 +16,7 @@ using Ryujinx.HLE.HOS.Services.Nv;
using Ryujinx.HLE.HOS.Services.Pctl;
using Ryujinx.HLE.HOS.Services.Pl;
using Ryujinx.HLE.HOS.Services.Prepo;
using Ryujinx.HLE.HOS.Services.Psm;
using Ryujinx.HLE.HOS.Services.Set;
using Ryujinx.HLE.HOS.Services.Sfdnsres;
using Ryujinx.HLE.HOS.Services.Sm;
@ -146,6 +147,9 @@ namespace Ryujinx.HLE.HOS.Services
case "pl:u":
return new ISharedFontManager();
case "psm":
return new IPsmServer();
case "prepo:a":
return new IPrepoService();