Added more ResumeGui() so the app doesn't freeze when it errors in the disc browser.

This commit is contained in:
giantpune 2009-09-12 00:39:49 +00:00
parent 1e335a1adc
commit 18b8f34b29
2 changed files with 16 additions and 66 deletions

View File

@ -34,27 +34,33 @@ int DiscBrowse(struct discHdr * header) {
bool exit = false; bool exit = false;
int ret, choice; int ret, choice;
u64 offset; u64 offset;
HaltGui();
//Halt Gui seems to fix that pain in the ass code dump. We'll see.
HaltGui();
ret = Disc_SetUSB(header->id); ret = Disc_SetUSB(header->id);
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK"));
return ret; return ret;
} }
ret = Disc_Open(); ret = Disc_Open();
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not open disc."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not open disc."), tr("OK"));
return ret; return ret;
} }
ret = __Disc_FindPartition(&offset); ret = __Disc_FindPartition(&offset);
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not find a WBFS partition."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not find a WBFS partition."), tr("OK"));
return ret; return ret;
} }
ret = WDVD_OpenPartition(offset); ret = WDVD_OpenPartition(offset);
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK"));
return ret; return ret;
} }
@ -62,12 +68,14 @@ HaltGui();
int *buffer = (int*)allocate_memory(0x20); int *buffer = (int*)allocate_memory(0x20);
if (buffer == NULL) { if (buffer == NULL) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
return -1; return -1;
} }
ret = WDVD_Read(buffer, 0x20, 0x420); ret = WDVD_Read(buffer, 0x20, 0x420);
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
return ret; return ret;
} }
@ -76,6 +84,7 @@ HaltGui();
FST_ENTRY *fst = (FST_ENTRY *)fstbuffer; FST_ENTRY *fst = (FST_ENTRY *)fstbuffer;
if (fst == NULL) { if (fst == NULL) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Not enough free memory."), tr("OK"));
free(buffer); free(buffer);
return -1; return -1;
@ -84,12 +93,13 @@ HaltGui();
ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4); ret = WDVD_Read(fstbuffer, buffer[2]*4, buffer[1]*4);
if (ret < 0) { if (ret < 0) {
ResumeGui();
WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK")); WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK"));
free(buffer); free(buffer);
free(fstbuffer); free(fstbuffer);
return ret; return ret;
} }
ResumeGui(); ResumeGui();
free(buffer); free(buffer);
WDVD_Reset(); WDVD_Reset();

View File

@ -2200,63 +2200,6 @@ int GameSettings(struct discHdr * header) {
int res = DiscBrowse(header); int res = DiscBrowse(header);
if ((res >= 0)&&(res !=696969)) {//if res==696969 they pressed the back button if ((res >= 0)&&(res !=696969)) {//if res==696969 they pressed the back button
alternatedoloffset = res; alternatedoloffset = res;
/////////////////
//w.Remove(&optionBrowser2);
//w.Remove(&backBtn);
//char entered[43] = "";
//titleTxt.SetText(tr("ThemePath"));
//strncpy(entered, CFG.theme_path, sizeof(entered));
//int result = BrowseDevice(entered);
//int result = OnScreenKeyboard(entered, 43,0);
// HaltGui();
//w.RemoveAll();
//if ( result == 1 ) {
// int len = (strlen(entered)-1);
// if (entered[len] !='/')
// strncat (entered, "/", 1);
// strncpy(CFG.theme_path, entered, sizeof(CFG.theme_path));
// WindowPrompt(tr("Themepath Changed"),0,tr("OK"));
// if(!isSdInserted()) {
// if (!isInserted(bootDevice)) {
// WindowPrompt(tr("No SD-Card inserted!"), tr("Insert an SD-Card to save."), tr("OK"));
// } else {
// cfg_save_global();
// }
// mainWindow->Remove(bgImg);
// CFG_Load();
// CFG_LoadGlobal();
// menu = MENU_SETTINGS;
//#ifdef HW_RVL
/* snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path);
pointer[0] = new GuiImageData(imgPath, player1_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer2_point.png", CFG.theme_path);
pointer[1] = new GuiImageData(imgPath, player2_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer3_point.png", CFG.theme_path);
pointer[2] = new GuiImageData(imgPath, player3_point_png);
snprintf(imgPath, sizeof(imgPath), "%splayer4_point.png", CFG.theme_path);
pointer[3] = new GuiImageData(imgPath, player4_point_png);
//#endif
if (CFG.widescreen)
snprintf(imgPath, sizeof(imgPath), "%swbackground.png", CFG.theme_path);
else
snprintf(imgPath, sizeof(imgPath), "%sbackground.png", CFG.theme_path);
background = new GuiImageData(imgPath, CFG.widescreen? wbackground_png : background_png);
bgImg = new GuiImage(background);
mainWindow->Append(bgImg);
mainWindow->Append(&w);
}
w.Append(&settingsbackground);
w.Append(&titleTxt);
titleTxt.SetText(tr("Custom Paths"));
w.Append(&backBtn);
w.Append(&optionBrowser2);*/
// ResumeGui();
////////////////
} }
} }
} else { } else {
@ -2264,14 +2207,11 @@ int GameSettings(struct discHdr * header) {
if ((res >= 0)&&(res !=696969)){ if ((res >= 0)&&(res !=696969)){
alternatedoloffset = res; alternatedoloffset = res;
char tmp[170]; char tmp[170];
snprintf(tmp,sizeof(tmp),"%s %s - %i",tr("It seems that you have some information that will be helpfull to us. Please pass this information along to the DEV team.") ,filename,alternatedoloffset); snprintf(tmp,sizeof(tmp),"%s %s - %i",tr("It seems that you have some information that will be helpfull to us. Please pass this information along to the DEV team.") ,filename,alternatedoloffset);
WindowPrompt(0,tmp,tr("Ok")); WindowPrompt(0,tmp,tr("Ok"));
}
} }
}
} }
break; break;
case 10: case 10: