From d17ebb37b4bd1a8bdf9749225c878aaea889e4cb Mon Sep 17 00:00:00 2001 From: giantpune Date: Sat, 1 Aug 2009 01:05:02 +0000 Subject: [PATCH] add subfolder create before trying to save the wad (fixes that code dump) changes to wad install() and the screen that call it to make the installing faster --- gui.pnproj | 2 +- source/prompts/TitleBrowser.cpp | 41 +++++++++++++++++++++++++++++---- source/wad/wad.cpp | 10 ++++---- 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/gui.pnproj b/gui.pnproj index 8178b615..878bfd6b 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/prompts/TitleBrowser.cpp b/source/prompts/TitleBrowser.cpp index 96bda244..ecd73c91 100644 --- a/source/prompts/TitleBrowser.cpp +++ b/source/prompts/TitleBrowser.cpp @@ -4,6 +4,10 @@ * * TitleBrowser.cpp *giantpune* ***************************************************************************/ + +#include + + #include "language/gettext.h" #include "libwiigui/gui.h" #include "libwiigui/gui_customoptionbrowser.h" @@ -12,14 +16,13 @@ #include "network/networkops.h" #include "network/http.h" #include "filelist.h" +#include "listfiles.h" #include "settings/cfg.h" #include "sys.h" #include "menu.h" #include "audio.h" #include "wad/wad.h" - #include "xml/xml.h" - #include "../wad/title.h" /*** Extern functions ***/ @@ -387,8 +390,17 @@ int TitleBrowser(u32 type) { char temp[50]; char filepath[100]; u32 read = 0; - - snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice); + + //make sure there is a folder for this to be saved in + struct stat st; + snprintf(filepath, sizeof(filepath), "%s/wad/", bootDevice); + if (stat(filepath, &st) != 0) { + if (subfoldercreate(filepath) != 1) { + WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK")); + } + } + snprintf(filepath, sizeof(filepath), "%s/wad/tmp.tmp", bootDevice); + FILE *file = fopen(filepath, "wb"); if (infilesize < MBSIZE) @@ -464,7 +476,26 @@ int TitleBrowser(u32 type) { if (lSize==infilesize) { int pick = WindowPrompt(tr(" Wad Saved as:"), tmptxt, tr("Install"),tr("Uninstall"),tr("Cancel")); //install or uninstall it - if (pick==1)Wad_Install(file); + if (pick==1) + { + + HaltGui(); + w.Remove(&titleTxt); + w.Remove(&cancelBtn); + w.Remove(&wifiBtn); + w.Remove(&optionBrowser3); + ResumeGui(); + + Wad_Install(file); + + HaltGui(); + w.Append(&titleTxt); + w.Append(&cancelBtn); + w.Append(&wifiBtn); + w.Append(&optionBrowser3); + ResumeGui(); + + } if (pick==2)Wad_Uninstall(file); } //close that beast, we're done with it diff --git a/source/wad/wad.cpp b/source/wad/wad.cpp index 0f520dbc..d2bfed00 100644 --- a/source/wad/wad.cpp +++ b/source/wad/wad.cpp @@ -338,11 +338,12 @@ s32 Wad_Install(FILE *fp) ret = cfd; goto err; } - + snprintf(imgPath, sizeof(imgPath), "%s%d...",tr(">> Installing content #"),content->cid); + msg4Txt.SetText(imgPath); // Install content data while (idx < len) { - VIDEO_WaitVSync (); + //VIDEO_WaitVSync (); u32 size; @@ -364,9 +365,10 @@ s32 Wad_Install(FILE *fp) // Increase variables idx += size; offset += size; - snprintf(imgPath, sizeof(imgPath), "%s%d (%d)...",tr(">> Installing content #"),content->cid,idx); + + //snprintf(imgPath, sizeof(imgPath), "%s%d (%d)...",tr(">> Installing content #"),content->cid,idx); - msg4Txt.SetText(imgPath); + //msg4Txt.SetText(imgPath); prTxt.SetTextf("%i%%", 100*(cnt*len+idx)/(tmd_data->num_contents*len)); if ((Settings.wsprompt == yes) && (CFG.widescreen)) {