From 72fef99548774fc3514847d19bd113e7a260b246 Mon Sep 17 00:00:00 2001 From: dborth Date: Thu, 15 Oct 2009 05:46:23 +0000 Subject: [PATCH] workaround for wiimote mouse movement issue --- SDL/src/video/wii/SDL_wiievents.c | 12 ++++++++++-- SDL/src/video/wii/SDL_wiivideo.c | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/SDL/src/video/wii/SDL_wiievents.c b/SDL/src/video/wii/SDL_wiievents.c index f68bfd2..9b174bd 100644 --- a/SDL/src/video/wii/SDL_wiievents.c +++ b/SDL/src/video/wii/SDL_wiievents.c @@ -41,6 +41,7 @@ static SDLKey keymap[232]; static s32 stat; static s32 mstat; static WPADData *wd; +static int lastx = 0, lasty = 0; static keyboard_event ke; static mouse_event me; @@ -61,7 +62,14 @@ void PumpEvents() if (wd->ir.valid) { - posted += SDL_PrivateMouseMotion(0, 0, (int)wd->ir.x, (int)wd->ir.y); + int newx = wd->ir.x; + int newy = wd->ir.y; + int diffx = newx - lastx; + int diffy = newy - lasty; + lastx = newx; + lasty = newy; + + posted += SDL_PrivateMouseMotion(0, 1, diffx, diffy); Uint8 stateA = SDL_RELEASED; Uint8 stateB = SDL_RELEASED; @@ -99,7 +107,7 @@ void PumpEvents() if (mstat) { - posted += SDL_PrivateMouseMotion(me.button, 1, me.rx, me.ry); + posted += SDL_PrivateMouseMotion(0, 1, me.rx*2, me.ry*2); u8 button = me.button; diff --git a/SDL/src/video/wii/SDL_wiivideo.c b/SDL/src/video/wii/SDL_wiivideo.c index 9b1588c..0d0a4ca 100644 --- a/SDL/src/video/wii/SDL_wiivideo.c +++ b/SDL/src/video/wii/SDL_wiivideo.c @@ -435,7 +435,7 @@ SDL_Surface *WII_SetVideoMode(_THIS, SDL_Surface *current, currentwidth = current->w; currentheight = current->h; currentbpp = bpp; - WPAD_SetVRes(WPAD_CHAN_ALL, currentwidth, currentheight); + WPAD_SetVRes(WPAD_CHAN_ALL, currentwidth*2, currentheight*2); draw_init(); StartVideoThread(); /* We're done */ @@ -754,6 +754,7 @@ void WII_VideoStart() SetupGX(); draw_init(); StartVideoThread(); + WPAD_SetVRes(WPAD_CHAN_ALL, currentwidth*2, currentheight*2); } void WII_VideoStop()