mirror of
https://github.com/izzy2lost/xenia-edge.git
synced 2026-07-06 00:20:26 -07:00
[Config] Log commandline overrides
This commit is contained in:
@@ -53,6 +53,7 @@ class IConfigVar : virtual public ICommandVar {
|
||||
virtual bool is_advanced() const = 0;
|
||||
virtual bool is_transient() const = 0;
|
||||
virtual std::string config_value() const = 0;
|
||||
virtual std::string commandline_value() const = 0;
|
||||
virtual void LoadConfigValue(const toml::node* result) = 0;
|
||||
virtual void LoadGameConfigValue(const toml::node* result) = 0;
|
||||
virtual void ResetConfigValueToDefault() = 0;
|
||||
@@ -93,6 +94,7 @@ class ConfigVar : public CommandVar<T>, virtual public IConfigVar {
|
||||
const char* display_name, const char* category, bool is_advanced,
|
||||
bool is_transient);
|
||||
std::string config_value() const override;
|
||||
std::string commandline_value() const override;
|
||||
const T& GetTypedConfigValue() const;
|
||||
const std::string& category() const override;
|
||||
const std::string& display_name() const override;
|
||||
@@ -296,6 +298,12 @@ std::string ConfigVar<T>::config_value() const {
|
||||
return this->ToString(this->default_value_);
|
||||
}
|
||||
template <class T>
|
||||
std::string ConfigVar<T>::commandline_value() const {
|
||||
if (this->commandline_value_)
|
||||
return this->ToString(*this->commandline_value_);
|
||||
return config_value();
|
||||
}
|
||||
template <class T>
|
||||
const T& ConfigVar<T>::GetTypedConfigValue() const {
|
||||
return config_value_ ? *config_value_ : this->default_value_;
|
||||
}
|
||||
|
||||
@@ -158,6 +158,19 @@ void ReadConfig(const std::filesystem::path& file_path,
|
||||
}
|
||||
}
|
||||
|
||||
// Log command line overrides (after config values are loaded)
|
||||
bool has_overrides = false;
|
||||
for (const auto& it : *cvar::ConfigVars) {
|
||||
auto config_var = static_cast<cvar::IConfigVar*>(it.second);
|
||||
if (config_var->commandline_value() != config_var->config_value()) {
|
||||
if (!has_overrides) {
|
||||
XELOGI("Command line overrides:");
|
||||
has_overrides = true;
|
||||
}
|
||||
XELOGI(" {} = {}", config_var->name(), config_var->commandline_value());
|
||||
}
|
||||
}
|
||||
|
||||
MigrateLegacyCvars(config);
|
||||
uint32_t config_defaults_date = defaults_date_cvar->GetTypedConfigValue();
|
||||
if (update_if_no_version_stored || config_defaults_date) {
|
||||
|
||||
Reference in New Issue
Block a user