From c3c18ab355b4b42f7a5689c35e8cf6de60706bd0 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 10 May 2017 22:06:59 -0700 Subject: Load extra controller mappings from gamecontrollerdb.txt --- render_sdl.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'render_sdl.c') 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); -- cgit v1.2.3