mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-17 14:18:44 +02:00
Implement some calls of ISelfController (#965)
* Implement some calls of ISelfController This PR implement some calls of ISelfController: - EnterFatalSection - LeaveFatalSection - GetAccumulatedSuspendedTickValue (close #937) According to RE of the 8.1.0 am service. * thread safe increment/decrement * Fix thread safe * remove unused using
This commit is contained in:
parent
cecbd256a5
commit
25c3b8b356
2 changed files with 55 additions and 6 deletions
|
@ -13,6 +13,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||
private KEvent _accumulatedSuspendedTickChangedEvent;
|
||||
private int _accumulatedSuspendedTickChangedEventHandle = 0;
|
||||
|
||||
private object _fatalSectionLock = new object();
|
||||
private int _fatalSectionCount;
|
||||
|
||||
// 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;
|
||||
|
||||
public ISelfController(Horizon system)
|
||||
|
@ -47,6 +53,39 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(3)] // 2.0.0+
|
||||
// EnterFatalSection()
|
||||
public ResultCode EnterFatalSection(ServiceCtx context)
|
||||
{
|
||||
lock (_fatalSectionLock)
|
||||
{
|
||||
_fatalSectionCount++;
|
||||
}
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(4)] // 2.0.0+
|
||||
// LeaveFatalSection()
|
||||
public ResultCode LeaveFatalSection(ServiceCtx context)
|
||||
{
|
||||
ResultCode result = ResultCode.Success;
|
||||
|
||||
lock (_fatalSectionLock)
|
||||
{
|
||||
if (_fatalSectionCount != 0)
|
||||
{
|
||||
_fatalSectionCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ResultCode.UnbalancedFatalSection;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[Command(9)]
|
||||
// GetLibraryAppletLaunchableEvent() -> handle<copy>
|
||||
public ResultCode GetLibraryAppletLaunchableEvent(ServiceCtx context)
|
||||
|
@ -176,6 +215,15 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(90)] // 6.0.0+
|
||||
// GetAccumulatedSuspendedTickValue() -> u64
|
||||
public ResultCode GetAccumulatedSuspendedTickValue(ServiceCtx context)
|
||||
{
|
||||
context.ResponseData.Write(_accumulatedSuspendedTickValue);
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(91)] // 6.0.0+
|
||||
// GetAccumulatedSuspendedTickChangedEvent() -> handle<copy>
|
||||
public ResultCode GetAccumulatedSuspendedTickChangedEvent(ServiceCtx context)
|
||||
|
|
|
@ -7,11 +7,12 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
|||
|
||||
Success = 0,
|
||||
|
||||
NotAvailable = (2 << ErrorCodeShift) | ModuleId,
|
||||
NoMessages = (3 << ErrorCodeShift) | ModuleId,
|
||||
ObjectInvalid = (500 << ErrorCodeShift) | ModuleId,
|
||||
OutOfBounds = (503 << ErrorCodeShift) | ModuleId,
|
||||
InvalidParameters = (506 << ErrorCodeShift) | ModuleId,
|
||||
NullObject = (518 << ErrorCodeShift) | ModuleId
|
||||
NotAvailable = (2 << ErrorCodeShift) | ModuleId,
|
||||
NoMessages = (3 << ErrorCodeShift) | ModuleId,
|
||||
ObjectInvalid = (500 << ErrorCodeShift) | ModuleId,
|
||||
OutOfBounds = (503 << ErrorCodeShift) | ModuleId,
|
||||
InvalidParameters = (506 << ErrorCodeShift) | ModuleId,
|
||||
UnbalancedFatalSection = (512 << ErrorCodeShift) | ModuleId,
|
||||
NullObject = (518 << ErrorCodeShift) | ModuleId
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue