mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
ConVar/ConCommands improvements.
This commit is contained in:
parent
899bde2af0
commit
f6a4b011f0
@ -32,8 +32,8 @@ void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage)
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg");
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
|
||||
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
|
@ -45,8 +45,8 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
|
||||
#endif // !DEDICATED
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
|
||||
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
printf(" Flaged: %08X\n", pCommandBase->m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
pCommandBase->m_nFlags &= ~(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pCommandBase->m_nFlags);
|
||||
@ -38,7 +38,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY || FCVAR_CHEAT query.
|
||||
return (pCommandBase->m_nFlags & nFlag) != 0;
|
||||
return pCommandBase->HasFlags(nFlag) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -48,7 +48,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
printf(" Flaged: %08X\n", pCommandBase->m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
pCommandBase->m_nFlags &= ~(FCVAR_DEVELOPMENTONLY);
|
||||
pCommandBase->RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pCommandBase->m_nFlags);
|
||||
@ -66,7 +66,7 @@ bool HConCommand_IsFlagSet(ConCommandBase* pCommandBase, int nFlag)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY query.
|
||||
return (pCommandBase->m_nFlags & nFlag) != 0;
|
||||
return pCommandBase->HasFlags(nFlag) != 0;
|
||||
}
|
||||
// Default behaviour.
|
||||
return ConCommand_IsFlagSet(pCommandBase, nFlag);
|
||||
|
@ -70,6 +70,22 @@ class ConCommand
|
||||
class ConCommandBase
|
||||
{
|
||||
public:
|
||||
|
||||
void AddFlags(int flags)
|
||||
{
|
||||
m_nFlags |= flags;
|
||||
}
|
||||
|
||||
void RemoveFlags(int flags)
|
||||
{
|
||||
m_nFlags &= ~flags;
|
||||
}
|
||||
|
||||
bool HasFlags(int flags)
|
||||
{
|
||||
return m_nFlags & flags;
|
||||
}
|
||||
|
||||
void* m_pConCommandBaseVTable; //0x0000
|
||||
ConCommandBase* m_pNext; //0x0008
|
||||
bool m_bRegistered; //0x0010
|
||||
|
@ -19,7 +19,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf(" Flaged: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY.
|
||||
pConVar->m_ConCommandBase.m_nFlags &= ~(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
pConVar->m_ConCommandBase.RemoveFlags(FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
@ -37,7 +37,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT query.
|
||||
return (pConVar->m_ConCommandBase.m_nFlags & nFlags) != 0;
|
||||
return pConVar->m_ConCommandBase.HasFlags(nFlags) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -47,7 +47,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
printf(" Flaged: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
}
|
||||
// Mask off FCVAR_DEVELOPMENTONLY.
|
||||
pConVar->m_ConCommandBase.m_nFlags &= ~(FCVAR_DEVELOPMENTONLY);
|
||||
pConVar->m_ConCommandBase.RemoveFlags(FCVAR_DEVELOPMENTONLY);
|
||||
if (cm_debug_cmdquery->m_pParent->m_iValue > 0)
|
||||
{
|
||||
printf(" Masked: %08X\n", pConVar->m_ConCommandBase.m_nFlags);
|
||||
@ -65,7 +65,7 @@ bool HIConVar_IsFlagSet(ConVar* pConVar, int nFlags)
|
||||
return false;
|
||||
}
|
||||
// Return false on every FCVAR_DEVELOPMENTONLY query.
|
||||
return (pConVar->m_ConCommandBase.m_nFlags & nFlags) != 0;
|
||||
return pConVar->m_ConCommandBase.HasFlags(nFlags) != 0;
|
||||
}
|
||||
// Default retail behaviour.
|
||||
return IConVar_IsFlagSet(pConVar, nFlags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user