speedrun mode hotfixes (#1160)

This commit is contained in:
qwertyquerty
2026-05-13 00:10:25 -07:00
committed by GitHub
parent 9ce1ab7d5a
commit ce554a107d
3 changed files with 17 additions and 2 deletions
+10
View File
@@ -285,6 +285,16 @@ public:
layer = ConfigVarLayer::Value;
}
}
/**
* \brief Get the user-persisted value, ignoring any temporary overrides.
*
* Used by Save() to write the correct value even when a speedrun override is active.
*/
[[nodiscard]] constexpr const T& getValueForSave() const noexcept {
checkRegistered();
return layer == ConfigVarLayer::Default ? defaultValue : value;
}
};
using ActionBindConfigVar = ConfigVar<int>;
+3 -2
View File
@@ -61,7 +61,7 @@ void ConfigImpl<T>::loadFromJson(ConfigVar<T>& cVar, const json& jsonValue) {
template<ConfigValue T>
nlohmann::json ConfigImpl<T>::dumpToJson(const ConfigVar<T>& cVar) {
return cVar.getValue();
return cVar.getValueForSave();
}
template<ConfigValue T> requires std::is_integral_v<T> && std::is_signed_v<T>
@@ -249,7 +249,8 @@ void dusk::config::Save() {
json j;
for (const auto& pair : RegisteredConfigVars) {
if (pair.second->getLayer() == ConfigVarLayer::Value) {
const auto layer = pair.second->getLayer();
if (layer == ConfigVarLayer::Value || layer == ConfigVarLayer::Speedrun) {
j[pair.first] = pair.second->getImpl()->dumpToJson(*pair.second);
}
}
+4
View File
@@ -80,6 +80,7 @@
#include "dusk/audio/DuskAudioSystem.h"
#include "dusk/audio/DuskDsp.hpp"
#include "dusk/config.hpp"
#include "dusk/speedrun.h"
#include "dusk/settings.h"
#include "dusk/io.hpp"
#include "dusk/version.hpp"
@@ -522,6 +523,9 @@ int game_main(int argc, char* argv[]) {
log_build_info();
dusk::config::LoadFromUserPreferences();
if (dusk::getSettings().game.speedrunMode) {
dusk::resetForSpeedrunMode();
}
ApplyCVarOverrides(parsed_arg_options["cvar"]);
dusk::crash_reporting::initialize();
// TODO: How to handle this?