summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/re3.cpp9
-rw-r--r--src/extras/ini_parser.hpp19
2 files changed, 27 insertions, 1 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index d7bf88ea..09eafe74 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -429,6 +429,7 @@ void LoadINISettings()
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
+ bool migrate = cfg.category_size("FrontendOptions") != 0;
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
@@ -438,7 +439,13 @@ void LoadINISettings()
// CFO check
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
// CFO only supports saving uint8 right now
- ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);
+
+ // Migrate from old .ini to new .ini
+ if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, option.m_CFO->value))
+ cfg.remove("FrontendOptions", option.m_CFO->save);
+ else
+ ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);
+
if (option.m_Action == MENUACTION_CFO_SELECT) {
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
}
diff --git a/src/extras/ini_parser.hpp b/src/extras/ini_parser.hpp
index 8e88bc29..7bea024c 100644
--- a/src/extras/ini_parser.hpp
+++ b/src/extras/ini_parser.hpp
@@ -158,6 +158,25 @@ namespace linb
/* Too lazy to continue this container... If you need more methods, just add it */
+ // re3
+ void remove(const string_type& sect, const key_type& key)
+ {
+ auto it = this->find(sect);
+ if(it != this->end())
+ {
+ it->second.erase(key);
+ }
+ }
+
+ int category_size(const string_type& sect)
+ {
+ auto it = this->find(sect);
+ if(it != this->end())
+ {
+ return it->second.size();
+ }
+ return 0;
+ }
#if 1
bool read_file(const char_type* filename)