aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Am
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/Am
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/Am')
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs17
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs15
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs42
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs38
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs17
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IAudioController.cs30
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs35
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs15
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs15
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs15
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs17
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs24
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs20
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ISelfController.cs78
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IStorage.cs14
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs19
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs44
-rw-r--r--Ryujinx.HLE/HOS/Services/Am/IWindowController.cs19
18 files changed, 157 insertions, 317 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs
index 64bb6745..4b712a38 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IAllSystemAppletProxiesService.cs
@@ -1,23 +1,12 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
[Service("appletAE")]
class IAllSystemAppletProxiesService : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IAllSystemAppletProxiesService(ServiceCtx context)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 100, OpenSystemAppletProxy }
- };
- }
+ public IAllSystemAppletProxiesService(ServiceCtx context) { }
+ [Command(100)]
+ // OpenSystemAppletProxy(u64, pid, handle<copy>) -> object<nn::am::service::ISystemAppletProxy>
public long OpenSystemAppletProxy(ServiceCtx context)
{
MakeObject(context, new ISystemAppletProxy());
diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs
index 5f31b323..e4c6615f 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs
@@ -1,20 +1,7 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationCreator : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IApplicationCreator()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- // ...
- };
- }
+ public IApplicationCreator() { }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs
index dc8adb93..a0083b85 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs
@@ -1,31 +1,13 @@
using Ryujinx.Common.Logging;
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationFunctions : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IApplicationFunctions()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 1, PopLaunchParameter },
- { 20, EnsureSaveData },
- { 21, GetDesiredLanguage },
- { 22, SetTerminateResult },
- { 23, GetDisplayVersion },
- { 40, NotifyRunning },
- { 50, GetPseudoDeviceId },
- { 66, InitializeGamePlayRecording },
- { 67, SetGamePlayRecordingState }
- };
- }
+ public IApplicationFunctions() { }
+ [Command(1)]
+ // PopLaunchParameter(u32) -> object<nn::am::service::IStorage>
public long PopLaunchParameter(ServiceCtx context)
{
// Only the first 0x18 bytes of the Data seems to be actually used.
@@ -34,6 +16,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(20)]
+ // EnsureSaveData(nn::account::Uid) -> u64
public long EnsureSaveData(ServiceCtx context)
{
long uIdLow = context.RequestData.ReadInt64();
@@ -46,6 +30,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(21)]
+ // GetDesiredLanguage() -> nn::settings::LanguageCode
public long GetDesiredLanguage(ServiceCtx context)
{
context.ResponseData.Write(context.Device.System.State.DesiredLanguageCode);
@@ -53,6 +39,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(22)]
+ // SetTerminateResult(u32)
public long SetTerminateResult(ServiceCtx context)
{
int errorCode = context.RequestData.ReadInt32();
@@ -72,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return $"{(2000 + module):d4}-{description:d4}";
}
+ [Command(23)]
+ // GetDisplayVersion() -> nn::oe::DisplayVersion
public long GetDisplayVersion(ServiceCtx context)
{
// FIXME: Need to check correct version on a switch.
@@ -81,6 +71,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(40)]
+ // NotifyRunning() -> b8
public long NotifyRunning(ServiceCtx context)
{
context.ResponseData.Write(1);
@@ -88,6 +80,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(50)] // 2.0.0+
+ // GetPseudoDeviceId() -> nn::util::Uuid
public long GetPseudoDeviceId(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -98,6 +92,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(66)] // 3.0.0+
+ // InitializeGamePlayRecording(u64, handle<copy>)
public long InitializeGamePlayRecording(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -105,6 +101,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(67)] // 3.0.0+
+ // SetGamePlayRecordingState(u32)
public long SetGamePlayRecordingState(ServiceCtx context)
{
int state = context.RequestData.ReadInt32();
@@ -114,4 +112,4 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
}
-}
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs
index fd785a70..2c877b93 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxy.cs
@@ -1,29 +1,11 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IApplicationProxy : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IApplicationProxy()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetCommonStateGetter },
- { 1, GetSelfController },
- { 2, GetWindowController },
- { 3, GetAudioController },
- { 4, GetDisplayController },
- { 11, GetLibraryAppletCreator },
- { 20, GetApplicationFunctions },
- { 1000, GetDebugFunctions }
- };
- }
+ public IApplicationProxy() { }
+ [Command(0)]
+ // GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
public long GetCommonStateGetter(ServiceCtx context)
{
MakeObject(context, new ICommonStateGetter(context.Device.System));
@@ -31,6 +13,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1)]
+ // GetSelfController() -> object<nn::am::service::ISelfController>
public long GetSelfController(ServiceCtx context)
{
MakeObject(context, new ISelfController(context.Device.System));
@@ -38,6 +22,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(2)]
+ // GetWindowController() -> object<nn::am::service::IWindowController>
public long GetWindowController(ServiceCtx context)
{
MakeObject(context, new IWindowController());
@@ -45,6 +31,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(3)]
+ // GetAudioController() -> object<nn::am::service::IAudioController>
public long GetAudioController(ServiceCtx context)
{
MakeObject(context, new IAudioController());
@@ -52,6 +40,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(4)]
+ // GetDisplayController() -> object<nn::am::service::IDisplayController>
public long GetDisplayController(ServiceCtx context)
{
MakeObject(context, new IDisplayController());
@@ -59,6 +49,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(11)]
+ // GetLibraryAppletCreator() -> object<nn::am::service::ILibraryAppletCreator>
public long GetLibraryAppletCreator(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletCreator());
@@ -66,6 +58,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(20)]
+ // GetApplicationFunctions() -> object<nn::am::service::IApplicationFunctions>
public long GetApplicationFunctions(ServiceCtx context)
{
MakeObject(context, new IApplicationFunctions());
@@ -73,6 +67,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1000)]
+ // GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
public long GetDebugFunctions(ServiceCtx context)
{
MakeObject(context, new IDebugFunctions());
diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs
index 8ca05868..631e2a37 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationProxyService.cs
@@ -1,23 +1,12 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
[Service("appletOE")]
class IApplicationProxyService : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IApplicationProxyService(ServiceCtx context)
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, OpenApplicationProxy }
- };
- }
+ public IApplicationProxyService(ServiceCtx context) { }
+ [Command(0)]
+ // OpenApplicationProxy(u64, pid, handle<copy>) -> object<nn::am::service::IApplicationProxy>
public long OpenApplicationProxy(ServiceCtx context)
{
MakeObject(context, new IApplicationProxy());
diff --git a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs
index 5bb21225..24d0c3d3 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IAudioController.cs
@@ -1,27 +1,13 @@
using Ryujinx.Common.Logging;
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IAudioController : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IAudioController()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, SetExpectedMasterVolume },
- { 1, GetMainAppletExpectedMasterVolume },
- { 2, GetLibraryAppletExpectedMasterVolume },
- { 3, ChangeMainAppletMasterVolume },
- { 4, SetTransparentVolumeRate }
- };
- }
+ public IAudioController() { }
+ [Command(0)]
+ // SetExpectedMasterVolume(f32, f32)
public long SetExpectedMasterVolume(ServiceCtx context)
{
float appletVolume = context.RequestData.ReadSingle();
@@ -32,6 +18,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1)]
+ // GetMainAppletExpectedMasterVolume() -> f32
public long GetMainAppletExpectedMasterVolume(ServiceCtx context)
{
context.ResponseData.Write(1f);
@@ -41,6 +29,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(2)]
+ // GetLibraryAppletExpectedMasterVolume() -> f32
public long GetLibraryAppletExpectedMasterVolume(ServiceCtx context)
{
context.ResponseData.Write(1f);
@@ -50,6 +40,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(3)]
+ // ChangeMainAppletMasterVolume(f32, u64)
public long ChangeMainAppletMasterVolume(ServiceCtx context)
{
float unknown0 = context.RequestData.ReadSingle();
@@ -60,6 +52,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(4)]
+ // SetTransparentVolumeRate(f32)
public long SetTransparentVolumeRate(ServiceCtx context)
{
float unknown0 = context.RequestData.ReadSingle();
@@ -69,4 +63,4 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
}
-}
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs
index 7cd34018..117d068a 100644
--- a/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/ICommonStateGetter.cs
@@ -3,7 +3,6 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
-using System.Collections.Generic;
using static Ryujinx.HLE.HOS.ErrorCode;
@@ -11,29 +10,15 @@ namespace Ryujinx.HLE.HOS.Services.Am
{
class ICommonStateGetter : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private KEvent _displayResolutionChangeEvent;
public ICommonStateGetter(Horizon system)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetEventHandle },
- { 1, ReceiveMessage },
- { 5, GetOperationMode },
- { 6, GetPerformanceMode },
- { 8, GetBootMode },
- { 9, GetCurrentFocusState },
- { 60, GetDefaultDisplayResolution },
- { 61, GetDefaultDisplayResolutionChangeEvent }
- };
-
_displayResolutionChangeEvent = new KEvent(system);
}
+ [Command(0)]
+ // GetEventHandle() -> handle<copy>
public long GetEventHandle(ServiceCtx context)
{
KEvent Event = context.Device.System.AppletState.MessageEvent;
@@ -48,6 +33,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1)]
+ // ReceiveMessage() -> nn::am::AppletMessage
public long ReceiveMessage(ServiceCtx context)
{
if (!context.Device.System.AppletState.TryDequeueMessage(out MessageInfo message))
@@ -60,6 +47,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(5)]
+ // GetOperationMode() -> u8
public long GetOperationMode(ServiceCtx context)
{
OperationMode mode = context.Device.System.State.DockedMode
@@ -71,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(6)]
+ // GetPerformanceMode() -> u32
public long GetPerformanceMode(ServiceCtx context)
{
Apm.PerformanceMode mode = context.Device.System.State.DockedMode
@@ -82,6 +73,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(8)]
+ // GetBootMode() -> u8
public long GetBootMode(ServiceCtx context)
{
context.ResponseData.Write((byte)0); //Unknown value.
@@ -91,6 +84,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(9)]
+ // GetCurrentFocusState() -> u8
public long GetCurrentFocusState(ServiceCtx context)
{
context.ResponseData.Write((byte)context.Device.System.AppletState.FocusState);
@@ -98,6 +93,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(60)] // 3.0.0+
+ // GetDefaultDisplayResolution() -> (u32, u32)
public long GetDefaultDisplayResolution(ServiceCtx context)
{
context.ResponseData.Write(1280);
@@ -106,6 +103,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(61)] // 3.0.0+
+ // GetDefaultDisplayResolutionChangeEvent() -> handle<copy>
public long GetDefaultDisplayResolutionChangeEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(_displayResolutionChangeEvent.ReadableEvent, out int handle) != KernelResult.Success)
@@ -120,4 +119,4 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
}
-}
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs
index a884a454..ebde33f4 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs
@@ -1,20 +1,7 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IDebugFunctions : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IDebugFunctions()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- // ...
- };
- }
+ public IDebugFunctions() { }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs
index fc668f3c..de3313c6 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs
@@ -1,20 +1,7 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IDisplayController : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IDisplayController()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- // ...
- };
- }
+ public IDisplayController() { }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs
index 634f65eb..9172e094 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs
@@ -1,20 +1,7 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IGlobalStateController : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IGlobalStateController()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- // ...
- };
- }
+ public IGlobalStateController() { }
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs
index 868e0215..7ab088da 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs
@@ -3,30 +3,21 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IHomeMenuFunctions : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private KEvent _channelEvent;
public IHomeMenuFunctions(Horizon system)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 10, RequestToGetForeground },
- { 21, GetPopFromGeneralChannelEvent }
- };
-
// TODO: Signal this Event somewhere in future.
_channelEvent = new KEvent(system);
}
+ [Command(10)]
+ // RequestToGetForeground()
public long RequestToGetForeground(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -34,6 +25,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(21)]
+ // GetPopFromGeneralChannelEvent() -> handle<copy>
public long GetPopFromGeneralChannelEvent(ServiceCtx context)
{
if (context.Process.HandleTable.GenerateHandle(_channelEvent.ReadableEvent, out int handle) != KernelResult.Success)
@@ -48,4 +41,4 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
}
-}
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs
index 7aead9f6..947114f3 100644
--- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletAccessor.cs
@@ -3,32 +3,20 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletAccessor : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private KEvent _stateChangedEvent;
public ILibraryAppletAccessor(Horizon system)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetAppletStateChangedEvent },
- { 10, Start },
- { 30, GetResult },
- { 100, PushInData },
- { 101, PopOutData }
- };
-
_stateChangedEvent = new KEvent(system);
}
+ [Command(0)]
+ // GetAppletStateChangedEvent() -> handle<copy>
public long GetAppletStateChangedEvent(ServiceCtx context)
{
_stateChangedEvent.ReadableEvent.Signal();
@@ -45,6 +33,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(10)]
+ // Start()
public long Start(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -52,6 +42,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(30)]
+ // GetResult()
public long GetResult(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -59,6 +51,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(100)]
+ // PushInData(object<nn::am::service::IStorage>)
public long PushInData(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -66,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(101)]
+ // PopOutData() -> object<nn::am::service::IStorage>
public long PopOutData(ServiceCtx context)
{
MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams()));
diff --git a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs
index 3f88c545..785472a7 100644
--- a/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/ILibraryAppletCreator.cs
@@ -1,23 +1,11 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class ILibraryAppletCreator : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public ILibraryAppletCreator()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, CreateLibraryApplet },
- { 10, CreateStorage }
- };
- }
+ public ILibraryAppletCreator() { }
+ [Command(0)]
+ // CreateLibraryApplet(u32, u32) -> object<nn::am::service::ILibraryAppletAccessor>
public long CreateLibraryApplet(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletAccessor(context.Device.System));
@@ -25,6 +13,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(10)]
+ // CreateStorage(u64) -> object<nn::am::service::IStorage>
public long CreateStorage(ServiceCtx context)
{
long size = context.RequestData.ReadInt64();
diff --git a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs
index 47ae207b..6207cd12 100644
--- a/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/ISelfController.cs
@@ -3,16 +3,11 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Threading;
using System;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class ISelfController : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private KEvent _libraryAppletLaunchableEvent;
private KEvent _accumulatedSuspendedTickChangedEvent;
@@ -22,54 +17,11 @@ namespace Ryujinx.HLE.HOS.Services.Am
public ISelfController(Horizon system)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, Exit },
- { 1, LockExit },
- { 2, UnlockExit },
- //{ 3, EnterFatalSection }, // 2.0.0+
- //{ 4, LeaveFatalSection }, // 2.0.0+
- { 9, GetLibraryAppletLaunchableEvent },
- { 10, SetScreenShotPermission },
- { 11, SetOperationModeChangedNotification },
- { 12, SetPerformanceModeChangedNotification },
- { 13, SetFocusHandlingMode },
- { 14, SetRestartMessageEnabled },
- //{ 15, SetScreenShotAppletIdentityInfo }, // 2.0.0+
- { 16, SetOutOfFocusSuspendingEnabled }, // 2.0.0+
- //{ 17, SetControllerFirmwareUpdateSection }, // 3.0.0+
- //{ 18, SetRequiresCaptureButtonShortPressedMessage }, // 3.0.0+
- { 19, SetScreenShotImageOrientation }, // 3.0.0+
- //{ 20, SetDesirableKeyboardLayout }, // 4.0.0+
- //{ 40, CreateManagedDisplayLayer },
- //{ 41, IsSystemBufferSharingEnabled }, // 4.0.0+
- //{ 42, GetSystemSharedLayerHandle }, // 4.0.0+
- //{ 43, GetSystemSharedBufferHandle }, // 5.0.0+
- { 50, SetHandlesRequestToDisplay },
- //{ 51, ApproveToDisplay },
- //{ 60, OverrideAutoSleepTimeAndDimmingTime },
- //{ 61, SetMediaPlaybackState },
- { 62, SetIdleTimeDetectionExtension },
- { 63, GetIdleTimeDetectionExtension },
- //{ 64, SetInputDetectionSourceSet },
- //{ 65, ReportUserIsActive }, // 2.0.0+
- //{ 66, GetCurrentIlluminance }, // 3.0.0+
- //{ 67, IsIlluminanceAvailable }, // 3.0.0+
- //{ 68, SetAutoSleepDisabled }, // 5.0.0+
- //{ 69, IsAutoSleepDisabled }, // 5.0.0+
- //{ 70, ReportMultimediaError }, // 4.0.0+
- //{ 71, GetCurrentIlluminanceEx }, // 5.0.0+
- //{ 80, SetWirelessPriorityMode }, // 4.0.0+
- //{ 90, GetAccumulatedSuspendedTickValue }, // 6.0.0+
- { 91, GetAccumulatedSuspendedTickChangedEvent }, // 6.0.0+
- //{ 100, SetAlbumImageTakenNotificationEnabled }, // 7.0.0+
- //{ 110, SetApplicationAlbumUserData }, // 8.0.0+
- //{ 1000, GetDebugStorageChannel }, // 7.0.0+
- };
-
_libraryAppletLaunchableEvent = new KEvent(system);
}
+ [Command(0)]
+ // Exit()
public long Exit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -77,6 +29,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1)]
+ // LockExit()
public long LockExit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -84,6 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(2)]
+ // UnlockExit()
public long UnlockExit(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -91,6 +47,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(9)]
+ // GetLibraryAppletLaunchableEvent() -> handle<copy>
public long GetLibraryAppletLaunchableEvent(ServiceCtx context)
{
_libraryAppletLaunchableEvent.ReadableEvent.Signal();
@@ -107,6 +65,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(10)]
+ // SetScreenShotPermission(u32)
public long SetScreenShotPermission(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -116,6 +76,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(11)]
+ // SetOperationModeChangedNotification(b8)
public long SetOperationModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -125,6 +87,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(12)]
+ // SetPerformanceModeChangedNotification(b8)
public long SetPerformanceModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -134,6 +98,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(13)]
+ // SetFocusHandlingMode(b8, b8, b8)
public long SetFocusHandlingMode(ServiceCtx context)
{
bool flag1 = context.RequestData.ReadByte() != 0;
@@ -145,6 +111,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(14)]
+ // SetRestartMessageEnabled(b8)
public long SetRestartMessageEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -154,6 +122,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(16)] // 2.0.0+
+ // SetOutOfFocusSuspendingEnabled(b8)
public long SetOutOfFocusSuspendingEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -163,6 +133,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(19)] // 3.0.0+
public long SetScreenShotImageOrientation(ServiceCtx context)
{
int orientation = context.RequestData.ReadInt32();
@@ -172,6 +143,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(50)]
+ // SetHandlesRequestToDisplay(b8)
public long SetHandlesRequestToDisplay(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
@@ -181,6 +154,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(62)]
// SetIdleTimeDetectionExtension(u32)
public long SetIdleTimeDetectionExtension(ServiceCtx context)
{
@@ -191,6 +165,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(63)]
// GetIdleTimeDetectionExtension() -> u32
public long GetIdleTimeDetectionExtension(ServiceCtx context)
{
@@ -201,6 +176,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(91)] // 6.0.0+
// GetAccumulatedSuspendedTickChangedEvent() -> handle<copy>
public long GetAccumulatedSuspendedTickChangedEvent(ServiceCtx context)
{
@@ -221,4 +197,4 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
}
-}
+} \ No newline at end of file
diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs
index aff9c5da..edc196af 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IStorage.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IStorage.cs
@@ -1,26 +1,16 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorage : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
public byte[] Data { get; private set; }
public IStorage(byte[] data)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, Open }
- };
-
Data = data;
}
+ [Command(0)]
+ // Open() -> object<nn::am::service::IStorageAccessor>
public long Open(ServiceCtx context)
{
MakeObject(context, new IStorageAccessor(this));
diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs
index ac44e444..8bb5805e 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs
@@ -1,29 +1,18 @@
-using Ryujinx.HLE.HOS.Ipc;
using System;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IStorageAccessor : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
private IStorage _storage;
public IStorageAccessor(IStorage storage)
{
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetSize },
- { 10, Write },
- { 11, Read }
- };
-
_storage = storage;
}
+ [Command(0)]
+ // GetSize() -> u64
public long GetSize(ServiceCtx context)
{
context.ResponseData.Write((long)_storage.Data.Length);
@@ -31,6 +20,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(10)]
+ // Write(u64, buffer<bytes, 0x21>)
public long Write(ServiceCtx context)
{
// TODO: Error conditions.
@@ -55,6 +46,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(11)]
+ // Read(u64) -> buffer<bytes, 0x22>
public long Read(ServiceCtx context)
{
// TODO: Error conditions.
diff --git a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs
index e8a442ae..b7f97a3b 100644
--- a/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/ISystemAppletProxy.cs
@@ -1,31 +1,11 @@
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
-
namespace Ryujinx.HLE.HOS.Services.Am
{
class ISystemAppletProxy : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public ISystemAppletProxy()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 0, GetCommonStateGetter },
- { 1, GetSelfController },
- { 2, GetWindowController },
- { 3, GetAudioController },
- { 4, GetDisplayController },
- { 11, GetLibraryAppletCreator },
- { 20, GetHomeMenuFunctions },
- { 21, GetGlobalStateController },
- { 22, GetApplicationCreator },
- { 1000, GetDebugFunctions }
- };
- }
+ public ISystemAppletProxy() { }
+ [Command(0)]
+ // GetCommonStateGetter() -> object<nn::am::service::ICommonStateGetter>
public long GetCommonStateGetter(ServiceCtx context)
{
MakeObject(context, new ICommonStateGetter(context.Device.System));
@@ -33,6 +13,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1)]
+ // GetSelfController() -> object<nn::am::service::ISelfController>
public long GetSelfController(ServiceCtx context)
{
MakeObject(context, new ISelfController(context.Device.System));
@@ -40,6 +22,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(2)]
+ // GetWindowController() -> object<nn::am::service::IWindowController>
public long GetWindowController(ServiceCtx context)
{
MakeObject(context, new IWindowController());
@@ -47,6 +31,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(3)]
+ // GetAudioController() -> object<nn::am::service::IAudioController>
public long GetAudioController(ServiceCtx context)
{
MakeObject(context, new IAudioController());
@@ -54,6 +40,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(4)]
+ // GetDisplayController() -> object<nn::am::service::IDisplayController>
public long GetDisplayController(ServiceCtx context)
{
MakeObject(context, new IDisplayController());
@@ -61,6 +49,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(11)]
+ // GetLibraryAppletCreator() -> object<nn::am::service::ILibraryAppletCreator>
public long GetLibraryAppletCreator(ServiceCtx context)
{
MakeObject(context, new ILibraryAppletCreator());
@@ -68,6 +58,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(20)]
+ // GetHomeMenuFunctions() -> object<nn::am::service::IHomeMenuFunctions>
public long GetHomeMenuFunctions(ServiceCtx context)
{
MakeObject(context, new IHomeMenuFunctions(context.Device.System));
@@ -75,6 +67,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(21)]
+ // GetGlobalStateController() -> object<nn::am::service::IGlobalStateController>
public long GetGlobalStateController(ServiceCtx context)
{
MakeObject(context, new IGlobalStateController());
@@ -82,6 +76,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(22)]
+ // GetApplicationCreator() -> object<nn::am::service::IApplicationCreator>
public long GetApplicationCreator(ServiceCtx context)
{
MakeObject(context, new IApplicationCreator());
@@ -89,6 +85,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(1000)]
+ // GetDebugFunctions() -> object<nn::am::service::IDebugFunctions>
public long GetDebugFunctions(ServiceCtx context)
{
MakeObject(context, new IDebugFunctions());
diff --git a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs
index 94a53480..5d05356e 100644
--- a/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs
+++ b/Ryujinx.HLE/HOS/Services/Am/IWindowController.cs
@@ -1,24 +1,13 @@
using Ryujinx.Common.Logging;
-using Ryujinx.HLE.HOS.Ipc;
-using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Am
{
class IWindowController : IpcService
{
- private Dictionary<int, ServiceProcessRequest> _commands;
-
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
-
- public IWindowController()
- {
- _commands = new Dictionary<int, ServiceProcessRequest>
- {
- { 1, GetAppletResourceUserId },
- { 10, AcquireForegroundRights }
- };
- }
+ public IWindowController() { }
+ [Command(1)]
+ // GetAppletResourceUserId() -> nn::applet::AppletResourceUserId
public long GetAppletResourceUserId(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);
@@ -28,6 +17,8 @@ namespace Ryujinx.HLE.HOS.Services.Am
return 0;
}
+ [Command(10)]
+ // AcquireForegroundRights()
public long AcquireForegroundRights(ServiceCtx context)
{
Logger.PrintStub(LogClass.ServiceAm);