Skip to content

Commit b797a84

Browse files
committed
Don't check SteamVirtualGamepadInfo when running as Wine
Wine will ignore the Steam Virtual Gamepad if it looks like it has the original (blocked) controller VID/PID. Fixes libsdl-org#14410 (cherry picked from commit 493bc62)
1 parent 45b0460 commit b797a84

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/joystick/SDL_steam_virtual_gamepad.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include "SDL_joystick_c.h"
2424
#include "SDL_steam_virtual_gamepad.h"
2525

26+
#ifdef SDL_PLATFORM_LINUX
27+
#include "../core/unix/SDL_appid.h"
28+
#endif
2629
#ifdef SDL_PLATFORM_WIN32
2730
#include "../core/windows/SDL_windows.h"
2831
#else
@@ -134,6 +137,15 @@ void SDL_InitSteamVirtualGamepadInfo(void)
134137

135138
file = SDL_GetHint(SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
136139
if (file && *file) {
140+
#ifdef SDL_PLATFORM_LINUX
141+
// Older versions of Wine will blacklist the Steam Virtual Gamepad if
142+
// it appears to have the real controller's VID/PID, so ignore this.
143+
const char *exe = SDL_GetExeName();
144+
if (exe && SDL_strcmp(exe, "wine64-preloader") == 0) {
145+
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Wine launched by Steam, ignoring %s", SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
146+
return;
147+
}
148+
#endif
137149
SDL_steam_virtual_gamepad_info_file = SDL_strdup(file);
138150
}
139151
SDL_UpdateSteamVirtualGamepadInfo();

0 commit comments

Comments
 (0)