[PATCH 09/12] winmm: Introduce compare_uint helper.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winmm/joystick.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72355 Your paranoid android. === debiant (64 bit WoW report) === winmm: midi.c:892: Test failed: expected greater than 50ms, got 50ms
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Wed, May 27, 2020 at 11:55:50PM +0200, Jacek Caban wrote:
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winmm/joystick.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/winmm/joystick.c b/dlls/winmm/joystick.c index e844be1837..2b1811d377 100644 --- a/dlls/winmm/joystick.c +++ b/dlls/winmm/joystick.c @@ -55,6 +55,12 @@ typedef struct tagWINE_JOYSTICK {
static WINE_JOYSTICK JOY_Sticks[MAXJOYSTICK];
+static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff) +{ + unsigned int diff = x > y ? x - y : y - x; + return diff <= max_diff; +} + /************************************************************************** * JOY_LoadDriver [internal] */ @@ -106,14 +112,14 @@ static void CALLBACK JOY_Timer(HWND hWnd, UINT wMsg, UINT_PTR wTimer, DWORD dwTi pos = MAKELONG(ji.wXpos, ji.wYpos);
if (!joy->bChanged || - abs(joy->ji.wXpos - ji.wXpos) > joy->threshold || - abs(joy->ji.wYpos - ji.wYpos) > joy->threshold) { + !compare_uint(joy->ji.wXpos, ji.wXpos, joy->threshold) || + !compare_uint(joy->ji.wYpos, ji.wYpos, joy->threshold)) { SendMessageA(joy->hCapture, MM_JOY1MOVE + i, ji.wButtons, pos); joy->ji.wXpos = ji.wXpos; joy->ji.wYpos = ji.wYpos; } if (!joy->bChanged || - abs(joy->ji.wZpos - ji.wZpos) > joy->threshold) { + !compare_uint(joy->ji.wZpos, ji.wZpos, joy->threshold)) { SendMessageA(joy->hCapture, MM_JOY1ZMOVE + i, ji.wButtons, pos); joy->ji.wZpos = ji.wZpos; }
participants (3)
-
Andrew Eikum -
Jacek Caban -
Marvin