summaryrefslogtreecommitdiff
path: root/render_sdl.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2020-11-09 00:29:47 -0800
committerMichael Pavone <pavone@retrodev.com>2020-11-09 00:29:47 -0800
commit4ddbae8255a0f223846c86b41d8b4e4cdcc1d8e2 (patch)
tree9013ab6232989a3cb8861209e46bbf6a26c6ffa1 /render_sdl.c
parent73a30109f67c3d168684ab26f10e9f51df676528 (diff)
Add a UI button to reset config to defaults
Diffstat (limited to 'render_sdl.c')
-rwxr-xr-xrender_sdl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/render_sdl.c b/render_sdl.c
index 81c2675..4099d5d 100755
--- a/render_sdl.c
+++ b/render_sdl.c
@@ -1203,6 +1203,19 @@ void render_init(int width, int height, char * title, uint8_t fullscreen)
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)