Skip to content

Commit

Permalink
Core/BaseConfigLoader: Disallow loading the MAIN_MEMORY_CARD_SIZE fro…
Browse files Browse the repository at this point in the history
…m the global config INI.
  • Loading branch information
AdmiralCurtiss committed Jan 29, 2022
1 parent 63df67b commit ff071f8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Source/Core/Core/ConfigLoaders/BaseConfigLoader.cpp
Expand Up @@ -19,6 +19,7 @@
#include "Common/IniFile.h"
#include "Common/Logging/Log.h"

#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h"
#include "Core/ConfigManager.h"
Expand Down Expand Up @@ -103,6 +104,11 @@ class BaseConfigLayerLoader final : public Config::ConfigLayerLoader
BaseConfigLayerLoader() : ConfigLayerLoader(Config::LayerType::Base) {}
void Load(Config::Layer* layer) override
{
// List of settings that under no circumstances should be loaded from the global config INI.
static const auto s_setting_disallowed = {
&Config::MAIN_MEMORY_CARD_SIZE.GetLocation(),
};

LoadFromSYSCONF(layer);
for (const auto& system : system_to_ini)
{
Expand All @@ -118,6 +124,12 @@ class BaseConfigLayerLoader final : public Config::ConfigLayerLoader
for (const auto& value : section_map)
{
const Config::Location location{system.first, section_name, value.first};
const bool load_disallowed =
std::any_of(begin(s_setting_disallowed), end(s_setting_disallowed),
[&location](const Config::Location* l) { return *l == location; });
if (load_disallowed)
continue;

layer->Set(location, value.second);
}
}
Expand Down

0 comments on commit ff071f8

Please sign in to comment.