summaryrefslogtreecommitdiffstats
path: root/src/hid_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/hid_core')
-rw-r--r--src/hid_core/resource_manager.cpp2
-rw-r--r--src/hid_core/resources/npad/npad.cpp4
-rw-r--r--src/hid_core/resources/npad/npad.h2
-rw-r--r--src/hid_core/resources/npad/npad_resource.cpp10
-rw-r--r--src/hid_core/resources/npad/npad_resource.h2
5 files changed, 16 insertions, 4 deletions
diff --git a/src/hid_core/resource_manager.cpp b/src/hid_core/resource_manager.cpp
index 245da582e..01261ba97 100644
--- a/src/hid_core/resource_manager.cpp
+++ b/src/hid_core/resource_manager.cpp
@@ -314,6 +314,7 @@ void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) {
std::scoped_lock lock{shared_mutex};
applet_resource->UnregisterAppletResourceUserId(aruid);
npad->UnregisterAppletResourceUserId(aruid);
+ // palma->UnregisterAppletResourceUserId(aruid);
}
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
@@ -324,6 +325,7 @@ Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle
void ResourceManager::FreeAppletResourceId(u64 aruid) {
std::scoped_lock lock{shared_mutex};
applet_resource->FreeAppletResourceId(aruid);
+ npad->FreeAppletResourceId(aruid);
}
void ResourceManager::EnableInput(u64 aruid, bool is_enabled) {
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index 053625b55..e10e97e1c 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -117,6 +117,10 @@ Result NPad::ActivateNpadResource(u64 aruid) {
return npad_resource.Activate(aruid);
}
+void NPad::FreeAppletResourceId(u64 aruid) {
+ return npad_resource.FreeAppletResourceId(aruid);
+}
+
void NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx) {
if (type == Core::HID::ControllerTriggerType::All) {
ControllerUpdate(Core::HID::ControllerTriggerType::Connected, controller_idx);
diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h
index c63488346..99e761127 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -58,6 +58,8 @@ public:
Result ActivateNpadResource();
Result ActivateNpadResource(u64 aruid);
+ void FreeAppletResourceId(u64 aruid);
+
// When the controller is requesting an update for the shared memory
void OnUpdate(const Core::Timing::CoreTiming& core_timing);
diff --git a/src/hid_core/resources/npad/npad_resource.cpp b/src/hid_core/resources/npad/npad_resource.cpp
index 8dd86b58e..79f7d74c0 100644
--- a/src/hid_core/resources/npad/npad_resource.cpp
+++ b/src/hid_core/resources/npad/npad_resource.cpp
@@ -67,7 +67,7 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) {
void NPadResource::UnregisterAppletResourceUserId(u64 aruid) {
const u64 aruid_index = GetIndexFromAruid(aruid);
- DestroyStyleSetUpdateEvents(aruid);
+ FreeAppletResourceId(aruid);
if (aruid_index < AruidIndexMax) {
state[aruid_index] = {};
registration_list.flag[aruid_index] = RegistrationStatus::PendingDelete;
@@ -80,14 +80,18 @@ void NPadResource::UnregisterAppletResourceUserId(u64 aruid) {
}
}
-void NPadResource::DestroyStyleSetUpdateEvents(u64 aruid) {
+void NPadResource::FreeAppletResourceId(u64 aruid) {
const u64 aruid_index = GetIndexFromAruid(aruid);
if (aruid_index >= AruidIndexMax) {
return;
}
- for (auto& controller_state : state[aruid_index].controller_state) {
+ auto& aruid_data = state[aruid_index];
+
+ aruid_data.flag.is_assigned.Assign(false);
+
+ for (auto& controller_state : aruid_data.controller_state) {
if (!controller_state.is_styleset_update_event_initialized) {
continue;
}
diff --git a/src/hid_core/resources/npad/npad_resource.h b/src/hid_core/resources/npad/npad_resource.h
index aed89eec6..8ee5702fd 100644
--- a/src/hid_core/resources/npad/npad_resource.h
+++ b/src/hid_core/resources/npad/npad_resource.h
@@ -55,7 +55,7 @@ public:
Result RegisterAppletResourceUserId(u64 aruid);
void UnregisterAppletResourceUserId(u64 aruid);
- void DestroyStyleSetUpdateEvents(u64 aruid);
+ void FreeAppletResourceId(u64 aruid);
Result Activate(u64 aruid);
Result Activate();