mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Add options to control gamepad autoselection heuristics
Also move gamepad type selection to the input tab while we're here
This commit is contained in:
@@ -1188,11 +1188,11 @@ namespace platf {
|
||||
BOOST_LOG(info) << "Gamepad " << id.globalIndex << " will be Xbox 360 controller (auto-selected by client-reported type)"sv;
|
||||
selectedGamepadType = Xbox360Wired;
|
||||
}
|
||||
else if (metadata.capabilities & (LI_CCAP_ACCEL | LI_CCAP_GYRO)) {
|
||||
else if (config::input.motion_as_ds4 && (metadata.capabilities & (LI_CCAP_ACCEL | LI_CCAP_GYRO))) {
|
||||
BOOST_LOG(info) << "Gamepad " << id.globalIndex << " will be DualShock 4 controller (auto-selected by motion sensor presence)"sv;
|
||||
selectedGamepadType = DualShock4Wired;
|
||||
}
|
||||
else if (metadata.capabilities & LI_CCAP_TOUCHPAD) {
|
||||
else if (config::input.touchpad_as_ds4 && (metadata.capabilities & LI_CCAP_TOUCHPAD)) {
|
||||
BOOST_LOG(info) << "Gamepad " << id.globalIndex << " will be DualShock 4 controller (auto-selected by touchpad presence)"sv;
|
||||
selectedGamepadType = DualShock4Wired;
|
||||
}
|
||||
@@ -1201,6 +1201,26 @@ namespace platf {
|
||||
selectedGamepadType = Xbox360Wired;
|
||||
}
|
||||
|
||||
if (selectedGamepadType == Xbox360Wired) {
|
||||
if (metadata.capabilities & (LI_CCAP_ACCEL | LI_CCAP_GYRO)) {
|
||||
BOOST_LOG(warning) << "Gamepad " << id.globalIndex << " has motion sensors, but they are not usable when emulating an Xbox 360 controller"sv;
|
||||
}
|
||||
if (metadata.capabilities & LI_CCAP_TOUCHPAD) {
|
||||
BOOST_LOG(warning) << "Gamepad " << id.globalIndex << " has a touchpad, but it is not usable when emulating an Xbox 360 controller"sv;
|
||||
}
|
||||
if (metadata.capabilities & LI_CCAP_RGB_LED) {
|
||||
BOOST_LOG(warning) << "Gamepad " << id.globalIndex << " has an RGB LED, but it is not usable when emulating an Xbox 360 controller"sv;
|
||||
}
|
||||
}
|
||||
else if (selectedGamepadType == DualShock4Wired) {
|
||||
if (!(metadata.capabilities & (LI_CCAP_ACCEL | LI_CCAP_GYRO))) {
|
||||
BOOST_LOG(warning) << "Gamepad " << id.globalIndex << " is emulating a DualShock 4 controller, but the client gamepad doesn't have motion sensors active"sv;
|
||||
}
|
||||
if (!(metadata.capabilities & LI_CCAP_TOUCHPAD)) {
|
||||
BOOST_LOG(warning) << "Gamepad " << id.globalIndex << " is emulating a DualShock 4 controller, but the client gamepad doesn't have a touchpad"sv;
|
||||
}
|
||||
}
|
||||
|
||||
return raw->vigem->alloc_gamepad_internal(id, feedback_queue, selectedGamepadType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user