mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 06:59:07 +01:00
ISOProperties: Allow opening region-free INIs with "Show Defaults" button
This commit is contained in:
parent
a1f0f60a79
commit
021f6d0f72
@ -163,22 +163,21 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it really necessary to use GetTitleID in case GetUniqueID fails?
|
// TODO: Is it really necessary to use GetTitleID in case GetUniqueID fails?
|
||||||
std::string _iniFilename = OpenISO->GetUniqueID();
|
game_id = OpenISO->GetUniqueID();
|
||||||
if (_iniFilename.empty())
|
if (game_id.empty())
|
||||||
{
|
{
|
||||||
u8 title_id[8];
|
u8 game_id_bytes[8];
|
||||||
if (OpenISO->GetTitleID(title_id))
|
if (OpenISO->GetTitleID(game_id_bytes))
|
||||||
{
|
{
|
||||||
_iniFilename = StringFromFormat("%016" PRIx64, Common::swap64(title_id));
|
game_id = StringFromFormat("%016" PRIx64, Common::swap64(game_id_bytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load game INIs
|
// Load game INIs
|
||||||
GameIniFileDefault = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + _iniFilename + ".ini";
|
GameIniFileLocal = File::GetUserPath(D_GAMESETTINGS_IDX) + game_id + ".ini";
|
||||||
GameIniFileLocal = File::GetUserPath(D_GAMESETTINGS_IDX) + _iniFilename + ".ini";
|
GameIniDefault = SCoreStartupParameter::LoadDefaultGameIni(game_id, OpenISO->GetRevision());
|
||||||
GameIniDefault = SCoreStartupParameter::LoadDefaultGameIni(_iniFilename, OpenISO->GetRevision());
|
GameIniLocal = SCoreStartupParameter::LoadLocalGameIni(game_id, OpenISO->GetRevision());
|
||||||
GameIniLocal = SCoreStartupParameter::LoadLocalGameIni(_iniFilename, OpenISO->GetRevision());
|
|
||||||
|
|
||||||
// Setup GUI
|
// Setup GUI
|
||||||
OpenGameListItem = new GameListItem(fileName);
|
OpenGameListItem = new GameListItem(fileName);
|
||||||
@ -657,7 +656,16 @@ void CISOProperties::CreateGUIControls(bool IsWad)
|
|||||||
sButtons->Add(new wxButton(this, wxID_OK, _("Close")));
|
sButtons->Add(new wxButton(this, wxID_OK, _("Close")));
|
||||||
|
|
||||||
// If there is no default gameini, disable the button.
|
// If there is no default gameini, disable the button.
|
||||||
if (!File::Exists(GameIniFileDefault))
|
bool game_ini_exists = false;
|
||||||
|
for (const std::string& ini_filename : SCoreStartupParameter::GetGameIniFilenames(game_id, OpenISO->GetRevision()))
|
||||||
|
{
|
||||||
|
if (File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + ini_filename))
|
||||||
|
{
|
||||||
|
game_ini_exists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!game_ini_exists)
|
||||||
EditConfigDefault->Disable();
|
EditConfigDefault->Disable();
|
||||||
|
|
||||||
// Add notebook and buttons to the dialog
|
// Add notebook and buttons to the dialog
|
||||||
@ -1296,9 +1304,16 @@ void CISOProperties::OnComputeMD5Sum(wxCommandEvent& WXUNUSED (event))
|
|||||||
m_MD5Sum->SetValue(output_string);
|
m_MD5Sum->SetValue(output_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opens all pre-defined INIs for the game. If there are multiple ones,
|
||||||
|
// they will all be opened, but there is usually only one
|
||||||
void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED (event))
|
void CISOProperties::OnShowDefaultConfig(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
LaunchExternalEditor(GameIniFileDefault);
|
for (const std::string& filename : SCoreStartupParameter::GetGameIniFilenames(game_id, OpenISO->GetRevision()))
|
||||||
|
{
|
||||||
|
std::string path = File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename;
|
||||||
|
if (File::Exists(path))
|
||||||
|
LaunchExternalEditor(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CISOProperties::ListSelectionChanged(wxCommandEvent& event)
|
void CISOProperties::ListSelectionChanged(wxCommandEvent& event)
|
||||||
|
@ -220,8 +220,8 @@ private:
|
|||||||
|
|
||||||
IniFile GameIniDefault;
|
IniFile GameIniDefault;
|
||||||
IniFile GameIniLocal;
|
IniFile GameIniLocal;
|
||||||
std::string GameIniFileDefault;
|
|
||||||
std::string GameIniFileLocal;
|
std::string GameIniFileLocal;
|
||||||
|
std::string game_id;
|
||||||
|
|
||||||
std::set<std::string> DefaultPatches;
|
std::set<std::string> DefaultPatches;
|
||||||
std::set<std::string> DefaultCheats;
|
std::set<std::string> DefaultCheats;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user