mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-02 02:34:21 +01:00
service: hid: Free npad applet resource
This commit is contained in:
parent
f049453dd6
commit
0ac777460d
@ -508,13 +508,8 @@ void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) {
|
|||||||
Result result = GetResourceManager()->RegisterAppletResourceUserId(
|
Result result = GetResourceManager()->RegisterAppletResourceUserId(
|
||||||
parameters.applet_resource_user_id, parameters.enable_input);
|
parameters.applet_resource_user_id, parameters.enable_input);
|
||||||
|
|
||||||
if (result.IsSuccess()) {
|
|
||||||
// result = GetResourceManager()->GetNpad()->RegisterAppletResourceUserId(
|
|
||||||
// parameters.applet_resource_user_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidSystemServer::UnregisterAppletResourceUserId(HLERequestContext& ctx) {
|
void IHidSystemServer::UnregisterAppletResourceUserId(HLERequestContext& ctx) {
|
||||||
@ -524,8 +519,6 @@ void IHidSystemServer::UnregisterAppletResourceUserId(HLERequestContext& ctx) {
|
|||||||
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
GetResourceManager()->UnregisterAppletResourceUserId(applet_resource_user_id);
|
GetResourceManager()->UnregisterAppletResourceUserId(applet_resource_user_id);
|
||||||
// GetResourceManager()->GetNpad()->UnregisterAppletResourceUserId(applet_resource_user_id);
|
|
||||||
// GetResourceManager()->GetPalma()->UnregisterAppletResourceUserId(applet_resource_user_id);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
@ -314,6 +314,7 @@ 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);
|
npad->UnregisterAppletResourceUserId(aruid);
|
||||||
|
// palma->UnregisterAppletResourceUserId(aruid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ResourceManager::GetSharedMemoryHandle(Kernel::KSharedMemory** out_handle, u64 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) {
|
void ResourceManager::FreeAppletResourceId(u64 aruid) {
|
||||||
std::scoped_lock lock{shared_mutex};
|
std::scoped_lock lock{shared_mutex};
|
||||||
applet_resource->FreeAppletResourceId(aruid);
|
applet_resource->FreeAppletResourceId(aruid);
|
||||||
|
npad->FreeAppletResourceId(aruid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceManager::EnableInput(u64 aruid, bool is_enabled) {
|
void ResourceManager::EnableInput(u64 aruid, bool is_enabled) {
|
||||||
|
@ -117,6 +117,10 @@ Result NPad::ActivateNpadResource(u64 aruid) {
|
|||||||
return npad_resource.Activate(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) {
|
void NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx) {
|
||||||
if (type == Core::HID::ControllerTriggerType::All) {
|
if (type == Core::HID::ControllerTriggerType::All) {
|
||||||
ControllerUpdate(Core::HID::ControllerTriggerType::Connected, controller_idx);
|
ControllerUpdate(Core::HID::ControllerTriggerType::Connected, controller_idx);
|
||||||
|
@ -58,6 +58,8 @@ public:
|
|||||||
Result ActivateNpadResource();
|
Result ActivateNpadResource();
|
||||||
Result ActivateNpadResource(u64 aruid);
|
Result ActivateNpadResource(u64 aruid);
|
||||||
|
|
||||||
|
void FreeAppletResourceId(u64 aruid);
|
||||||
|
|
||||||
// When the controller is requesting an update for the shared memory
|
// When the controller is requesting an update for the shared memory
|
||||||
void OnUpdate(const Core::Timing::CoreTiming& core_timing);
|
void OnUpdate(const Core::Timing::CoreTiming& core_timing);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ Result NPadResource::RegisterAppletResourceUserId(u64 aruid) {
|
|||||||
void NPadResource::UnregisterAppletResourceUserId(u64 aruid) {
|
void NPadResource::UnregisterAppletResourceUserId(u64 aruid) {
|
||||||
const u64 aruid_index = GetIndexFromAruid(aruid);
|
const u64 aruid_index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
DestroyStyleSetUpdateEvents(aruid);
|
FreeAppletResourceId(aruid);
|
||||||
if (aruid_index < AruidIndexMax) {
|
if (aruid_index < AruidIndexMax) {
|
||||||
state[aruid_index] = {};
|
state[aruid_index] = {};
|
||||||
registration_list.flag[aruid_index] = RegistrationStatus::PendingDelete;
|
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);
|
const u64 aruid_index = GetIndexFromAruid(aruid);
|
||||||
|
|
||||||
if (aruid_index >= AruidIndexMax) {
|
if (aruid_index >= AruidIndexMax) {
|
||||||
return;
|
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) {
|
if (!controller_state.is_styleset_update_event_initialized) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
Result RegisterAppletResourceUserId(u64 aruid);
|
Result RegisterAppletResourceUserId(u64 aruid);
|
||||||
void UnregisterAppletResourceUserId(u64 aruid);
|
void UnregisterAppletResourceUserId(u64 aruid);
|
||||||
|
|
||||||
void DestroyStyleSetUpdateEvents(u64 aruid);
|
void FreeAppletResourceId(u64 aruid);
|
||||||
|
|
||||||
Result Activate(u64 aruid);
|
Result Activate(u64 aruid);
|
||||||
Result Activate();
|
Result Activate();
|
||||||
|
Loading…
Reference in New Issue
Block a user