mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
service: hid: Ensure state is correct
This commit is contained in:
parent
8fb9f78e83
commit
c8b9467f50
1 changed files with 8 additions and 8 deletions
|
@ -419,9 +419,17 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
|
||||||
std::scoped_lock lock{mutex};
|
std::scoped_lock lock{mutex};
|
||||||
auto& controller = GetControllerFromNpadIdType(npad_id);
|
auto& controller = GetControllerFromNpadIdType(npad_id);
|
||||||
const auto controller_type = controller.device->GetNpadStyleIndex();
|
const auto controller_type = controller.device->GetNpadStyleIndex();
|
||||||
|
|
||||||
|
if (!controller.device->IsConnected() && controller.is_connected) {
|
||||||
|
DisconnectNpad(npad_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!controller.device->IsConnected()) {
|
if (!controller.device->IsConnected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (controller.device->IsConnected() && !controller.is_connected) {
|
||||||
|
InitNewlyAddedController(npad_id);
|
||||||
|
}
|
||||||
|
|
||||||
// This function is unique to yuzu for the turbo buttons and motion to work properly
|
// This function is unique to yuzu for the turbo buttons and motion to work properly
|
||||||
controller.device->StatusUpdate();
|
controller.device->StatusUpdate();
|
||||||
|
@ -736,14 +744,6 @@ void Controller_NPad::SetSupportedStyleSet(Core::HID::NpadStyleTag style_set) {
|
||||||
|
|
||||||
// Once SetSupportedStyleSet is called controllers are fully initialized
|
// Once SetSupportedStyleSet is called controllers are fully initialized
|
||||||
is_controller_initialized = true;
|
is_controller_initialized = true;
|
||||||
|
|
||||||
// Connect all active controllers
|
|
||||||
for (auto& controller : controller_data) {
|
|
||||||
const auto& device = controller.device;
|
|
||||||
if (device->IsConnected()) {
|
|
||||||
AddNewControllerAt(device->GetNpadStyleIndex(), device->GetNpadIdType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
|
Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
|
||||||
|
|
Loading…
Reference in a new issue