ISOProperties/GameListCtrl: Use Global INI Change event.

ISOProperties no longer needs its hack to refresh the game list, the
new INI Modified event can be used instead.
This commit is contained in:
EmptyChaos
2016-05-29 14:49:11 +00:00
parent 6ab1b27477
commit 309d0e59f4
6 changed files with 128 additions and 86 deletions

View File

@ -124,27 +124,19 @@ GameListItem::GameListItem(const std::string& _rFileName, const std::unordered_m
if (IsValid())
{
IniFile ini = SConfig::LoadGameIni(m_UniqueID, m_Revision);
ini.GetIfExists("EmuState", "EmulationStateId", &m_emu_state);
ini.GetIfExists("EmuState", "EmulationIssues", &m_issues);
m_has_custom_name = ini.GetIfExists("EmuState", "Title", &m_custom_name);
std::string game_id = m_UniqueID;
if (!m_has_custom_name)
// Ignore publisher ID for WAD files
if (m_Platform == DiscIO::IVolume::WII_WAD && game_id.size() > 4)
game_id.erase(4);
auto it = custom_titles.find(game_id);
if (it != custom_titles.end())
{
std::string game_id = m_UniqueID;
// Ignore publisher ID for WAD files
if (m_Platform == DiscIO::IVolume::WII_WAD && game_id.size() > 4)
game_id.erase(4);
auto end = custom_titles.end();
auto it = custom_titles.find(game_id);
if (it != end)
{
m_custom_name = it->second;
m_has_custom_name = true;
}
m_custom_name_titles_txt = it->second;
}
ReloadINI();
}
if (!IsValid() && IsElfOrDol())
@ -183,6 +175,24 @@ GameListItem::~GameListItem()
{
}
void GameListItem::ReloadINI()
{
if (!IsValid())
return;
IniFile ini = SConfig::LoadGameIni(m_UniqueID, m_Revision);
ini.GetIfExists("EmuState", "EmulationStateId", &m_emu_state, 0);
ini.GetIfExists("EmuState", "EmulationIssues", &m_issues, std::string());
m_custom_name.clear();
m_has_custom_name = ini.GetIfExists("EmuState", "Title", &m_custom_name);
if (!m_has_custom_name && !m_custom_name_titles_txt.empty())
{
m_custom_name = m_custom_name_titles_txt;
m_has_custom_name = true;
}
}
bool GameListItem::LoadFromCache()
{
return CChunkFileReader::Load<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);