diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-01-07 03:51:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-07 03:51:22 +0100 |
commit | 71fbc87dbd1d828dd6e008a2d397d5733843b124 (patch) | |
tree | 80bc1dbba75b26c38630f9db81f218dee6c8a71b /src/hid_core/resources/applet_resource.cpp | |
parent | Merge pull request #12582 from german77/hid-core (diff) | |
parent | service: hid: Handle pending delete (diff) | |
download | yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar.gz yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar.bz2 yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar.lz yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar.xz yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.tar.zst yuzu-71fbc87dbd1d828dd6e008a2d397d5733843b124.zip |
Diffstat (limited to 'src/hid_core/resources/applet_resource.cpp')
-rw-r--r-- | src/hid_core/resources/applet_resource.cpp | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/hid_core/resources/applet_resource.cpp b/src/hid_core/resources/applet_resource.cpp index d16cff1a4..d09a525c6 100644 --- a/src/hid_core/resources/applet_resource.cpp +++ b/src/hid_core/resources/applet_resource.cpp @@ -87,7 +87,9 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input data_index = i; break; } - if (registration_list.flag[i] == RegistrationStatus::None) { + // TODO: Don't Handle pending delete here + if (registration_list.flag[i] == RegistrationStatus::None || + registration_list.flag[i] == RegistrationStatus::PendingDelete) { data_index = i; break; } @@ -104,30 +106,22 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input } void AppletResource::UnregisterAppletResourceUserId(u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - if (data[index].flag.is_assigned) { - data[index].shared_memory_format = nullptr; - data[index].flag.is_assigned.Assign(false); - } + if (index >= AruidIndexMax) { + return; } - index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - DestroySevenSixAxisTransferMemory(); - data[index].flag.raw = 0; - data[index].aruid = 0; + FreeAppletResourceId(aruid); + DestroySevenSixAxisTransferMemory(); + data[index].flag.raw = 0; + data[index].aruid = 0; - index = GetIndexFromAruid(aruid); - if (index < AruidIndexMax) { - registration_list.flag[index] = RegistrationStatus::PendingDelete; - } - } + registration_list.flag[index] = RegistrationStatus::PendingDelete; } void AppletResource::FreeAppletResourceId(u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return; } @@ -144,7 +138,7 @@ u64 AppletResource::GetActiveAruid() { } Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return ResultAruidNotRegistered; } @@ -155,7 +149,7 @@ Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format, u64 aruid) { - u64 index = GetIndexFromAruid(aruid); + const u64 index = GetIndexFromAruid(aruid); if (index >= AruidIndexMax) { return ResultAruidNotRegistered; } |