From 87e26de0fca682e48c21edd98c7636e797f8b2f2 Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 28 Jan 2024 18:26:40 -0600 Subject: service: hid: Restore active aruid --- src/hid_core/resources/applet_resource.cpp | 6 ++++++ src/hid_core/resources/npad/npad_resource.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/hid_core/resources/applet_resource.cpp b/src/hid_core/resources/applet_resource.cpp index db4134037..243beb1c7 100644 --- a/src/hid_core/resources/applet_resource.cpp +++ b/src/hid_core/resources/applet_resource.cpp @@ -118,6 +118,12 @@ void AppletResource::UnregisterAppletResourceUserId(u64 aruid) { data[index].aruid = 0; registration_list.flag[index] = RegistrationStatus::PendingDelete; + + for (std::size_t i = 0; i < AruidIndexMax; i++) { + if (registration_list.flag[i] == RegistrationStatus::Initialized) { + active_aruid = registration_list.aruid[i]; + } + } } void AppletResource::FreeAppletResourceId(u64 aruid) { diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp index ea9fc14ed..8dd86b58e 100644 --- a/src/hid_core/resources/npad/npad_resource.cpp +++ b/src/hid_core/resources/npad/npad_resource.cpp @@ -72,6 +72,12 @@ void NPadResource::UnregisterAppletResourceUserId(u64 aruid) { state[aruid_index] = {}; registration_list.flag[aruid_index] = RegistrationStatus::PendingDelete; } + + for (std::size_t i = 0; i < AruidIndexMax; i++) { + if (registration_list.flag[i] == RegistrationStatus::Initialized) { + active_data_aruid = registration_list.aruid[i]; + } + } } void NPadResource::DestroyStyleSetUpdateEvents(u64 aruid) { -- cgit v1.2.3