Implement basic psm service
- Add `IPsmServer` - Stub `GetBatteryChargePercentage` & `GetChargerType`
This commit is contained in:
parent
b5f7d8106b
commit
be7bcf108f
3 changed files with 56 additions and 0 deletions
|
@ -33,6 +33,7 @@ namespace Ryujinx.Common.Logging
|
|||
ServicePctl,
|
||||
ServicePl,
|
||||
ServicePrepo,
|
||||
ServicePsm,
|
||||
ServiceSet,
|
||||
ServiceSfdnsres,
|
||||
ServiceSm,
|
||||
|
|
51
Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
Normal file
51
Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue