mirror of https://github.com/AxioDL/metaforce.git
CVar: Ensure m_wasDeserialized set in deferred & command line cases
This commit is contained in:
parent
e9b4cce6db
commit
789e23b16c
|
@ -78,8 +78,7 @@ void CTweakGame::initCVars(hecl::CVarManager* mgr) {
|
|||
constexpr hecl::CVar::EFlags skDefaultFlags = hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive;
|
||||
CREATE_CVAR(WorldPrefix, "", x4_worldPrefix, skDefaultFlags);
|
||||
CREATE_CVAR(FieldOfView, "", x24_fov, skDefaultFlags);
|
||||
CREATE_CVAR(SplashScreensDisabled, "", x2b_splashScreensDisabled,
|
||||
hecl::CVar::EFlags::Game | hecl::CVar::EFlags::Archive);
|
||||
CREATE_CVAR(SplashScreensDisabled, "", x2b_splashScreensDisabled, skDefaultFlags);
|
||||
CREATE_CVAR(PressStartDelay, "", x30_pressStartDelay, skDefaultFlags);
|
||||
CREATE_CVAR(WavecapIntensityNormal, "", x34_wavecapIntensityNormal, skDefaultFlags);
|
||||
CREATE_CVAR(WavecapIntensityPoison, "", x38_wavecapIntensityPoison, skDefaultFlags);
|
||||
|
|
|
@ -218,10 +218,7 @@ bool CVar::toBoolean(bool* isValid) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isValid != nullptr)
|
||||
*isValid = true;
|
||||
|
||||
return athena::utility::parseBool(m_value);
|
||||
return athena::utility::parseBool(m_value, isValid);
|
||||
}
|
||||
|
||||
int32_t CVar::toSigned(bool* isValid) const {
|
||||
|
|
|
@ -97,7 +97,11 @@ void CVarManager::deserialize(CVar* cvar) {
|
|||
if (cvar->isBoolean() && val.empty()) {
|
||||
// We were deferred without a value, assume true
|
||||
cvar->fromBoolean(true);
|
||||
} else if (!val.empty() && cvar->fromLiteralToType(val)) {
|
||||
cvar->m_wasDeserialized = true;
|
||||
return;
|
||||
}
|
||||
if (!val.empty() && cvar->fromLiteralToType(val)) {
|
||||
cvar->m_wasDeserialized = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -327,6 +331,7 @@ void CVarManager::parseCommandLine(const std::vector<SystemString>& args) {
|
|||
} else if (!cvarValue.empty()) {
|
||||
cv->fromLiteralToType(cvarValue);
|
||||
}
|
||||
cv->m_wasDeserialized = true;
|
||||
athena::utility::tolower(cvarName);
|
||||
if (developerName == cvarName)
|
||||
/* Make sure we're not overriding developer mode when we restore */
|
||||
|
|
Loading…
Reference in New Issue