Check for wine_get_version() to detect Wine/Proton
If this application is being run under Wine but Steam doesn't know that, Steam won't set STEAM_COMPAT_PROTON. So we'll use wine_get_version() to detect that we're running under Wine instead.
This commit is contained in:
@@ -325,6 +325,24 @@ static BOOL IsWindowsBuildVersionAtLeast(DWORD dwBuildNumber)
|
|||||||
return result;
|
return result;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BOOL WIN_IsWine(void)
|
||||||
|
{
|
||||||
|
static bool checked;
|
||||||
|
static bool is_wine;
|
||||||
|
|
||||||
|
if (!checked) {
|
||||||
|
HMODULE ntdll = LoadLibrary(TEXT("ntdll.dll"));
|
||||||
|
if (ntdll) {
|
||||||
|
if (GetProcAddress(ntdll, "wine_get_version") != NULL) {
|
||||||
|
is_wine = true;
|
||||||
|
}
|
||||||
|
FreeLibrary(ntdll);
|
||||||
|
}
|
||||||
|
checked = true;
|
||||||
|
}
|
||||||
|
return is_wine;
|
||||||
|
}
|
||||||
|
|
||||||
// this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!),
|
// this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!),
|
||||||
// so there's no "OrGreater" as that would always be TRUE. The other functions are here to
|
// so there's no "OrGreater" as that would always be TRUE. The other functions are here to
|
||||||
// ask "can we support a specific feature?" but this function is here to ask "do we need to do
|
// ask "can we support a specific feature?" but this function is here to ask "do we need to do
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ extern void WIN_CoUninitialize(void);
|
|||||||
extern HRESULT WIN_RoInitialize(void);
|
extern HRESULT WIN_RoInitialize(void);
|
||||||
extern void WIN_RoUninitialize(void);
|
extern void WIN_RoUninitialize(void);
|
||||||
|
|
||||||
|
// Returns true if we're running on Wine
|
||||||
|
extern BOOL WIN_IsWine(void);
|
||||||
|
|
||||||
// Returns true if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"!
|
// Returns true if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"!
|
||||||
extern BOOL WIN_IsWindowsXP(void);
|
extern BOOL WIN_IsWindowsXP(void);
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,11 @@
|
|||||||
#include "hidapi/SDL_hidapi_sinput.h"
|
#include "hidapi/SDL_hidapi_sinput.h"
|
||||||
#include "../events/SDL_events_c.h"
|
#include "../events/SDL_events_c.h"
|
||||||
|
|
||||||
|
#ifdef SDL_PLATFORM_WIN32
|
||||||
#ifdef SDL_PLATFORM_ANDROID
|
#include "../core/windows/SDL_windows.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Many gamepads turn the center button into an instantaneous button press
|
// Many gamepads turn the center button into an instantaneous button press
|
||||||
#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250
|
#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250
|
||||||
|
|
||||||
@@ -3262,10 +3263,10 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
|
|||||||
|
|
||||||
#ifdef SDL_PLATFORM_WIN32
|
#ifdef SDL_PLATFORM_WIN32
|
||||||
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
|
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
|
||||||
SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) {
|
WIN_IsWine()) {
|
||||||
// We are launched by Steam and running under Proton
|
// We are launched by Steam and running under Proton or Wine
|
||||||
// We can't tell whether this controller is a Steam Virtual Gamepad,
|
// We can't tell whether this controller is a Steam Virtual Gamepad,
|
||||||
// so assume that Proton is doing the appropriate filtering of controllers
|
// so assume that is doing the appropriate filtering of controllers
|
||||||
// and anything we see here is fine to use.
|
// and anything we see here is fine to use.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user