*Fixed crash when trying to set alternate dol from game disc in game settings

This commit is contained in:
dimok321 2010-12-04 07:36:23 +00:00
parent 500dc4020f
commit 777e0394d0
6 changed files with 22 additions and 21 deletions

View File

@ -233,6 +233,7 @@ bool gettextLoadLanguage(const char* langFile)
}
const char *gettext(const char *msgid)
{
if(!msgid) return NULL;
MSG *msg = findMSG(hash_string(msgid));
if (msg && msg->msgstr) return msg->msgstr;
return msgid;

View File

@ -1383,7 +1383,7 @@ int MenuDiscList()
if (Settings.quickboot == ON) //quickboot game
{
if (alternatedol == ON)
if (alternatedol == 2)
{
/* Open dol File and check exist */
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
@ -1443,7 +1443,7 @@ int MenuDiscList()
if (choice == 1)
{
if (alternatedol == ON)
if (alternatedol == 2)
{
/* Open dol File and check exist */
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);

View File

@ -71,27 +71,27 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si
WBFS_CloseDisc(disc);
u32 discfilecount = fstbuffer[0].filelen;
u32 dolfilecount = 0;
OptionList options3;
for (u32 i = 0; i < discfilecount; i++)
{
//don't add files that aren't .dol to the list
int len = (strlen(fstfiles(fstbuffer, i)));
if (fstfiles(fstbuffer, i)[len - 4] == '.' && fstfiles(fstbuffer, i)[len - 3] == 'd' && fstfiles(fstbuffer, i)[len - 2] == 'o'
&& fstfiles(fstbuffer, i)[len - 1] == 'l')
const char * filename = fstfiles(fstbuffer, i);
const char * fileext = NULL;
if(filename)
fileext = strrchr(filename, '.');
if (fileext && strcasecmp(fileext, ".dol") == 0)
{
options3.SetName(i, "%i", i);
options3.SetValue(i, fstfiles(fstbuffer, i));
//options3.SetName(i, fstfiles(fst, i));
}
}
dolfilecount++;
}
}
gprintf("\n%i alt dols found", dolfilecount);
if (dolfilecount <= 0)
gprintf("\n%i alt dols found", options3.GetLength()+1);
if (options3.GetLength() <= 0)
{
WindowPrompt(tr( "ERROR" ), tr( "No DOL file found on disc." ), tr( "OK" ));
free(fstbuffer);

View File

@ -152,7 +152,7 @@ void FlyingButtonsMenu::SetPageIndicators()
for(int i = 0; i < IndicatorCount; ++i)
{
PageindicatorImg.push_back(new GuiImage(PageindicatorImgData));
PageindicatorTxt.push_back(new GuiText(fmt("%i", i), 22, ( GXColor ) {0, 0, 0, 255}));
PageindicatorTxt.push_back(new GuiText(fmt("%i", i+1), 22, ( GXColor ) {0, 0, 0, 255}));
PageIndicatorBtn.push_back(new GuiButton(PageindicatorImgData->GetWidth(), PageindicatorImgData->GetHeight()));
PageIndicatorBtn[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
PageIndicatorBtn[i]->SetPosition(270-IndicatorCount*35+35*i, 400);

View File

@ -82,8 +82,8 @@ static const char * ParentalText[5] =
static const char * AlternateDOLText[] =
{
trNOOP( "OFF" ),
trNOOP( "Select a DOL from Game" ),
trNOOP( "Load From SD/USB" ),
trNOOP( "Select a DOL" )
};
IndGameLoadSM::IndGameLoadSM(const char * GameID)
@ -216,7 +216,7 @@ void IndGameLoadSM::SetOptionValues()
Options->SetValue(Idx++, "%s", tr( AlternateDOLText[GameConfig.loadalternatedol] ));
//! Settings: Select DOL Offset
if(GameConfig.loadalternatedol != 2)
if(GameConfig.loadalternatedol != 1)
Options->SetValue(Idx++, tr("Not required"));
else
{
@ -327,12 +327,12 @@ int IndGameLoadSM::GetMenuInternal()
//! Settings: Alternate DOL
else if (ret == ++Idx)
{
if (--GameConfig.loadalternatedol < 0) // 0->2->1->0
GameConfig.loadalternatedol = 2;
if (++GameConfig.loadalternatedol > 2)
GameConfig.loadalternatedol = 0;
}
//! Settings: Select DOL Offset
else if (ret == ++Idx && GameConfig.loadalternatedol == 2)
//! Settings: Select DOL Offset from Game
else if (ret == ++Idx && GameConfig.loadalternatedol == 1)
{
char filename[10];
snprintf(filename, 7, "%s", GameConfig.id);

View File

@ -118,7 +118,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
*entry = appldr_final();
/** Load alternate dol if set **/
if (alternatedol == 1)
if (alternatedol == 2)
{
wip_reset_counter();
void *dolbuffer = NULL;
@ -132,7 +132,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
if (dolbuffer) free(dolbuffer);
}
else if (alternatedol == 2)
else if (alternatedol == 1)
{
wip_reset_counter();
FST_ENTRY *fst = (FST_ENTRY *) *(u32 *) 0x80000038;