aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Psm
diff options
context:
space:
mode:
authorAc_K <Acoustik666@gmail.com>2019-07-12 03:13:43 +0200
committergdkchan <gab.dark.100@gmail.com>2019-07-11 22:13:43 -0300
commit560ccbeb2d55a4426ad2827bf7534d4a695431c2 (patch)
tree7e224acbd6c023ea56ff80c6207aa0966aa06ee5 /Ryujinx.HLE/HOS/Services/Psm
parentf723f6f39aaf7b1cebc0224a055058d62e3b689c (diff)
Refactoring commands handling (#728)
* Refactoring commands handling - Use Reflection to handle commands ID. - Add all symbols (from SwIPC so not all time accurate). - Re-sort some services commands methods. - Some cleanup. - Keep some empty constructor for consistency. * Fix order in IProfile
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Psm')
-rw-r--r--Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs19
-rw-r--r--Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs19
2 files changed, 9 insertions, 29 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
index 2310e8b9..002cc61c 100644
--- a/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Psm/IPsmServer.cs
@@ -1,6 +1,4 @@
using Ryujinx.Common.Logging;
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Psm
{
@@ -14,20 +12,9 @@ namespace Ryujinx.HLE.HOS.Services.Psm
UsbC
}
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IPsmServer(ServiceCtx context)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetBatteryChargePercentage },
- { 1, GetChargerType },
- { 7, OpenSession }
- };
- }
+ public IPsmServer(ServiceCtx context) { }
+ [Command(0)]
// GetBatteryChargePercentage() -> u32
public static long GetBatteryChargePercentage(ServiceCtx context)
{
@@ -40,6 +27,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(1)]
// GetChargerType() -> u32
public static long GetChargerType(ServiceCtx context)
{
@@ -52,6 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(7)]
// OpenSession() -> IPsmSession
public long OpenSession(ServiceCtx context)
{
diff --git a/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs b/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs
index 3db3bd27..de86ed73 100644
--- a/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs
+++ b/Ryujinx.HLE/HOS/Services/Psm/IPsmSession.cs
@@ -2,34 +2,21 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Psm
{
class IPsmSession : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private KEvent _stateChangeEvent;
private int _stateChangeEventHandle;
public IPsmSession(Horizon system)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, BindStateChangeEvent },
- { 1, UnbindStateChangeEvent },
- { 2, SetChargerTypeChangeEventEnabled },
- { 3, SetPowerSupplyChangeEventEnabled },
- { 4, SetBatteryVoltageStateChangeEventEnabled }
- };
-
_stateChangeEvent = new KEvent(system);
_stateChangeEventHandle = -1;
}
+ [Command(0)]
// BindStateChangeEvent() -> KObject
public long BindStateChangeEvent(ServiceCtx context)
{
@@ -50,6 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(1)]
// UnbindStateChangeEvent()
public long UnbindStateChangeEvent(ServiceCtx context)
{
@@ -64,6 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(2)]
// SetChargerTypeChangeEventEnabled(u8)
public long SetChargerTypeChangeEventEnabled(ServiceCtx context)
{
@@ -74,6 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(3)]
// SetPowerSupplyChangeEventEnabled(u8)
public long SetPowerSupplyChangeEventEnabled(ServiceCtx context)
{
@@ -84,6 +74,7 @@ namespace Ryujinx.HLE.HOS.Services.Psm
return 0;
}
+ [Command(4)]
// SetBatteryVoltageStateChangeEventEnabled(u8)
public long SetBatteryVoltageStateChangeEventEnabled(ServiceCtx context)
{