mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-18 01:09:16 +01:00
*Added a prompt after a theme was downloaded which asks if you want to apply the downloaded theme
*Changed GuiDrawThread priority to maximum. This seems to take care of the vanishing WiiMotePointer problem (let's see if it works. If anyone notices a slowdown of any process caused by this revision, please report.)
This commit is contained in:
parent
0f7be67d7b
commit
5058a6688d
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>1.0 r876</version>
|
||||
<release_date>200912271958</release_date>
|
||||
<version>1.0 r877</version>
|
||||
<release_date>200912281318</release_date>
|
||||
<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.
|
||||
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.
|
||||
|
File diff suppressed because one or more lines are too long
@ -139,8 +139,46 @@ bool checkfile(char * path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SearchFile(const char * searchpath, const char * searched_filename, char * outfilepath)
|
||||
{
|
||||
struct stat st;
|
||||
DIR_ITER *dir = NULL;
|
||||
bool result = false;
|
||||
|
||||
char filename[1024];
|
||||
char pathptr[strlen(searchpath)+1];
|
||||
snprintf(pathptr, sizeof(pathptr), "%s", searchpath);
|
||||
|
||||
if(pathptr[strlen(pathptr)-1] == '/')
|
||||
{
|
||||
pathptr[strlen(pathptr)-1] = '\0';
|
||||
}
|
||||
|
||||
dir = diropen(pathptr);
|
||||
if(!dir)
|
||||
return false;
|
||||
|
||||
while (dirnext(dir,filename,&st) == 0 && result == false)
|
||||
{
|
||||
if(strcasecmp(filename, searched_filename) == 0)
|
||||
{
|
||||
if(outfilepath)
|
||||
{
|
||||
sprintf(outfilepath, "%s/%s", pathptr, filename);
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
else if((st.st_mode & S_IFDIR) != 0)
|
||||
{
|
||||
if(strcmp(filename, ".") != 0 && strcmp(filename, "..") != 0)
|
||||
{
|
||||
char newpath[1024];
|
||||
snprintf(newpath, sizeof(newpath), "%s/%s", pathptr, filename);
|
||||
result = SearchFile(newpath, searched_filename, outfilepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
dirclose(dir);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ extern "C" {
|
||||
int GetAllDirFiles(char * filespath);
|
||||
bool subfoldercreate(const char * fullpath);
|
||||
bool checkfile(char * path);
|
||||
bool SearchFile(const char * searchpath, const char * searched_filename, char * outfilepath);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ static void * UpdateGUI (void *arg) {
|
||||
* Startup GUI threads
|
||||
***************************************************************************/
|
||||
void InitGUIThreads() {
|
||||
LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 0, 75);
|
||||
LWP_CreateThread(&guithread, UpdateGUI, NULL, NULL, 0, LWP_PRIO_HIGHEST);
|
||||
InitProgressThread();
|
||||
InitNetworkThread();
|
||||
|
||||
|
@ -36,10 +36,10 @@ extern u8 shutdown;
|
||||
extern u8 reset;
|
||||
|
||||
|
||||
bool DownloadTheme(const char *url, const char *title)
|
||||
int DownloadTheme(const char *url, const char *title)
|
||||
{
|
||||
if(!url)
|
||||
return false;
|
||||
return 0;
|
||||
|
||||
char filename[255];
|
||||
memset(filename, 0, sizeof(filename));
|
||||
@ -49,7 +49,7 @@ bool DownloadTheme(const char *url, const char *title)
|
||||
if(filesize <= 0)
|
||||
{
|
||||
WindowPrompt(tr("Download request failed."), 0, tr("OK"));
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char path[300];
|
||||
@ -65,7 +65,7 @@ bool DownloadTheme(const char *url, const char *title)
|
||||
if(!file)
|
||||
{
|
||||
WindowPrompt(tr("Download failed."), tr("Can't create file"), tr("OK"));
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 done = 0;
|
||||
@ -89,7 +89,7 @@ bool DownloadTheme(const char *url, const char *title)
|
||||
remove(path);
|
||||
ProgressStop();
|
||||
WindowPrompt(tr("Download failed."), tr("Transfer failed."), tr("OK"));
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
else if (ret == 0)
|
||||
break;
|
||||
@ -108,16 +108,37 @@ bool DownloadTheme(const char *url, const char *title)
|
||||
{
|
||||
remove(filepath);
|
||||
WindowPrompt(tr("Download failed."), tr("Connection lost..."), tr("OK"));
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ZipFile zipfile(filepath);
|
||||
|
||||
bool result = zipfile.ExtractAll(path);
|
||||
int result = zipfile.ExtractAll(path);
|
||||
if(result)
|
||||
{
|
||||
remove(filepath);
|
||||
WindowPrompt(tr("Successfully extracted theme"), title, tr("OK"));
|
||||
int choice = WindowPrompt(tr("Successfully extracted theme."), tr("Do you want to apply it now?"), tr("Yes"), tr("No"));
|
||||
if(choice)
|
||||
{
|
||||
char real_themepath[1024];
|
||||
sprintf(real_themepath, "%s", CFG.theme_path);
|
||||
if(SearchFile(path, "GXtheme.cfg", real_themepath) == true)
|
||||
{
|
||||
char *ptr = strrchr(real_themepath, '/');
|
||||
if(ptr)
|
||||
{
|
||||
ptr++;
|
||||
ptr[0] = '\0';
|
||||
}
|
||||
snprintf(CFG.theme_path, sizeof(CFG.theme_path), "%s", real_themepath);
|
||||
cfg_save_global();
|
||||
CFG_Load();
|
||||
CFG_LoadGlobal();
|
||||
result = 2;
|
||||
}
|
||||
else
|
||||
WindowPrompt(tr("ERROR: Can't set up theme."), tr("GXtheme.cfg not found in any subfolder."), tr("OK"));
|
||||
}
|
||||
}
|
||||
else
|
||||
WindowPrompt(tr("Failed to extract."), tr("Unsupported format, try to extract manually."), tr("OK"));
|
||||
@ -126,10 +147,11 @@ bool DownloadTheme(const char *url, const char *title)
|
||||
}
|
||||
|
||||
|
||||
static void Theme_Prompt(const char *title, const char *author, GuiImageData *thumbimageData, const char *downloadlink)
|
||||
static int Theme_Prompt(const char *title, const char *author, GuiImageData *thumbimageData, const char *downloadlink)
|
||||
{
|
||||
gprintf("\nTheme_Prompt(%s ,%s, <DATA>, %s)",title,author,downloadlink);
|
||||
bool leave = false;
|
||||
int result = 0;
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, Settings.sfxvolume);
|
||||
// because destroy GuiSound must wait while sound playing is finished, we use a global sound
|
||||
@ -233,7 +255,9 @@ static void Theme_Prompt(const char *title, const char *author, GuiImageData *th
|
||||
int choice = WindowPrompt(tr("Do you want to download this theme?"), title, tr("Yes"), tr("Cancel"));
|
||||
if(choice)
|
||||
{
|
||||
DownloadTheme(downloadlink, title);
|
||||
result = DownloadTheme(downloadlink, title);
|
||||
if(result == 2)
|
||||
leave = true;
|
||||
}
|
||||
mainWindow->SetState(STATE_DISABLED);
|
||||
promptWindow.SetState(STATE_DEFAULT);
|
||||
@ -254,6 +278,8 @@ static void Theme_Prompt(const char *title, const char *author, GuiImageData *th
|
||||
mainWindow->Remove(&promptWindow);
|
||||
mainWindow->SetState(STATE_DEFAULT);
|
||||
ResumeGui();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -600,8 +626,13 @@ int Theme_Downloader()
|
||||
if(MainButton[i]->GetState() == STATE_CLICKED)
|
||||
{
|
||||
snprintf(url, sizeof(url), "%s", Theme->GetDownloadLink(currenttheme+i));
|
||||
Theme_Prompt(Theme->GetThemeTitle(currenttheme+i), Theme->GetThemeAuthor(currenttheme+i), ImageData[i], url);
|
||||
int ret = Theme_Prompt(Theme->GetThemeTitle(currenttheme+i), Theme->GetThemeAuthor(currenttheme+i), ImageData[i], url);
|
||||
MainButton[i]->ResetState();
|
||||
if(ret == 2)
|
||||
{
|
||||
listchanged = true;
|
||||
menu = MENU_THEMEDOWNLOADER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,12 +242,12 @@ void StopGX() {
|
||||
* Renders everything current sent to GX, and flushes video
|
||||
***************************************************************************/
|
||||
void Menu_Render() {
|
||||
GX_DrawDone ();
|
||||
|
||||
whichfb ^= 1; // flip framebuffer
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
GX_CopyDisp(xfb[whichfb],GX_TRUE);
|
||||
GX_DrawDone ();
|
||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
@ -499,4 +499,3 @@ s32 TakeScreenshot(const char *path)
|
||||
gprintf(":%d", ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user