Support a gcm revision-specific game ini for cheats + partially fix gecko codes in default ini.
The local ini is not revision-specific because it would require renaming everything. Meh.
This commit is contained in:
@@ -242,10 +242,9 @@ void wxCheatsWindow::OnEvent_Close(wxCloseEvent& ev)
|
||||
void wxCheatsWindow::UpdateGUI()
|
||||
{
|
||||
// load code
|
||||
m_gameini_default_path = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + Core::g_CoreStartupParameter.GetUniqueID() + ".ini";
|
||||
m_gameini_default.Load(m_gameini_default_path);
|
||||
m_gameini_local_path = File::GetUserPath(D_GAMESETTINGS_IDX) + Core::g_CoreStartupParameter.GetUniqueID() + ".ini";
|
||||
m_gameini_local.Load(m_gameini_local_path, true);
|
||||
m_gameini_default = Core::g_CoreStartupParameter.LoadDefaultGameIni();
|
||||
m_gameini_local = Core::g_CoreStartupParameter.LoadLocalGameIni();
|
||||
m_gameini_local_path = Core::g_CoreStartupParameter.m_strGameIniLocal;
|
||||
Load_ARCodes();
|
||||
Load_GeckoCodes();
|
||||
|
||||
@@ -286,7 +285,7 @@ void wxCheatsWindow::Load_ARCodes()
|
||||
|
||||
void wxCheatsWindow::Load_GeckoCodes()
|
||||
{
|
||||
m_geckocode_panel->LoadCodes(m_gameini_local, Core::g_CoreStartupParameter.GetUniqueID(), true);
|
||||
m_geckocode_panel->LoadCodes(m_gameini_default, m_gameini_local, Core::g_CoreStartupParameter.GetUniqueID(), true);
|
||||
}
|
||||
|
||||
void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (event))
|
||||
|
||||
@@ -132,7 +132,6 @@ class wxCheatsWindow : public wxDialog
|
||||
Gecko::CodeConfigPanel *m_geckocode_panel;
|
||||
IniFile m_gameini_default;
|
||||
IniFile m_gameini_local;
|
||||
std::string m_gameini_default_path;
|
||||
std::string m_gameini_local_path;
|
||||
|
||||
void Init_ChildControls();
|
||||
|
||||
@@ -81,13 +81,13 @@ void CodeConfigPanel::UpdateCodeList(bool checkRunning)
|
||||
UpdateInfoBox(evt);
|
||||
}
|
||||
|
||||
void CodeConfigPanel::LoadCodes(const IniFile& inifile, const std::string& gameid, bool checkRunning)
|
||||
void CodeConfigPanel::LoadCodes(const IniFile& globalIni, const IniFile& localIni, const std::string& gameid, bool checkRunning)
|
||||
{
|
||||
m_gameid = gameid;
|
||||
|
||||
m_gcodes.clear();
|
||||
if (!checkRunning || Core::IsRunning())
|
||||
Gecko::LoadCodes(inifile, m_gcodes);
|
||||
Gecko::LoadCodes(globalIni, localIni, m_gcodes);
|
||||
|
||||
UpdateCodeList(checkRunning);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
CodeConfigPanel(wxWindow* const parent);
|
||||
|
||||
|
||||
void LoadCodes(const IniFile& inifile, const std::string& gameid = "", bool checkRunning = false);
|
||||
void LoadCodes(const IniFile& globalIni, const IniFile& localIni, const std::string& gameid = "", bool checkRunning = false);
|
||||
const std::vector<GeckoCode>& GetCodes() const { return m_gcodes; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -110,6 +110,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
||||
|
||||
// Load game ini
|
||||
std::string _iniFilename = OpenISO->GetUniqueID();
|
||||
std::string _iniFilenameRevisionSpecific = OpenISO->GetRevisionSpecificUniqueID();
|
||||
|
||||
if (!_iniFilename.length())
|
||||
{
|
||||
@@ -123,9 +124,12 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
||||
}
|
||||
|
||||
GameIniFileDefault = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + _iniFilename + ".ini";
|
||||
std::string GameIniFileDefaultRevisionSpecific = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + _iniFilenameRevisionSpecific + ".ini";
|
||||
GameIniFileLocal = File::GetUserPath(D_GAMESETTINGS_IDX) + _iniFilename + ".ini";
|
||||
|
||||
GameIniDefault.Load(GameIniFileDefault);
|
||||
if (_iniFilenameRevisionSpecific != "")
|
||||
GameIniDefault.Load(GameIniFileDefaultRevisionSpecific);
|
||||
GameIniLocal.Load(GameIniFileLocal);
|
||||
|
||||
// Setup GUI
|
||||
@@ -1047,7 +1051,7 @@ void CISOProperties::LoadGameConfig()
|
||||
|
||||
PatchList_Load();
|
||||
ActionReplayList_Load();
|
||||
m_geckocode_panel->LoadCodes(GameIniLocal, OpenISO->GetUniqueID());
|
||||
m_geckocode_panel->LoadCodes(GameIniDefault, GameIniLocal, OpenISO->GetUniqueID());
|
||||
}
|
||||
|
||||
void CISOProperties::SaveGameIniValueFrom3StateCheckbox(const char* section, const char* key, wxCheckBox* checkbox)
|
||||
|
||||
Reference in New Issue
Block a user