mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
Made unsafe execution context check for CVARs more strict
This prevents changing of non-mod CVARs from unsafe context for various code paths including set and toggle CCMDs
This commit is contained in:
parent
c7eea9b480
commit
1e9fdca755
3 changed files with 8 additions and 9 deletions
|
@ -53,6 +53,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "menu/menu.h"
|
||||
#include "vm.h"
|
||||
#include "v_text.h"
|
||||
|
||||
struct FLatchedValue
|
||||
{
|
||||
|
@ -156,6 +157,11 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type)
|
|||
{
|
||||
return;
|
||||
}
|
||||
else if (UnsafeExecutionContext && !(GetFlags() & CVAR_MOD))
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Cannot set console variable" TEXTCOLOR_GOLD " %s " TEXTCOLOR_RED "from unsafe command\n", GetName());
|
||||
return;
|
||||
}
|
||||
else if ((Flags & CVAR_LATCH) && gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
||||
{
|
||||
FLatchedValue latch;
|
||||
|
|
|
@ -127,8 +127,7 @@ FButtonStatus Button_Mlook, Button_Klook, Button_Use, Button_AltAttack,
|
|||
Button_AM_PanLeft, Button_AM_PanRight, Button_AM_PanDown, Button_AM_PanUp,
|
||||
Button_AM_ZoomIn, Button_AM_ZoomOut;
|
||||
|
||||
bool ParsingKeyConf;
|
||||
static bool UnsafeExecutionContext;
|
||||
bool ParsingKeyConf, UnsafeExecutionContext;
|
||||
|
||||
// To add new actions, go to the console and type "key <action name>".
|
||||
// This will give you the key value to use in the first column. Then
|
||||
|
@ -658,12 +657,6 @@ void C_DoCommand (const char *cmd, int keynum)
|
|||
|
||||
if (args.argc() >= 2)
|
||||
{ // Set the variable
|
||||
if (UnsafeExecutionContext && !(var->GetFlags() & CVAR_MOD))
|
||||
{
|
||||
Printf(TEXTCOLOR_RED "Cannot set console variable" TEXTCOLOR_GOLD " %s " TEXTCOLOR_RED "from unsafe command\n", var->GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
var->CmdSet (args[1]);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -200,7 +200,7 @@ extern FButtonStatus Button_Mlook, Button_Klook, Button_Use, Button_AltAttack,
|
|||
Button_User1, Button_User2, Button_User3, Button_User4,
|
||||
Button_AM_PanLeft, Button_AM_PanRight, Button_AM_PanDown, Button_AM_PanUp,
|
||||
Button_AM_ZoomIn, Button_AM_ZoomOut;
|
||||
extern bool ParsingKeyConf;
|
||||
extern bool ParsingKeyConf, UnsafeExecutionContext;
|
||||
|
||||
void ResetButtonTriggers (); // Call ResetTriggers for all buttons
|
||||
void ResetButtonStates (); // Same as above, but also clear bDown
|
||||
|
|
Loading…
Reference in a new issue