*little fix in loading settings

This commit is contained in:
dimok321 2010-09-24 21:43:46 +00:00
parent e44e3c817c
commit 0ddf6e9d72
4 changed files with 19 additions and 17 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>1.0 r971</version>
<release_date>201009241958</release_date>
<version>1.0 r972</version>
<release_date>201009242132</release_date>
<short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.
The interactive GUI is completely controllable with WiiMote, Classic Controller or GC Controller.

View File

@ -93,13 +93,13 @@ bool CGameSettings::AddGame(const GameCFG * NewGame)
if(strncmp(NewGame->id, GameList[i].id, 6) == 0)
{
memcpy(&GameList[i], NewGame, sizeof(GameCFG));
return Save();
return true;
}
}
GameList.push_back(*NewGame);
return Save();
return true;
}
bool CGameSettings::RemoveAll()
@ -124,7 +124,7 @@ bool CGameSettings::Remove(const char * id)
}
}
return Save();
return true;
}
bool CGameSettings::Load(const char * path)
@ -341,12 +341,10 @@ void CGameSettings::ParseLine(char *line)
if(!ReadGameID(line, GameID, 6))
return;
int pos = GameList.size();
GameCFG NewCFG;
memset(&NewCFG, 0, sizeof(GameCFG));
GameList.resize(pos+1);
memset(&GameList[pos], 0, sizeof(GameCFG));
strcpy(GameList[pos].id, GameID);
strcpy(NewCFG.id, GameID);
char * LinePtr = strchr(line, '=');
@ -361,10 +359,12 @@ void CGameSettings::ParseLine(char *line)
this->TrimLine(name, LinePtr, sizeof(name));
this->TrimLine(value, eq + 1, sizeof(value));
SetSetting(GameList[pos], name, value);
SetSetting(NewCFG, name, value);
LinePtr = strchr(LinePtr, ';');
}
AddGame(&NewCFG);
}
void CGameSettings::TrimLine(char *dest, const char *src, int size)

View File

@ -207,8 +207,8 @@ bool CSettings::Save()
fprintf(file, "quickboot = %d\n ", quickboot);
fprintf(file, "wsprompt = %d\n ", wsprompt);
fprintf(file, "parentalcontrol = %d\n ", parentalcontrol);
fprintf(file, "cover_path = %s\n ", covers_path);
fprintf(file, "cover2d_path = %s\n ", covers2d_path);
fprintf(file, "covers_path = %s\n ", covers_path);
fprintf(file, "covers2d_path = %s\n ", covers2d_path);
fprintf(file, "theme_path = %s\n ", theme_path);
fprintf(file, "disc_path = %s\n ", disc_path);
fprintf(file, "language_path = %s\n ", language_path);
@ -235,8 +235,8 @@ bool CSettings::Save()
fprintf(file, "discart = %d\n ", discart);
fprintf(file, "partition = %d\n ", partition);
fprintf(file, "marknewtitles = %d\n ", marknewtitles);
fprintf(file, "fatInstallToDir = %d\n ", FatInstallToDir);
fprintf(file, "partitions = %d\n ", partitions_to_install);
fprintf(file, "FatInstallToDir = %d\n ", FatInstallToDir);
fprintf(file, "partitions_to_install = %d\n ", partitions_to_install);
fprintf(file, "fullcopy = %d\n ", fullcopy);
fprintf(file, "beta_upgrades = %d\n ", beta_upgrades);
fprintf(file, "returnTo = %s\n ", returnTo);
@ -337,7 +337,7 @@ bool CSettings::SetSetting(char *name, char *value)
}
return true;
}
else if (strcmp(name, "unlockCode") == 0)
else if (strcmp(name, "password") == 0)
{
strcpy(unlockCode, value);
return true;

View File

@ -2602,7 +2602,7 @@ int MenuGameSettings(struct discHdr * header)
else if (saveBtn.GetState() == STATE_CLICKED)
{
if (GameSettings.AddGame(&game_cfg))
if (GameSettings.AddGame(&game_cfg) && GameSettings.Save())
{
WindowPrompt(tr( "Successfully Saved" ), 0, tr( "OK" ));
}
@ -2905,6 +2905,7 @@ int MenuGameSettings(struct discHdr * header)
if (choice1 == 1 && !mountMethod)
{
GameSettings.Remove(header->id);
GameSettings.Save();
CFG_forget_game_num(header->id);
ret = WBFS_RemoveGame(header->id);
if (ret < 0)
@ -3049,6 +3050,7 @@ int MenuGameSettings(struct discHdr * header)
strcpy(game_cfg.alternatedolname, "");
game_cfg.returnTo = 1;
GameSettings.Remove(header->id);
GameSettings.Save();
}
pageToDisplay = 1;