Commit 69c963c3 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winmm: Get rid of the bFrom32 parameter in MMDRV_Alloc and MMDRV_Message.

parent 32c17034
......@@ -116,7 +116,7 @@ UINT MMDRV_GetNum(UINT type)
* MMDRV_Message [internal]
*/
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
DWORD_PTR dwParam2, BOOL bFrom32)
DWORD_PTR dwParam2)
{
LPWINE_MM_DRIVER lpDrv;
DWORD ret;
......@@ -125,9 +125,9 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
WINMM_MapType map;
int devID;
TRACE("(%s %u %u 0x%08lx 0x%08lx 0x%08lx %c)\n",
TRACE("(%s %u %u 0x%08lx 0x%08lx 0x%08lx)\n",
llTypes[mld->type].typestr, mld->uDeviceID, wMsg,
mld->dwDriverInstance, dwParam1, dwParam2, bFrom32?'Y':'N');
mld->dwDriverInstance, dwParam1, dwParam2);
if (mld->uDeviceID == (UINT16)-1) {
if (!llType->bSupportMapper) {
......@@ -158,74 +158,37 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
if (lpDrv->bIs32) {
assert(part->u.fnMessage32);
if (bFrom32) {
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 = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
} else {
map = llType->Map16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
switch (map) {
case WINMM_MAP_NOMEM:
ret = MMSYSERR_NOMEM;
break;
case WINMM_MAP_MSGERROR:
FIXME("NIY: no conversion yet 16->32 (%u)\n", wMsg);
ret = MMSYSERR_ERROR;
break;
case WINMM_MAP_OK:
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 = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
if (map == WINMM_MAP_OKMEM)
llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break;
default:
FIXME("NIY\n");
ret = MMSYSERR_NOTSUPPORTED;
break;
}
}
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 = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
} else {
assert(part->u.fnMessage16 && pFnCallMMDrvFunc16);
if (bFrom32) {
map = llType->Map32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
switch (map) {
case WINMM_MAP_NOMEM:
ret = MMSYSERR_NOMEM;
break;
case WINMM_MAP_MSGERROR:
FIXME("NIY: no conversion yet 32->16 (%u)\n", wMsg);
ret = MMSYSERR_ERROR;
break;
case WINMM_MAP_OK:
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 = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
if (map == WINMM_MAP_OKMEM)
llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break;
default:
FIXME("NIY\n");
ret = MMSYSERR_NOTSUPPORTED;
break;
}
} 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 = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
}
map = llType->Map32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
switch (map) {
case WINMM_MAP_NOMEM:
ret = MMSYSERR_NOMEM;
break;
case WINMM_MAP_MSGERROR:
FIXME("NIY: no conversion yet 32->16 (%u)\n", wMsg);
ret = MMSYSERR_ERROR;
break;
case WINMM_MAP_OK:
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 = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, mld->uDeviceID, wMsg,
mld->dwDriverInstance, dwParam1, dwParam2);
TRACE("=> %s\n", WINMM_ErrorToString(ret));
if (map == WINMM_MAP_OKMEM)
llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break;
default:
FIXME("NIY\n");
ret = MMSYSERR_NOTSUPPORTED;
break;
}
}
return ret;
}
......@@ -234,12 +197,12 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
* MMDRV_Alloc [internal]
*/
LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance, BOOL bFrom32)
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance)
{
LPWINE_MLD mld;
UINT_PTR i;
TRACE("(%d, %04x, %p, %p, %p, %p, %c)\n",
size, type, hndl, dwFlags, dwCallback, dwInstance, bFrom32?'Y':'N');
TRACE("(%d, %04x, %p, %p, %p, %p)\n",
size, type, hndl, dwFlags, dwCallback, dwInstance);
mld = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (!mld) return NULL;
......@@ -265,7 +228,6 @@ LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
ERR("Shouldn't happen. Bad allocation scheme\n");
}
mld->bFrom32 = bFrom32;
mld->dwFlags = HIWORD(*dwFlags);
mld->dwCallback = *dwCallback;
mld->dwClientInstance = *dwInstance;
......@@ -328,14 +290,14 @@ DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
mld->uDeviceID = (UINT16)-1;
mld->mmdIndex = llType->lpMlds[-1].mmdIndex;
TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE);
dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
}
}
} else {
if (mld->uDeviceID < llType->wMaxId) {
mld->mmdIndex = llType->lpMlds[mld->uDeviceID].mmdIndex;
TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags, TRUE);
dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
}
}
if (dwRet == MMSYSERR_NOERROR)
......@@ -349,7 +311,7 @@ DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg)
{
TRACE("(%p, %04x)\n", mld, wMsg);
return MMDRV_Message(mld, wMsg, 0L, 0L, TRUE);
return MMDRV_Message(mld, wMsg, 0L, 0L);
}
/**************************************************************************
......@@ -457,11 +419,11 @@ UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg,
case DRV_QUERYDEVICEINTERFACE:
case DRV_QUERYDEVICEINTERFACESIZE:
return MMDRV_Message(mld, uMsg, dwParam1, dwParam2, TRUE);
return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
case DRV_QUERYDSOUNDIFACE: /* Wine-specific: Retrieve DirectSound interface */
case DRV_QUERYDSOUNDDESC: /* Wine-specific: Retrieve DirectSound driver description*/
return MMDRV_Message(mld, uMsg, dwParam1, dwParam2, TRUE);
return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
default:
WARN("Unknown call %04x\n", uMsg);
......
......@@ -41,7 +41,7 @@ static void MMDRV_Callback(LPWINE_MLD mld, HDRVR hDev, UINT uMsg, DWORD_PTR dwP
TRACE("CB (*%08lx)(%p %08x %08lx %08lx %08lx\n",
mld->dwCallback, hDev, uMsg, mld->dwClientInstance, dwParam1, dwParam2);
if (!mld->bFrom32 && (mld->dwFlags & DCB_TYPEMASK) == DCB_FUNCTION)
if ((mld->dwFlags & DCB_TYPEMASK) == DCB_FUNCTION)
{
WORD args[8];
/* 16 bit func, call it */
......@@ -243,7 +243,7 @@ static void CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dwI
case MIM_LONGDATA:
case MIM_LONGERROR:
/* dwParam1 points to a MidiHdr, work to be done !!! */
if (mld->bFrom32 && !MMDRV_Is32(mld->mmdIndex)) {
if (!MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 32 => 16 */
LPMIDIHDR mh16 = MapSL(dwParam1);
LPMIDIHDR mh32 = *(LPMIDIHDR*)((LPSTR)mh16 - sizeof(LPMIDIHDR));
......@@ -253,19 +253,8 @@ static void CALLBACK MMDRV_MidiIn_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dwI
mh32->dwBytesRecorded = mh16->dwBytesRecorded;
if (mh32->reserved >= sizeof(MIDIHDR))
mh32->dwOffset = mh16->dwOffset;
} else if (!mld->bFrom32 && MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 16 => 32 */
LPMIDIHDR mh32 = (LPMIDIHDR)(dwParam1);
SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR));
LPMIDIHDR mh16 = MapSL(segmh16);
dwParam1 = (DWORD)segmh16;
mh16->dwFlags = mh32->dwFlags;
mh16->dwBytesRecorded = mh32->dwBytesRecorded;
if (mh16->reserved >= sizeof(MIDIHDR))
mh16->dwOffset = mh32->dwOffset;
}
/* else { 16 => 16 or 32 => 32, nothing to do, same struct is kept }*/
/* else { 32 => 32, nothing to do, same struct is kept }*/
break;
/* case MOM_POSITIONCB: */
default:
......@@ -708,7 +697,7 @@ static void CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dw
/* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
break;
case MOM_DONE:
if (mld->bFrom32 && !MMDRV_Is32(mld->mmdIndex)) {
if (!MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 32 => 16 */
LPMIDIHDR mh16 = MapSL(dwParam1);
LPMIDIHDR mh32 = *(LPMIDIHDR*)((LPSTR)mh16 - sizeof(LPMIDIHDR));
......@@ -718,18 +707,8 @@ static void CALLBACK MMDRV_MidiOut_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dw
mh32->dwOffset = mh16->dwOffset;
if (mh32->reserved >= sizeof(MIDIHDR))
mh32->dwOffset = mh16->dwOffset;
} else if (!mld->bFrom32 && MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 16 => 32 */
LPMIDIHDR mh32 = (LPMIDIHDR)(dwParam1);
SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR));
LPMIDIHDR mh16 = MapSL(segmh16);
dwParam1 = (DWORD)segmh16;
mh16->dwFlags = mh32->dwFlags;
if (mh16->reserved >= sizeof(MIDIHDR))
mh16->dwOffset = mh32->dwOffset;
}
/* else { 16 => 16 or 32 => 32, nothing to do, same struct is kept }*/
/* else { 32 => 32, nothing to do, same struct is kept }*/
break;
/* case MOM_POSITIONCB: */
default:
......@@ -1234,7 +1213,7 @@ static void CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dwI
/* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
break;
case WIM_DATA:
if (mld->bFrom32 && !MMDRV_Is32(mld->mmdIndex)) {
if (!MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 32 => 16 */
LPWAVEHDR wh16 = MapSL(dwParam1);
LPWAVEHDR wh32 = *(LPWAVEHDR*)((LPSTR)wh16 - sizeof(LPWAVEHDR));
......@@ -1242,17 +1221,8 @@ static void CALLBACK MMDRV_WaveIn_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dwI
dwParam1 = (DWORD)wh32;
wh32->dwFlags = wh16->dwFlags;
wh32->dwBytesRecorded = wh16->dwBytesRecorded;
} else if (!mld->bFrom32 && MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 16 => 32 */
LPWAVEHDR wh32 = (LPWAVEHDR)(dwParam1);
SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR));
LPWAVEHDR wh16 = MapSL(segwh16);
dwParam1 = (DWORD)segwh16;
wh16->dwFlags = wh32->dwFlags;
wh16->dwBytesRecorded = wh32->dwBytesRecorded;
}
/* else { 16 => 16 or 32 => 32, nothing to do, same struct is kept }*/
/* else { 32 => 32, nothing to do, same struct is kept }*/
break;
default:
ERR("Unknown msg %u\n", uMsg);
......@@ -1807,23 +1777,15 @@ static void CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD_PTR dw
/* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
break;
case WOM_DONE:
if (mld->bFrom32 && !MMDRV_Is32(mld->mmdIndex)) {
if (!MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 32 => 16 */
LPWAVEHDR wh16 = MapSL(dwParam1);
LPWAVEHDR wh32 = *(LPWAVEHDR*)((LPSTR)wh16 - sizeof(LPWAVEHDR));
dwParam1 = (DWORD)wh32;
wh32->dwFlags = wh16->dwFlags;
} else if (!mld->bFrom32 && MMDRV_Is32(mld->mmdIndex)) {
/* initial map is: 16 => 32 */
LPWAVEHDR wh32 = (LPWAVEHDR)(dwParam1);
SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR));
LPWAVEHDR wh16 = MapSL(segwh16);
dwParam1 = (DWORD)segwh16;
wh16->dwFlags = wh32->dwFlags;
}
/* else { 16 => 16 or 32 => 32, nothing to do, same struct is kept }*/
/* else { 32 => 32, nothing to do, same struct is kept }*/
break;
default:
ERR("Unknown msg %u\n", uMsg);
......
......@@ -97,7 +97,6 @@ typedef struct tagWINE_MLD {
UINT mmdIndex; /* index to low-level driver in MMDrvs table */
DWORD_PTR dwDriverInstance; /* this value is driver related, as opposed to
* opendesc.dwInstance which is client (callback) related */
WORD bFrom32;
WORD dwFlags;
DWORD_PTR dwCallback;
DWORD_PTR dwClientInstance;
......@@ -183,13 +182,13 @@ BOOL MMDRV_Init(void);
void MMDRV_Exit(void);
UINT MMDRV_GetNum(UINT);
LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance, BOOL bFrom32);
DWORD_PTR* dwCallback, DWORD_PTR* dwInstance);
void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld);
DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwParam2);
DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg);
LPWINE_MLD MMDRV_Get(HANDLE hndl, UINT type, BOOL bCanBeID);
LPWINE_MLD MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT dstTyped);
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2, BOOL bFrom32);
DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
BOOL MMDRV_Is32(unsigned int);
void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_UNMAPFUNC,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment