From cffd68230c663b05a8e89570787be834de948c47 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 18 Jun 2014 23:18:06 +0200 Subject: [PATCH] Fix XA2 driver compile under MinGW --- .../src/sound/driver/xaudio2/adpcm_xaudio2.h | 2 +- .../sound/driver/xaudio2/driver_xaudio2.def | 10 ++-- .../driver/xaudio2/sound_driver_xaudio2.cpp | 16 +++++++ .../nel/src/sound/driver/xaudio2/stdxaudio2.h | 48 +++++++++++++++++++ 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h index 6655c57a8..3b46d1b9a 100644 --- a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h @@ -62,7 +62,7 @@ protected: /// Mutex for cross-thread access from XAudio2 callbacks. NLMISC::CMutex _Mutex; /// Unique id for buffer. - uint _LastBufferContext; + uintptr_t _LastBufferContext; /// Current buffer. void *_ValidBufferContext[_BufferNb]; public: diff --git a/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def b/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def index 247ed160f..2a29a2d91 100644 --- a/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def +++ b/code/nel/src/sound/driver/xaudio2/driver_xaudio2.def @@ -1,4 +1,6 @@ -EXPORTS NLSOUND_createISoundDriverInstance -EXPORTS NLSOUND_interfaceVersion -EXPORTS NLSOUND_outputProfile -EXPORTS NLSOUND_getDriverType \ No newline at end of file +LIBRARY nel_drv_xaudio2_win_r +EXPORTS + NLSOUND_createISoundDriverInstance + NLSOUND_interfaceVersion + NLSOUND_outputProfile + NLSOUND_getDriverType \ No newline at end of file diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp index c1cdd3729..b95735fc5 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp @@ -53,6 +53,14 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lp // *************************************************************************** +#ifndef NL_STATIC +#ifdef NL_COMP_MINGW +extern "C" { +#endif +#endif + +// *************************************************************************** + #ifdef NL_STATIC ISoundDriver* createISoundDriverInstanceXAudio2 #else @@ -99,6 +107,14 @@ __declspec(dllexport) ISoundDriver::TDriver NLSOUND_getDriverType() // ****************************************************************** +#ifndef NL_STATIC +#ifdef NL_COMP_MINGW +} +#endif +#endif + +// ****************************************************************** + #ifdef NL_DEBUG static XAUDIO2_DEBUG_CONFIGURATION NLSOUND_XAUDIO2_DEBUG_CONFIGURATION_DISABLED = { diff --git a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h index d716d91bf..76b2a13d8 100644 --- a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h @@ -25,9 +25,57 @@ #include #include #include +#include // 3rd Party Includes +#include #define XAUDIO2_HELPER_FUNCTIONS + +#ifdef NL_COMP_MINGW +#define __in_bcount(x) +#define __in_bcount_opt(x) +#define __in_ecount(x) +#define __in_xcount(x) +#define __inout_bcount_full(x) +#define __inout_bcount_opt(x) +#define __out_bcount(x) +#define __out_bcount_full(x) +#define __out_bcount_opt(x) +#define __out_bcount_part_opt(x,y) +#define __out_ecount(x) +#define __out_xcount(x) +#define __deref_opt_inout_bcount_part_opt(x,y) +#define __deref_out_bcount(x) +#define __deref_out_bcount_opt(x) +#define __out +#define __in +#define __inout +#define __deref_out +#define __in_opt +#define __inout_opt +#define __out_opt +#define __deref +#define __deref_inout_opt +#define __reserved +#define __XMA2DEFS_INCLUDED__ +#endif /* NL_COMP_MINGW */ + +#include + +#ifdef NL_COMP_MINGW +#undef DEFINE_CLSID +#undef DEFINE_IID +#undef DECLSPEC_UUID_WRAPPER +#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + class className; \ + __CRT_UUID_DECL(className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \ + EXTERN_C const GUID CLSID_##className +#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + interface interfaceName; \ + __CRT_UUID_DECL(interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \ + EXTERN_C const GUID IID_##interfaceName +#endif /* NL_COMP_MINGW */ + #include #include #include