AntiMicroX / antimicrox

Graphical program used to map keyboard buttons and mouse controls to a gamepad. Useful for playing games with no gamepad support.
GNU General Public License v3.0
2.42k stars 140 forks source link

Invalid number of gamepad buttons is showed #582

Open pktiuk opened 1 year ago

pktiuk commented 1 year ago

All of the gamepads in AntiMicroX show wrong number of buttons.

This is caused by hardcoded value of button number for every device recognized as GamePad.

int GameController::getNumberRawButtons() { return SDL_CONTROLLER_BUTTON_MAX; }

Fixing attempt https://github.com/AntiMicroX/antimicrox/pull/555

int GameController::getNumberRawButtons() { return SDL_JoystickNumButtons(m_device); }

caused sudden crashes for some controllers https://github.com/AntiMicroX/antimicrox/issues/579 caused smaller than expected number of buttons (and lack of proper handling of this case)

At first glance, it seems, that SDL API SDL_JoystickNumButtons is broken, because in some cases it shows invalid number of buttons.

Button numbers for gamepad: PS5 Controller SDL_JoystickNumButtons: 13

SDL version: 2.24.0

Example log from this kind of situation:
antimicrox.log

Reported to SDL https://github.com/libsdl-org/SDL/issues/6442


Upvote & Fund

Fund with Polar

imyxh commented 14 hours ago

Relatedly, it's not possible to map the SDL paddle buttons using the mapping GUI. controllermap does it just fine, though.