Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[hid_core] Code cleanup (#4461)

MaranBr87d2f03c39bc
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp
index 1092970ee8..7b4af13232 100644
--- a/src/hid_core/frontend/emulated_controller.cpp
+++ b/src/hid_core/frontend/emulated_controller.cpp
@@ -761,9 +761,6 @@ void EmulatedController::StartMotionCalibration() {
}
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;
}
@@ -916,21 +913,10 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
break;
}
- if (!is_connected) {
- if (npad_type == NpadStyleIndex::Handheld) {
- if (npad_id_type == NpadIdType::Handheld) {
- Connect();
- controller_connected[player_index] = true;
- }
- } else if (npad_type != NpadStyleIndex::Handheld) {
- if (npad_id_type == NpadIdType::Player1) {
- Connect();
- controller_connected[player_index] = true;
- } else if (player.connected && !controller_connected[player_index]) {
- Connect();
- controller_connected[player_index] = true;
- }
- }
+ const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
+ const auto& player = Settings::values.players.GetValue()[player_index];
+ if (player.connected) {
+ Connect();
}
TriggerOnChange(ControllerTriggerType::Button, true);
diff --git a/src/hid_core/frontend/emulated_controller.h b/src/hid_core/frontend/emulated_controller.h
index 7a2291b8a4..80ea633c63 100644
--- a/src/hid_core/frontend/emulated_controller.h
+++ b/src/hid_core/frontend/emulated_controller.h
@@ -22,7 +22,6 @@
#include "common/settings.h"
#include "common/vector_math.h"
#include "hid_core/frontend/motion_input.h"
-#include "hid_core/hid_core.h"
#include "hid_core/hid_types.h"
#include "hid_core/irsensor/irs_types.h"
@@ -585,7 +584,6 @@ private:
std::array<VibrationValue, 2> last_vibration_value{DEFAULT_VIBRATION_VALUE,
DEFAULT_VIBRATION_VALUE};
std::array<std::chrono::steady_clock::time_point, 2> last_vibration_timepoint{};
- std::array<bool, HIDCore::available_controllers> controller_connected{};
// Atomically synched values
std::atomic<HID::NpadStyleIndex> npad_type{HID::NpadStyleIndex::None};