Merge pull request #12317 from JosJuice/setting-saveable-cleanup

Config: Clean up IsSettingSaveable
This commit is contained in:
Mai 2023-11-28 04:20:21 +01:00 committed by GitHub
commit 99cf862596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 37 deletions

View File

@ -108,7 +108,6 @@
#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 DUALSHOCKUDPCLIENT_CONFIG "DSUClient.ini"
#define FREELOOK_CONFIG "FreeLook.ini"

View File

@ -154,7 +154,6 @@ static const std::map<System, std::string> system_to_name = {
{System::GCKeyboard, "GCKeyboard"},
{System::GFX, "Graphics"},
{System::Logger, "Logger"},
{System::Debugger, "Debugger"},
{System::SYSCONF, "SYSCONF"},
{System::DualShockUDPClient, "DualShockUDPClient"},
{System::FreeLook, "FreeLook"},

View File

@ -29,7 +29,6 @@ enum class System
GCKeyboard,
GFX,
Logger,
Debugger,
DualShockUDPClient,
FreeLook,
Session,

View File

@ -872,7 +872,6 @@ static void RebuildUserDirectories(unsigned int dir_index)
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_DUALSHOCKUDPCLIENTCONFIG_IDX] =
s_user_paths[D_CONFIG_IDX] + DUALSHOCKUDPCLIENT_CONFIG;
@ -908,7 +907,6 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[F_GCKEYBOARDCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCKEYBOARD_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_DUALSHOCKUDPCLIENTCONFIG_IDX] =
s_user_paths[D_CONFIG_IDX] + DUALSHOCKUDPCLIENT_CONFIG;

View File

@ -77,7 +77,6 @@ enum
F_WIIPADCONFIG_IDX,
F_GCKEYBOARDCONFIG_IDX,
F_GFXCONFIG_IDX,
F_DEBUGGERCONFIG_IDX,
F_LOGGERCONFIG_IDX,
F_MAINLOG_IDX,
F_MEM1DUMP_IDX,

View File

@ -80,7 +80,6 @@ const std::map<Config::System, int> system_to_ini = {
{Config::System::GCKeyboard, F_GCKEYBOARDCONFIG_IDX},
{Config::System::GFX, F_GFXCONFIG_IDX},
{Config::System::Logger, F_LOGGERCONFIG_IDX},
{Config::System::Debugger, F_DEBUGGERCONFIG_IDX},
{Config::System::DualShockUDPClient, F_DUALSHOCKUDPCLIENTCONFIG_IDX},
{Config::System::FreeLook, F_FREELOOKCONFIG_IDX},
{Config::System::Achievements, F_RETROACHIEVEMENTSCONFIG_IDX},

View File

@ -4,7 +4,7 @@
#include "Core/ConfigLoaders/IsSettingSaveable.h"
#include <algorithm>
#include <vector>
#include <array>
#include "Common/Config/Config.h"
#include "Core/Config/AchievementSettings.h"
@ -17,40 +17,19 @@ namespace ConfigLoaders
{
bool IsSettingSaveable(const Config::Location& config_location)
{
for (Config::System system :
{Config::System::SYSCONF, Config::System::GFX, Config::System::DualShockUDPClient,
Config::System::Logger, Config::System::FreeLook, Config::System::Main,
Config::System::GameSettingsOnly})
static constexpr std::array<Config::System, 3> systems_not_saveable = {
Config::System::GCPad, Config::System::WiiPad, Config::System::GCKeyboard};
if (std::find(begin(systems_not_saveable), end(systems_not_saveable), config_location.system) ==
end(systems_not_saveable))
{
if (config_location.system == system)
return true;
return true;
}
static const auto s_setting_saveable = {
// UI.General
&Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(),
// Wiimote
&Config::WIIMOTE_1_SOURCE.GetLocation(),
&Config::WIIMOTE_2_SOURCE.GetLocation(),
&Config::WIIMOTE_3_SOURCE.GetLocation(),
&Config::WIIMOTE_4_SOURCE.GetLocation(),
&Config::WIIMOTE_1_SOURCE.GetLocation(), &Config::WIIMOTE_2_SOURCE.GetLocation(),
&Config::WIIMOTE_3_SOURCE.GetLocation(), &Config::WIIMOTE_4_SOURCE.GetLocation(),
&Config::WIIMOTE_BB_SOURCE.GetLocation(),
// Achievements
&Config::RA_ENABLED.GetLocation(),
&Config::RA_USERNAME.GetLocation(),
&Config::RA_API_TOKEN.GetLocation(),
&Config::RA_ACHIEVEMENTS_ENABLED.GetLocation(),
&Config::RA_LEADERBOARDS_ENABLED.GetLocation(),
&Config::RA_RICH_PRESENCE_ENABLED.GetLocation(),
&Config::RA_PROGRESS_ENABLED.GetLocation(),
&Config::RA_BADGES_ENABLED.GetLocation(),
&Config::RA_UNOFFICIAL_ENABLED.GetLocation(),
&Config::RA_ENCORE_ENABLED.GetLocation(),
};
return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),