Mercurial > repos > blastem
diff render_sdl.c @ 1355:03cb4dd2499f
Load extra controller mappings from gamecontrollerdb.txt
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 10 May 2017 22:06:59 -0700 |
parents | baaf05fd64c4 |
children | 8c6d2ed3b959 |
line wrap: on
line diff
--- a/render_sdl.c Wed May 10 19:32:13 2017 -0700 +++ b/render_sdl.c Wed May 10 22:06:59 2017 -0700 @@ -488,6 +488,15 @@ 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);