2017-05-13 15:59:20 +01:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-13 15:59:20 +01:00
|
|
|
|
2017-06-08 00:53:59 -04:00
|
|
|
#include "Core/ConfigLoaders/IsSettingSaveable.h"
|
|
|
|
|
|
2017-05-13 15:59:20 +01:00
|
|
|
#include <algorithm>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2017-07-09 16:17:36 -07:00
|
|
|
#include "Common/Config/Config.h"
|
2023-03-16 09:06:24 -04:00
|
|
|
#include "Core/Config/AchievementSettings.h"
|
2017-05-18 14:01:55 +01:00
|
|
|
#include "Core/Config/GraphicsSettings.h"
|
2018-07-06 18:29:46 -07:00
|
|
|
#include "Core/Config/MainSettings.h"
|
2018-06-08 15:56:11 -05:00
|
|
|
#include "Core/Config/UISettings.h"
|
2022-01-25 20:34:03 +01:00
|
|
|
#include "Core/Config/WiimoteSettings.h"
|
2017-05-13 15:59:20 +01:00
|
|
|
|
|
|
|
|
namespace ConfigLoaders
|
|
|
|
|
{
|
2020-05-02 14:39:40 +02:00
|
|
|
bool IsSettingSaveable(const Config::Location& config_location)
|
2017-05-13 15:59:20 +01:00
|
|
|
{
|
2020-07-22 19:19:35 -05:00
|
|
|
for (Config::System system :
|
|
|
|
|
{Config::System::SYSCONF, Config::System::GFX, Config::System::DualShockUDPClient,
|
2023-03-11 17:14:01 +01:00
|
|
|
Config::System::Logger, Config::System::FreeLook, Config::System::Main,
|
|
|
|
|
Config::System::GameSettingsOnly})
|
2019-09-24 00:42:39 -04:00
|
|
|
{
|
2020-07-22 11:46:47 +02:00
|
|
|
if (config_location.system == system)
|
2019-09-24 00:42:39 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
2017-08-02 16:52:26 -07:00
|
|
|
|
2022-01-05 03:25:19 +01:00
|
|
|
static const auto s_setting_saveable = {
|
2018-06-08 15:56:11 -05:00
|
|
|
// UI.General
|
2018-06-06 00:16:42 -04:00
|
|
|
|
2020-09-20 13:58:17 +02:00
|
|
|
&Config::MAIN_USE_DISCORD_PRESENCE.GetLocation(),
|
2022-01-25 20:34:03 +01:00
|
|
|
|
|
|
|
|
// Wiimote
|
|
|
|
|
|
|
|
|
|
&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(),
|
2023-03-16 09:06:24 -04:00
|
|
|
|
|
|
|
|
// Achievements
|
|
|
|
|
|
|
|
|
|
&Config::RA_ENABLED.GetLocation(),
|
|
|
|
|
&Config::RA_USERNAME.GetLocation(),
|
|
|
|
|
&Config::RA_API_TOKEN.GetLocation(),
|
2023-05-26 18:29:22 -04:00
|
|
|
&Config::RA_ACHIEVEMENTS_ENABLED.GetLocation(),
|
|
|
|
|
&Config::RA_LEADERBOARDS_ENABLED.GetLocation(),
|
|
|
|
|
&Config::RA_RICH_PRESENCE_ENABLED.GetLocation(),
|
|
|
|
|
&Config::RA_UNOFFICIAL_ENABLED.GetLocation(),
|
|
|
|
|
&Config::RA_ENCORE_ENABLED.GetLocation(),
|
2017-05-18 14:01:55 +01:00
|
|
|
};
|
|
|
|
|
|
2021-06-26 17:21:30 -05:00
|
|
|
return std::any_of(begin(s_setting_saveable), end(s_setting_saveable),
|
2020-05-02 14:39:40 +02:00
|
|
|
[&config_location](const Config::Location* location) {
|
2019-09-24 00:42:39 -04:00
|
|
|
return *location == config_location;
|
|
|
|
|
});
|
2017-05-13 15:59:20 +01:00
|
|
|
}
|
2018-06-28 02:12:13 -04:00
|
|
|
} // namespace ConfigLoaders
|