|
|
@@ -37,6 +37,9 @@
|
|
|
#include <stdint.h>
|
|
|
|
|
|
// Start SDL modifications
|
|
|
+
|
|
|
+// !! File has been modified for compatibility with pre-c++11 toolchains
|
|
|
+
|
|
|
#ifndef RRF_SUBKEY_WOW6432KEY
|
|
|
#define RRF_SUBKEY_WOW6432KEY 0x00020000
|
|
|
#endif
|
|
|
@@ -45,6 +48,11 @@
|
|
|
#define wcscpy_s(DST, DST_SIZE, SRC) SDL_wcslcpy(DST, SRC, DST_SIZE)
|
|
|
#define wcscat_s(DST, DST_SIZE, SRC) SDL_wcslcat(DST, SRC, DST_SIZE)
|
|
|
|
|
|
+#if __cplusplus < 2011003L
|
|
|
+#define noexcept
|
|
|
+#define nullptr NULL
|
|
|
+#endif
|
|
|
+
|
|
|
// Additional changes:
|
|
|
// - Removed unused `static uint32_t g_productType = PRODUCT_UNDEFINED;`
|
|
|
// - Removed unused `static HMODULE g_ntdllDll = nullptr;`
|
|
|
@@ -102,6 +110,13 @@ template <typename T>
|
|
|
class Vector
|
|
|
{
|
|
|
public:
|
|
|
+ Vector()
|
|
|
+ : m_data(nullptr)
|
|
|
+ , m_count(0)
|
|
|
+ , m_capacity(0)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
~Vector()
|
|
|
{
|
|
|
if (m_data != nullptr)
|
|
|
@@ -163,9 +178,9 @@ public:
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
- T* m_data = nullptr;
|
|
|
- size_t m_count = 0;
|
|
|
- size_t m_capacity = 0;
|
|
|
+ T* m_data;
|
|
|
+ size_t m_count;
|
|
|
+ size_t m_capacity;
|
|
|
};
|
|
|
|
|
|
template <typename T>
|
|
|
@@ -244,8 +259,8 @@ private:
|
|
|
Vector<T> m_string;
|
|
|
};
|
|
|
|
|
|
-using WString = String<wchar_t>;
|
|
|
-using AString = String<char>;
|
|
|
+typedef String<wchar_t> WString;
|
|
|
+typedef String<char> AString;
|
|
|
|
|
|
|
|
|
//
|
|
|
@@ -344,10 +359,11 @@ static HRESULT GetApplicationDirectory(
|
|
|
static HRESULT GetRedistDirectory(
|
|
|
_Inout_ WString* redistDir) noexcept
|
|
|
{
|
|
|
- constexpr const wchar_t* RedistDirRegPath = L"SOFTWARE\\Microsoft\\GameInput";
|
|
|
- constexpr const wchar_t* RedistDirValueName = L"RedistDir";
|
|
|
+ static const wchar_t* RedistDirRegPath = L"SOFTWARE\\Microsoft\\GameInput";
|
|
|
+ static const wchar_t* RedistDirValueName = L"RedistDir";
|
|
|
|
|
|
- decltype(RegGetValueW)* regGetValue = nullptr;
|
|
|
+ typedef LONG (WINAPI *RegGetValueW_t)(HKEY,LPCWSTR,LPCWSTR,DWORD,LPDWORD,PVOID,LPDWORD);
|
|
|
+ RegGetValueW_t regGetValue = nullptr;
|
|
|
RETURN_IF_FAILED(LoadSystemModuleProc(
|
|
|
&g_advapi32Dll,
|
|
|
L"advapi32.dll",
|
|
|
@@ -386,21 +402,24 @@ static HRESULT GetFileVersion(
|
|
|
{
|
|
|
*version = 0;
|
|
|
|
|
|
- decltype(GetFileVersionInfoSizeW)* getFileVersionInfoSize = nullptr;
|
|
|
+ typedef DWORD (WINAPI *GetFileVersionInfoSizeW_t)(LPCWSTR,LPDWORD);
|
|
|
+ GetFileVersionInfoSizeW_t getFileVersionInfoSize = nullptr;
|
|
|
RETURN_IF_FAILED(LoadSystemModuleProc(
|
|
|
&g_versionDll,
|
|
|
L"version.dll",
|
|
|
"GetFileVersionInfoSizeW",
|
|
|
&getFileVersionInfoSize));
|
|
|
|
|
|
- decltype(GetFileVersionInfoW)* getFileVersionInfo = nullptr;
|
|
|
+ typedef BOOL (WINAPI *GetFileVersionInfoW_t)(LPCWSTR,DWORD,DWORD,LPVOID);
|
|
|
+ GetFileVersionInfoW_t getFileVersionInfo = nullptr;
|
|
|
RETURN_IF_FAILED(LoadSystemModuleProc(
|
|
|
&g_versionDll,
|
|
|
L"version.dll",
|
|
|
"GetFileVersionInfoW",
|
|
|
&getFileVersionInfo));
|
|
|
|
|
|
- decltype(VerQueryValueW)* verQueryValue = nullptr;
|
|
|
+ typedef BOOL (WINAPI *VerQueryValueW_t)(LPCVOID,LPCWSTR,LPVOID*,PUINT);
|
|
|
+ VerQueryValueW_t verQueryValue = nullptr;
|
|
|
RETURN_IF_FAILED(LoadSystemModuleProc(
|
|
|
&g_versionDll,
|
|
|
L"version.dll",
|
|
|
@@ -586,7 +605,7 @@ static HRESULT GameInputCreateWithVersion(
|
|
|
RETURN_IF_FAILED(LoadGameInputDll(&g_gameInputDll));
|
|
|
}
|
|
|
|
|
|
- using GameInputInitializeFn = HRESULT (*)(
|
|
|
+ typedef HRESULT (*GameInputInitializeFn)(
|
|
|
_In_ REFIID riid,
|
|
|
_COM_Outptr_ LPVOID* ppv);
|
|
|
|
|
|
@@ -602,7 +621,7 @@ static HRESULT GameInputCreateWithVersion(
|
|
|
// did not find it via above query, we must be running an old version of GameInput
|
|
|
// which only supports the v0 API. Don't attempt to use it for newer API versions.
|
|
|
|
|
|
- using GameInputCreateFn = HRESULT (*)(
|
|
|
+ typedef HRESULT (*GameInputCreateFn)(
|
|
|
_COM_Outptr_ LPVOID* ppv);
|
|
|
|
|
|
GameInputCreateFn gameInputCreate = nullptr;
|