From c674e828773bbcabbf2960fd726a9f2f25ea0620 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Wed, 4 Jun 2025 14:41:18 +0200 Subject: [PATCH 1/6] test 1: add an event handle --- .../ApplicationProxy/IApplicationFunctions.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs index 8648b0642..caf1c3a4c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs @@ -31,11 +31,13 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati private readonly KEvent _friendInvitationStorageChannelEvent; private readonly KEvent _notificationStorageChannelEvent; private readonly KEvent _healthWarningDisappearedSystemEvent; + private readonly KEvent _unknownEvent; private int _gpuErrorDetectedSystemEventHandle; private int _friendInvitationStorageChannelEventHandle; private int _notificationStorageChannelEventHandle; private int _healthWarningDisappearedSystemEventHandle; + private int _unknownEventHandle; private bool _gamePlayRecordingState; @@ -50,6 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati _friendInvitationStorageChannelEvent = new KEvent(system.KernelContext); _notificationStorageChannelEvent = new KEvent(system.KernelContext); _healthWarningDisappearedSystemEvent = new KEvent(system.KernelContext); + _unknownEvent = new KEvent(system.KernelContext); _horizon = system.LibHacHorizonManager.AmClient; } @@ -647,6 +650,25 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati return ResultCode.Success; } + + [CommandCmif(210)] + // GetUnknownEvent() -> handle + public ResultCode GetUnknownEvent(ServiceCtx context) + { + if (_unknownEventHandle == 0) + { + if (context.Process.HandleTable.GenerateHandle(_unknownEvent.ReadableEvent, out _unknownEventHandle) != Result.Success) + { + throw new InvalidOperationException("Out of handles!"); + } + } + + context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_unknownEventHandle); + + Logger.Stub?.PrintStub(LogClass.ServiceAm); + + return ResultCode.Success; + } [CommandCmif(1001)] // 10.0.0+ // PrepareForJit() From 65baa5a04cf2434356ca13e255b593453b1bc05b Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Wed, 4 Jun 2025 20:52:44 +0200 Subject: [PATCH 2/6] remove stub --- .../ApplicationProxy/IApplicationFunctions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs index caf1c3a4c..eaf3a73bb 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs @@ -665,8 +665,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_unknownEventHandle); - Logger.Stub?.PrintStub(LogClass.ServiceAm); - return ResultCode.Success; } From 936e055dfd3dc77d66debcabd7d7a25eb79c72c1 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Mon, 23 Jun 2025 01:34:18 +0200 Subject: [PATCH 3/6] Add version comment --- .../ApplicationProxy/IApplicationFunctions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs index eaf3a73bb..9986bf824 100644 --- a/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs +++ b/src/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs @@ -651,7 +651,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati return ResultCode.Success; } - [CommandCmif(210)] + [CommandCmif(210)] // 20.0.0+ // GetUnknownEvent() -> handle public ResultCode GetUnknownEvent(ServiceCtx context) { From b32bc6495229d3691dae324c373a733a84c5b5cb Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Mon, 23 Jun 2025 01:34:35 +0200 Subject: [PATCH 4/6] fix spelling --- .../Services/Hid/Types/SharedMemory/Common/RingLifo.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs index 99f2f59e4..50e5e3bc3 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/RingLifo.cs @@ -39,9 +39,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common public ref AtomicStorage GetCurrentAtomicEntryRef() { - ulong countAvailaible = Math.Min(Math.Max(0, ReadCurrentCount()), 1); + ulong countAvailable = Math.Min(Math.Max(0, ReadCurrentCount()), 1); - if (countAvailaible == 0) + if (countAvailable == 0) { _storage[0] = default; @@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common while (true) { - int inputEntryIndex = (int)((index + MaxEntries + 1 - countAvailaible) % MaxEntries); + int inputEntryIndex = (int)((index + MaxEntries + 1 - countAvailable) % MaxEntries); ref AtomicStorage result = ref _storage[inputEntryIndex]; @@ -61,9 +61,9 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common if (samplingNumber0 != samplingNumber1 && (result.SamplingNumber - result.SamplingNumber) != 1) { - ulong tempCount = Math.Min(ReadCurrentCount(), countAvailaible); + ulong tempCount = Math.Min(ReadCurrentCount(), countAvailable); - countAvailaible = Math.Min(tempCount, 1); + countAvailable = Math.Min(tempCount, 1); index = ReadCurrentIndex(); continue; From 6ffd10a3270f35d2b3656d49d4f1e9ed39d58fa1 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Mon, 23 Jun 2025 01:34:45 +0200 Subject: [PATCH 5/6] add missing field --- .../Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs index f79a2657e..c518cf95d 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Npad/NpadInternalState.cs @@ -41,6 +41,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad public NpadLarkType LarkTypeRight; public NpadLuciaType LuciaType; public uint Unknown43EC; + public ulong SixAxisSensorPropertiesArray; [StructLayout(LayoutKind.Sequential, Size = 123, Pack = 1)] private struct Reserved2Struct { } From e984b0d1e7f1edcd09d02334b31d702ee18a5796 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Mon, 23 Jun 2025 01:38:17 +0200 Subject: [PATCH 6/6] TotK boots with overriden audio REV15 --- .../Hid/Types/SharedMemory/Common/ISampledDataStruct.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs index 312075bc4..5a6aab495 100644 --- a/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs +++ b/src/Ryujinx.HLE/HOS/Services/Hid/Types/SharedMemory/Common/ISampledDataStruct.cs @@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common ulong value = BinaryPrimitives.ReadUInt64LittleEndian(byteSpan); - return value; + return value << 1; } private static int GetSamplingNumberFieldOffset(ref T sampledDataStruct) where T : unmanaged, ISampledDataStruct