2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

service: hid: Implement EnableAppletForInput

This commit is contained in:
Narr the Reg 2024-01-21 13:51:50 -06:00
parent 93a3342841
commit 1b984738ab
3 changed files with 17 additions and 2 deletions

View file

@ -533,7 +533,7 @@ void IHidSystemServer::EnableAppletToGetInput(HLERequestContext& ctx) {
parameters.is_enabled, parameters.applet_resource_user_id); parameters.is_enabled, parameters.applet_resource_user_id);
GetResourceManager()->EnableInput(parameters.applet_resource_user_id, parameters.is_enabled); GetResourceManager()->EnableInput(parameters.applet_resource_user_id, parameters.is_enabled);
// GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
@ -596,7 +596,7 @@ void IHidSystemServer::EnableAppletToGetPadInput(HLERequestContext& ctx) {
parameters.is_enabled, parameters.applet_resource_user_id); parameters.is_enabled, parameters.applet_resource_user_id);
GetResourceManager()->EnablePadInput(parameters.applet_resource_user_id, parameters.is_enabled); GetResourceManager()->EnablePadInput(parameters.applet_resource_user_id, parameters.is_enabled);
// GetResourceManager()->GetNpad()->EnableInput(parameters.applet_resource_user_id); GetResourceManager()->GetNpad()->EnableAppletToGetInput(parameters.applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);

View file

@ -480,6 +480,10 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
continue; continue;
} }
if (!data->flag.enable_pad_input) {
continue;
}
RequestPadStateUpdate(aruid, controller.device->GetNpadIdType()); RequestPadStateUpdate(aruid, controller.device->GetNpadIdType());
auto& pad_state = controller.npad_pad_state; auto& pad_state = controller.npad_pad_state;
auto& libnx_state = controller.npad_libnx_state; auto& libnx_state = controller.npad_libnx_state;
@ -1316,4 +1320,13 @@ void NPad::UpdateHandheldAbstractState() {
abstracted_pads[NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld)].Update(); abstracted_pads[NpadIdTypeToIndex(Core::HID::NpadIdType::Handheld)].Update();
} }
void NPad::EnableAppletToGetInput(u64 aruid) {
std::scoped_lock lock{mutex};
std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
for (auto& abstract_pad : abstracted_pads) {
abstract_pad.EnableAppletToGetInput(aruid);
}
}
} // namespace Service::HID } // namespace Service::HID

View file

@ -153,6 +153,8 @@ public:
void UpdateHandheldAbstractState(); void UpdateHandheldAbstractState();
void EnableAppletToGetInput(u64 aruid);
private: private:
struct NpadControllerData { struct NpadControllerData {
NpadInternalState* shared_memory = nullptr; NpadInternalState* shared_memory = nullptr;