Add multiple calls to am service (#1411)

* Add multiple calls to am service

This implement/stub some am calls:

- SetAutoSleepDisabled
- IsAutoSleepDisabled
- SetAlbumImageTakenNotificationEnabled
- EnableApplicationCrashReport
- GetPreviousProgramIndex
- NeedsToExitProcess
- RequestForAppletToGetForeground
- GetIndirectLayerConsumerHandle

All checked by RE.
Additionnaly to that, there is some cleanup here and there.

Fix #1387, #1324, #1165, #1163, #1065

* Fix casting

* Thread safe assign
This commit is contained in:
Ac_K 2020-07-22 06:56:00 +02:00 committed by GitHub
parent 4aa47a66c6
commit c6e12949e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 147 additions and 23 deletions

View file

@ -19,7 +19,18 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// TODO: Set this when the game goes in suspension (go back to home menu ect), we currently don't support that so we can keep it set to 0.
private ulong _accumulatedSuspendedTickValue = 0;
private int _idleTimeDetectionExtension;
// TODO: Determine where those fields are used.
private bool _screenShotPermission = false;
private bool _operationModeChangedNotification = false;
private bool _performanceModeChangedNotification = false;
private bool _restartMessageEnabled = false;
private bool _outOfFocusSuspendingEnabled = false;
private bool _handlesRequestToDisplay = false;
private bool _autoSleepDisabled = false;
private bool _albumImageTakenNotificationEnabled = false;
private uint _screenShotImageOrientation = 0;
private uint _idleTimeDetectionExtension = 0;
public ISelfController(Horizon system)
{
@ -108,9 +119,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetScreenShotPermission(u32)
public ResultCode SetScreenShotPermission(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool screenShotPermission = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { screenShotPermission });
_screenShotPermission = screenShotPermission;
return ResultCode.Success;
}
@ -119,9 +132,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetOperationModeChangedNotification(b8)
public ResultCode SetOperationModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool operationModeChangedNotification = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { operationModeChangedNotification });
_operationModeChangedNotification = operationModeChangedNotification;
return ResultCode.Success;
}
@ -130,9 +145,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetPerformanceModeChangedNotification(b8)
public ResultCode SetPerformanceModeChangedNotification(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool performanceModeChangedNotification = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { performanceModeChangedNotification });
_performanceModeChangedNotification = performanceModeChangedNotification;
return ResultCode.Success;
}
@ -141,11 +158,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetFocusHandlingMode(b8, b8, b8)
public ResultCode SetFocusHandlingMode(ServiceCtx context)
{
bool flag1 = context.RequestData.ReadByte() != 0;
bool flag2 = context.RequestData.ReadByte() != 0;
bool flag3 = context.RequestData.ReadByte() != 0;
bool unknownFlag1 = context.RequestData.ReadBoolean();
bool unknownFlag2 = context.RequestData.ReadBoolean();
bool unknownFlag3 = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { unknownFlag1, unknownFlag2, unknownFlag3 });
return ResultCode.Success;
}
@ -154,9 +171,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetRestartMessageEnabled(b8)
public ResultCode SetRestartMessageEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool restartMessageEnabled = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { restartMessageEnabled });
_restartMessageEnabled = restartMessageEnabled;
return ResultCode.Success;
}
@ -165,19 +184,24 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetOutOfFocusSuspendingEnabled(b8)
public ResultCode SetOutOfFocusSuspendingEnabled(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool outOfFocusSuspendingEnabled = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { outOfFocusSuspendingEnabled });
_outOfFocusSuspendingEnabled = outOfFocusSuspendingEnabled;
return ResultCode.Success;
}
[Command(19)] // 3.0.0+
// SetScreenShotImageOrientation(u32)
public ResultCode SetScreenShotImageOrientation(ServiceCtx context)
{
int orientation = context.RequestData.ReadInt32();
uint screenShotImageOrientation = context.RequestData.ReadUInt32();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { screenShotImageOrientation });
_screenShotImageOrientation = screenShotImageOrientation;
return ResultCode.Success;
}
@ -186,9 +210,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetHandlesRequestToDisplay(b8)
public ResultCode SetHandlesRequestToDisplay(ServiceCtx context)
{
bool enable = context.RequestData.ReadByte() != 0;
bool handlesRequestToDisplay = context.RequestData.ReadBoolean();
Logger.PrintStub(LogClass.ServiceAm);
Logger.PrintStub(LogClass.ServiceAm, new { handlesRequestToDisplay });
_handlesRequestToDisplay = handlesRequestToDisplay;
return ResultCode.Success;
}
@ -197,9 +223,11 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
// SetIdleTimeDetectionExtension(u32)
public ResultCode SetIdleTimeDetectionExtension(ServiceCtx context)
{
_idleTimeDetectionExtension = context.RequestData.ReadInt32();
uint idleTimeDetectionExtension = context.RequestData.ReadUInt32();
Logger.PrintStub(LogClass.ServiceAm, new { _idleTimeDetectionExtension });
Logger.PrintStub(LogClass.ServiceAm, new { idleTimeDetectionExtension });
_idleTimeDetectionExtension = idleTimeDetectionExtension;
return ResultCode.Success;
}
@ -215,6 +243,26 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
return ResultCode.Success;
}
[Command(68)]
// SetAutoSleepDisabled(u8)
public ResultCode SetAutoSleepDisabled(ServiceCtx context)
{
bool autoSleepDisabled = context.RequestData.ReadBoolean();
_autoSleepDisabled = autoSleepDisabled;
return ResultCode.Success;
}
[Command(69)]
// IsAutoSleepDisabled() -> u8
public ResultCode IsAutoSleepDisabled(ServiceCtx context)
{
context.ResponseData.Write(_autoSleepDisabled);
return ResultCode.Success;
}
[Command(90)] // 6.0.0+
// GetAccumulatedSuspendedTickValue() -> u64
public ResultCode GetAccumulatedSuspendedTickValue(ServiceCtx context)
@ -244,5 +292,16 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
return ResultCode.Success;
}
[Command(100)] // 7.0.0+
// SetAlbumImageTakenNotificationEnabled(u8)
public ResultCode SetAlbumImageTakenNotificationEnabled(ServiceCtx context)
{
bool albumImageTakenNotificationEnabled = context.RequestData.ReadBoolean();
_albumImageTakenNotificationEnabled = albumImageTakenNotificationEnabled;
return ResultCode.Success;
}
}
}