Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50154 Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/winebus.sys/bus_sdl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index feac5acf950..19c6f23e071 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -1024,8 +1024,15 @@ static DWORD CALLBACK deviceloop_thread(void *args) { HKEY key; static const WCHAR szPath[] = {'m','a','p',0}; + const char *mapping;
- if (!RegOpenKeyExW(driver_key, szPath, 0, KEY_QUERY_VALUE, &key)) + if ((mapping = getenv("SDL_GAMECONTROLLERCONFIG"))) + { + TRACE("Setting environment mapping %s\n", debugstr_a(mapping)); + if (pSDL_GameControllerAddMapping(mapping) < 0) + WARN("Failed to add environment mapping %s\n", pSDL_GetError()); + } + else if (!RegOpenKeyExW(driver_key, szPath, 0, KEY_QUERY_VALUE, &key)) { DWORD index = 0; CHAR *buffer = NULL; @@ -1054,8 +1061,9 @@ static DWORD CALLBACK deviceloop_thread(void *args)
if (rc == STATUS_SUCCESS) { - TRACE("Setting mapping %s...\n",debugstr_an(buffer,29)); - pSDL_GameControllerAddMapping(buffer); + TRACE("Setting registry mapping %s\n", debugstr_a(buffer)); + if (pSDL_GameControllerAddMapping(buffer) < 0) + WARN("Failed to add registry mapping %s\n", pSDL_GetError()); index ++; } } while (rc == STATUS_SUCCESS);