mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
InputCommon/SDL: Fix incorrect use of std::vector::assign() and check bounds.
This commit is contained in:
@ -354,13 +354,16 @@ GameController::GameController(SDL_GameController* const gamecontroller,
|
|||||||
case SDL_CONTROLLER_BINDTYPE_NONE:
|
case SDL_CONTROLLER_BINDTYPE_NONE:
|
||||||
return;
|
return;
|
||||||
case SDL_CONTROLLER_BINDTYPE_BUTTON:
|
case SDL_CONTROLLER_BINDTYPE_BUTTON:
|
||||||
is_button_mapped.assign(bind.value.button, true);
|
if (bind.value.button >= 0 && bind.value.button < n_legacy_buttons)
|
||||||
|
is_button_mapped[bind.value.button] = true;
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLER_BINDTYPE_AXIS:
|
case SDL_CONTROLLER_BINDTYPE_AXIS:
|
||||||
is_axis_mapped.assign(bind.value.axis, true);
|
if (bind.value.axis >= 0 && bind.value.axis < n_legacy_axes)
|
||||||
|
is_axis_mapped[bind.value.axis] = true;
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLER_BINDTYPE_HAT:
|
case SDL_CONTROLLER_BINDTYPE_HAT:
|
||||||
is_hat_mapped.assign(bind.value.hat.hat, true);
|
if (bind.value.hat.hat >= 0 && bind.value.hat.hat < n_legacy_hats)
|
||||||
|
is_hat_mapped[bind.value.hat.hat] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user