PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.74k stars 1.62k forks source link

Build Error Spu2-X #2727

Closed ghost closed 5 years ago

ghost commented 5 years ago

This has been for the last few commits. I have recently had to reinstall windows so I'm not sure if it is because I'm missing something but I cannot seem to figure it out.

The error I get is from windows header xaudio.h

"This version of XAudio2 is available only in Windows 8 or later. Use the XAudio2 headers and libraries from the DirectX SDK with applications that target Windows 7 and earlier versions."

I am running Windows 10 Education 64-bit 1809 (Build 17763.134) and am using Visual Studio 15 2017 15.9.3 with Windows 10 SDK 10.0.17763.0 installed. The error the header is raising doesn't seem to make any sense.

tadanokojin commented 5 years ago

There's a define guard in spu2-x that prevents you from building it without the proper sdk. It forces your windows version to 7 and the SDK you're using complains about it.

ghost commented 5 years ago

There's a define guard in xaudio that prevents you from building it without the proper sdk. It forces your windows version to 7 and the SDK you're using complains about it.

I see. What version SDK should I be using?

tadanokojin commented 5 years ago

I've had luck installing directxtk_desktop_2013 from VS2017 nuget package manager but building spu2-x isn't a requirement. You can disable the build and use a release version of the plugin instead.

ghost commented 5 years ago

That is what I ended up doing. It is just strange that I haven't run into the issue previously.

tadanokojin commented 5 years ago

Perhaps your old install had the older sdk on it.

lightningterror commented 5 years ago

Perhaps the build guide documentation can be updated a bit for Windows 8 and up.

tadanokojin commented 5 years ago

I believe @AlessandroVetere expressed interest in that. If not, I can do it.

ghost commented 5 years ago

It would be extremely appreciated as I still have not figured out what I had installed to make it build without a problem.

iMineLink commented 5 years ago

I didn't manage to get the plugin built so...

tadanokojin commented 5 years ago

I'll update then. Been meaning to do it just been busy with other things.

ghost commented 5 years ago

So I changed '#if _WIN32_WINNT >= 0x602' on line 21 in SndOut_XAudio2_27.cpp to '#if #if _WIN32_WINNT == _WIN32_WINNT_VISTA' and it happily throws the error that it is time to remove the module.

It appears that something is setting #if _WIN32_WINNT to _WIN32_WINNT_VISTA and is the cause of receiving the xaudio error stating that xaudio2 is only available for win8 or greater.

tadanokojin commented 5 years ago

Yes, as I explained there is a define that force sets your windows version to prevent you from using the windows 8 version of xaudio SDK. https://github.com/PCSX2/pcsx2/blob/2af05a92f8046a5e9151bf014a9e0a9a8375032b/plugins/spu2-x/src/Windows/SndOut_XAudio2.cpp#L21-L23

ghost commented 5 years ago

That sets it to 0x0602 which is _WIN32_WINNT_WIN8 something is setting it to Vista which is 0x0600

tadanokojin commented 5 years ago

probably this then. pardon my memory of messing with this stuff is hazy. https://github.com/PCSX2/pcsx2/blob/2af05a92f8046a5e9151bf014a9e0a9a8375032b/plugins/spu2-x/src/Windows/dsp.cpp#L21

ghost commented 5 years ago

Ok so it does not build successfully with the following. Each were the only instances of Visual Studio and all windows sdks were fully uninstalled before installing and testing another.

Visual Studio Ultimate (2013) Visual Studio 15 Community Visual Studio 17 Community Visual Studio 19 Enterprise Preview

Even running msbuild.cmd completes successfully with only Spu2-X failing to build...

I have yet to figure out a way around this or figure out what exactly changed. It is frustrating because I have the SDK's required to build it and didn't have any issues before.

RedPanda4552 commented 5 years ago

If the build is failing both inside and outside of Visual Studio, and on multiple Visual Studio installs, then the issue likely lies outside of Visual Studio. Can you verify that you have:

SPU2-X should be able to compile, agnostic to any Visual Studio configuration, if you have these dependencies installed. If not, there may be another force in the build environment that needs to be discovered first.

ghost commented 5 years ago

@RedPanda4552 I will check further in the morning whether I have the directx9 runtime. I would like to reiterate that this was also from a fresh windows installation.

RedPanda4552 commented 5 years ago

I would like to reiterate that this was also from a fresh windows installation

That would be why. DirectX 9 has not shipped with stock Windows since at least Windows 8, possibly before.

ghost commented 5 years ago

I would like to reiterate that this was also from a fresh windows installation

That would be why. DirectX 9 has not shipped with stock Windows since at least Windows 8, possibly before.

I just installed it from the link above and re-ran mscompile.cmd and it still failed with the same error.

turtleli commented 5 years ago

It's the old DirectX SDK you're missing, not the runtime. Specifically, we still need to use 5 include files (Include/{audiodefs.h,comdecl.h,dxsdkver.h,XAudio2.h,xma2defs.h]} from the old SDK to support XAudio2 on Windows 7.

So either

  1. Install the SDK

or

  1. Extract the mentioned files from the SDK, put them in a folder (e.g. C:\DXSDK\Include) and setup the DXSDK_DIR environment variable (e.g. C:\DXSDK\, final backslash is essential).
ghost commented 5 years ago

It's the old DirectX SDK you're missing, not the runtime. Specifically, we still need to use 5 include files (Include/{audiodefs.h,comdecl.h,dxsdkver.h,XAudio2.h,xma2defs.h]} from the old SDK to support XAudio2 on Windows 7.

So either

  1. Install the SDK

or

  1. Extract the mentioned files from the SDK, put them in a folder (e.g. C:\DXSDK\Include) and setup the DXSDK_DIR environment variable (e.g. C:\DXSDK\, final backslash is essential).

This was it, downloading the DXSDK from https://www.microsoft.com/en-us/download/details.aspx?id=6812 has resolved the issue. It may be necessary to check for the DXSDK if building in Win10 to prevent this from arising again.