From 662266d3fddeab5f3a7247ca12bc8372b2fdbfe0 Mon Sep 17 00:00:00 2001 From: dimok321 <15055714+dimok789@users.noreply.github.com> Date: Thu, 7 Jan 2010 10:33:57 +0000 Subject: [PATCH] *Fixed the clicking problem and some speed issues because of that --- HBC/META.XML | 4 ++-- source/input.cpp | 37 +++++++++++++++++++++++++++++++++++ source/input.h | 1 + source/menu.cpp | 7 ++++--- source/menu/device_check.cpp | 16 +++++++-------- source/video.cpp | 38 +++++------------------------------- 6 files changed, 57 insertions(+), 46 deletions(-) diff --git a/HBC/META.XML b/HBC/META.XML index b225aec8..e620ea00 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 1.0 r886 - 201001070832 + 1.0 r887 + 201001070923 Loads games from USB-devices 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. diff --git a/source/input.cpp b/source/input.cpp index b8ea2289..9cb65714 100644 --- a/source/input.cpp +++ b/source/input.cpp @@ -23,6 +23,43 @@ int rumbleRequest[4] = {0,0,0,0}; GuiTrigger userInput[4]; 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 diff --git a/source/input.h b/source/input.h index b82c6263..80b7fe0e 100644 --- a/source/input.h +++ b/source/input.h @@ -17,6 +17,7 @@ extern int rumbleRequest[4]; +void UpdatePadsCB (); void ShutoffRumble(); void DoRumble(int i); diff --git a/source/menu.cpp b/source/menu.cpp index 7dfe3fb2..a79fa02c 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -121,13 +121,13 @@ static void * UpdateGUI (void *arg) { if (Settings.tooltips == TooltipsOn && THEME.show_tooltip != 0 && mainWindow->GetState() != STATE_DISABLED) 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) 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); - if (Settings.rumble == RumbleOn) { + if (Settings.rumble == RumbleOn) DoRumble(i); - } } Menu_Render(); @@ -187,6 +187,7 @@ void InitGUIThreads() { InitProgressThread(); InitNetworkThread(); InitCheckThread(); + ResumeCheck(); if (Settings.autonetwork) ResumeNetworkThread(); diff --git a/source/menu/device_check.cpp b/source/menu/device_check.cpp index 467eac14..328c2bd8 100644 --- a/source/menu/device_check.cpp +++ b/source/menu/device_check.cpp @@ -17,6 +17,7 @@ static bool ExitRequested = false; static u8 sdState =0; u8 hddState = 0; u8 checkthreadState = 0; +bool ScreenshotTriggered = false; extern u8 shutdown; extern u8 reset; @@ -146,8 +147,6 @@ static void * CheckDevices (void *arg) sdState = isInserted(bootDevice); while (!ExitRequested) { - usleep(100); - if (checkHalt && !ExitRequested) { LWP_SuspendThread(checkthread); @@ -177,14 +176,15 @@ static void * CheckDevices (void *arg) WindowPrompt("2",0,"OK"); } - u32 buttons = ButtonsPressed(); - if((buttons & WPAD_NUNCHUK_BUTTON_Z) || (buttons & WPAD_CLASSIC_BUTTON_ZL) || - (buttons & PAD_TRIGGER_Z)) + if(ScreenshotTriggered) { - gprintf("\n\tscreenShotBtn clicked"); - ScreenShot(); - gprintf("...It's easy, mmmmmmKay"); + gprintf("\n\tscreenShotBtn clicked"); + ScreenShot(); + ScreenshotTriggered = false; + gprintf("...It's easy, mmmmmmKay"); } + + usleep(20000); } return NULL; diff --git a/source/video.cpp b/source/video.cpp index b5a67a36..81edf599 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -22,13 +22,13 @@ #define DEFAULT_FIFO_SIZE 256 * 1024 static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered +static unsigned int *xfbTxt = NULL; static int whichfb = 0; // Switch static GXRModeObj *vmode; // Menu video mode static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32); static Mtx GXmodelView2D; int screenheight; int screenwidth; -u32 frameCount = 0; extern bool textVideoInit; extern bool geckoinit; @@ -36,33 +36,6 @@ extern bool geckoinit; u8 * gameScreenTex = NULL; // a GX texture screen capture of the game 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 * @@ -204,7 +177,6 @@ InitVideo () { void InitTextVideo () { - unsigned int *xfb = NULL; gprintf("\nInitTextVideo ()"); if (textVideoInit) { @@ -219,14 +191,14 @@ void InitTextVideo () VIDEO_Configure (vmode); // 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 - 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. - VIDEO_ClearFrameBuffer (vmode, xfb, COLOR_BLACK); - VIDEO_SetNextFramebuffer (xfb); + VIDEO_ClearFrameBuffer (vmode, xfbTxt, COLOR_BLACK); + VIDEO_SetNextFramebuffer (xfbTxt); VIDEO_SetBlack (FALSE); VIDEO_Flush ();