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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-11-24 12:22:01 +01:00 committed by Alexandre Julliard
parent 6ce03d9313
commit 3a007a95e8
1 changed files with 11 additions and 3 deletions

View File

@ -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);