summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hid/emulated_controller.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 5587ee097..71364c323 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -11,6 +11,11 @@
11namespace Core::HID { 11namespace Core::HID {
12constexpr s32 HID_JOYSTICK_MAX = 0x7fff; 12constexpr s32 HID_JOYSTICK_MAX = 0x7fff;
13constexpr s32 HID_TRIGGER_MAX = 0x7fff; 13constexpr s32 HID_TRIGGER_MAX = 0x7fff;
14// Use a common UUID for TAS and Virtual Gamepad
15constexpr Common::UUID TAS_UUID =
16 Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
17constexpr Common::UUID VIRTUAL_UUID =
18 Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
14 19
15EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(npad_id_type_) {} 20EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(npad_id_type_) {}
16 21
@@ -348,10 +353,6 @@ void EmulatedController::ReloadInput() {
348 } 353 }
349 } 354 }
350 355
351 // Use a common UUID for TAS
352 static constexpr Common::UUID TAS_UUID = Common::UUID{
353 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
354
355 // Register TAS devices. No need to force update 356 // Register TAS devices. No need to force update
356 for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { 357 for (std::size_t index = 0; index < tas_button_devices.size(); ++index) {
357 if (!tas_button_devices[index]) { 358 if (!tas_button_devices[index]) {
@@ -377,10 +378,6 @@ void EmulatedController::ReloadInput() {
377 }); 378 });
378 } 379 }
379 380
380 // Use a common UUID for Virtual Gamepad
381 static constexpr Common::UUID VIRTUAL_UUID = Common::UUID{
382 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
383
384 // Register virtual devices. No need to force update 381 // Register virtual devices. No need to force update
385 for (std::size_t index = 0; index < virtual_button_devices.size(); ++index) { 382 for (std::size_t index = 0; index < virtual_button_devices.size(); ++index) {
386 if (!virtual_button_devices[index]) { 383 if (!virtual_button_devices[index]) {
@@ -780,7 +777,12 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback,
780 777
781 // Only read stick values that have the same uuid or are over the threshold to avoid flapping 778 // Only read stick values that have the same uuid or are over the threshold to avoid flapping
782 if (controller.stick_values[index].uuid != uuid) { 779 if (controller.stick_values[index].uuid != uuid) {
783 if (!stick_value.down && !stick_value.up && !stick_value.left && !stick_value.right) { 780 const bool is_tas = uuid == TAS_UUID;
781 if (is_tas && stick_value.x.value == 0 && stick_value.y.value == 0) {
782 return;
783 }
784 if (!is_tas && !stick_value.down && !stick_value.up && !stick_value.left &&
785 !stick_value.right) {
784 return; 786 return;
785 } 787 }
786 } 788 }