Add manual config saving to CVar struct

Allows for calling to save custom cvars manually to ensure they're reliably stored. As is, the only way to ensure that cvars are saved is to safely/manually close out GZDoom, meaning if a crash occurs, that data is lost.

THis is very detrimental to mods/standalone projects that rely on CVars for storing custom data, and or data that transcends save games.
This commit is contained in:
Kaelan 2024-10-15 12:12:33 -06:00 committed by Ricardo Luís Vaz Silva
commit 9d725276ac
2 changed files with 7 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#include "c_cvars.h"
#include "c_bind.h"
#include "c_dispatch.h"
#include "m_misc.h"
#include "menu.h"
#include "vm.h"
@ -1032,6 +1033,11 @@ DEFINE_ACTION_FUNCTION(_CVar, FindCVar)
ACTION_RETURN_POINTER(FindCVar(name.GetChars(), nullptr));
}
DEFINE_ACTION_FUNCTION(_CVar, SaveConfig)
{
ACTION_RETURN_BOOL(M_SaveDefaults(nullptr));
}
//=============================================================================
//
//