From fcde6f686e6b3401867a12f2954c7e3f0593cebf Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 28 Jun 2022 17:37:02 +1000 Subject: [PATCH] Build: Bump _WIN32_WINNT to Windows 10 and link against OneCore Necessary for us to utilize the new WinAPI functions. We just need to be careful not to call any of these in wx, because otherwise it'll no longer run on Win8. --- common/RedtapeWindows.h | 8 +++++++- common/vsprops/BaseProperties.props | 2 +- pcsx2-qt/pcsx2-qt.vcxproj | 2 +- pcsx2/CMakeLists.txt | 6 +++++- pcsx2/SPU2/Windows/SndOut_XAudio2.cpp | 12 +++++++++++- pcsx2/pcsx2core.vcxproj | 2 +- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/common/RedtapeWindows.h b/common/RedtapeWindows.h index d9474bb186..6d83ce7c9c 100644 --- a/common/RedtapeWindows.h +++ b/common/RedtapeWindows.h @@ -24,8 +24,14 @@ #define NOMINMAX #endif -// Win8.1 is our minimum at the moment. +// Qt build requires Windows 10+, WX Windows 8.1+. +#ifndef _WIN32_WINNT +#ifdef PCSX2_CORE +#define _WIN32_WINNT 0x0A00 // Windows 10 +#else #define _WIN32_WINNT 0x0603 // Windows 8.1 +#endif +#endif #include #include diff --git a/common/vsprops/BaseProperties.props b/common/vsprops/BaseProperties.props index eec343552b..fd701baf63 100644 --- a/common/vsprops/BaseProperties.props +++ b/common/vsprops/BaseProperties.props @@ -11,7 +11,7 @@ true $(SolutionDir);%(AdditionalIncludeDirectories) - __WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;WINVER=0x0603;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) + __WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;WINVER=0x0A00;_WIN32_WINNT=0x0A00;%(PreprocessorDefinitions) 16Bytes true false diff --git a/pcsx2-qt/pcsx2-qt.vcxproj b/pcsx2-qt/pcsx2-qt.vcxproj index 9f11f7bf6c..1e3c584711 100644 --- a/pcsx2-qt/pcsx2-qt.vcxproj +++ b/pcsx2-qt/pcsx2-qt.vcxproj @@ -74,7 +74,7 @@ Windows Yes comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies) - dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies) + dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;OneCore.lib;%(AdditionalDependencies) $(QtEntryPointLib);%(AdditionalDependencies) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 43a6bc2b43..cfa1a72c46 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -1649,7 +1649,11 @@ if(WIN32) opengl32.lib comsuppw.lib ) - if(NOT PCSX2_CORE) + if(PCSX2_CORE) + target_link_libraries(PCSX2_FLAGS INTERFACE + OneCore.lib + ) + else() target_link_libraries(PCSX2_FLAGS INTERFACE pthreads4w ) diff --git a/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp b/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp index f4c91ad432..a83e62f50a 100644 --- a/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp +++ b/pcsx2/SPU2/Windows/SndOut_XAudio2.cpp @@ -20,7 +20,6 @@ #endif #include "common/Console.h" -#include #include #include #include @@ -30,6 +29,17 @@ #include #include +// We set _WIN32_WINNT to Win10, which means that xaudio2.h tries to use +// the Windows 10 version. For wx, we still need to support Win8, so we +// cheekily redefine _WIN32_WINNT before xaudio2.h is included, so that +// it uses the older DLL. +#ifndef PCSX2_CORE +#undef _WIN32_WINNT +#define _WIN32_WINNT _WIN32_WINNT_WIN8 +#endif + +#include + //#define XAUDIO2_DEBUG class XAudio2Mod final : public SndOutModule diff --git a/pcsx2/pcsx2core.vcxproj b/pcsx2/pcsx2core.vcxproj index d2f7e377a6..4c023d5f9e 100644 --- a/pcsx2/pcsx2core.vcxproj +++ b/pcsx2/pcsx2core.vcxproj @@ -75,7 +75,7 @@ Yes comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies) - dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies) + dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;OneCore.lib;%(AdditionalDependencies)