*Fixed the clicking problem and some speed issues because of that

This commit is contained in:
dimok321 2010-01-07 10:33:57 +00:00
parent 604ecb7b79
commit 662266d3fd
6 changed files with 57 additions and 46 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>1.0 r886</version> <version>1.0 r887</version>
<release_date>201001070832</release_date> <release_date>201001070923</release_date>
<short_description>Loads games from USB-devices</short_description> <short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times. <long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller. The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -23,6 +23,43 @@
int rumbleRequest[4] = {0,0,0,0}; int rumbleRequest[4] = {0,0,0,0};
GuiTrigger userInput[4]; GuiTrigger userInput[4];
static int rumbleCount[4] = {0,0,0,0}; static int rumbleCount[4] = {0,0,0,0};
u32 frameCount = 0;
extern bool ScreenshotTriggered;
/****************************************************************************
* UpdatePadsCB
*
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
***************************************************************************/
void UpdatePadsCB ()
{
frameCount++;
WPAD_ScanPads();
PAD_ScanPads();
for (int i=3; i >= 0; i--)
{
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
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);
if((userInput[i].wpad.btns_d & WPAD_NUNCHUK_BUTTON_Z)
|| (userInput[i].wpad.btns_d & WPAD_CLASSIC_BUTTON_ZL)
|| (userInput[i].pad.btns_d & PAD_TRIGGER_Z))
{
ScreenshotTriggered = true;
}
}
}
/**************************************************************************** /****************************************************************************
* ShutoffRumble * ShutoffRumble

View File

@ -17,6 +17,7 @@
extern int rumbleRequest[4]; extern int rumbleRequest[4];
void UpdatePadsCB ();
void ShutoffRumble(); void ShutoffRumble();
void DoRumble(int i); void DoRumble(int i);

View File

@ -121,13 +121,13 @@ static void * UpdateGUI (void *arg) {
if (Settings.tooltips == TooltipsOn && THEME.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED) if (Settings.tooltips == TooltipsOn && THEME.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED)
mainWindow->DrawTooltip(); mainWindow->DrawTooltip();
for (int i=3; i >= 0; i--) { // so that player 1's cursor appears on top! for (int i=3; i >= 0; i--)
{ // so that player 1's cursor appears on top!
if (userInput[i].wpad.ir.valid) if (userInput[i].wpad.ir.valid)
Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0, Menu_DrawImg(userInput[i].wpad.ir.x-48, userInput[i].wpad.ir.y-48, 200.0,
96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255,0,0,0,0,0,0,0,0); 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255,0,0,0,0,0,0,0,0);
if (Settings.rumble == RumbleOn) { if (Settings.rumble == RumbleOn)
DoRumble(i); DoRumble(i);
}
} }
Menu_Render(); Menu_Render();
@ -187,6 +187,7 @@ void InitGUIThreads() {
InitProgressThread(); InitProgressThread();
InitNetworkThread(); InitNetworkThread();
InitCheckThread(); InitCheckThread();
ResumeCheck();
if (Settings.autonetwork) if (Settings.autonetwork)
ResumeNetworkThread(); ResumeNetworkThread();

View File

@ -17,6 +17,7 @@ static bool ExitRequested = false;
static u8 sdState =0; static u8 sdState =0;
u8 hddState = 0; u8 hddState = 0;
u8 checkthreadState = 0; u8 checkthreadState = 0;
bool ScreenshotTriggered = false;
extern u8 shutdown; extern u8 shutdown;
extern u8 reset; extern u8 reset;
@ -146,8 +147,6 @@ static void * CheckDevices (void *arg)
sdState = isInserted(bootDevice); sdState = isInserted(bootDevice);
while (!ExitRequested) while (!ExitRequested)
{ {
usleep(100);
if (checkHalt && !ExitRequested) if (checkHalt && !ExitRequested)
{ {
LWP_SuspendThread(checkthread); LWP_SuspendThread(checkthread);
@ -177,14 +176,15 @@ static void * CheckDevices (void *arg)
WindowPrompt("2",0,"OK"); WindowPrompt("2",0,"OK");
} }
u32 buttons = ButtonsPressed(); if(ScreenshotTriggered)
if((buttons & WPAD_NUNCHUK_BUTTON_Z) || (buttons & WPAD_CLASSIC_BUTTON_ZL) ||
(buttons & PAD_TRIGGER_Z))
{ {
gprintf("\n\tscreenShotBtn clicked"); gprintf("\n\tscreenShotBtn clicked");
ScreenShot(); ScreenShot();
gprintf("...It's easy, mmmmmmKay"); ScreenshotTriggered = false;
gprintf("...It's easy, mmmmmmKay");
} }
usleep(20000);
} }
return NULL; return NULL;

View File

@ -22,13 +22,13 @@
#define DEFAULT_FIFO_SIZE 256 * 1024 #define DEFAULT_FIFO_SIZE 256 * 1024
static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered
static unsigned int *xfbTxt = NULL;
static int whichfb = 0; // Switch static int whichfb = 0; // Switch
static GXRModeObj *vmode; // Menu video mode static GXRModeObj *vmode; // Menu video mode
static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32); static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32);
static Mtx GXmodelView2D; static Mtx GXmodelView2D;
int screenheight; int screenheight;
int screenwidth; int screenwidth;
u32 frameCount = 0;
extern bool textVideoInit; extern bool textVideoInit;
extern bool geckoinit; extern bool geckoinit;
@ -36,33 +36,6 @@ extern bool geckoinit;
u8 * gameScreenTex = NULL; // a GX texture screen capture of the game u8 * gameScreenTex = NULL; // a GX texture screen capture of the game
u8 * gameScreenTex2 = NULL; // a GX texture screen capture of the game (copy) u8 * gameScreenTex2 = NULL; // a GX texture screen capture of the game (copy)
/****************************************************************************
* UpdatePadsCB
*
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
***************************************************************************/
static void
UpdatePadsCB () {
frameCount++;
WPAD_ScanPads();
PAD_ScanPads();
for (int i=3; i >= 0; i--) {
memcpy(&userInput[i].wpad, WPAD_Data(i), sizeof(WPADData));
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);
}
}
/**************************************************************************** /****************************************************************************
* StartGX * StartGX
* *
@ -204,7 +177,6 @@ InitVideo () {
void InitTextVideo () void InitTextVideo ()
{ {
unsigned int *xfb = NULL;
gprintf("\nInitTextVideo ()"); gprintf("\nInitTextVideo ()");
if (textVideoInit) if (textVideoInit)
{ {
@ -219,14 +191,14 @@ void InitTextVideo ()
VIDEO_Configure (vmode); VIDEO_Configure (vmode);
// Allocate the video buffers // Allocate the video buffers
xfb = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode)); xfbTxt = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
// A console is always useful while debugging // A console is always useful while debugging
console_init (xfb, 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2); console_init (xfbTxt, 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);
// Clear framebuffers etc. // Clear framebuffers etc.
VIDEO_ClearFrameBuffer (vmode, xfb, COLOR_BLACK); VIDEO_ClearFrameBuffer (vmode, xfbTxt, COLOR_BLACK);
VIDEO_SetNextFramebuffer (xfb); VIDEO_SetNextFramebuffer (xfbTxt);
VIDEO_SetBlack (FALSE); VIDEO_SetBlack (FALSE);
VIDEO_Flush (); VIDEO_Flush ();