*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:
dimok321 2009-12-28 16:05:16 +00:00
parent 0f7be67d7b
commit 5058a6688d
7 changed files with 95 additions and 26 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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
}

View File

@ -110,7 +110,7 @@ static void * UpdateGUI (void *arg) {
while (1) {
if (guiHalt) {
LWP_SuspendThread(guithread);
}
}
else {
if (!ExitRequested) {
mainWindow->Draw();
@ -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();
@ -252,7 +252,7 @@ int MainMenu(int menu) {
currentMenu = menu;
char imgPath[100];
//if (strcmp(headlessID,"")!=0)HaltGui();
//WindowPrompt("Can you see me now",0,"ok");
@ -287,7 +287,7 @@ int MainMenu(int menu) {
bgMusic->Load(Settings.ogg_path);
}
bgMusic->Play();
while (currentMenu != MENU_EXIT) {
bgMusic->SetVolume(Settings.volume);
@ -373,11 +373,11 @@ int MainMenu(int menu) {
else if (boothomebrew == 1) {
gprintf("\nBootHomebrew");
BootHomebrew(Settings.selected_homebrew);
}
}
else if (boothomebrew == 2) {
gprintf("\nBootHomebrewFromMenu");
BootHomebrewFromMem();
}
}
else {
gprintf("\n\tSettings.partition:%d",Settings.partition);
struct discHdr *header = NULL;
@ -411,8 +411,8 @@ int MainMenu(int menu) {
}
}
}
int ret = 0;
header = (mountMethod?dvdheader:&gameList[gameSelected]);
@ -491,7 +491,7 @@ int MainMenu(int menu) {
gprintf("\nSetting fragment list...");
ret = set_frag_list(header->id);
gprintf("%d\n", ret);
ret = Disc_SetUSB(header->id);
if (ret < 0) Sys_BackToLoader();
gprintf("\n\tUSB set to game");
@ -519,7 +519,7 @@ int MainMenu(int menu) {
mload_close();
}
}
u8 errorfixer002 = 0;
switch (fix002) {
case on:

View File

@ -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;
}
}
}
}

View File

@ -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;
}