[PATCH 1/8] x3daudio1_7: Use shared source

Andrew Eikum aeikum at codeweavers.com
Thu Jan 14 11:38:19 CST 2016


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 configure.ac                      |  3 ++-
 dlls/x3daudio1_7/Makefile.in      |  6 ++++--
 dlls/x3daudio1_7/main.c           | 45 ---------------------------------------
 dlls/x3daudio1_7/x3daudio1_7.spec |  4 ++--
 dlls/xaudio2_7/x3daudio.c         | 29 ++++++++++++++++++++++++-
 dlls/xaudio2_8/Makefile.in        |  1 -
 6 files changed, 36 insertions(+), 52 deletions(-)
 delete mode 100644 dlls/x3daudio1_7/main.c

diff --git a/configure.ac b/configure.ac
index 8aca9a1..9f2c24e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1662,6 +1662,7 @@ fi
 if test "x$ac_cv_have_openalsoft" != xyes
 then
     WINE_NOTICE([openal-soft ${notice_platform}development files not found (or too old), XAudio2 won't be supported])
+    enable_x3daudio1_7=${enable_x3daudio1_7:-no}
     enable_xapofx1_1=${enable_xapofx1_1:-no}
     enable_xapofx1_2=${enable_xapofx1_2:-no}
     enable_xapofx1_3=${enable_xapofx1_3:-no}
@@ -3391,7 +3392,7 @@ WINE_CONFIG_DLL(xaudio2_5,,[clean])
 WINE_CONFIG_DLL(xaudio2_6,,[clean])
 WINE_CONFIG_DLL(xaudio2_7,,[clean])
 WINE_CONFIG_TEST(dlls/xaudio2_7/tests)
-WINE_CONFIG_DLL(xaudio2_8,,[clean,implib])
+WINE_CONFIG_DLL(xaudio2_8,,[clean])
 WINE_CONFIG_DLL(xinput1_1)
 WINE_CONFIG_DLL(xinput1_2)
 WINE_CONFIG_DLL(xinput1_3,,[implib],[xinput])
diff --git a/dlls/x3daudio1_7/Makefile.in b/dlls/x3daudio1_7/Makefile.in
index 299351e..2232e84 100644
--- a/dlls/x3daudio1_7/Makefile.in
+++ b/dlls/x3daudio1_7/Makefile.in
@@ -1,5 +1,7 @@
+EXTRADEFS = -DX3DAUDIO1_VER=7 -DXAUDIO2_VER=7
 MODULE    = x3daudio1_7.dll
-IMPORTS   = xaudio2_8
+IMPORTS   = kernel32
+PARENTSRC = ../xaudio2_7
 
 C_SRCS = \
-	main.c
+	x3daudio.c
diff --git a/dlls/x3daudio1_7/main.c b/dlls/x3daudio1_7/main.c
deleted file mode 100644
index 5d1a5a5..0000000
--- a/dlls/x3daudio1_7/main.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2014 Alex Henrie
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "x3daudio.h"
-
-BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
-    switch (reason)
-    {
-        case DLL_WINE_PREATTACH:
-            return FALSE;    /* prefer native version */
-        case DLL_PROCESS_ATTACH:
-            DisableThreadLibraryCalls(instance);
-            break;
-    }
-
-    return TRUE;
-}
-
-void CDECL X3DA17_X3DAudioInitialize(UINT32 chanmask, float speedofsound,
-        X3DAUDIO_HANDLE handle)
-{
-    /* forward to xaudio2_8 */
-    X3DAudioInitialize(chanmask, speedofsound, handle);
-}
diff --git a/dlls/x3daudio1_7/x3daudio1_7.spec b/dlls/x3daudio1_7/x3daudio1_7.spec
index 78926ef..0d6caa0 100644
--- a/dlls/x3daudio1_7/x3daudio1_7.spec
+++ b/dlls/x3daudio1_7/x3daudio1_7.spec
@@ -1,2 +1,2 @@
-@ cdecl X3DAudioCalculate(ptr ptr ptr long ptr) xaudio2_8.X3DAudioCalculate
-@ cdecl X3DAudioInitialize(long float ptr) X3DA17_X3DAudioInitialize
+@ cdecl X3DAudioCalculate(ptr ptr ptr long ptr)
+@ cdecl X3DAudioInitialize(long float ptr) LEGACY_X3DAudioInitialize
diff --git a/dlls/xaudio2_7/x3daudio.c b/dlls/xaudio2_7/x3daudio.c
index 2966f56..a182852 100644
--- a/dlls/xaudio2_7/x3daudio.c
+++ b/dlls/xaudio2_7/x3daudio.c
@@ -25,6 +25,23 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
 
+#ifdef X3DAUDIO1_VER
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved)
+{
+    TRACE("(%p, %d, %p)\n", hinstDLL, reason, pReserved);
+
+    switch (reason)
+    {
+    case DLL_WINE_PREATTACH:
+        return FALSE;  /* prefer native version */
+    case DLL_PROCESS_ATTACH:
+        DisableThreadLibraryCalls( hinstDLL );
+        break;
+    }
+    return TRUE;
+}
+#endif /* X3DAUDIO1_VER */
+
 #if XAUDIO2_VER >= 8
 HRESULT CDECL X3DAudioInitialize(UINT32 chanmask, float speedofsound,
         X3DAUDIO_HANDLE handle)
@@ -32,7 +49,17 @@ HRESULT CDECL X3DAudioInitialize(UINT32 chanmask, float speedofsound,
     FIXME("0x%x, %f, %p: Stub!\n", chanmask, speedofsound, handle);
     return S_OK;
 }
+#endif /* XAUDIO2_VER >= 8 */
 
+#ifdef X3DAUDIO1_VER
+void CDECL LEGACY_X3DAudioInitialize(UINT32 chanmask, float speedofsound,
+        X3DAUDIO_HANDLE handle)
+{
+    FIXME("0x%x, %f, %p: Stub!\n", chanmask, speedofsound, handle);
+}
+#endif /* X3DAUDIO1_VER */
+
+#if XAUDIO2_VER >= 8 || defined X3DAUDIO1_VER
 void CDECL X3DAudioCalculate(const X3DAUDIO_HANDLE handle,
         const X3DAUDIO_LISTENER *listener, const X3DAUDIO_EMITTER *emitter,
         UINT32 flags, X3DAUDIO_DSP_SETTINGS *out)
@@ -52,4 +79,4 @@ void CDECL X3DAudioCalculate(const X3DAUDIO_HANDLE handle,
     out->EmitterVelocityComponent = 0;
     out->ListenerVelocityComponent = 0;
 }
-#endif /* XAUDIO2_VER >= 8 */
+#endif /* XAUDIO2_VER >= 8 || defined X3DAUDIO1_VER */
diff --git a/dlls/xaudio2_8/Makefile.in b/dlls/xaudio2_8/Makefile.in
index 55f5ea2..cf16eb7 100644
--- a/dlls/xaudio2_8/Makefile.in
+++ b/dlls/xaudio2_8/Makefile.in
@@ -1,6 +1,5 @@
 EXTRADEFS = -DXAUDIO2_VER=8
 MODULE    = xaudio2_8.dll
-IMPORTLIB = xaudio2_8
 IMPORTS   = advapi32 kernel32 ole32 user32 uuid
 EXTRALIBS = $(OPENAL_LIBS)
 PARENTSRC = ../xaudio2_7
-- 
2.7.0





More information about the wine-patches mailing list