mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-05 07:39:17 +00:00
InputCommon/SDL: Check for errors from SDL_JoystickNumButtons(), SDL_JoystickNumAxes(), SDL_JoystickNumHats().
This commit is contained in:
parent
959c39133b
commit
d657ad5932
1 changed files with 18 additions and 0 deletions
|
@ -342,8 +342,26 @@ GameController::GameController(SDL_GameController* const gamecontroller,
|
||||||
|
|
||||||
// If a Joystick Button has a GameController equivalent, don't detect it
|
// If a Joystick Button has a GameController equivalent, don't detect it
|
||||||
int n_legacy_buttons = SDL_JoystickNumButtons(joystick);
|
int n_legacy_buttons = SDL_JoystickNumButtons(joystick);
|
||||||
|
if (n_legacy_buttons < 0)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Error in SDL_JoystickNumButtons(): {}", SDL_GetError());
|
||||||
|
n_legacy_buttons = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int n_legacy_axes = SDL_JoystickNumAxes(joystick);
|
int n_legacy_axes = SDL_JoystickNumAxes(joystick);
|
||||||
|
if (n_legacy_axes < 0)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Error in SDL_JoystickNumAxes(): {}", SDL_GetError());
|
||||||
|
n_legacy_axes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int n_legacy_hats = SDL_JoystickNumHats(joystick);
|
int n_legacy_hats = SDL_JoystickNumHats(joystick);
|
||||||
|
if (n_legacy_hats < 0)
|
||||||
|
{
|
||||||
|
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Error in SDL_JoystickNumHats(): {}", SDL_GetError());
|
||||||
|
n_legacy_hats = 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<bool> is_button_mapped(n_legacy_buttons);
|
std::vector<bool> is_button_mapped(n_legacy_buttons);
|
||||||
std::vector<bool> is_axis_mapped(n_legacy_axes);
|
std::vector<bool> is_axis_mapped(n_legacy_axes);
|
||||||
std::vector<bool> is_hat_mapped(n_legacy_hats);
|
std::vector<bool> is_hat_mapped(n_legacy_hats);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue