mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-18 19:41:01 +01:00
service: hid: Handle pending delete
This commit is contained in:
parent
12fd2ae86d
commit
edfbf363de
3 changed files with 18 additions and 21 deletions
|
@ -224,6 +224,7 @@ Result ResourceManager::RegisterAppletResourceUserId(u64 aruid, bool bool_value)
|
||||||
void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) {
|
void ResourceManager::UnregisterAppletResourceUserId(u64 aruid) {
|
||||||
std::scoped_lock lock{shared_mutex};
|
std::scoped_lock lock{shared_mutex};
|
||||||
applet_resource->UnregisterAppletResourceUserId(aruid);
|
applet_resource->UnregisterAppletResourceUserId(aruid);
|
||||||
|
npad->UnregisterAppletResourceUserId(aruid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
|
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
|
||||||
|
|
|
@ -87,7 +87,9 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input
|
||||||
data_index = i;
|
data_index = i;
|
||||||
break;
|
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;
|
data_index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -104,30 +106,22 @@ Result AppletResource::RegisterAppletResourceUserId(u64 aruid, bool enable_input
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletResource::UnregisterAppletResourceUserId(u64 aruid) {
|
void AppletResource::UnregisterAppletResourceUserId(u64 aruid) {
|
||||||
u64 index = GetIndexFromAruid(aruid);
|
const u64 index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
if (index < AruidIndexMax) {
|
if (index >= AruidIndexMax) {
|
||||||
if (data[index].flag.is_assigned) {
|
return;
|
||||||
data[index].shared_memory_format = nullptr;
|
|
||||||
data[index].flag.is_assigned.Assign(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
index = GetIndexFromAruid(aruid);
|
FreeAppletResourceId(aruid);
|
||||||
if (index < AruidIndexMax) {
|
DestroySevenSixAxisTransferMemory();
|
||||||
DestroySevenSixAxisTransferMemory();
|
data[index].flag.raw = 0;
|
||||||
data[index].flag.raw = 0;
|
data[index].aruid = 0;
|
||||||
data[index].aruid = 0;
|
|
||||||
|
|
||||||
index = GetIndexFromAruid(aruid);
|
registration_list.flag[index] = RegistrationStatus::PendingDelete;
|
||||||
if (index < AruidIndexMax) {
|
|
||||||
registration_list.flag[index] = RegistrationStatus::PendingDelete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletResource::FreeAppletResourceId(u64 aruid) {
|
void AppletResource::FreeAppletResourceId(u64 aruid) {
|
||||||
u64 index = GetIndexFromAruid(aruid);
|
const u64 index = GetIndexFromAruid(aruid);
|
||||||
if (index >= AruidIndexMax) {
|
if (index >= AruidIndexMax) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +138,7 @@ u64 AppletResource::GetActiveAruid() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
|
Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 aruid) {
|
||||||
u64 index = GetIndexFromAruid(aruid);
|
const u64 index = GetIndexFromAruid(aruid);
|
||||||
if (index >= AruidIndexMax) {
|
if (index >= AruidIndexMax) {
|
||||||
return ResultAruidNotRegistered;
|
return ResultAruidNotRegistered;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +149,7 @@ Result AppletResource::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle,
|
||||||
|
|
||||||
Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format,
|
Result AppletResource::GetSharedMemoryFormat(SharedMemoryFormat** out_shared_memory_format,
|
||||||
u64 aruid) {
|
u64 aruid) {
|
||||||
u64 index = GetIndexFromAruid(aruid);
|
const u64 index = GetIndexFromAruid(aruid);
|
||||||
if (index >= AruidIndexMax) {
|
if (index >= AruidIndexMax) {
|
||||||
return ResultAruidNotRegistered;
|
return ResultAruidNotRegistered;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,9 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) {
|
||||||
data_index = i;
|
data_index = i;
|
||||||
break;
|
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;
|
data_index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue