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
This commit is contained in:
giantpune 2009-08-01 01:05:02 +00:00
parent 52c3661c26
commit d17ebb37b4
3 changed files with 43 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,10 @@
*
* TitleBrowser.cpp *giantpune*
***************************************************************************/
#include <dirent.h>
#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

View File

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