|
|
@@ -33,6 +33,7 @@
|
|
|
#include "hidapi/SDL_hidapi_nintendo.h"
|
|
|
#include "hidapi/SDL_hidapi_sinput.h"
|
|
|
#include "../events/SDL_events_c.h"
|
|
|
+#include "../SDL_hints_c.h"
|
|
|
|
|
|
#ifdef SDL_PLATFORM_WIN32
|
|
|
#include "../core/windows/SDL_windows.h"
|
|
|
@@ -2616,7 +2617,11 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- value = SDL_GetHintBoolean(hint, default_value);
|
|
|
+ const char *hint_value = SDL_GetHint(hint);
|
|
|
+ if (!hint_value) {
|
|
|
+ hint_value = SDL_getenv_unsafe(hint_value);
|
|
|
+ }
|
|
|
+ value = SDL_GetStringBoolean(hint_value, default_value);
|
|
|
if (negate) {
|
|
|
value = !value;
|
|
|
}
|
|
|
@@ -3235,9 +3240,10 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const char *hint = SDL_getenv_unsafe("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD");
|
|
|
+ bool allow_steam_virtual_gamepad = SDL_GetStringBoolean(hint, false);
|
|
|
#ifdef SDL_PLATFORM_WIN32
|
|
|
- if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
|
|
|
- WIN_IsWine()) {
|
|
|
+ if (allow_steam_virtual_gamepad && WIN_IsWine()) {
|
|
|
// We are launched by Steam and running under Proton or Wine
|
|
|
// We can't tell whether this controller is a Steam Virtual Gamepad,
|
|
|
// so assume that is doing the appropriate filtering of controllers
|
|
|
@@ -3247,7 +3253,7 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
|
|
|
#endif // SDL_PLATFORM_WIN32
|
|
|
|
|
|
if (SDL_IsJoystickSteamVirtualGamepad(vendor_id, product_id, version)) {
|
|
|
- return !SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false);
|
|
|
+ return !allow_steam_virtual_gamepad;
|
|
|
}
|
|
|
|
|
|
if (SDL_allowed_gamepads.num_included_entries > 0) {
|