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 604b0d7c0ba..666b0e6c871 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -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; }
/**************************************************************************