From 22d0644b0c94ed89819beb351985ef5fd57c48e8 Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 1 Jul 2009 18:30:33 +0000 Subject: [PATCH] remove video callback - prevents over-reading of pads --- SDL/src/joystick/wii/SDL_sysjoystick.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/SDL/src/joystick/wii/SDL_sysjoystick.c b/SDL/src/joystick/wii/SDL_sysjoystick.c index f0d3840..25469c4 100644 --- a/SDL/src/joystick/wii/SDL_sysjoystick.c +++ b/SDL/src/joystick/wii/SDL_sysjoystick.c @@ -129,8 +129,6 @@ static int __jspad_enabled = 1; static int __numwiijoysticks = 4; static int __numgcjoysticks = 4; -static int __num_joysticks_open = 0; - /* Helpers to separate nunchuk vs classic buttons which share the * same scan codes. In particular, up on the classic controller is * the same as Z on the nunchuk. The numbers refer to the sdl_buttons_wii @@ -167,14 +165,6 @@ const char *SDL_SYS_JoystickName(int index) return (const char *)joy_name; } - -static void -UpdatePadsCB() -{ - WPAD_ScanPads(); - PAD_ScanPads(); -} - /* Function to open a joystick for use. The joystick to open is specified by the index field of the joystick. This should fill the nbuttons and naxes fields of the joystick structure. @@ -212,12 +202,6 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick) joystick->nhats = MAX_GC_HATS; } } - - /* Update pads at vertical retrace */ - if(__num_joysticks_open == 0) - VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB); - __num_joysticks_open++; - return(0); } @@ -480,6 +464,9 @@ void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) if(!joystick || !joystick->hwdata) return; + WPAD_ScanPads(); + PAD_ScanPads(); + switch(((joystick_hwdata*)(joystick->hwdata))->type) { case 0: @@ -502,11 +489,6 @@ void SDL_SYS_JoystickClose(SDL_Joystick *joystick) return; SDL_free(joystick->hwdata); - - /* Clear callback again */ - __num_joysticks_open--; - if (__num_joysticks_open == 0) - VIDEO_SetPostRetraceCallback (NULL); } /* Function to perform any system-specific joystick related cleanup */