diff --git a/src/Ryujinx.Horizon/Am/Ipc/Controllers/GlobalStateController.cs b/src/Ryujinx.Horizon/Am/Ipc/Controllers/GlobalStateController.cs new file mode 100644 index 000000000..391fc9ef8 --- /dev/null +++ b/src/Ryujinx.Horizon/Am/Ipc/Controllers/GlobalStateController.cs @@ -0,0 +1,125 @@ +using Ryujinx.Common.Logging; +using Ryujinx.Horizon.Common; +using Ryujinx.Horizon.Sdk.Am; +using Ryujinx.Horizon.Sdk.Am.Controllers; +using Ryujinx.Horizon.Sdk.Sf; + +namespace Ryujinx.Horizon.Am.Ipc.Controllers +{ + partial class GlobalStateController : IGlobalStateController + { + [CmifCommand(0)] + public Result RequestToEnterSleep() + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return AmResult.Stubbed; + } + + [CmifCommand(1)] + public Result EnterSleep() + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return AmResult.Stubbed; + } + + [CmifCommand(2)] + public Result StartSleepSequence(bool arg0) + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(3)] + public Result StartShutdownSequence() + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(4)] + public Result StartRebootSequence() + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(9)] + public Result IsAutoPowerDownRequested(out bool arg0) + { + arg0 = false; + // Uses #idle:sys cmd1 + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(10)] + public Result LoadAndApplyIdlePolicySettings() + { + // Uses #idle:sys cmd LoadAndApplySettings + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(11)] + public Result NotifyCecSettingsChanged() + { + // Uses #omm cmd NotifyCecSettingsChanged + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(12)] + public Result SetDefaultHomeButtonLongPressTime(long arg0) + { + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(13)] + public Result UpdateDefaultDisplayResolution() + { + // Uses #omm cmd UpdateDefaultDisplayResolution + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(14)] + public Result ShouldSleepOnBoot(out bool arg0) + { + arg0 = false; + // Uses #omm cmd ShouldSleepOnBoot + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(15)] + public Result GetHdcpAuthenticationFailedEvent(out int arg0) + { + arg0 = 0; + // Uses #omm cmd GetHdcpAuthenticationFailedEvent + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + + [CmifCommand(30)] + public Result OpenCradleFirmwareUpdater(out ICradleFirmwareUpdater arg0) + { + arg0 = new CradleFirmwareUpdater(); + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return Result.Success; + } + } +} diff --git a/src/Ryujinx.Horizon/Am/Ipc/Proxies/LibraryAppletProxy.cs b/src/Ryujinx.Horizon/Am/Ipc/Proxies/LibraryAppletProxy.cs index 1dfe5a700..36bfcf563 100644 --- a/src/Ryujinx.Horizon/Am/Ipc/Proxies/LibraryAppletProxy.cs +++ b/src/Ryujinx.Horizon/Am/Ipc/Proxies/LibraryAppletProxy.cs @@ -87,9 +87,11 @@ namespace Ryujinx.Horizon.Am.Ipc.Proxies } [CmifCommand(23)] - public Result GetGlobalStateController() + public Result GetGlobalStateController(out IGlobalStateController globalStateController) { - throw new System.NotImplementedException(); + globalStateController = new GlobalStateController(); + + return Result.Success; } [CmifCommand(1000)] diff --git a/src/Ryujinx.Horizon/Am/Ipc/Storage/Storage.cs b/src/Ryujinx.Horizon/Am/Ipc/Storage/Storage.cs index 8b475c2e6..c0fc66e7f 100644 --- a/src/Ryujinx.Horizon/Am/Ipc/Storage/Storage.cs +++ b/src/Ryujinx.Horizon/Am/Ipc/Storage/Storage.cs @@ -1,4 +1,3 @@ -using Ryujinx.Common.Logging; using Ryujinx.Horizon.Common; using Ryujinx.Horizon.Sdk.Am.Storage; using Ryujinx.Horizon.Sdk.Sf; diff --git a/src/Ryujinx.Horizon/Am/Ipc/Storage/StorageChannel.cs b/src/Ryujinx.Horizon/Am/Ipc/Storage/StorageChannel.cs index 2c9137aae..190a8ecdb 100644 --- a/src/Ryujinx.Horizon/Am/Ipc/Storage/StorageChannel.cs +++ b/src/Ryujinx.Horizon/Am/Ipc/Storage/StorageChannel.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; namespace Ryujinx.Horizon.Am.Ipc.Storage { + // Might not be used outside of debug software partial class StorageChannel : IStorageChannel { private readonly Stack _storages; diff --git a/src/Ryujinx.Horizon/Sdk/Am/AmResult.cs b/src/Ryujinx.Horizon/Sdk/Am/AmResult.cs index 877dea9eb..5865e9fa8 100644 --- a/src/Ryujinx.Horizon/Sdk/Am/AmResult.cs +++ b/src/Ryujinx.Horizon/Sdk/Am/AmResult.cs @@ -23,5 +23,6 @@ namespace Ryujinx.Horizon.Sdk.Am public static Result StackPoolExhausted => new(Moduleld, 712); public static Result DebugModeNotEnabled => new(Moduleld, 974); public static Result DevFunctionNotEnabled => new(Moduleld, 980); + public static Result Stubbed => new(Moduleld, 999); } } diff --git a/src/Ryujinx.Horizon/Sdk/Am/Controllers/IGlobalStateController.cs b/src/Ryujinx.Horizon/Sdk/Am/Controllers/IGlobalStateController.cs new file mode 100644 index 000000000..a171c30ea --- /dev/null +++ b/src/Ryujinx.Horizon/Sdk/Am/Controllers/IGlobalStateController.cs @@ -0,0 +1,22 @@ +using Ryujinx.Horizon.Common; +using Ryujinx.Horizon.Sdk.Sf; + +namespace Ryujinx.Horizon.Sdk.Am.Controllers +{ + interface IGlobalStateController : IServiceObject + { + Result RequestToEnterSleep(); + Result EnterSleep(); + Result StartSleepSequence(bool arg0); + Result StartShutdownSequence(); + Result StartRebootSequence(); + Result IsAutoPowerDownRequested(out bool arg0); + Result LoadAndApplyIdlePolicySettings(); + Result NotifyCecSettingsChanged(); + Result SetDefaultHomeButtonLongPressTime(long arg0); + Result UpdateDefaultDisplayResolution(); + Result ShouldSleepOnBoot(out bool arg0); + Result GetHdcpAuthenticationFailedEvent(out int arg0); + Result OpenCradleFirmwareUpdater(out ICradleFirmwareUpdater arg0); + } +} diff --git a/src/Ryujinx.Horizon/Sdk/Am/Proxies/ILibraryAppletProxy.cs b/src/Ryujinx.Horizon/Sdk/Am/Proxies/ILibraryAppletProxy.cs index ffbb90acf..3220bf3de 100644 --- a/src/Ryujinx.Horizon/Sdk/Am/Proxies/ILibraryAppletProxy.cs +++ b/src/Ryujinx.Horizon/Sdk/Am/Proxies/ILibraryAppletProxy.cs @@ -16,7 +16,7 @@ namespace Ryujinx.Horizon.Sdk.Am.Proxies Result OpenLibraryAppletSelfAccessor(out ILibraryAppletSelfAccessor libraryAppletSelfAccessor); Result GetAppletCommonFunctions(out IAppletCommonFunctions appletCommonFunctions); Result GetHomeMenuFunctions(); - Result GetGlobalStateController(); + Result GetGlobalStateController(out IGlobalStateController globalStateController); Result GetDebugFunctions(out IDebugFunctions debugFunctions); } }