winmm: Reimplement joyGetPos with joyGetPosEx.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-12-03 12:19:06 +01:00 committed by Alexandre Julliard
parent b67cda8975
commit 0b49f91573
1 changed files with 16 additions and 10 deletions

View File

@ -263,20 +263,26 @@ MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetPosEx(UINT wID, LPJOYINFOEX lpInfo)
/**************************************************************************
* joyGetPos [WINMM.@]
*/
MMRESULT WINAPI joyGetPos(UINT wID, LPJOYINFO lpInfo)
MMRESULT WINAPI joyGetPos( UINT id, JOYINFO *info )
{
TRACE("(%d, %p);\n", wID, lpInfo);
JOYINFOEX infoex =
{
.dwSize = sizeof(JOYINFOEX),
.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNBUTTONS,
};
MMRESULT res;
if (!lpInfo) return MMSYSERR_INVALPARAM;
if (wID >= ARRAY_SIZE(joysticks)) return JOYERR_PARMS;
if (!JOY_LoadDriver(wID)) return MMSYSERR_NODRIVER;
TRACE( "id %u, info %p.\n", id, info );
lpInfo->wXpos = 0;
lpInfo->wYpos = 0;
lpInfo->wZpos = 0;
lpInfo->wButtons = 0;
if (!info) return MMSYSERR_INVALPARAM;
if ((res = joyGetPosEx( id, &infoex ))) return res;
return SendDriverMessage( joysticks[wID].hDriver, JDD_GETPOS, (LPARAM)lpInfo, 0 );
info->wXpos = infoex.dwXpos;
info->wYpos = infoex.dwYpos;
info->wZpos = infoex.dwZpos;
info->wButtons = infoex.dwButtons;
return JOYERR_NOERROR;
}
/**************************************************************************