|
|
@@ -760,11 +760,14 @@ void EmulatedController::StartMotionCalibration() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index,
|
|
|
- Common::UUID uuid) {
|
|
|
- if (index >= controller.button_values.size()) {
|
|
|
+void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, Common::UUID uuid) {
|
|
|
+ const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
|
|
|
+ const auto& player = Settings::values.players.GetValue()[player_index];
|
|
|
+
|
|
|
+ if (index >= controller.button_values.size()) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
std::unique_lock lock{mutex};
|
|
|
bool value_changed = false;
|
|
|
const auto new_status = TransformToButton(callback);
|
|
|
@@ -917,13 +920,8 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
|
|
|
|
|
|
lock.unlock();
|
|
|
|
|
|
- if (!is_connected) {
|
|
|
- if (npad_id_type == NpadIdType::Player1 && npad_type != NpadStyleIndex::Handheld) {
|
|
|
- Connect();
|
|
|
- }
|
|
|
- if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) {
|
|
|
- Connect();
|
|
|
- }
|
|
|
+ if (player.connected) {
|
|
|
+ Connect();
|
|
|
}
|
|
|
TriggerOnChange(ControllerTriggerType::Button, true);
|
|
|
}
|