Hans Leidekker : winebus.sys: Support setting SDL controller mapping through environment variable.
Alexandre Julliard
julliard at winehq.org
Tue Nov 24 17:01:44 CST 2020
Module: wine
Branch: master
Commit: 3a007a95e86b6a9795a6ab92a53a08acf58e4b2e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3a007a95e86b6a9795a6ab92a53a08acf58e4b2e
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Nov 24 12:22:01 2020 +0100
winebus.sys: Support setting SDL controller mapping through environment variable.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50154
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
More information about the wine-cvs
mailing list