mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 19:29:18 +01:00
*Fixed crash when trying to set alternate dol from game disc in game settings
This commit is contained in:
parent
500dc4020f
commit
777e0394d0
@ -233,6 +233,7 @@ bool gettextLoadLanguage(const char* langFile)
|
|||||||
}
|
}
|
||||||
const char *gettext(const char *msgid)
|
const char *gettext(const char *msgid)
|
||||||
{
|
{
|
||||||
|
if(!msgid) return NULL;
|
||||||
MSG *msg = findMSG(hash_string(msgid));
|
MSG *msg = findMSG(hash_string(msgid));
|
||||||
if (msg && msg->msgstr) return msg->msgstr;
|
if (msg && msg->msgstr) return msg->msgstr;
|
||||||
return msgid;
|
return msgid;
|
||||||
|
@ -1383,7 +1383,7 @@ int MenuDiscList()
|
|||||||
|
|
||||||
if (Settings.quickboot == ON) //quickboot game
|
if (Settings.quickboot == ON) //quickboot game
|
||||||
{
|
{
|
||||||
if (alternatedol == ON)
|
if (alternatedol == 2)
|
||||||
{
|
{
|
||||||
/* Open dol File and check exist */
|
/* Open dol File and check exist */
|
||||||
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
|
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
|
||||||
@ -1443,7 +1443,7 @@ int MenuDiscList()
|
|||||||
|
|
||||||
if (choice == 1)
|
if (choice == 1)
|
||||||
{
|
{
|
||||||
if (alternatedol == ON)
|
if (alternatedol == 2)
|
||||||
{
|
{
|
||||||
/* Open dol File and check exist */
|
/* Open dol File and check exist */
|
||||||
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
|
sprintf(nipple, "%s%s.dol", Settings.dolpath, IDfull);
|
||||||
|
@ -71,27 +71,27 @@ int DiscBrowse(const char * GameID, char * alternatedname, int alternatedname_si
|
|||||||
WBFS_CloseDisc(disc);
|
WBFS_CloseDisc(disc);
|
||||||
|
|
||||||
u32 discfilecount = fstbuffer[0].filelen;
|
u32 discfilecount = fstbuffer[0].filelen;
|
||||||
u32 dolfilecount = 0;
|
|
||||||
|
|
||||||
OptionList options3;
|
OptionList options3;
|
||||||
|
|
||||||
for (u32 i = 0; i < discfilecount; i++)
|
for (u32 i = 0; i < discfilecount; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
//don't add files that aren't .dol to the list
|
//don't add files that aren't .dol to the list
|
||||||
int len = (strlen(fstfiles(fstbuffer, i)));
|
const char * filename = fstfiles(fstbuffer, i);
|
||||||
if (fstfiles(fstbuffer, i)[len - 4] == '.' && fstfiles(fstbuffer, i)[len - 3] == 'd' && fstfiles(fstbuffer, i)[len - 2] == 'o'
|
const char * fileext = NULL;
|
||||||
&& fstfiles(fstbuffer, i)[len - 1] == 'l')
|
|
||||||
|
if(filename)
|
||||||
|
fileext = strrchr(filename, '.');
|
||||||
|
|
||||||
|
if (fileext && strcasecmp(fileext, ".dol") == 0)
|
||||||
{
|
{
|
||||||
options3.SetName(i, "%i", i);
|
options3.SetName(i, "%i", i);
|
||||||
options3.SetValue(i, fstfiles(fstbuffer, i));
|
options3.SetValue(i, fstfiles(fstbuffer, i));
|
||||||
//options3.SetName(i, fstfiles(fst, i));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dolfilecount++;
|
gprintf("\n%i alt dols found", options3.GetLength()+1);
|
||||||
}
|
if (options3.GetLength() <= 0)
|
||||||
}
|
|
||||||
gprintf("\n%i alt dols found", dolfilecount);
|
|
||||||
if (dolfilecount <= 0)
|
|
||||||
{
|
{
|
||||||
WindowPrompt(tr( "ERROR" ), tr( "No DOL file found on disc." ), tr( "OK" ));
|
WindowPrompt(tr( "ERROR" ), tr( "No DOL file found on disc." ), tr( "OK" ));
|
||||||
free(fstbuffer);
|
free(fstbuffer);
|
||||||
|
@ -152,7 +152,7 @@ void FlyingButtonsMenu::SetPageIndicators()
|
|||||||
for(int i = 0; i < IndicatorCount; ++i)
|
for(int i = 0; i < IndicatorCount; ++i)
|
||||||
{
|
{
|
||||||
PageindicatorImg.push_back(new GuiImage(PageindicatorImgData));
|
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.push_back(new GuiButton(PageindicatorImgData->GetWidth(), PageindicatorImgData->GetHeight()));
|
||||||
PageIndicatorBtn[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
PageIndicatorBtn[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
PageIndicatorBtn[i]->SetPosition(270-IndicatorCount*35+35*i, 400);
|
PageIndicatorBtn[i]->SetPosition(270-IndicatorCount*35+35*i, 400);
|
||||||
|
@ -82,8 +82,8 @@ static const char * ParentalText[5] =
|
|||||||
static const char * AlternateDOLText[] =
|
static const char * AlternateDOLText[] =
|
||||||
{
|
{
|
||||||
trNOOP( "OFF" ),
|
trNOOP( "OFF" ),
|
||||||
|
trNOOP( "Select a DOL from Game" ),
|
||||||
trNOOP( "Load From SD/USB" ),
|
trNOOP( "Load From SD/USB" ),
|
||||||
trNOOP( "Select a DOL" )
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IndGameLoadSM::IndGameLoadSM(const char * GameID)
|
IndGameLoadSM::IndGameLoadSM(const char * GameID)
|
||||||
@ -216,7 +216,7 @@ void IndGameLoadSM::SetOptionValues()
|
|||||||
Options->SetValue(Idx++, "%s", tr( AlternateDOLText[GameConfig.loadalternatedol] ));
|
Options->SetValue(Idx++, "%s", tr( AlternateDOLText[GameConfig.loadalternatedol] ));
|
||||||
|
|
||||||
//! Settings: Select DOL Offset
|
//! Settings: Select DOL Offset
|
||||||
if(GameConfig.loadalternatedol != 2)
|
if(GameConfig.loadalternatedol != 1)
|
||||||
Options->SetValue(Idx++, tr("Not required"));
|
Options->SetValue(Idx++, tr("Not required"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -327,12 +327,12 @@ int IndGameLoadSM::GetMenuInternal()
|
|||||||
//! Settings: Alternate DOL
|
//! Settings: Alternate DOL
|
||||||
else if (ret == ++Idx)
|
else if (ret == ++Idx)
|
||||||
{
|
{
|
||||||
if (--GameConfig.loadalternatedol < 0) // 0->2->1->0
|
if (++GameConfig.loadalternatedol > 2)
|
||||||
GameConfig.loadalternatedol = 2;
|
GameConfig.loadalternatedol = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Settings: Select DOL Offset
|
//! Settings: Select DOL Offset from Game
|
||||||
else if (ret == ++Idx && GameConfig.loadalternatedol == 2)
|
else if (ret == ++Idx && GameConfig.loadalternatedol == 1)
|
||||||
{
|
{
|
||||||
char filename[10];
|
char filename[10];
|
||||||
snprintf(filename, 7, "%s", GameConfig.id);
|
snprintf(filename, 7, "%s", GameConfig.id);
|
||||||
|
@ -118,7 +118,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
|
|||||||
*entry = appldr_final();
|
*entry = appldr_final();
|
||||||
|
|
||||||
/** Load alternate dol if set **/
|
/** Load alternate dol if set **/
|
||||||
if (alternatedol == 1)
|
if (alternatedol == 2)
|
||||||
{
|
{
|
||||||
wip_reset_counter();
|
wip_reset_counter();
|
||||||
void *dolbuffer = NULL;
|
void *dolbuffer = NULL;
|
||||||
@ -132,7 +132,7 @@ s32 Apploader_Run(entry_point *entry, char * dolpath, u8 cheat, u8 videoSelected
|
|||||||
|
|
||||||
if (dolbuffer) free(dolbuffer);
|
if (dolbuffer) free(dolbuffer);
|
||||||
}
|
}
|
||||||
else if (alternatedol == 2)
|
else if (alternatedol == 1)
|
||||||
{
|
{
|
||||||
wip_reset_counter();
|
wip_reset_counter();
|
||||||
FST_ENTRY *fst = (FST_ENTRY *) *(u32 *) 0x80000038;
|
FST_ENTRY *fst = (FST_ENTRY *) *(u32 *) 0x80000038;
|
||||||
|
Loading…
Reference in New Issue
Block a user