mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-17 09:21:59 +08:00
windows: vendor GameInput headers
This commit is contained in:
committed by
Anonymous Maarten
parent
331e10c2a3
commit
b048e8e6f8
@@ -244,8 +244,6 @@ class JobDetails:
|
||||
msys2_packages: list[str] = dataclasses.field(default_factory=list)
|
||||
cygwin_packages: list[str] = dataclasses.field(default_factory=list)
|
||||
werror: bool = True
|
||||
microsoft_gameinput: bool = False
|
||||
microsoft_gameinput_arch: str = ""
|
||||
msvc_vcvars_arch: str = ""
|
||||
msvc_vcvars_sdk: str = ""
|
||||
msvc_project: str = ""
|
||||
@@ -316,8 +314,6 @@ class JobDetails:
|
||||
"android-mk": self.android_mk,
|
||||
"werror": self.werror,
|
||||
"sudo": self.sudo,
|
||||
"microsoft-gameinput": self.microsoft_gameinput,
|
||||
"microsoft-gameinput-arch": self.microsoft_gameinput_arch,
|
||||
"msvc-vcvars-arch": self.msvc_vcvars_arch,
|
||||
"msvc-vcvars-sdk": self.msvc_vcvars_sdk,
|
||||
"msvc-project": self.msvc_project,
|
||||
@@ -483,14 +479,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool, ctest_args
|
||||
job.setup_libusb_arch = "x86"
|
||||
case MsvcArch.X64:
|
||||
job.setup_libusb_arch = "x64"
|
||||
job.microsoft_gameinput = True
|
||||
match spec.msvc_arch:
|
||||
case MsvcArch.X64:
|
||||
job.microsoft_gameinput_arch = "x64"
|
||||
case MsvcArch.Arm64:
|
||||
job.microsoft_gameinput_arch = "arm64"
|
||||
job.cflags.append("-I$GAMEINPUT_INCLUDE")
|
||||
job.cxxflags.append("-I$GAMEINPUT_INCLUDE")
|
||||
case SdlPlatform.Linux:
|
||||
if spec.name.startswith("Ubuntu"):
|
||||
assert spec.os.value.startswith("ubuntu-")
|
||||
@@ -827,9 +815,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool, ctest_args
|
||||
job.msys2_packages.append(f"{msys2_env}-clang-tools-extra")
|
||||
if job.ccache:
|
||||
job.msys2_packages.append(f"{msys2_env}-ccache")
|
||||
job.microsoft_gameinput = True
|
||||
job.cflags.append("-I$GAMEINPUT_INCLUDE")
|
||||
job.cxxflags.append("-I$GAMEINPUT_INCLUDE")
|
||||
case SdlPlatform.Cygwin:
|
||||
job.ccache = False # Missing evict-older-than option
|
||||
job.clang_tidy = False # error finding files [clang-diagnostic-error] cause might be space in command path
|
||||
|
||||
@@ -176,13 +176,6 @@ jobs:
|
||||
echo '#error "System SDL headers must not be used by build system"' >"$dest"
|
||||
done
|
||||
done
|
||||
- name: 'Set up Microsoft.GameInput headers'
|
||||
if: ${{ !!matrix.platform.microsoft-gameinput }}
|
||||
run: |
|
||||
python build-scripts/download-gameinput-sdk.py -o $HOME/gameinput
|
||||
echo "GAMEINPUT_INCLUDE=$(cygpath -w "$HOME/gameinput/include")" >>$GITHUB_ENV
|
||||
echo "INCLUDE=$(cygpath -w "$HOME/gameinput/include");$INCLUDE" >>$GITHUB_ENV
|
||||
${{ (!!matrix.platform.microsoft-gameinput-arch && format('echo "LIB=$(cygpath -w "$HOME/gameinput/lib/{0}");$LIB" >>$GITHUB_ENV', matrix.platform.microsoft-gameinput-arch)) || '' }}
|
||||
- name: 'Calculate ccache key'
|
||||
if: ${{ matrix.platform.ccache }}
|
||||
id: prepare-restore-ccache
|
||||
|
||||
+21
-46
@@ -512,14 +512,6 @@ if(SDL_SHARED)
|
||||
SDL_AddCommonCompilerFlags(SDL3-shared)
|
||||
target_compile_definitions(SDL3-shared PRIVATE "$<$<CONFIG:Debug>:DEBUG>")
|
||||
set_property(TARGET SDL3-shared PROPERTY UNITY_BUILD OFF)
|
||||
if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
|
||||
target_compile_features(SDL3-shared PRIVATE c_std_99)
|
||||
else()
|
||||
# tcc does support the subset of C99 used by SDL
|
||||
if (NOT USE_TCC)
|
||||
message(WARNING "target_compile_features does not know c_std_99 for C compiler")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_STATIC)
|
||||
@@ -528,12 +520,13 @@ if(SDL_STATIC)
|
||||
SDL_AddCommonCompilerFlags(SDL3-static)
|
||||
target_compile_definitions(SDL3-static PRIVATE "$<$<CONFIG:Debug>:DEBUG>")
|
||||
set_property(TARGET SDL3-static PROPERTY UNITY_BUILD OFF)
|
||||
if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
|
||||
target_compile_features(SDL3-static PRIVATE c_std_99)
|
||||
else()
|
||||
if (NOT USE_TCC)
|
||||
message(WARNING "target_compile_features does not know c_std_99 for C compiler")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
|
||||
sdl_compile_features(c_std_99)
|
||||
else()
|
||||
if(NOT USE_TCC)
|
||||
message(WARNING "target_compile_features does not know c_std_99 for C compiler")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -2353,40 +2346,22 @@ elseif(WINDOWS OR CYGWIN)
|
||||
int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H
|
||||
)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <gameinput.h>
|
||||
int main(int argc, char **argv) { return 0; }" HAVE_GAMEINPUT_H
|
||||
)
|
||||
if(HAVE_GAMEINPUT_H)
|
||||
set(SDL_GAMEINPUT_DYNAMIC 1)
|
||||
find_library(GAMEINPUT_LIB NAMES "gameinput.lib")
|
||||
if(GAMEINPUT_LIB)
|
||||
cmake_push_check_state()
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${GAMEINPUT_LIB}")
|
||||
check_cxx_source_compiles("
|
||||
#include <windows.h>
|
||||
#include <gameinput.h>
|
||||
#if defined(GAMEINPUT_API_VERSION) && GAMEINPUT_API_VERSION > 0
|
||||
#define STR_JOIN2(A, B) A##B
|
||||
#define STR_JOIN(A, B) STR_JOIN2(A, B)
|
||||
using namespace GameInput::STR_JOIN(v, GAMEINPUT_API_VERSION);
|
||||
#endif
|
||||
int main(int argc, char **argv) {
|
||||
IGameInput *gameInput;
|
||||
HRESULT hr = GameInputCreate(&gameInput);
|
||||
if (SUCCEEDED(hr)) {
|
||||
gameInput->Release();
|
||||
}
|
||||
(void) argc; (void) argv;
|
||||
return 0;
|
||||
}" HAVE_GAMEINPUT_LIB
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
if(HAVE_GAMEINPUT_LIB)
|
||||
sdl_link_dependency(gameinput LIBS gameinput.lib PKG_CONFIG_LINK_OPTIONS -lgameinput)
|
||||
set(SDL_GAMEINPUT_DYNAMIC 0)
|
||||
set(HAVE_GAMEINPUT_H 1)
|
||||
sdl_include_directories(PRIVATE SYSTEM "${SDL3_SOURCE_DIR}/src/core/windows/gameinput")
|
||||
if("cxx_std_11" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/core/windows/gameinput/gameinput.cpp")
|
||||
sdl_compile_features(cxx_std_11)
|
||||
if(USE_GCC OR USE_CLANG)
|
||||
# Avoid a dependency on libstdc++-X.dll for `__gxx_personality_seh0`
|
||||
check_c_compiler_flag(-fno-exceptions COMPILER_SUPPORTS_FNO_EXCEPTIONS)
|
||||
if(COMPILER_SUPPORTS_FNO_EXCEPTIONS)
|
||||
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/core/windows/gameinput/gameinput.cpp" APPEND PROPERTY COMPILE_OPTIONS "-fno-exceptions")
|
||||
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/core/windows/gameinput/gameinput.cpp" PROPERTY SKIP_PRECOMPILE_HEADERS 1)
|
||||
endif()
|
||||
endif()
|
||||
set(SDL_GAMEINPUT_DYNAMIC 0)
|
||||
else()
|
||||
set(SDL_GAMEINPUT_DYNAMIC 1)
|
||||
endif()
|
||||
|
||||
check_include_file(dxgi1_5.h HAVE_DXGI1_5_H)
|
||||
|
||||
+11
-12
@@ -114,22 +114,22 @@
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(ProjectDir)/../../src;$(ProjectDir)/../../src/core/windows;$(ProjectDir)/../../src/core/windows/gameinput;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
@@ -435,6 +435,7 @@
|
||||
<ClInclude Include="..\..\src\camera\SDL_camera_c.h" />
|
||||
<ClInclude Include="..\..\src\camera\SDL_syscamera.h" />
|
||||
<ClInclude Include="..\..\src\core\SDL_core_unsupported.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\gameinput\gameinput.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_directx.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_gameinput.h" />
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_hid.h" />
|
||||
@@ -773,13 +774,11 @@
|
||||
<ClCompile Include="..\..\src\audio\SDL_wave.c" />
|
||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||
<ClCompile Include="..\..\src\core\SDL_core_unsupported.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\gameinput\gameinput.cpp">
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp">
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_cpp.pch</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_hid.c" />
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_immdevice.c" />
|
||||
|
||||
@@ -543,6 +543,9 @@
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_directx.h">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\core\windows\gameinput\gameinput.h">
|
||||
<Filter>core\windows\gameinput</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\core\windows\SDL_gameinput.h">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClInclude>
|
||||
@@ -1447,6 +1450,9 @@
|
||||
<ClCompile Include="..\..\src\core\SDL_core_unsupported.c">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\gameinput\gameinput.cpp">
|
||||
<Filter>core\windows\gameinput</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\windows\SDL_gameinput.cpp">
|
||||
<Filter>core\windows</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -1200,7 +1200,7 @@ class Releaser:
|
||||
shutil.rmtree(deps_path, ignore_errors=True)
|
||||
dep_roots = []
|
||||
dep_includes = []
|
||||
for dep in self.release_info.get("dependencies"):
|
||||
for dep in self.release_info.get("dependencies", []):
|
||||
if "command" in self.release_info["dependencies"][dep]:
|
||||
dep_includes.append(self.deps_path / dep / "include")
|
||||
continue
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import urllib.request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_GAMEINPUT_VERSION = "v3.3.195.0"
|
||||
|
||||
def download_sdk(tag: str, lowercase: bool, output: Path):
|
||||
base_url = f"https://raw.githubusercontent.com/microsoftconnect/GameInput/refs/tags/{tag}/"
|
||||
url_relpaths = (
|
||||
"include/GameInput.h",
|
||||
"include/v0/GameInput.h",
|
||||
"include/v1/GameInput.h",
|
||||
"include/v2/GameInput.h",
|
||||
"lib/arm64/GameInput.lib",
|
||||
"lib/x64/GameInput.lib",
|
||||
)
|
||||
for url_relpath in url_relpaths:
|
||||
url = base_url + url_relpath
|
||||
local_relpath = url_relpath
|
||||
if lowercase:
|
||||
local_relpath = local_relpath.lower()
|
||||
local_path = output / local_relpath
|
||||
|
||||
local_dirpath = local_path.parent
|
||||
local_dirpath.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
logger.info("Downloading %s to %s...", url, local_path)
|
||||
urllib.request.urlretrieve(url, local_path)
|
||||
logger.info("... done")
|
||||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
parser = argparse.ArgumentParser(description="Download Microsoft.GameInput SDK", allow_abbrev=False)
|
||||
parser.add_argument("--version", help="GameInput release tag (see https://github.com/microsoftconnect/GameInput/tags)", default=DEFAULT_GAMEINPUT_VERSION)
|
||||
parser.add_argument("--no-lowercase", action="store_false", dest="lowercase", help="Don't lowercase downloaded files")
|
||||
parser.add_argument("-o", "--output", type=Path, default=Path.cwd(), help="SDK will be stored here (in include and lib subdirectories)")
|
||||
args = parser.parse_args()
|
||||
download_sdk(tag=args.version, lowercase=args.lowercase, output=args.output)
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -1,12 +1,6 @@
|
||||
{
|
||||
"name": "SDL3",
|
||||
"remote": "libsdl-org/SDL",
|
||||
"dependencies": {
|
||||
"gameinput": {
|
||||
"command": "build-scripts/download-gameinput-sdk.py -o @<@DEPS_PATH@>@",
|
||||
"artifact": "gameinput/include/gameinput.h"
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"file": "include/SDL3/SDL_version.h",
|
||||
"re_major": "^#define SDL_MAJOR_VERSION\\s+([0-9]+)$",
|
||||
@@ -60,9 +54,6 @@
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake",
|
||||
"build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"gameinput": {}
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
@@ -138,9 +129,6 @@
|
||||
"include/SDL3": [
|
||||
"include/SDL3/*.h"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"gameinput": {}
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
|
||||
@@ -104,6 +104,15 @@ function(sdl_test_link_dependency )
|
||||
sdl_generic_link_dependency(${ARGN} COLLECTOR SDL3_test-collector STATIC_TARGETS SDL3_test)
|
||||
endfunction()
|
||||
|
||||
function(sdl_compile_features)
|
||||
if(TARGET SDL3-shared)
|
||||
target_compile_features(SDL3-shared PRIVATE ${ARGN})
|
||||
endif()
|
||||
if(TARGET SDL3-static)
|
||||
target_compile_features(SDL3-static PRIVATE ${ARGN})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(_get_ARGS_visibility)
|
||||
set(_conflict FALSE)
|
||||
set(visibility)
|
||||
|
||||
@@ -100,9 +100,7 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_AUDIOCLIENT_H 1
|
||||
#define HAVE_TPCSHRD_H 1
|
||||
#define HAVE_SENSORSAPI_H 1
|
||||
#if defined(__has_include) && __has_include(<gameinput.h>)
|
||||
#define HAVE_GAMEINPUT_H 1
|
||||
#endif
|
||||
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if !__has_include(<immintrin.h>)
|
||||
@@ -225,9 +223,7 @@ typedef unsigned int uintptr_t;
|
||||
|
||||
/* Enable various input drivers */
|
||||
#define SDL_JOYSTICK_DINPUT 1
|
||||
#ifdef HAVE_GAMEINPUT_H
|
||||
#define SDL_JOYSTICK_GAMEINPUT 1
|
||||
#endif
|
||||
#define SDL_JOYSTICK_HIDAPI 1
|
||||
#define SDL_JOYSTICK_RAWINPUT 1
|
||||
#define SDL_JOYSTICK_VIRTUAL 1
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
|
||||
#ifdef HAVE_GAMEINPUT_H
|
||||
|
||||
#ifndef SDL_GAMEINPUT_DYNAMIC
|
||||
#define USE_GAMEINPUT_LIB
|
||||
#define USE_GAMEINPUTCREATE
|
||||
#if defined(SDL_PLATFORM_GDK)
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "gameinput.lib")
|
||||
#endif
|
||||
#endif // !SDL_GAMEINPUT_DYNAMIC
|
||||
#endif
|
||||
|
||||
static SDL_SharedObject *g_hGameInputDLL;
|
||||
static IGameInput *g_pGameInput;
|
||||
@@ -40,50 +40,12 @@ static int g_nGameInputRefCount;
|
||||
bool SDL_InitGameInput(IGameInput **ppGameInput)
|
||||
{
|
||||
if (g_nGameInputRefCount == 0) {
|
||||
#ifdef USE_GAMEINPUT_LIB
|
||||
// This is recommended, as Microsoft's GameInputCreate() is robust
|
||||
// and better handles various GameInput installations
|
||||
HRESULT hr = GameInputCreate(&g_pGameInput);
|
||||
if (FAILED(hr)) {
|
||||
return WIN_SetErrorFromHRESULT("GameInputCreate failed", hr);
|
||||
}
|
||||
#elif GAMEINPUT_API_VERSION > 0
|
||||
g_hGameInputDLL = SDL_LoadObject("gameinputredist.dll");
|
||||
if (!g_hGameInputDLL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef HRESULT (WINAPI *pfnGameInputInitialize)(REFIID riid, void **ppvObject);
|
||||
pfnGameInputInitialize pGameInputInitialize = (pfnGameInputInitialize)SDL_LoadFunction(g_hGameInputDLL, "GameInputInitialize");
|
||||
if (!pGameInputInitialize) {
|
||||
SDL_UnloadObject(g_hGameInputDLL);
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = pGameInputInitialize(IID_IGameInput, (void **)&g_pGameInput);
|
||||
if (FAILED(hr)) {
|
||||
SDL_UnloadObject(g_hGameInputDLL);
|
||||
return WIN_SetErrorFromHRESULT("GameInputInitialize failed", hr);
|
||||
}
|
||||
#else
|
||||
g_hGameInputDLL = SDL_LoadObject("gameinput.dll");
|
||||
if (!g_hGameInputDLL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef HRESULT (WINAPI *pfnGameInputCreate)(IGameInput **gameInput);
|
||||
pfnGameInputCreate pGameInputCreate = (pfnGameInputCreate)SDL_LoadFunction(g_hGameInputDLL, "GameInputCreate");
|
||||
if (!pGameInputCreate) {
|
||||
SDL_UnloadObject(g_hGameInputDLL);
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = pGameInputCreate(&g_pGameInput);
|
||||
if (FAILED(hr)) {
|
||||
SDL_UnloadObject(g_hGameInputDLL);
|
||||
return WIN_SetErrorFromHRESULT("GameInputCreate failed", hr);
|
||||
}
|
||||
#endif // USE_GAMEINPUT_LIB
|
||||
}
|
||||
++g_nGameInputRefCount;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#pragma GCC diagnostic ignored "-Wundef"
|
||||
#endif
|
||||
|
||||
#include <gameinput.h>
|
||||
#include "gameinput.h"
|
||||
|
||||
#ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user