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.
This commit is contained in:
Connor McLaughlin 2022-06-28 17:37:02 +10:00 committed by refractionpcsx2
parent 444dce4aeb
commit fcde6f686e
6 changed files with 26 additions and 6 deletions

View File

@ -24,8 +24,14 @@
#define NOMINMAX #define NOMINMAX
#endif #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 #define _WIN32_WINNT 0x0603 // Windows 8.1
#endif
#endif
#include <windows.h> #include <windows.h>
#include <VersionHelpers.h> #include <VersionHelpers.h>

View File

@ -11,7 +11,7 @@
<ClCompile> <ClCompile>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>__WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;WINVER=0x0603;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>__WIN32__;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;WINVER=0x0A00;_WIN32_WINNT=0x0A00;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StructMemberAlignment>16Bytes</StructMemberAlignment> <StructMemberAlignment>16Bytes</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -74,7 +74,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<LargeAddressAware>Yes</LargeAddressAware> <LargeAddressAware>Yes</LargeAddressAware>
<AdditionalDependencies>comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;OneCore.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>$(QtEntryPointLib);%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>

View File

@ -1649,7 +1649,11 @@ if(WIN32)
opengl32.lib opengl32.lib
comsuppw.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 target_link_libraries(PCSX2_FLAGS INTERFACE
pthreads4w pthreads4w
) )

View File

@ -20,7 +20,6 @@
#endif #endif
#include "common/Console.h" #include "common/Console.h"
#include <xaudio2.h>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
@ -30,6 +29,17 @@
#include <wil/resource.h> #include <wil/resource.h>
#include <wil/win32_helpers.h> #include <wil/win32_helpers.h>
// 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 <xaudio2.h>
//#define XAUDIO2_DEBUG //#define XAUDIO2_DEBUG
class XAudio2Mod final : public SndOutModule class XAudio2Mod final : public SndOutModule

View File

@ -75,7 +75,7 @@
<Link> <Link>
<LargeAddressAware>Yes</LargeAddressAware> <LargeAddressAware>Yes</LargeAddressAware>
<AdditionalDependencies>comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;rpcrt4.lib;iphlpapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>dxguid.lib;dinput8.lib;hid.lib;PowrProf.lib;d3dcompiler.lib;d3d11.lib;dxgi.lib;strmiids.lib;opengl32.lib;comsuppw.lib;OneCore.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>