From 59bea9900cfd25a1a7d7e27bfc749ae497965735 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Tue, 27 Nov 2012 15:21:05 +0100 Subject: [PATCH] Added a few hacks to get it compiling on Windows 8 with VS 2012. --- doomclassic/doom/i_sound_win32.cpp | 12 ++++++-- doomclassic/doomclassic.vcxproj | 2 ++ doomclassic/timidity/timidity.vcxproj | 2 ++ neo/_PCLibs.props | 2 +- neo/amplitude/amplitude.vcxproj | 3 ++ neo/doomexe.vcxproj | 3 ++ neo/external.vcxproj | 3 ++ neo/game-d3xp.vcxproj | 3 ++ neo/idlib.vcxproj | 3 ++ neo/sound/XAudio2/XA2_SoundHardware.cpp | 39 ++++++++++++++++++++++--- neo/sound/snd_local.h | 10 +++++++ neo/sys/win32/win_snd.cpp | 5 +++- 12 files changed, 79 insertions(+), 8 deletions(-) diff --git a/doomclassic/doom/i_sound_win32.cpp b/doomclassic/doom/i_sound_win32.cpp index d4da8187..51f833ac 100644 --- a/doomclassic/doom/i_sound_win32.cpp +++ b/doomclassic/doom/i_sound_win32.cpp @@ -654,7 +654,9 @@ I_InitSoundChannel void I_InitSoundChannel( int channel, int numOutputChannels_ ) { activeSound_t *soundchannel = &activeSounds[ channel ]; - X3DAUDIO_VECTOR ZeroVector = { 0.0f, 0.0f, 0.0f }; + // RB: fixed non-aggregates cannot be initialized with initializer list + X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f ); + // RB end // Set up emitter parameters soundchannel->m_Emitter.OrientFront.x = 0.0f; @@ -718,7 +720,9 @@ void I_InitSound() { if (S_initialized == 0) { int i; - X3DAUDIO_VECTOR ZeroVector = { 0.0f, 0.0f, 0.0f }; + // RB: non-aggregates cannot be initialized with initializer list + X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f ); + // RB end // Set up listener parameters doom_Listener.OrientFront.x = 0.0f; @@ -813,7 +817,11 @@ void I_InitMusic(void) voiceFormat.wBitsPerSample = MIDI_FORMAT_BYTES * 8; voiceFormat.cbSize = 0; +// RB: XAUDIO2_VOICE_MUSIC not available on Windows 8 SDK +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) soundSystemLocal.hardware.GetIXAudio2()->CreateSourceVoice( &pMusicSourceVoice, (WAVEFORMATEX *)&voiceFormat, XAUDIO2_VOICE_MUSIC ); +#endif +// RB end Music_initialized = true; } diff --git a/doomclassic/doomclassic.vcxproj b/doomclassic/doomclassic.vcxproj index e3f1304f..2ec6ae40 100644 --- a/doomclassic/doomclassic.vcxproj +++ b/doomclassic/doomclassic.vcxproj @@ -165,12 +165,14 @@ StaticLibrary true Unicode + v110 StaticLibrary false true Unicode + v110 diff --git a/doomclassic/timidity/timidity.vcxproj b/doomclassic/timidity/timidity.vcxproj index 76f1ca7d..699dad60 100644 --- a/doomclassic/timidity/timidity.vcxproj +++ b/doomclassic/timidity/timidity.vcxproj @@ -58,12 +58,14 @@ StaticLibrary true Unicode + v110 StaticLibrary false true Unicode + v110 diff --git a/neo/_PCLibs.props b/neo/_PCLibs.props index 7d272487..836c3af9 100644 --- a/neo/_PCLibs.props +++ b/neo/_PCLibs.props @@ -14,7 +14,7 @@ libcmt.lib;%(IgnoreSpecificDefaultLibraries) - xinput.lib;dbghelp.lib;dinput8.lib;dsound.lib;dxguid.lib;DxErr.lib;glu32.lib;iphlpapi.lib;odbc32.lib;odbccp32.lib;opengl32.lib;winmm.lib;wsock32.lib;x3daudio.lib;%(AdditionalDependencies) + xinput.lib;dbghelp.lib;dinput8.lib;dsound.lib;dxguid.lib;glu32.lib;iphlpapi.lib;odbc32.lib;odbccp32.lib;opengl32.lib;winmm.lib;wsock32.lib;xaudio2.lib;%(AdditionalDependencies) $(DXSDK_DIR)\Lib\x86\;%(AdditionalLibraryDirectories) Windows diff --git a/neo/amplitude/amplitude.vcxproj b/neo/amplitude/amplitude.vcxproj index b16f24b7..893e94d5 100644 --- a/neo/amplitude/amplitude.vcxproj +++ b/neo/amplitude/amplitude.vcxproj @@ -35,18 +35,21 @@ Application true Unicode + v110 Application false true Unicode + v110 Application false true Unicode + v110 diff --git a/neo/doomexe.vcxproj b/neo/doomexe.vcxproj index 6a7bcb4b..39403191 100644 --- a/neo/doomexe.vcxproj +++ b/neo/doomexe.vcxproj @@ -32,16 +32,19 @@ Application MultiByte + v110 Application MultiByte false + v110 Application MultiByte false + v110 diff --git a/neo/external.vcxproj b/neo/external.vcxproj index 163b0e37..41a160d3 100644 --- a/neo/external.vcxproj +++ b/neo/external.vcxproj @@ -103,18 +103,21 @@ StaticLibrary true Unicode + v110 StaticLibrary false true Unicode + v110 StaticLibrary false true Unicode + v110 diff --git a/neo/game-d3xp.vcxproj b/neo/game-d3xp.vcxproj index c3e66593..6f1d803a 100644 --- a/neo/game-d3xp.vcxproj +++ b/neo/game-d3xp.vcxproj @@ -32,14 +32,17 @@ StaticLibrary MultiByte + v110 StaticLibrary MultiByte + v110 StaticLibrary MultiByte + v110 DynamicLibrary diff --git a/neo/idlib.vcxproj b/neo/idlib.vcxproj index 6db19f81..3fbeccb1 100644 --- a/neo/idlib.vcxproj +++ b/neo/idlib.vcxproj @@ -32,14 +32,17 @@ StaticLibrary MultiByte + v110 StaticLibrary MultiByte + v110 StaticLibrary MultiByte + v110 diff --git a/neo/sound/XAudio2/XA2_SoundHardware.cpp b/neo/sound/XAudio2/XA2_SoundHardware.cpp index c703fe5e..b14aad97 100644 --- a/neo/sound/XAudio2/XA2_SoundHardware.cpp +++ b/neo/sound/XAudio2/XA2_SoundHardware.cpp @@ -69,6 +69,14 @@ void listDevices_f( const idCmdArgs & args ) { return; } +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) + + // FIXME + + idLib::Warning( "No audio devices found" ); + return; +#else UINT32 deviceCount = 0; if ( pXAudio2->GetDeviceCount( &deviceCount ) != S_OK || deviceCount == 0 ) { idLib::Warning( "No audio devices found" ); @@ -157,6 +165,8 @@ void listDevices_f( const idCmdArgs & args ) { idLib::Printf( ", and %s\n", roles[roles.Num() - 1] ); } } +#endif +// RB end } /* @@ -169,13 +179,18 @@ void idSoundHardware_XAudio2::Init() { cmdSystem->AddCommand( "listDevices", listDevices_f, 0, "Lists the connected sound devices", NULL ); DWORD xAudioCreateFlags = 0; -#ifdef _DEBUG + +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) && defined(_DEBUG) xAudioCreateFlags |= XAUDIO2_DEBUG_ENGINE; #endif +// RB end XAUDIO2_PROCESSOR xAudioProcessor = XAUDIO2_DEFAULT_PROCESSOR; - if ( FAILED( XAudio2Create( &pXAudio2, xAudioCreateFlags, xAudioProcessor ) ) ) { +// RB: not available on Windows 8 SDK + if ( FAILED( XAudio2Create( &pXAudio2, xAudioCreateFlags, xAudioProcessor ) ) ){ +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) && defined(_DEBUG) if ( xAudioCreateFlags & XAUDIO2_DEBUG_ENGINE ) { // in case the debug engine isn't installed xAudioCreateFlags &= ~XAUDIO2_DEBUG_ENGINE; @@ -183,7 +198,10 @@ void idSoundHardware_XAudio2::Init() { idLib::FatalError( "Failed to create XAudio2 engine. Try installing the latest DirectX." ); return; } - } else { + } else +#endif +// RB end + { idLib::FatalError( "Failed to create XAudio2 engine. Try installing the latest DirectX." ); return; } @@ -199,8 +217,19 @@ void idSoundHardware_XAudio2::Init() { pXAudio2->RegisterForCallbacks( &soundEngineCallback ); soundEngineCallback.hardware = this; +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/) + + // FIXME + + idLib::Warning( "No audio devices found" ); + pXAudio2->Release(); + pXAudio2 = NULL; + return; +#else UINT32 deviceCount = 0; - if ( pXAudio2->GetDeviceCount( &deviceCount ) != S_OK || deviceCount == 0 ) { + if ( pXAudio2->GetDeviceCount( &deviceCount ) != S_OK || deviceCount == 0 ) + { idLib::Warning( "No audio devices found" ); pXAudio2->Release(); pXAudio2 = NULL; @@ -325,6 +354,8 @@ void idSoundHardware_XAudio2::Init() { for ( int i = 0; i < voices.Num(); i++ ) { freeVoices[i] = &voices[i]; } +#endif // #if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) +// RB end } /* diff --git a/neo/sound/snd_local.h b/neo/sound/snd_local.h index ee7c1b03..286bb6ca 100644 --- a/neo/sound/snd_local.h +++ b/neo/sound/snd_local.h @@ -82,12 +82,22 @@ typedef enum { #define OPERATION_SET 1 +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) #include +#endif +// RB end #include #include #include + +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) #include +#endif +// RB end + #include "XAudio2/XA2_SoundSample.h" #include "XAudio2/XA2_SoundVoice.h" #include "XAudio2/XA2_SoundHardware.h" diff --git a/neo/sys/win32/win_snd.cpp b/neo/sys/win32/win_snd.cpp index 4730b029..b7f6ebda 100644 --- a/neo/sys/win32/win_snd.cpp +++ b/neo/sys/win32/win_snd.cpp @@ -28,8 +28,11 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "../../idlib/precompiled.h" -// DirectX SDK +// RB: not available on Windows 8 SDK +#if (_WIN32_WINNT < 0x0602 /*_WIN32_WINNT_WIN8*/) #include +#endif +// RB end #include #include