| Summary: | SDL_GameControllerAddMapping update problem | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Bob Ombo <bombo> |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | NEW --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | bombo |
| Version: | 2.0.9 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Example code for SDL_GameControllerAddMapping() | ||
Actually the same happens if i just call SDL_GameControllerAddMapping() ONCE, then just close and reopen the controller: SDL_GameControllerClose(controller); controller=SDL_GameControllerOpen(0); The map is saved: SDL_GameControllerMapping(controller) does show the correct map. Just some axis and buttons are wrong now. OK i finally found out what the problem was: 1. The mapping was wrong 2. The controller did work because it didn't use the wrong map, but default mapping instead If you do controller=SDL_GameControllerOpen(0); SDL_GameControllerAddMapping(mappingString); the mapping will not be active! So always do it the other way round: SDL_GameControllerAddMapping(mappingString); controller=SDL_GameControllerOpen(0); So unless this is a bug, and SDL_GameControllerAddMapping should work even when the controller is opened already, this bug can be closed. |
Created attachment 3625 [details] Example code for SDL_GameControllerAddMapping() The map doesn't seem to survive a second SDL_GameControllerAddMapping() SDL_GameControllerAddMapping const char *mappingString="..." // first add my map amr=SDL_GameControllerAddMapping(mappingString); // (added) everything works as expected! // just do it a second time amr=SDL_GameControllerAddMapping(mappingString); // (updated) now some axis and buttons are wrong (Complete example attached.)