From a2f5c3dbe0141b33377bd96c852e80379c784e70 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 14 Jan 2016 16:37:33 -0600 Subject: [PATCH 1/2] Add some missing INI files to FileUtil --- Source/Core/Common/CommonPaths.h | 5 +++++ Source/Core/Common/FileUtil.cpp | 9 +++++++++ Source/Core/Common/FileUtil.h | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h index 6e248a3c2d..056e3004ba 100644 --- a/Source/Core/Common/CommonPaths.h +++ b/Source/Core/Common/CommonPaths.h @@ -87,8 +87,13 @@ // Filenames // Files in the directory returned by GetUserPath(D_CONFIG_IDX) #define DOLPHIN_CONFIG "Dolphin.ini" +#define GCPAD_CONFIG "GCPadNew.ini" +#define WIIPAD_CONFIG "WiimoteNew.ini" +#define GCKEYBOARD_CONFIG "GCKeyNew.ini" +#define GFX_CONFIG "GFX.ini" #define DEBUGGER_CONFIG "Debugger.ini" #define LOGGER_CONFIG "Logger.ini" +#define UI_CONFIG "UI.ini" // Files in the directory returned by GetUserPath(D_LOGS_IDX) #define MAIN_LOG "dolphin.log" diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 08cee6ca3f..ebab9e9c48 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -783,8 +783,13 @@ static void RebuildUserDirectories(unsigned int dir_index) s_user_paths[D_WFSROOT_IDX] = s_user_paths[D_USER_IDX] + WFSROOT_DIR DIR_SEP; s_user_paths[D_BACKUP_IDX] = s_user_paths[D_USER_IDX] + BACKUP_DIR DIR_SEP; s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG; + s_user_paths[F_GCPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCPAD_CONFIG; + s_user_paths[F_WIIPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + WIIPAD_CONFIG; + s_user_paths[F_GCKEYBOARDCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCKEYBOARD_CONFIG; + s_user_paths[F_GFXCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GFX_CONFIG; s_user_paths[F_DEBUGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG; + s_user_paths[F_UICONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + UI_CONFIG; s_user_paths[F_MAINLOG_IDX] = s_user_paths[D_LOGS_IDX] + MAIN_LOG; s_user_paths[F_RAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + RAM_DUMP; s_user_paths[F_ARAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + ARAM_DUMP; @@ -805,8 +810,12 @@ static void RebuildUserDirectories(unsigned int dir_index) case D_CONFIG_IDX: s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG; + s_user_paths[F_GCPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCPAD_CONFIG; + s_user_paths[F_WIIPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + WIIPAD_CONFIG; + s_user_paths[F_GFXCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GFX_CONFIG; s_user_paths[F_DEBUGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DEBUGGER_CONFIG; s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG; + s_user_paths[F_UICONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + UI_CONFIG; break; case D_CACHE_IDX: diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 77228af00e..d0aca675dc 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -49,8 +49,13 @@ enum D_WFSROOT_IDX, D_BACKUP_IDX, F_DOLPHINCONFIG_IDX, + F_GCPADCONFIG_IDX, + F_WIIPADCONFIG_IDX, + F_GCKEYBOARDCONFIG_IDX, + F_GFXCONFIG_IDX, F_DEBUGGERCONFIG_IDX, F_LOGGERCONFIG_IDX, + F_UICONFIG_IDX, F_MAINLOG_IDX, F_RAMDUMP_IDX, F_ARAMDUMP_IDX, From 85c3e677da02d9850a488cc2f648a0eaefd0ad35 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 14 Jan 2016 16:38:06 -0600 Subject: [PATCH 2/2] Expose some ways to manage an INI file. This is required for our later INI file loaders and savers --- Source/Core/Common/IniFile.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/IniFile.h b/Source/Core/Common/IniFile.h index d0b3ec3618..41061e4d67 100644 --- a/Source/Core/Common/IniFile.h +++ b/Source/Core/Common/IniFile.h @@ -76,11 +76,15 @@ public: bool Get(const std::string& key, std::vector* values) const; bool operator<(const Section& other) const { return name < other.name; } + using SectionMap = std::map; + + const std::string& GetName() const { return name; } + const SectionMap& GetValues() const { return values; } protected: std::string name; std::vector keys_order; - std::map values; + SectionMap values; std::vector lines; }; @@ -140,6 +144,7 @@ public: // In particular it is used in PostProcessing for its configuration static void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut); + const std::list
& GetSections() const { return sections; } private: std::list
sections;