Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get SPU2 to compile on visual studio 2019 and to modern xaudio
#1
how to get SPU2 to compile on visual studio 2017 to run on windows 8 or higher. I've updated this guide a little bit

change WinConfig.h
0x602  == windows 8   == xaudio2.8
0x603 == windows 8.1  == xaudio2.8
0x0A00 == windows 10   == xaudio2.9
Code:
#ifndef _WIN32_WINNT
//#define _WIN32_WINNT 0x0600
#define _WIN32_WINNT 0x0602
#endif

remove SndOut_XAudio2_27.cpp  from the project. it straight up tells you to remove it if the windows version is 0x602 or higher
Code:
#include "Global.h"
#include "Dialogs.h"

#if _WIN32_WINNT >= 0x602
#error Time to remove this module.
#endif
#include <xaudio2.h>

#include "SndOut_XAudio2.inl"


change SndOut.h by commenting out the line with xaudio2_27_out
Code:
#ifdef _MSC_VER
//internal
extern SndOutModule *WaveOut;
extern SndOutModule *DSoundOut;
//extern SndOutModule *XAudio2_27_Out;
extern SndOutModule *XAudio2Out;
#endif
extern SndOutModule *PortaudioOut;
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
extern SndOutModule *const SDLOut;
#endif
#ifdef __linux__
extern SndOutModule *AlsaOut;
#endif

change sndout.cpp by again commenting out the line about xaudio2_27 and adding "XAudio2OUT,"
Code:
SndOutModule *mods[] =
    {
        &NullOut,
#ifdef _MSC_VER
        //XAudio2_27_Out,  // CHANGE THIS LINE TO THE ONE UNDER IT
        XAudio2Out,
        DSoundOut,
        WaveOut,
#endif
        PortaudioOut,

comment out or remove this code from PS23-spu2.cpp
Code:
#ifdef _WIN32
    if (IsWindows8OrGreater()) {
        for (int n = 0; mods[n] != nullptr; ++n) {
            if (mods[n] == XAudio2_27_Out) {
                mods[n] = XAudio2Out;
                break;
            }
        }
    }
#endif

and remove or comment out this extremely similar code from spu2replay.cpp

Code:
  if (IsWindows8OrGreater()) {
        for (int n = 0; mods[n] != nullptr; ++n) {
            if (mods[n] == XAudio2_27_Out) {
                mods[n] = XAudio2Out;
                break;
            }
        }
    }

SndOut_XAudio2.inl still includes references to Xaudio2_27_Out but because they are hidden behind preprocessor logic you don't really have to do anything if you don't want.

congrats. you should now be able to compile the spu-2 dll without the burdens of old Windows 7 code.

Sponsored links

#2
What are you doing?

Your problem is you don't have the DX SDK installed.

Also don't forget to add this to your windows Environment Variables once you have installed it

Variable name: DXSDK_DIR
Variable value: c:\dxsdk\ (or wherever you installed it)
[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
#3
(06-27-2019, 12:58 AM)refraction Wrote: What are you doing?

Your problem is you don't have the DX SDK installed.

Also don't forget to add this to your windows Environment Variables once you have installed it

Variable name: DXSDK_DIR
Variable value: c:\dxsdk\ (or wherever you installed it)
I don't know. I just figured out how to force it to work. I thought the direct x sdk included in visual studio was all I needed. but yeah. I basically removed xaudio2_27
#4
Visual studio doesn't come with the DirectX SDK, it comes with the Windows SDK
[Image: ref_sig_anim.gif]
Like our Facebook Page and visit our Facebook Group!
#5
(06-27-2019, 01:01 AM)refraction Wrote: Visual studio doesn't come with the DirectX SDK, it comes with the Windows SDK
it has something. I got it to compile and run. GSDX under DirectX11 also works
#6
I've got a feeling you're surprised this hackery works.   Tongue
#7
what I find surprising is in SndOut.h where it assumes XAudio2_27_Out; and has no option for XAudio2Out.... After all the version checking it's basically using the xaudio for windows vista anyway according to the code on the svn

maybe change SndOut.h to this?
Code:
SndOutModule *mods[] =
    {
        &NullOut,
#ifdef _MSC_VER
#if _WIN32_WINNT < 0x602
        XAudio2_27_Out,
#else
        XAudio2Out,
#endif
        DSoundOut,
        WaveOut,
#endif
        PortaudioOut,

I might be the first person to play the emulator with the newest version of xaudio Ohmy Tongue

okay. now i'm using the latest version of xaudio. I changed the windows version number in the code to 0x0A00(windows 10) and now xaudio2.h is sending me towards xaudio2_9.dll Smile --- compiled and working


this is how i'm feeling right now.
https://www.youtube.com/watch?v=I1L8l3LrzLA
#8
updated the guide a little bit. i redid my computer and ended up needing to redo this. It's time to strip out the windows 7 code Tongue


Attached Files Thumbnail(s)
   
#9
the anger and contempt they have for Windows 7 cannot force people to use another operating system

I can't run the emulator in new versions because I get an error, I keep insisting that they should support the old operating systems and not force someone to use Windows 10, which for me is not to my liking and that I have several computers from NASA.

if you have any solution to keep running the emulator on windows please let me know

   
#10
(08-27-2020, 03:08 PM)josebraund Wrote: the anger and contempt they have for Windows 7 cannot force people to use another operating system

I can't run the emulator in new versions because I get an error, I keep insisting that they should support the old operating systems and not force someone to use Windows 10, which for me is not to my liking and that I have several computers from NASA.

if you have any solution to keep running the emulator on windows please let me know

You can still use the emulator as long as you switch to another audio backend that isn't XAudio.

Also, Windows 8.1 is still supported, you're not limited to 10. Matter of the fact is that Windows 7 support was ended by Microsoft, which is our cue to do the same. We encourage users to update their OSes to one that is still being supported by Microsoft.




Users browsing this thread: 1 Guest(s)