Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winmm/joystick.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c index 43c68bd453c..85e46153ec8 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -260,20 +260,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; }
/**************************************************************************