mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-16 23:42:23 +00:00
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:
parent
70eb4b974d
commit
9d725276ac
2 changed files with 7 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -689,6 +689,7 @@ struct CVar native
|
|||
};
|
||||
|
||||
native static CVar FindCVar(Name name);
|
||||
native static bool SaveConfig();
|
||||
bool GetBool() { return GetInt(); }
|
||||
native int GetInt();
|
||||
native double GetFloat();
|
||||
|
|
Loading…
Reference in a new issue