Config: Describe the settings for the UI, and find them by pointer

ConfigSetting gets a ConfigSettingInfo, set with constexpr chained setters:
a label, choices, a range with step and units, labels for 0 and negative
values (like Unlimited and Disabled), and a callback for what has to happen
when the UI changes the value. Using a setter on the wrong type of setting is
a compile error. The settings in the config tables now have these, so the
settings screen can take them from there instead of repeating them, including
what changing them needs (resize and GPU config messages, fullscreen, audio
and camera notifications and so on). The settings screen starts using them
in a later commit.

Config::FindSetting finds a setting from a pointer to its value. Defaults can
now also be looked up for blocks that reset as a whole (display layouts, touch
and gesture controls), by reading them from a freshly reset copy of the block.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-25 15:12:24 +01:00
1 parent 09b899845a
commit 3bb4664fd6
6 files changed
+707 -202

No files matched your search

+9 -1
View File
@@ -8,8 +8,16 @@
#include "Core/ConfigValues.h"
#include "Core/Config.h"
void ConfigSettingTableError() {
_dbg_assert_msg_(false, "ConfigSetting info setter used on the wrong kind of setting");
}
bool ConfigSetting::PerGame(void *ptr) {
return g_Config.IsGameSpecific() && g_Config.getPtrLUT().count(ptr) > 0 && g_Config.getPtrLUT()[ptr].second->PerGame();
if (!g_Config.IsGameSpecific()) {
return false;
}
const ConfigSettingRef *ref = Config::FindSetting(ptr);
return ref && ref->setting->PerGame();
}
bool ConfigSetting::ReadFromIniSection(ConfigBlock *configBlock, const Section *section, bool applyDefaultIfMissing) const {