Manual DS4 mode: Allow Back/Select to trigger Touchpad click (#1772)

Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
Erick C
2023-10-22 15:03:33 -04:00
committed by GitHub
parent 5b052d7c2c
commit 3212b036a1
5 changed files with 48 additions and 1 deletions
+2
View File
@@ -418,6 +418,7 @@ namespace config {
platf::supported_gamepads().front().data(),
platf::supported_gamepads().front().size(),
}, // Default gamepad
true, // back as touchpad click enabled (manual DS4 only)
true, // keyboard enabled
true, // mouse enabled
@@ -1041,6 +1042,7 @@ namespace config {
}
string_restricted_f(vars, "gamepad"s, input.gamepad, platf::supported_gamepads());
bool_f(vars, "ds4_back_as_touchpad_click", input.ds4_back_as_touchpad_click);
bool_f(vars, "mouse", input.mouse);
bool_f(vars, "keyboard", input.keyboard);
+1
View File
@@ -112,6 +112,7 @@ namespace config {
std::chrono::duration<double> key_repeat_period;
std::string gamepad;
bool ds4_back_as_touchpad_click;
bool keyboard;
bool mouse;
+4 -1
View File
@@ -1174,7 +1174,7 @@ namespace platf {
BOOST_LOG(info) << "Gamepad " << id.globalIndex << " will be Xbox 360 controller (manual selection)"sv;
selectedGamepadType = Xbox360Wired;
}
else if (config::input.gamepad == "ps4"sv || config::input.gamepad == "ds4"sv) {
else if (config::input.gamepad == "ds4"sv) {
BOOST_LOG(info) << "Gamepad " << id.globalIndex << " will be DualShock 4 controller (manual selection)"sv;
selectedGamepadType = DualShock4Wired;
}
@@ -1334,6 +1334,9 @@ namespace platf {
// Allow either PS4/PS5 clickpad button or Xbox Series X share button to activate DS4 clickpad
if (gamepad_state.buttonFlags & (TOUCHPAD_BUTTON | MISC_BUTTON)) buttons |= DS4_SPECIAL_BUTTON_TOUCHPAD;
// Manual DS4 emulation: check if BACK button should also trigger DS4 touchpad click
if (config::input.gamepad == "ds4"sv && config::input.ds4_back_as_touchpad_click && (gamepad_state.buttonFlags & BACK)) buttons |= DS4_SPECIAL_BUTTON_TOUCHPAD;
return (DS4_SPECIAL_BUTTONS) buttons;
}