fix ASAN error in sdl_impl.cpp (#7427)
This commit is contained in:
parent
0c40c10022
commit
3c9157b1ec
1 changed files with 13 additions and 11 deletions
|
@ -429,6 +429,7 @@ Common::ParamPackage SDLState::GetSDLControllerButtonBindByGUID(
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 6)
|
#if SDL_VERSION_ATLEAST(2, 0, 6)
|
||||||
{
|
{
|
||||||
|
if (mapped_button != SDL_CONTROLLER_BUTTON_INVALID) {
|
||||||
const SDL_ExtendedGameControllerBind extended_bind =
|
const SDL_ExtendedGameControllerBind extended_bind =
|
||||||
controller->bindings[mapped_button];
|
controller->bindings[mapped_button];
|
||||||
if (extended_bind.input.axis.axis_max < extended_bind.input.axis.axis_min) {
|
if (extended_bind.input.axis.axis_max < extended_bind.input.axis.axis_min) {
|
||||||
|
@ -436,12 +437,13 @@ Common::ParamPackage SDLState::GetSDLControllerButtonBindByGUID(
|
||||||
} else {
|
} else {
|
||||||
params.Set("direction", "+");
|
params.Set("direction", "+");
|
||||||
}
|
}
|
||||||
params.Set(
|
params.Set("threshold", (extended_bind.input.axis.axis_min +
|
||||||
"threshold",
|
(extended_bind.input.axis.axis_max -
|
||||||
(extended_bind.input.axis.axis_min +
|
extended_bind.input.axis.axis_min) /
|
||||||
(extended_bind.input.axis.axis_max - extended_bind.input.axis.axis_min) / 2.0f) /
|
2.0f) /
|
||||||
SDL_JOYSTICK_AXIS_MAX);
|
SDL_JOYSTICK_AXIS_MAX);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
params.Set("direction", "+"); // lacks extended_bind, so just a guess
|
params.Set("direction", "+"); // lacks extended_bind, so just a guess
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue