Mercurial > repos > blastem
diff render_sdl.c @ 2018:193b804c9845
Add a UI button to reset config to defaults
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 09 Nov 2020 00:29:47 -0800 |
parents | 66f08024d9e9 |
children | 0757da8ee702 |
line wrap: on
line diff
--- a/render_sdl.c Sat Nov 07 18:27:34 2020 -0800 +++ b/render_sdl.c Mon Nov 09 00:29:47 2020 -0800 @@ -1203,6 +1203,19 @@ atexit(render_quit); } + +void render_reset_mappings(void) +{ + SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER); + SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); + 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); + debug_message("Added %d game controller mappings from gamecontrollerdb.txt\n", added); + } +} static int in_toggle; void render_config_updated(void)