2017-05-13 15:59:20 +01:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
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"
|
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"
|
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 11:46:47 +02:00
|
|
|
for (Config::System system :
|
|
|
|
|
{Config::System::GFX, Config::System::DualShockUDPClient, Config::System::Logger})
|
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
|
|
|
|
2020-07-22 11:46:47 +02:00
|
|
|
if (config_location.system == Config::System::Main)
|
|
|
|
|
{
|
|
|
|
|
for (const char* section : {"NetPlay", "General", "Display", "Network"})
|
|
|
|
|
{
|
|
|
|
|
if (config_location.section == section)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-15 13:16:01 +02:00
|
|
|
static constexpr std::array<const Config::Location*, 13> s_setting_saveable = {
|
2018-11-07 04:29:44 -05:00
|
|
|
// Main.Core
|
|
|
|
|
|
2019-09-24 00:42:39 -04:00
|
|
|
&Config::MAIN_DEFAULT_ISO.location,
|
|
|
|
|
&Config::MAIN_MEMCARD_A_PATH.location,
|
|
|
|
|
&Config::MAIN_MEMCARD_B_PATH.location,
|
|
|
|
|
&Config::MAIN_AUTO_DISC_CHANGE.location,
|
2020-05-23 03:13:26 -04:00
|
|
|
&Config::MAIN_ALLOW_SD_WRITES.location,
|
2019-09-24 00:42:39 -04:00
|
|
|
&Config::MAIN_DPL2_DECODER.location,
|
|
|
|
|
&Config::MAIN_DPL2_QUALITY.location,
|
2020-04-28 12:10:50 -05:00
|
|
|
&Config::MAIN_RAM_OVERRIDE_ENABLE.location,
|
|
|
|
|
&Config::MAIN_MEM1_SIZE.location,
|
|
|
|
|
&Config::MAIN_MEM2_SIZE.location,
|
2020-05-04 01:21:51 +02:00
|
|
|
&Config::MAIN_GFX_BACKEND.location,
|
2018-07-06 18:29:46 -07:00
|
|
|
|
2020-06-15 13:16:01 +02:00
|
|
|
// Main.Interface
|
|
|
|
|
|
|
|
|
|
&Config::MAIN_SKIP_NKIT_WARNING.location,
|
|
|
|
|
|
2018-06-08 15:56:11 -05:00
|
|
|
// UI.General
|
2018-06-06 00:16:42 -04:00
|
|
|
|
2019-09-24 00:42:39 -04:00
|
|
|
&Config::MAIN_USE_DISCORD_PRESENCE.location,
|
2017-05-18 14:01:55 +01:00
|
|
|
};
|
|
|
|
|
|
2019-09-24 00:42:39 -04:00
|
|
|
return std::any_of(s_setting_saveable.cbegin(), s_setting_saveable.cend(),
|
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
|