winmm 16/32 split (#12)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ChangeLog:
- all low level driver functions (internals for wave, midi, mixer and
aux) are now cleanly separated

A+
--- winmm_11/lolvldrv.c	Tue Oct 29 09:54:08 2002
+++ winmm_12/lolvldrv.c	Tue Oct 29 14:07:34 2002
@@ -23,15 +23,15 @@
 #include <string.h>
 #include <stdio.h>
 #include <assert.h>
-#include "wine/winbase16.h"
 #include "winreg.h"
 #include "winver.h"
 #include "winemm.h"
 #include "wine/debug.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(mmsys);
+WINE_DEFAULT_DEBUG_CHANNEL(winmm);
 
-extern WORD CALLBACK MMDRV_CallTo16_word_wwlll(FARPROC16,WORD,WORD,LONG,LONG,LONG);
+LRESULT         (*pFnCallMMDrvFunc16)(FARPROC16,WORD,WORD,LONG,LONG,LONG) /* = NULL */;
+unsigned        (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER) /* = NULL */;
 
 /* each known type of driver has an instance of this structure */
 typedef struct tagWINE_LLTYPE {
@@ -54,11 +54,43 @@
 static LPWINE_MLD	MM_MLDrvs[40];
 #define MAX_MM_MLDRVS	(sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0]))
 
+#define A(_x,_y) {#_y, _x, NULL, NULL, NULL, NULL, NULL, 0, NULL, -1}
+/* Note: the indices of this array must match the definitions
+ *	 of the MMDRV_???? manifest constants
+ */
+static WINE_LLTYPE	llTypes[MMDRV_MAX] = {
+    A(TRUE,  Aux),
+    A(FALSE, Mixer),
+    A(TRUE,  MidiIn),
+    A(TRUE,  MidiOut),
+    A(TRUE,  WaveIn),
+    A(TRUE,  WaveOut),
+};
+#undef A
+
+/******************************************************************
+ *		MMDRV_InstallMap
+ *
+ *
+ */
+void    MMDRV_InstallMap(unsigned int drv, 
+                         MMDRV_MAPFUNC mp1632, MMDRV_MAPFUNC um1632,
+                         MMDRV_MAPFUNC mp3216, MMDRV_MAPFUNC um3216,
+                         LPDRVCALLBACK cb)
+{
+    assert(drv < MMDRV_MAX);
+    llTypes[drv].Map16To32A   = mp1632;
+    llTypes[drv].UnMap16To32A = um1632;
+    llTypes[drv].Map32ATo16   = mp3216;
+    llTypes[drv].UnMap32ATo16 = um1632;
+    llTypes[drv].Callback     = cb;
+}
+
 /******************************************************************
  *		MMDRV_Is32
  *
  */
-BOOL                    MMDRV_Is32(unsigned int idx)
+BOOL            MMDRV_Is32(unsigned int idx)
 {
     return MMDrvs[idx].bIs32;
 }
@@ -124,24 +156,6 @@
     return ret;
 }
 
-#define A(_x,_y) {#_y, _x, \
-MMDRV_##_y##_Map16To32A, MMDRV_##_y##_UnMap16To32A, \
-MMDRV_##_y##_Map32ATo16, MMDRV_##_y##_UnMap32ATo16, \
-MMDRV_##_y##_Callback, 0, NULL, -1}
-
-/* Note: the indices of this array must match the definitions
- *	 of the MMDRV_???? manifest constants
- */
-static WINE_LLTYPE	llTypes[MMDRV_MAX] = {
-    A(TRUE,  Aux),
-    A(FALSE, Mixer),
-    A(TRUE,  MidiIn),
-    A(TRUE,  MidiOut),
-    A(TRUE,  WaveIn),
-    A(TRUE,  WaveOut),
-};
-#undef A
-
 /**************************************************************************
  * 			MMDRV_GetNum				[internal]
  */
@@ -223,14 +237,14 @@
 		    llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
 		break;
 	    default:
-		FIXME("NIY ?\n");
+		FIXME("NIY\n");
 		ret = MMSYSERR_NOTSUPPORTED;
 		break;
 	    }
 	}
     } else {
-	assert(part->u.fnMessage16);
-
+	assert(part->u.fnMessage16 && pFnCallMMDrvFunc16);
+        
 	if (bFrom32) {
 	    map = llType->Map32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
 	    switch (map) {
@@ -245,8 +259,9 @@
 	    case WINMM_MAP_OKMEM:
 		TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx\n",
 		      mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
-		ret = MMDRV_CallTo16_word_wwlll((FARPROC16)part->u.fnMessage16, mld->uDeviceID,
-						wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
+		ret = pFnCallMMDrvFunc16((FARPROC16)part->u.fnMessage16, 
+                                         mld->uDeviceID, wMsg, mld->dwDriverInstance, 
+                                         dwParam1, dwParam2);
 		TRACE("=> %lu\n", ret);
 		if (map == WINMM_MAP_OKMEM)
 		    llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
@@ -259,8 +274,9 @@
 	} else {
 	    TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx\n",
 		  mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
-            ret = MMDRV_CallTo16_word_wwlll((FARPROC16)part->u.fnMessage16, mld->uDeviceID,
-					    wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
+            ret = pFnCallMMDrvFunc16((FARPROC16)part->u.fnMessage16, 
+                                     mld->uDeviceID, wMsg, mld->dwDriverInstance, 
+                                     dwParam1, dwParam2);
 	    TRACE("=> %lu\n", ret);
 	}
     }
@@ -304,9 +320,12 @@
     mld->dwCallback = *dwCallback;
     mld->dwClientInstance = *dwInstance;
 
-    *dwFlags = LOWORD(*dwFlags) | CALLBACK_FUNCTION;
-    *dwCallback = (DWORD)llTypes[type].Callback;
-    *dwInstance = (DWORD)mld; /* FIXME: wouldn't some 16 bit drivers only use the loword ? */
+    if (llTypes[type].Callback)
+    {
+        *dwFlags = LOWORD(*dwFlags) | CALLBACK_FUNCTION;
+        *dwCallback = (DWORD)llTypes[type].Callback;
+        *dwInstance = (DWORD)mld; /* FIXME: wouldn't some 16 bit drivers only use the loword ? */
+    }
 
     return mld;
 }
@@ -498,17 +517,17 @@
 	TRACE("DRVM_ENABLE => %08lx\n", ret);
 #endif
         count = part->u.fnMessage32(0, wMsg, 0L, 0L, 0L);
-    } else if (!lpDrv->bIs32 && part->u.fnMessage16) {
-        ret = MMDRV_CallTo16_word_wwlll((FARPROC16)part->u.fnMessage16,
-					0, DRVM_INIT, 0L, 0L, 0L);
+    } else if (!lpDrv->bIs32 && part->u.fnMessage16 && pFnCallMMDrvFunc16) {
+        ret = pFnCallMMDrvFunc16((FARPROC16)part->u.fnMessage16,
+                                 0, DRVM_INIT, 0L, 0L, 0L);
 	TRACE("DRVM_INIT => %08lx\n", ret);
 #if 0
-	ret = MMDRV_CallTo16_word_wwlll((FARPROC16)part->u.fnMessage16,
-					0, DRVM_ENABLE, 0L, 0L, 0L);
+	ret = pFnCallMMDrvFunc16((FARPROC16)part->u.fnMessage16,
+                                 0, DRVM_ENABLE, 0L, 0L, 0L);
 	TRACE("DRVM_ENABLE => %08lx\n", ret);
 #endif
-        count = MMDRV_CallTo16_word_wwlll((FARPROC16)part->u.fnMessage16,
-					  0, wMsg, 0L, 0L, 0L);
+        count = pFnCallMMDrvFunc16((FARPROC16)part->u.fnMessage16,
+                                   0, wMsg, 0L, 0L, 0L);
     } else {
 	return FALSE;
     }
@@ -565,7 +584,6 @@
 static	BOOL	MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
 {
     int			i, count = 0;
-    char		buffer[128];
     LPWINE_MM_DRIVER	lpDrv = &MMDrvs[MMDrvsHi];
     LPWINE_DRIVER	d;
 
@@ -598,6 +616,7 @@
 
     if (lpDrv->bIs32) {
 	WINEMM_msgFunc32	func;
+        char    		buffer[128];
 
 	if (d->d.d32.hModule) {
 #define A(_x,_y)	AA(d->d.d32.hModule,_x,_y,32,GetProcAddress)
@@ -609,47 +628,16 @@
 	    A(MMDRV_WAVEOUT,	wodMessage);
 #undef A
 	}
-    } else {
-	WINEMM_msgFunc16	func;
-
-	/*
-	 * DESCRIPTION 'wave,aux,mixer:Creative Labs Sound Blaster 16 Driver'
-	 * The beginning of the module description indicates the driver supports
-	 * waveform, auxiliary, and mixer devices. Use one of the following
-	 * device-type names, followed by a colon (:) to indicate the type of
-	 * device your driver supports. If the driver supports more than one
-	 * type of device, separate each device-type name with a comma (,).
-	 *
-	 * wave for waveform audio devices
-	 * wavemapper for wave mappers
-	 * midi for MIDI audio devices
-	 * midimapper for midi mappers
-	 * aux for auxiliary audio devices
-	 * mixer for mixer devices
-	 */
-
-	if (d->d.d16.hDriver16) {
-	    HMODULE16	hMod16 = GetDriverModuleHandle16(d->d.d16.hDriver16);
-
-#define A(_x,_y)	AA(hMod16,_x,_y,16,GetProcAddress16)
-	    A(MMDRV_AUX,	auxMessage);
-	    A(MMDRV_MIXER,	mixMessage);
-	    A(MMDRV_MIDIIN,	midMessage);
-	    A(MMDRV_MIDIOUT, 	modMessage);
-	    A(MMDRV_WAVEIN,	widMessage);
-	    A(MMDRV_WAVEOUT,	wodMessage);
-#undef A
-	}
-    }
-#undef AA
-
-    if (TRACE_ON(mmsys)) {
-	if ((lpDrv->bIs32) ? MMDRV_GetDescription32(drvFileName, buffer, sizeof(buffer)) :
-	                     MMDRV_GetDescription16(drvFileName, buffer, sizeof(buffer)))
+        if (TRACE_ON(winmm)) {
+            if (MMDRV_GetDescription32(drvFileName, buffer, sizeof(buffer)))
 	    TRACE("%s => %s\n", drvFileName, buffer);
 	else
 	    TRACE("%s => No description\n", drvFileName);
+        }
+    } else if (WINMM_CheckForMMSystem() && pFnLoadMMDrvFunc16) {
+        count += pFnLoadMMDrvFunc16(drvFileName, d, lpDrv);
     }
+#undef AA
 
     if (!count) {
 	CloseDriver(lpDrv->hDriver, 0, 0);
--- winmm_11/message16.c	Tue Oct 29 14:16:35 2002
+++ winmm_12/message16.c	Tue Oct 29 14:16:48 2002
@@ -39,7 +39,7 @@
 /**************************************************************************
  * 				MMDRV_Callback			[internal]
  */
-void	MMDRV_Callback(LPWINE_MLD mld, HDRVR hDev, UINT uMsg, DWORD dwParam1, DWORD dwParam2)
+static  void	MMDRV_Callback(LPWINE_MLD mld, HDRVR hDev, UINT uMsg, DWORD dwParam1, DWORD dwParam2)
 {
     TRACE("CB (*%08lx)(%08x %08x %08lx %08lx %08lx\n",
 	  mld->dwCallback, hDev, uMsg, mld->dwClientInstance, dwParam1, dwParam2);
@@ -62,7 +62,7 @@
 /**************************************************************************
  * 				MMDRV_Aux_Map16To32A		[internal]
  */
-WINMM_MapType	MMDRV_Aux_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Aux_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -70,7 +70,7 @@
 /**************************************************************************
  * 				MMDRV_Aux_UnMap16To32A		[internal]
  */
-WINMM_MapType	MMDRV_Aux_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Aux_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -78,7 +78,7 @@
 /**************************************************************************
  * 				MMDRV_Aux_Map32ATo16		[internal]
  */
-WINMM_MapType	MMDRV_Aux_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Aux_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -86,7 +86,7 @@
 /**************************************************************************
  * 				MMDRV_Aux_UnMap32ATo16		[internal]
  */
-WINMM_MapType	MMDRV_Aux_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Aux_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
 #if 0
  case AUXDM_GETDEVCAPS:
@@ -103,7 +103,7 @@
 /**************************************************************************
  * 				MMDRV_Aux_Callback		[internal]
  */
-void	CALLBACK MMDRV_Aux_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_Aux_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -118,7 +118,7 @@
 /**************************************************************************
  * 				xMMDRV_Mixer_Map16To32A		[internal]
  */
-WINMM_MapType	MMDRV_Mixer_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Mixer_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -126,7 +126,7 @@
 /**************************************************************************
  * 				MMDRV_Mixer_UnMap16To32A	[internal]
  */
-WINMM_MapType	MMDRV_Mixer_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Mixer_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
 #if 0
     MIXERCAPSA	micA;
@@ -148,7 +148,7 @@
 /**************************************************************************
  * 				MMDRV_Mixer_Map32ATo16		[internal]
  */
-WINMM_MapType	MMDRV_Mixer_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Mixer_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -156,7 +156,7 @@
 /**************************************************************************
  * 				MMDRV_Mixer_UnMap32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_Mixer_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_Mixer_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -164,7 +164,7 @@
 /**************************************************************************
  * 				MMDRV_Mixer_Callback		[internal]
  */
-void	CALLBACK MMDRV_Mixer_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_Mixer_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -179,7 +179,7 @@
 /**************************************************************************
  * 				MMDRV_MidiIn_Map16To32A		[internal]
  */
-WINMM_MapType	MMDRV_MidiIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -187,7 +187,7 @@
 /**************************************************************************
  * 				MMDRV_MidiIn_UnMap16To32A	[internal]
  */
-WINMM_MapType	MMDRV_MidiIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -195,7 +195,7 @@
 /**************************************************************************
  * 				MMDRV_MidiIn_Map32ATo16		[internal]
  */
-WINMM_MapType	MMDRV_MidiIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -203,7 +203,7 @@
 /**************************************************************************
  * 				MMDRV_MidiIn_UnMap32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_MidiIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     return WINMM_MAP_MSGERROR;
 }
@@ -211,7 +211,7 @@
 /**************************************************************************
  * 				MMDRV_MidiIn_Callback		[internal]
  */
-void	CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -267,7 +267,7 @@
 /**************************************************************************
  * 				MMDRV_MidiOut_Map16To32A	[internal]
  */
-WINMM_MapType	MMDRV_MidiOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -360,7 +360,7 @@
 /**************************************************************************
  * 				MMDRV_MidiOut_UnMap16To32A	[internal]
  */
-WINMM_MapType	MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -431,7 +431,7 @@
 /**************************************************************************
  * 				MMDRV_MidiOut_Map32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_MidiOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -571,7 +571,7 @@
 /**************************************************************************
  * 				MMDRV_MidiOut_UnMap32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -648,7 +648,7 @@
 /**************************************************************************
  * 				MMDRV_MidiOut_Callback		[internal]
  */
-void	CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -696,7 +696,7 @@
 /**************************************************************************
  * 				MMDRV_WaveIn_Map16To32A		[internal]
  */
-WINMM_MapType	MMDRV_WaveIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -805,7 +805,7 @@
 /**************************************************************************
  * 				MMDRV_WaveIn_UnMap16To32A	[internal]
  */
-WINMM_MapType	MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -877,7 +877,7 @@
 /**************************************************************************
  * 				MMDRV_WaveIn_Map32ATo16		[internal]
  */
-WINMM_MapType	MMDRV_WaveIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -1047,7 +1047,7 @@
 /**************************************************************************
  * 				MMDRV_WaveIn_UnMap32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -1141,7 +1141,7 @@
 /**************************************************************************
  * 				MMDRV_WaveIn_Callback		[internal]
  */
-void	CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -1185,7 +1185,7 @@
 /**************************************************************************
  * 				MMDRV_WaveOut_Map16To32A	[internal]
  */
-WINMM_MapType	MMDRV_WaveOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -1303,7 +1303,7 @@
 /**************************************************************************
  * 				MMDRV_WaveOut_UnMap16To32A	[internal]
  */
-WINMM_MapType	MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret = WINMM_MAP_MSGERROR;
 
@@ -1386,7 +1386,7 @@
 /**************************************************************************
  * 				MMDRV_WaveOut_Map32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_WaveOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret;
 
@@ -1575,7 +1575,7 @@
 /**************************************************************************
  * 				MMDRV_WaveOut_UnMap32ATo16	[internal]
  */
-WINMM_MapType	MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
+static  WINMM_MapType	MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
 {
     WINMM_MapType	ret;
 
@@ -1687,7 +1687,7 @@
 /**************************************************************************
  * 				MMDRV_WaveOut_Callback		[internal]
  */
-void	CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
+static  void	CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
 {
     LPWINE_MLD	mld = (LPWINE_MLD)dwInstance;
 
@@ -1722,10 +1722,20 @@
     MMDRV_Callback(mld, hDev, uMsg, dwParam1, dwParam2);
 }
 
+/* =================================
+ *  M A P P E R S   H A N D L I N G
+ * ================================= */
+
+static  LRESULT    MMDRV_CallMMDrvFunc16(FARPROC16 fp16, WORD dev, WORD msg, LONG instance,
+                                 LONG lp1, LONG lp2)
+{
+    return MMDRV_CallTo16_word_wwlll(fp16, dev, msg, instance, lp1, lp2);
+}
+
 /**************************************************************************
  * 				MMDRV_GetDescription16		[internal]
  */
-BOOL	MMDRV_GetDescription16(const char* fname, char* buf, int buflen)
+static  BOOL	MMDRV_GetDescription16(const char* fname, char* buf, int buflen)
 {
     OFSTRUCT   	ofs;
     HFILE	hFile;
@@ -1758,6 +1768,61 @@
     return ret;
 }
 
+/******************************************************************
+ *		MMDRV_LoadMMDrvFunc16
+ *
+ */
+unsigned   MMDRV_LoadMMDrvFunc16(LPCSTR drvName, LPWINE_DRIVER d, 
+                                 LPWINE_MM_DRIVER lpDrv)
+{        
+    WINEMM_msgFunc16	func;
+    unsigned            count = 0;
+    char    		buffer[128];
+    /*
+     * DESCRIPTION 'wave,aux,mixer:Creative Labs Sound Blaster 16 Driver'
+     * The beginning of the module description indicates the driver supports
+     * waveform, auxiliary, and mixer devices. Use one of the following
+     * device-type names, followed by a colon (:) to indicate the type of
+     * device your driver supports. If the driver supports more than one
+     * type of device, separate each device-type name with a comma (,).
+     *
+     * wave for waveform audio devices
+     * wavemapper for wave mappers
+     * midi for MIDI audio devices
+     * midimapper for midi mappers
+     * aux for auxiliary audio devices
+     * mixer for mixer devices
+     */
+
+    if (d->d.d16.hDriver16) {
+        HMODULE16	hMod16 = GetDriverModuleHandle16(d->d.d16.hDriver16);
+
+#define	AA(_h,_w,_x,_y,_z)					\
+    func = (WINEMM_msgFunc##_y) _z ((_h), #_x);			\
+    if (func != NULL) 						\
+        { lpDrv->parts[_w].u.fnMessage##_y = func; count++; 	\
+          TRACE("Got %d bit func '%s'\n", _y, #_x);         }
+
+#define A(_x,_y)	AA(hMod16,_x,_y,16,GetProcAddress16)
+        A(MMDRV_AUX,	auxMessage);
+        A(MMDRV_MIXER,	mixMessage);
+        A(MMDRV_MIDIIN,	midMessage);
+        A(MMDRV_MIDIOUT,modMessage);
+        A(MMDRV_WAVEIN,	widMessage);
+        A(MMDRV_WAVEOUT,wodMessage);
+#undef A
+#undef AA
+    }
+    if (TRACE_ON(winmm)) {
+        if (MMDRV_GetDescription16(drvName, buffer, sizeof(buffer)))
+	    TRACE("%s => %s\n", drvName, buffer);
+	else
+	    TRACE("%s => No description\n", drvName);
+    }
+
+    return count;
+}
+
 /* =================================
  *              M C I
  * ================================= */
@@ -2669,6 +2734,21 @@
 
 void    MMDRV_Init16(void)
 {
+#define A(_x,_y) MMDRV_InstallMap(_x, \
+MMDRV_##_y##_Map16To32A, MMDRV_##_y##_UnMap16To32A, \
+MMDRV_##_y##_Map32ATo16, MMDRV_##_y##_UnMap32ATo16, \
+MMDRV_##_y##_Callback)
+    A(MMDRV_AUX,        Aux);
+    A(MMDRV_MIXER,      Mixer);
+    A(MMDRV_MIDIIN,     MidiIn);
+    A(MMDRV_MIDIOUT,    MidiOut);
+    A(MMDRV_WAVEIN,     WaveIn);
+    A(MMDRV_WAVEOUT,    WaveOut);
+#undef A
+
+    pFnCallMMDrvFunc16 = MMDRV_CallMMDrvFunc16;
+    pFnLoadMMDrvFunc16 = MMDRV_LoadMMDrvFunc16;
+
     pFnMciMapMsg16To32A   = MCI_MapMsg16To32A;
     pFnMciUnMapMsg16To32A = MCI_UnMapMsg16To32A;
     pFnMciMapMsg32ATo16   = MCI_MapMsg32ATo16;
--- winmm_11/winemm.h	Tue Oct 29 16:09:36 2002
+++ winmm_12/winemm.h	Tue Oct 29 16:09:41 2002
@@ -243,6 +243,8 @@
 DWORD		MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
 UINT		MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1, DWORD dwParam2);
 BOOL            MMDRV_Is32(unsigned int);
+void            MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_MAPFUNC,
+                                 MMDRV_MAPFUNC, MMDRV_MAPFUNC, LPDRVCALLBACK);
 
 BOOL    	MCI_Init(void);
 WINE_MCIDRIVER* MCI_GetDriver(UINT16 uDevID);
@@ -289,47 +291,6 @@
 void    	TIME_MMTimeStart(void);
 void		TIME_MMTimeStop(void);
 
-/* temporary definitions */
-void	MMDRV_Callback(LPWINE_MLD mld, HDRVR hDev, UINT uMsg, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_Aux_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Aux_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Aux_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Aux_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_Aux_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_Mixer_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Mixer_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Mixer_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_Mixer_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_Mixer_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_MidiIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiIn_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiIn_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_MidiOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiOut_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_MidiOut_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_WaveIn_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveIn_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveIn_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveIn_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-WINMM_MapType	MMDRV_WaveOut_Map16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveOut_UnMap16To32A  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveOut_Map32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-WINMM_MapType	MMDRV_WaveOut_UnMap32ATo16  (UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
-void	CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
-
-BOOL	MMDRV_GetDescription16(const char* fname, char* buf, int buflen);
-
 /* Global variables */
 extern LPWINE_MM_IDATA  WINMM_IData;
 
@@ -344,6 +305,8 @@
 extern  WINMM_MapType   (*pFnMciUnMapMsg16To32A)(WORD,WORD,DWORD);
 extern  WINMM_MapType   (*pFnMciMapMsg32ATo16)(WORD,WORD,DWORD,DWORD*);
 extern  WINMM_MapType   (*pFnMciUnMapMsg32ATo16)(WORD,WORD,DWORD,DWORD);
+extern  LRESULT         (*pFnCallMMDrvFunc16)(FARPROC16,WORD,WORD,LONG,LONG,LONG);
+extern  unsigned        (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
 extern  LRESULT         (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
 
 /* mmsystem only functions */

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux