diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-05-10 22:06:59 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-05-10 22:06:59 -0700 |
commit | c3c18ab355b4b42f7a5689c35e8cf6de60706bd0 (patch) | |
tree | 0c8591e467430ec14367b07ea54c8cdc9c5a363b /render_sdl.c | |
parent | f2eaab22349332249187dac8ab25932209e7f608 (diff) |
Load extra controller mappings from gamecontrollerdb.txt
Diffstat (limited to 'render_sdl.c')
-rwxr-xr-x | render_sdl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/render_sdl.c b/render_sdl.c index e50030b..f993ae5 100755 --- a/render_sdl.c +++ b/render_sdl.c @@ -488,6 +488,15 @@ void render_init(int width, int height, char * title, uint8_t fullscreen) sample_rate = actual.freq; printf("Initialized audio at frequency %d with a %d sample buffer\n", actual.freq, actual.samples); SDL_PauseAudio(0); + + uint32_t db_size; + char *db_data = read_bundled_file("gamecontrollerdb.txt", &db_size); + if (db_data) { + int added = SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem(db_data, db_size), 1); + free(db_data); + info_message("Added %d game controller mappings from gamecontrollerdb.txt\n", added); + } + SDL_JoystickEventState(SDL_ENABLE); atexit(render_quit); |