From 44102abbcca2d088dcb253da8ec7c9b869064139 Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Mon, 10 Jan 2022 02:47:19 +0100 Subject: [PATCH] Execute dev configs when '-devsdk' parameter is passed --- r5dev/client/cdll_engine_int.cpp | 16 +++++++++++++--- r5dev/engine/host_state.cpp | 21 +++++++++++++++++---- r5dev/tier0/commandline.h | 4 ++-- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/r5dev/client/cdll_engine_int.cpp b/r5dev/client/cdll_engine_int.cpp index a7991805..0110c68b 100644 --- a/r5dev/client/cdll_engine_int.cpp +++ b/r5dev/client/cdll_engine_int.cpp @@ -3,6 +3,7 @@ #include "tier0/basetypes.h" #include "tier0/IConVar.h" #include "tier0/cvar.h" +#include "tier0/commandline.h" #include "client/IVEngineClient.h" #include "client/client.h" #include "client/cdll_engine_int.h" @@ -30,9 +31,18 @@ void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage) g_pConCommand->Init(); CKeyValueSystem_Init(); - IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg"); - IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg"); - IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg"); + if (!g_pCmdLine->CheckParm("-devsdk")) + { + IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg"); + } + else // Development configs. + { + IVEngineClient_CommandExecute(NULL, "exec autoexec_dev.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_server_dev.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_client_dev.cfg"); + } *(bool*)m_bRestrictServerCommands = true; // Restrict commands. ConCommandBase* disconnect = (ConCommandBase*)g_pCVar->FindCommand("disconnect"); diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 7b14a8bb..03748851 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -1,8 +1,9 @@ #include "core/stdafx.h" +#include "tier0/cvar.h" +#include "tier0/commandline.h" #include "engine/sys_utils.h" #include "engine/host_state.h" #include "engine/net_chan.h" -#include "tier0/cvar.h" #include "client/IVEngineClient.h" #include "networksystem/r5net.h" #include "squirrel/sqinit.h" @@ -132,11 +133,23 @@ void HCHostState_FrameUpdate(void* rcx, void* rdx, float time) g_pConCommand->Init(); g_pConVar->ClearHostNames(); - IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg"); - IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg"); + + if (!g_pCmdLine->CheckParm("-devsdk")) + { + IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg"); #ifndef DEDICATED - IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg"); #endif // !DEDICATED + } + else // Development configs. + { + IVEngineClient_CommandExecute(NULL, "exec autoexec_dev.cfg"); + IVEngineClient_CommandExecute(NULL, "exec autoexec_server_dev.cfg"); +#ifndef DEDICATED + IVEngineClient_CommandExecute(NULL, "exec autoexec_client_dev.cfg"); +#endif // !DEDICATED + } *(bool*)m_bRestrictServerCommands = true; // Restrict commands. ConCommandBase* disconnect = (ConCommandBase*)g_pCVar->FindCommand("disconnect"); diff --git a/r5dev/tier0/commandline.h b/r5dev/tier0/commandline.h index aada769e..b6402a50 100644 --- a/r5dev/tier0/commandline.h +++ b/r5dev/tier0/commandline.h @@ -7,10 +7,10 @@ public: void CreateCmdLine(int argc, char** argv); void CreatePool(void* pMem); const char* GetCmdLine(void); - const char* CheckParm(const char* psz, const char** ppszValue); + const char* CheckParm(const char* psz, const char** ppszValue = NULL); void RemoveParm(void); void AppendParm(const char* pszParm, const char* pszValues); - const char* ParmValue(const char* psz, const char* pDefaultVal); + const char* ParmValue(const char* psz, const char* pDefaultVal = NULL); int ParmValue(const char* psz, int nDefaultVal); float ParmValue(const char* psz, float flDefaultVal); int ParmCount(void);