diff options
| author | Ac_K <Acoustik666@gmail.com> | 2020-03-04 04:41:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-04 00:41:41 -0300 |
| commit | 25c3b8b3564bb7c3c353b5ea2171200f9ebfa2ca (patch) | |
| tree | d68968becf7507584790bf17fd18fc970bced580 | |
| parent | cecbd256a5b95cce815fcbbffc40b3898c319d9f (diff) | |
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
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs | 48 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Am/ResultCode.cs | 13 |
2 files changed, 55 insertions, 6 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs index 62f1beec..d7abfdfe 100644 --- a/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs @@ -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) diff --git a/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs index 2ff83d7f..a5e27071 100644 --- a/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs +++ b/Ryujinx.HLE/HOS/Services/Am/ResultCode.cs @@ -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 } }
\ No newline at end of file |
