Move scanning of pads to joystick implementation instead. Frodo doesn't use
the SDL joystick support (and scans the pads by itself!). Scanning the pads at multiple places just makes things fall apart.
This commit is contained in:
parent
7690bb4d2b
commit
1a727cf088
|
@ -87,6 +87,8 @@ static int __jspad_enabled = 1;
|
|||
static int __numwiijoysticks = 4;
|
||||
static int __numgcjoysticks = 4;
|
||||
|
||||
static int __scan_pads_callback_set = 0;
|
||||
|
||||
/* Function to scan the system for joysticks.
|
||||
* This function should set SDL_numjoysticks to the number of available
|
||||
* joysticks. Joystick 0 should be the system default joystick.
|
||||
|
@ -110,6 +112,14 @@ 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.
|
||||
|
@ -147,6 +157,11 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
|
|||
joystick->nhats = MAX_GC_HATS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update pads at vertical retrace */
|
||||
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
|
||||
__scan_pads_callback_set++;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -381,6 +396,11 @@ void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
|
|||
{
|
||||
if (joystick->hwdata != NULL)
|
||||
SDL_free(joystick->hwdata);
|
||||
|
||||
/* Clear callback again */
|
||||
__scan_pads_callback_set--;
|
||||
if ( __scan_pads_callback_set == 0 )
|
||||
VIDEO_SetPostRetraceCallback (NULL);
|
||||
}
|
||||
|
||||
/* Function to perform any system-specific joystick related cleanup */
|
||||
|
|
|
@ -164,13 +164,6 @@ draw_square (Mtx v)
|
|||
GX_End ();
|
||||
}
|
||||
|
||||
static void
|
||||
UpdatePadsCB()
|
||||
{
|
||||
WPAD_ScanPads();
|
||||
PAD_ScanPads();
|
||||
}
|
||||
|
||||
void
|
||||
WII_InitVideoSystem()
|
||||
{
|
||||
|
@ -194,9 +187,6 @@ WII_InitVideoSystem()
|
|||
VIDEO_ClearFrameBuffer(display_mode, xfb[1], COLOR_BLACK);
|
||||
VIDEO_SetNextFramebuffer (xfb[0]);
|
||||
|
||||
// video callbacks
|
||||
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
|
||||
|
||||
// Show the screen.
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
|
|
Reference in a new issue