change video callbacks to avoid over-reading pads

This commit is contained in:
dborth 2009-06-27 20:05:45 +00:00
parent b73dfceacb
commit d16ee561f3
5 changed files with 43 additions and 37 deletions

View File

@ -35,6 +35,8 @@ Wii/GameCube.
[3.0.5] [3.0.5]
* Increase file browser listing to 10 entries, decrease font size * Increase file browser listing to 10 entries, decrease font size
* Added text scrolling on file browser
* Added reset button for controller mappings
* Settings are now loaded from USB when loading the app from USB on HBC * Settings are now loaded from USB when loading the app from USB on HBC
* Fixed original mode lockup bug * Fixed original mode lockup bug
* Fixed menu crashes caused by ogg player bugs * Fixed menu crashes caused by ogg player bugs

View File

@ -393,7 +393,7 @@ ParseDirectory(int method)
} }
else else
{ {
StripExt(browserList[entryNum].displayname, filename); // hide file extension StripExt(browserList[entryNum].displayname, browserList[entryNum].filename); // hide file extension
} }
browserList[entryNum].length = filestat.st_size; browserList[entryNum].length = filestat.st_size;

View File

@ -15,7 +15,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wiiuse/wpad.h>
#include <malloc.h> #include <malloc.h>
#include "driver.h" #include "driver.h"
@ -438,39 +437,6 @@ UpdateScaling()
draw_init (); draw_init ();
} }
/****************************************************************************
* UpdatePadsCB
*
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
***************************************************************************/
static void
UpdatePadsCB ()
{
#ifdef HW_RVL
WPAD_ScanPads();
#endif
PAD_ScanPads();
for(int i=3; i >= 0; i--)
{
#ifdef HW_RVL
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
#endif
userInput[i].chan = i;
userInput[i].pad.btns_d = PAD_ButtonsDown(i);
userInput[i].pad.btns_u = PAD_ButtonsUp(i);
userInput[i].pad.btns_h = PAD_ButtonsHeld(i);
userInput[i].pad.stickX = PAD_StickX(i);
userInput[i].pad.stickY = PAD_StickY(i);
userInput[i].pad.substickX = PAD_SubStickX(i);
userInput[i].pad.substickY = PAD_SubStickY(i);
userInput[i].pad.triggerL = PAD_TriggerL(i);
userInput[i].pad.triggerR = PAD_TriggerR(i);
}
}
/**************************************************************************** /****************************************************************************
* SetupVideoMode * SetupVideoMode
* *
@ -597,8 +563,7 @@ InitGCVideo ()
VIDEO_SetNextFramebuffer (xfb[0]); VIDEO_SetNextFramebuffer (xfb[0]);
// video callbacks // video callbacks
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB); VIDEO_SetPostRetraceCallback ((VIRetraceCallback)copy_to_xfb);
VIDEO_SetPreRetraceCallback ((VIRetraceCallback)copy_to_xfb);
VIDEO_SetBlack (FALSE); VIDEO_SetBlack (FALSE);
VIDEO_Flush (); VIDEO_Flush ();
@ -639,6 +604,8 @@ ResetVideo_Emu ()
while (VIDEO_GetNextField()) while (VIDEO_GetNextField())
VIDEO_WaitVSync(); VIDEO_WaitVSync();
VIDEO_SetPreRetraceCallback(NULL);
GXColor background = {0, 0, 0, 255}; GXColor background = {0, 0, 0, 255};
GX_SetCopyClear (background, 0x00ffffff); GX_SetCopyClear (background, 0x00ffffff);
@ -866,6 +833,8 @@ ResetVideo_Menu ()
while (VIDEO_GetNextField()) while (VIDEO_GetNextField())
VIDEO_WaitVSync(); VIDEO_WaitVSync();
VIDEO_SetPreRetraceCallback((VIRetraceCallback)UpdatePads);
// clears the bg to color and clears the z buffer // clears the bg to color and clears the z buffer
GXColor background = {0, 0, 0, 255}; GXColor background = {0, 0, 0, 255};
GX_SetCopyClear (background, 0x00ffffff); GX_SetCopyClear (background, 0x00ffffff);

View File

@ -186,6 +186,38 @@ void SetControllers()
} }
} }
/****************************************************************************
* UpdatePads
*
* called by postRetraceCallback in InitGCVideo - scans pad and wpad
***************************************************************************/
static void
UpdatePads ()
{
#ifdef HW_RVL
WPAD_ScanPads();
#endif
PAD_ScanPads();
for(int i=3; i >= 0; i--)
{
#ifdef HW_RVL
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
#endif
userInput[i].chan = i;
userInput[i].pad.btns_d = PAD_ButtonsDown(i);
userInput[i].pad.btns_u = PAD_ButtonsUp(i);
userInput[i].pad.btns_h = PAD_ButtonsHeld(i);
userInput[i].pad.stickX = PAD_StickX(i);
userInput[i].pad.stickY = PAD_StickY(i);
userInput[i].pad.substickX = PAD_SubStickX(i);
userInput[i].pad.substickY = PAD_SubStickY(i);
userInput[i].pad.triggerL = PAD_TriggerL(i);
userInput[i].pad.triggerR = PAD_TriggerR(i);
}
}
#ifdef HW_RVL #ifdef HW_RVL
/**************************************************************************** /****************************************************************************
@ -604,6 +636,8 @@ void GetJoy()
unsigned char pad[4]; unsigned char pad[4];
short i; short i;
UpdatePads();
// Turbo mode // Turbo mode
// RIGHT on c-stick and on classic ctrlr right joystick // RIGHT on c-stick and on classic ctrlr right joystick
if(userInput[0].pad.substickX > 70 || userInput[0].WPAD_Stick(1,0) > 70) if(userInput[0].pad.substickX > 70 || userInput[0].WPAD_Stick(1,0) > 70)

View File

@ -33,5 +33,6 @@ s8 WPAD_StickY(u8 chan, u8 right);
void GetJoy(); void GetJoy();
void DrawCursor(); void DrawCursor();
bool MenuRequested(); bool MenuRequested();
void UpdatePads();
#endif #endif