Move some BootManager game INI code to CoreParameter

This commit is contained in:
JosJuice 2015-02-06 19:28:43 +01:00
parent 451c4f3c4b
commit d73a6ea3b7
4 changed files with 32 additions and 30 deletions

View File

@ -96,16 +96,7 @@ bool BootCore(const std::string& _rFilename)
return false; return false;
// Load game specific settings // Load game specific settings
std::string unique_id = StartUp.GetUniqueID(); if (StartUp.GetUniqueID().size() == 6)
std::string revision_specific = StartUp.m_strRevisionSpecificUniqueID;
StartUp.m_strGameIniDefault = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + unique_id + ".ini";
if (revision_specific != "")
StartUp.m_strGameIniDefaultRevisionSpecific = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + revision_specific + ".ini";
else
StartUp.m_strGameIniDefaultRevisionSpecific = "";
StartUp.m_strGameIniLocal = File::GetUserPath(D_GAMESETTINGS_IDX) + unique_id + ".ini";
if (unique_id.size() == 6)
{ {
IniFile game_ini = StartUp.LoadGameIni(); IniFile game_ini = StartUp.LoadGameIni();

View File

@ -375,28 +375,36 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
} }
} }
IniFile SCoreStartupParameter::LoadGameIni() const
{
IniFile game_ini;
game_ini.Load(m_strGameIniDefault);
if (m_strGameIniDefaultRevisionSpecific != "")
game_ini.Load(m_strGameIniDefaultRevisionSpecific, true);
game_ini.Load(m_strGameIniLocal, true);
return game_ini;
}
IniFile SCoreStartupParameter::LoadDefaultGameIni() const IniFile SCoreStartupParameter::LoadDefaultGameIni() const
{ {
IniFile game_ini; IniFile game_ini;
game_ini.Load(m_strGameIniDefault); LoadDefaultGameIni(&game_ini);
if (m_strGameIniDefaultRevisionSpecific != "")
game_ini.Load(m_strGameIniDefaultRevisionSpecific, true);
return game_ini; return game_ini;
} }
IniFile SCoreStartupParameter::LoadLocalGameIni() const IniFile SCoreStartupParameter::LoadLocalGameIni() const
{ {
IniFile game_ini; IniFile game_ini;
game_ini.Load(m_strGameIniLocal); LoadLocalGameIni(&game_ini);
return game_ini; return game_ini;
} }
IniFile SCoreStartupParameter::LoadGameIni() const
{
IniFile game_ini;
LoadDefaultGameIni(&game_ini);
LoadLocalGameIni(&game_ini);
return game_ini;
}
void SCoreStartupParameter::LoadDefaultGameIni(IniFile* game_ini) const
{
game_ini->Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + GetUniqueID() + ".ini", true);
if (!m_strRevisionSpecificUniqueID.empty())
game_ini->Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + m_strRevisionSpecificUniqueID + ".ini", true);
}
void SCoreStartupParameter::LoadLocalGameIni(IniFile* game_ini) const
{
game_ini->Load(File::GetUserPath(D_GAMESETTINGS_IDX) + GetUniqueID() + ".ini", true);
}

View File

@ -249,9 +249,6 @@ struct SCoreStartupParameter
std::string m_strUniqueID; std::string m_strUniqueID;
std::string m_strRevisionSpecificUniqueID; std::string m_strRevisionSpecificUniqueID;
std::string m_strName; std::string m_strName;
std::string m_strGameIniDefault;
std::string m_strGameIniDefaultRevisionSpecific;
std::string m_strGameIniLocal;
std::string m_perfDir; std::string m_perfDir;
@ -262,7 +259,12 @@ struct SCoreStartupParameter
bool AutoSetup(EBootBS2 _BootBS2); bool AutoSetup(EBootBS2 _BootBS2);
const std::string &GetUniqueID() const { return m_strUniqueID; } const std::string &GetUniqueID() const { return m_strUniqueID; }
void CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA); void CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA);
IniFile LoadDefaultGameIni() const; IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const; IniFile LoadLocalGameIni() const;
IniFile LoadGameIni() const; IniFile LoadGameIni() const;
private:
void LoadDefaultGameIni(IniFile* game_ini) const;
void LoadLocalGameIni(IniFile* game_ini) const;
}; };

View File

@ -159,9 +159,10 @@ void wxCheatsWindow::OnEvent_Close(wxCloseEvent& ev)
void wxCheatsWindow::UpdateGUI() void wxCheatsWindow::UpdateGUI()
{ {
// load code // load code
m_gameini_default = SConfig::GetInstance().m_LocalCoreStartupParameter.LoadDefaultGameIni(); SCoreStartupParameter parameters = SConfig::GetInstance().m_LocalCoreStartupParameter;
m_gameini_local = SConfig::GetInstance().m_LocalCoreStartupParameter.LoadLocalGameIni(); m_gameini_default = parameters.LoadDefaultGameIni();
m_gameini_local_path = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIniLocal; m_gameini_local = parameters.LoadLocalGameIni();
m_gameini_local_path = File::GetUserPath(D_GAMESETTINGS_IDX) + parameters.GetUniqueID() + ".ini";
Load_ARCodes(); Load_ARCodes();
Load_GeckoCodes(); Load_GeckoCodes();