Rename global cvar pointer

This commit is contained in:
Amos 2022-01-10 01:31:25 +01:00
parent 0146f22e0a
commit c0f24e64ff
7 changed files with 19 additions and 19 deletions

View File

@ -35,14 +35,14 @@ void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage)
IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg");
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
ConCommandBase* disconnect = (ConCommandBase*)g_pCVar->FindCommand("disconnect");
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
if (net_userandomkey->GetBool())
{
HNET_GenerateKey();
}
g_pCvar->FindVar("net_usesocketsforloopback")->SetValue(1);
g_pCVar->FindVar("net_usesocketsforloopback")->SetValue(1);
bInitialized = true;
}

View File

@ -21,11 +21,11 @@ void KeepAliveToPylon()
DevMsg(eDLL_T::CLIENT, "Sending PostServerHost request\n");
bool result = g_pR5net->PostServerHost(m_szHostRequestMessage, m_szHostToken,
ServerListing{
g_pCvar->FindVar("hostname")->m_pzsCurrentValue,
g_pCVar->FindVar("hostname")->m_pzsCurrentValue,
std::string(g_pHostState->m_levelName),
"",
g_pCvar->FindVar("hostport")->m_pzsCurrentValue,
g_pCvar->FindVar("mp_gamemode")->m_pzsCurrentValue,
g_pCVar->FindVar("hostport")->m_pzsCurrentValue,
g_pCVar->FindVar("mp_gamemode")->m_pzsCurrentValue,
false,
// BUG BUG: Checksum is null on dedi
@ -139,7 +139,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
#endif // !DEDICATED
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
ConCommandBase* disconnect = (ConCommandBase*)g_pCvar->FindCommand("disconnect");
ConCommandBase* disconnect = (ConCommandBase*)g_pCVar->FindCommand("disconnect");
disconnect->AddFlags(FCVAR_SERVER_CAN_EXECUTE); // Make sure server is not restricted to this.
static std::thread PylonThread([]() // Pylon request thread.
@ -165,7 +165,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
HNET_GenerateKey();
}
g_pCvar->FindVar("net_usesocketsforloopback")->SetValue(1);
g_pCVar->FindVar("net_usesocketsforloopback")->SetValue(1);
bInitialized = true;
}
@ -234,7 +234,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->GetBool())
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCVar->FindVar("host_hasIrreversibleShutdown")->GetBool())
{
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
}
@ -264,7 +264,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->GetBool())
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCVar->FindVar("host_hasIrreversibleShutdown")->GetBool())
{
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
}
@ -297,7 +297,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->GetBool())
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCVar->FindVar("host_hasIrreversibleShutdown")->GetBool())
{
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
}
@ -337,7 +337,7 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
}
}
} while ((oldState != HostStates_t::HS_RUN || g_pHostState->m_iNextState == HostStates_t::HS_LOAD_GAME && g_pCvar->FindVar("g_single_frame_shutdown_for_reload_cvar")->GetBool())
} while ((oldState != HostStates_t::HS_RUN || g_pHostState->m_iNextState == HostStates_t::HS_LOAD_GAME && g_pCVar->FindVar("g_single_frame_shutdown_for_reload_cvar")->GetBool())
&& oldState != HostStates_t::HS_SHUTDOWN
&& oldState != HostStates_t::HS_RESTART);

View File

@ -94,7 +94,7 @@ IBrowser::~IBrowser()
//-----------------------------------------------------------------------------
void IBrowser::UpdateHostingStatus()
{
if (!g_pHostState || !g_pCvar)
if (!g_pHostState || !g_pCVar)
{
return;
}
@ -177,8 +177,8 @@ void IBrowser::SendHostingPostRequest()
m_Server.svServerName,
std::string(g_pHostState->m_levelName),
"",
g_pCvar->FindVar("hostport")->m_pzsCurrentValue,
g_pCvar->FindVar("mp_gamemode")->m_pzsCurrentValue,
g_pCVar->FindVar("hostport")->m_pzsCurrentValue,
g_pCVar->FindVar("mp_gamemode")->m_pzsCurrentValue,
m_Server.bHidden,
std::to_string(*g_nRemoteFunctionCallsChecksum),

View File

@ -588,7 +588,7 @@ void ConVar::ClearHostNames(void)
for (int i = 0; i < 17; i++)
{
const char* pszName = pszHostnameArray[i];
ConVar* pCVar = g_pCvar->FindVar(pszName);
ConVar* pCVar = g_pCVar->FindVar(pszName);
if (pCVar != nullptr)
{

View File

@ -519,7 +519,7 @@ void _NET_TraceNetChan_f_CompletionFunc(CCommand* cmd)
static bool bTraceNetChannel = false;
if (!bTraceNetChannel)
{
g_pCvar->FindVar("net_usesocketsforloopback")->SetValue(1);
g_pCVar->FindVar("net_usesocketsforloopback")->SetValue(1);
DevMsg(eDLL_T::ENGINE, "\n");
DevMsg(eDLL_T::ENGINE, "+--------------------------------------------------------+\n");
DevMsg(eDLL_T::ENGINE, "|>>>>>>>>>>>>>| NETCHANNEL TRACE ACTIVATED |<<<<<<<<<<<<<|\n");

View File

@ -106,4 +106,4 @@ std::unordered_map<std::string, ConCommandBase*> CCVar::DumpToMap()
}
///////////////////////////////////////////////////////////////////////////////
CCVar* g_pCvar = reinterpret_cast<CCVar*>(p_CEngineAPI_Connect.FindPatternSelf("48 8D 0D", ADDRESS::Direction::DOWN, 40).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr());
CCVar* g_pCVar = reinterpret_cast<CCVar*>(p_CEngineAPI_Connect.FindPatternSelf("48 8D 0D", ADDRESS::Direction::DOWN, 40).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr());

View File

@ -82,7 +82,7 @@ public:
};
///////////////////////////////////////////////////////////////////////////////
extern CCVar* g_pCvar;
extern CCVar* g_pCVar;
///////////////////////////////////////////////////////////////////////////////
@ -92,7 +92,7 @@ class HCvar : public IDetour
{
std::cout << "| FUN: CCVar::Disconnect : 0x" << std::hex << std::uppercase << p_CCVar_Disconnect.GetPtr() << std::setw(npad) << " |" << std::endl;
std::cout << "| FUN: CCVar::GetCommandLineValue : 0x" << std::hex << std::uppercase << p_CCVar_GetCommandLineValue.GetPtr() << std::setw(npad) << " |" << std::endl;
std::cout << "| VAR: g_pCvar : 0x" << std::hex << std::uppercase << g_pCvar << std::setw(0) << " |" << std::endl;
std::cout << "| VAR: g_pCvar : 0x" << std::hex << std::uppercase << g_pCVar << std::setw(0) << " |" << std::endl;
std::cout << "+----------------------------------------------------------------+" << std::endl;
}
};