add GameControllerDB
mappings before initializing the SDL gamecontroller subsystem
#799
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
controllers that don't have built in mappings and rely on
gamecontrollerdb.txt
mappings were firingSDL_JOYDEVICEADDED
events at boot but notSDL_CONTROLLERDEVICEADDED
eventsThe documentation for
SDL_ControllerDeviceEvent
states:i looked a bit and found we weren't loading
gamecontrollerdb.txt
until after initializing the game controller subsystem, so the "already plugged in" events were firing when the devices weren't recognized as game controllers yet.this PR ensures
SDL_GameControllerAddMappingsFromFile
happens before the subsystem is initialized. i have verified this makes it so we getSDL_CONTROLLERDEVICEADDED
events on boot.relevant discourse post from someone with a similar issue: https://discourse.libsdl.org/t/deviced-added-events-for-devices-plugged-in-at-game-start/55039