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
This commit is contained in:
parent
f723f6f39a
commit
560ccbeb2d
99 changed files with 1035 additions and 1983 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue