From e163ecd2f8a2667f291774ea26c162ef0ad9374d Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 10 Jan 2019 19:14:18 +1030 Subject: [PATCH] [Projext64] Add check around duplicate name --- Source/Project64-core/Settings.cpp | 31 +++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Source/Project64-core/Settings.cpp b/Source/Project64-core/Settings.cpp index 7d03b3553..88fdd94b9 100644 --- a/Source/Project64-core/Settings.cpp +++ b/Source/Project64-core/Settings.cpp @@ -161,7 +161,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Rdb_TLB_VAddrLen, new CSettingTypeRomDatabase("TLB: Vaddr Len", (uint32_t)0)); AddHandler(Rdb_TLB_PAddrStart, new CSettingTypeRomDatabase("TLB: PAddr Start", (uint32_t)0)); AddHandler(Rdb_UseHleGfx, new CSettingTypeRomDatabase("HLE GFX RDB", Plugin_UseHleGfx)); - AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio", Plugin_UseHleAudio)); + AddHandler(Rdb_UseHleAudio, new CSettingTypeRomDatabase("HLE Audio RDB", Plugin_UseHleAudio)); AddHandler(Rdb_LoadRomToMemory, new CSettingTypeRomDatabase("Rom In Memory", false)); AddHandler(Rdb_ScreenHertz, new CSettingTypeRomDatabase("ScreenHertz", (uint32_t)0)); AddHandler(Rdb_FuncLookupMode, new CSettingTypeRomDatabase("FuncFind", (uint32_t)FuncFind_PhysicalLookup)); @@ -384,7 +384,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Plugin_CONT_CurVer, new CSettingTypeApplication("Plugin", "Controller Dll Ver", "")); AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX Plugin", Default_UseHleGfx)); - AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false)); + AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio Plugin", false)); AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true)); //Logging @@ -428,6 +428,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) uint32_t CSettings::FindSetting(CSettings * _this, const char * Name) { + uint32_t setting_id = 0; for (SETTING_MAP::iterator iter = _this->m_SettingInfo.begin(); iter != _this->m_SettingInfo.end(); iter++) { CSettingType * Setting = iter->second; @@ -438,7 +439,11 @@ uint32_t CSettings::FindSetting(CSettings * _this, const char * Name) { continue; } - return iter->first; + if (setting_id != 0) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } + setting_id = iter->first; } else if (Setting->GetSettingType() == SettingType_CfgFile) { @@ -447,7 +452,11 @@ uint32_t CSettings::FindSetting(CSettings * _this, const char * Name) { continue; } - return iter->first; + if (setting_id != 0) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } + setting_id = iter->first; } else if (Setting->GetSettingType() == SettingType_SelectedDirectory) { @@ -456,7 +465,11 @@ uint32_t CSettings::FindSetting(CSettings * _this, const char * Name) { continue; } - return iter->first; + if (setting_id != 0) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } + setting_id = iter->first; } else if (Setting->GetSettingType() == SettingType_BoolVariable) { @@ -465,10 +478,14 @@ uint32_t CSettings::FindSetting(CSettings * _this, const char * Name) { continue; } - return iter->first; + if (setting_id != 0) + { + g_Notify->BreakPoint(__FILE__, __LINE__); + } + setting_id = iter->first; } } - return 0; + return setting_id; } void CSettings::FlushSettings(CSettings * /*_this*/)