Fixed VID/PID list parsing of SDL_HINT_GAMECONTROLLER_SENSOR_FUSION
Fixes https://github.com/libsdl-org/SDL/issues/11118
This commit is contained in:
parent
5db64300b8
commit
81b48de3f5
1 changed files with 19 additions and 26 deletions
|
@ -888,9 +888,6 @@ static bool IsROGAlly(SDL_Joystick *joystick)
|
||||||
|
|
||||||
static bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, bool *invert_sensors)
|
static bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, bool *invert_sensors)
|
||||||
{
|
{
|
||||||
const char *hint;
|
|
||||||
int hint_value;
|
|
||||||
|
|
||||||
SDL_AssertJoysticksLocked();
|
SDL_AssertJoysticksLocked();
|
||||||
|
|
||||||
*invert_sensors = false;
|
*invert_sensors = false;
|
||||||
|
@ -905,16 +902,9 @@ static bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, bool *invert_senso
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hint = SDL_GetHint(SDL_HINT_GAMECONTROLLER_SENSOR_FUSION);
|
const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLER_SENSOR_FUSION);
|
||||||
hint_value = SDL_GetStringInteger(hint, -1);
|
if (hint && *hint) {
|
||||||
if (hint_value > 0) {
|
if (*hint == '@' || SDL_strncmp(hint, "0x", 2) == 0) {
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (hint_value == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hint) {
|
|
||||||
SDL_vidpid_list gamepads;
|
SDL_vidpid_list gamepads;
|
||||||
SDL_GUID guid;
|
SDL_GUID guid;
|
||||||
Uint16 vendor, product;
|
Uint16 vendor, product;
|
||||||
|
@ -930,6 +920,9 @@ static bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, bool *invert_senso
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return SDL_GetStringBoolean(hint, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if this is another known wraparound gamepad
|
// See if this is another known wraparound gamepad
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue