Host_NewGame
0x0017abd0 · 2542 bytes · __cdecl
_Z12Host_NewGamePcbbbPKcS1_
Decompiled
undefined (6 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Host_NewGame(char*, bool, bool, bool, char const*, char const*) */
undefined4
Host_NewGame(char *param_1,bool param_2,bool param_3,bool param_4,char *param_5,char *param_6)
{
code *pcVar1;
char cVar2;
bool bVar3;
int *piVar4;
int iVar5;
char *pcVar6;
CMapReslistGenerator *this;
CDownloadListGenerator *pCVar7;
undefined4 uVar8;
char *pcVar9;
uint uVar10;
undefined4 uVar11;
int iVar12;
int in_GS_OFFSET;
longdouble lVar13;
undefined4 local_454;
undefined4 local_450;
undefined4 local_44c;
undefined4 local_448;
undefined4 local_440;
undefined4 local_43c;
CDownloadListGenerator *local_438;
undefined4 local_434;
undefined4 local_430;
CDownloadListGenerator *local_42c;
char local_428 [260];
char local_324 [260];
Color local_220;
undefined1 local_21f;
undefined1 local_21e;
undefined1 local_21d;
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
piVar4 = (int *)CommandLine_Tier0();
iVar5 = (**(code **)(*piVar4 + 0xc))(piVar4,"-ioidlecheck",0);
if (iVar5 != 0) {
(**(code **)(*g_pFileSystem + 0x1e4))(g_pFileSystem,0x3f000000);
}
local_454 = 0;
local_450 = 0;
if (_exit == (CDownloadListGenerator *)0x0) {
local_438 = (CDownloadListGenerator *)0x0;
}
else {
(**(code **)(_exit + 0x50))
(_exit,&local_454,0,0,0,0,"/data/src/engine/./host.cpp",0x1375,
&Host_NewGame(char*,bool,bool,bool,char_const*,char_const*)::tm_fmt,"(%s)%s",
"Unaccounted","Host_NewGame");
local_438 = _exit;
}
iVar5 = _DAT_0040b9d4;
local_440 = local_454;
local_43c = local_450;
if ((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) {
/* try { // try from 0017b22e to 0017b27c has its CatchHandler @ 0017b64a */
iVar12 = ThreadGetCurrentId();
if (iVar5 == iVar12) {
if (*(char **)_DAT_0040b030 != "Host_NewGame") {
_DAT_0040b030 =
(CDownloadListGenerator *)
CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b3121,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
}
/* try { // try from 0017ad16 to 0017ae54 has its CatchHandler @ 0017b642 */
COM_TimestampedLog("Host_NewGame");
if (param_3) {
ResetGameConVarsToDefaults();
}
pcVar9 = local_324;
GetPlatformMapPath(param_1,pcVar9,0x104);
pcVar6 = "FCVAR_NEVER_AS_STRING";
if ((host_map[0x15] & 0x10) == 0) {
pcVar6 = "";
if (*(char **)(host_map._28_4_ + 0x24) != (char *)0x0) {
pcVar6 = *(char **)(host_map._28_4_ + 0x24);
}
}
V_strncpy(local_428,pcVar6,0x104);
ConVar::SetValue(host_map);
Warning("---- Host_NewGame ----\n",pcVar9);
SV_CheckForFlushMemory(local_428,param_1);
this = (CMapReslistGenerator *)MapReslistGenerator();
CMapReslistGenerator::OnLevelLoadStart(this,param_1);
pCVar7 = (CDownloadListGenerator *)DownloadListGenerator();
CDownloadListGenerator::OnLevelLoadStart(pCVar7,param_1);
if (!param_2) {
local_44c = 0;
local_448 = 0;
if (_exit == (CDownloadListGenerator *)0x0) {
local_42c = (CDownloadListGenerator *)0x0;
}
else {
pCVar7 = _exit;
(**(code **)(_exit + 0x50))
(_exit,&local_44c,0,0,0,0,"/data/src/engine/./host.cpp",0x1398,
&Host_NewGame(char*,bool,bool,bool,char_const*,char_const*)::tm_fmt,"(%s)%s",
"Unaccounted","Host_NewGame_HostState_RunGameInit");
local_42c = _exit;
}
iVar5 = _DAT_0040b9d4;
local_434 = local_44c;
local_430 = local_448;
if ((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) {
/* try { // try from 0017b476 to 0017b4c4 has its CatchHandler @ 0017b646 */
iVar12 = ThreadGetCurrentId();
if (iVar5 == iVar12) {
if (*(char **)_DAT_0040b030 != "Host_NewGame_HostState_RunGameInit") {
_DAT_0040b030 =
(CDownloadListGenerator *)
CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b3e40,&DAT_00000001,0x2a054b);
}
pCVar7 = _DAT_0040b030;
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
}
/* try { // try from 0017ae93 to 0017ae97 has its CatchHandler @ 0017b604 */
HostState_RunGameInit();
iVar5 = _DAT_0040b9d4;
if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
iVar12 = ThreadGetCurrentId(pCVar7);
if (iVar5 == iVar12) {
pCVar7 = _DAT_0040b030;
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0040b030 = *(CDownloadListGenerator **)(_DAT_0040b030 + 100);
}
DAT_0040b02c = _DAT_0040b030 == (CDownloadListGenerator *)0x40b034;
}
}
if (local_42c != (CDownloadListGenerator *)0x0) {
pCVar7 = local_42c;
(**(code **)(local_42c + 0x54))(local_42c,local_434,local_430,0,0,0);
}
}
local_44c = 0;
local_448 = 0;
if (_exit == (CDownloadListGenerator *)0x0) {
local_42c = (CDownloadListGenerator *)0x0;
}
else {
/* try { // try from 0017af6d to 0017af6f has its CatchHandler @ 0017b642 */
pCVar7 = _exit;
(**(code **)(_exit + 0x50))
(_exit,&local_44c,0,0,0,0,"/data/src/engine/./host.cpp",0x139d,
&Host_NewGame(char*,bool,bool,bool,char_const*,char_const*)::tm_fmt,"(%s)%s",
"Unaccounted","Host_NewGame_SpawnServer");
local_42c = _exit;
}
iVar5 = _DAT_0040b9d4;
local_434 = local_44c;
local_430 = local_448;
if ((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) {
/* try { // try from 0017b296 to 0017b2e4 has its CatchHandler @ 0017b662 */
iVar12 = ThreadGetCurrentId(pCVar7);
if (iVar5 == iVar12) {
if (*(char **)_DAT_0040b030 != "Host_NewGame_SpawnServer") {
_DAT_0040b030 =
(CDownloadListGenerator *)
CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b3146,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
}
/* try { // try from 0017afbe to 0017b063 has its CatchHandler @ 0017b652 */
NET_SetMutiplayer(1 < DAT_003b8064);
if (DAT_003b8064 < 2) {
/* try { // try from 0017b4f2 to 0017b507 has its CatchHandler @ 0017b652 */
piVar4 = (int *)(**(code **)(*g_pMatchFramework + 0x20))(g_pMatchFramework);
bVar3 = (bool)(**(code **)(*piVar4 + 8))(piVar4);
NET_SetMutiplayer(bVar3);
}
NET_ListenSocket(DAT_003b7f68,true);
Host_EnsureHostNameSet();
pCVar7 = (CDownloadListGenerator *)&sv;
uVar8 = CGameServer::SpawnServer((CGameServer *)&sv,param_1,(char *)0x0);
iVar5 = _DAT_0040b9d4;
if ((char)uVar8 == '\0') {
if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
iVar12 = ThreadGetCurrentId();
if (iVar5 == iVar12) {
pCVar7 = _DAT_0040b030;
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0040b030 = *(CDownloadListGenerator **)(_DAT_0040b030 + 100);
}
DAT_0040b02c = _DAT_0040b030 == (CDownloadListGenerator *)0x40b034;
}
}
if (local_42c != (CDownloadListGenerator *)0x0) {
pCVar7 = local_42c;
(**(code **)(local_42c + 0x54))(local_42c,local_434,local_430,0,0,0);
}
}
else {
local_220 = (Color)0x0;
local_21f = 0xff;
local_21e = 0;
DAT_003b8186 = param_3;
pcVar9 = " (background map)";
if (!param_3) {
pcVar9 = "";
}
local_21d = 0;
ConColorMsg(&local_220,"Host_NewGame on map %s%s\n",param_1,pcVar9);
iVar5 = _DAT_0040b9d4;
if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
iVar12 = ThreadGetCurrentId();
if (iVar5 == iVar12) {
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0040b030 = *(CDownloadListGenerator **)(_DAT_0040b030 + 100);
}
DAT_0040b02c = _DAT_0040b030 == (CDownloadListGenerator *)0x40b034;
}
}
if (local_42c != (CDownloadListGenerator *)0x0) {
(**(code **)(local_42c + 0x54))(local_42c,local_434,local_430,0,0,0);
}
/* try { // try from 0017b0c2 to 0017b21e has its CatchHandler @ 0017b642 */
lVar13 = (longdouble)CBaseServer::GetTime((CBaseServer *)&sv);
g_ServerGlobalVariables._12_4_ = (undefined4)lVar13;
COM_TimestampedLog("serverGameDLL->LevelInit");
pcVar1 = *(code **)(*(int *)g_pServerPluginHandler + 0xc);
uVar8 = CM_EntityString();
pCVar7 = (CDownloadListGenerator *)g_pServerPluginHandler;
(*pcVar1)(g_pServerPluginHandler,param_1,uVar8,param_5,param_6,param_2,param_3);
if (param_2) {
CBaseServer::SetPaused((CBaseServer *)&sv,true);
pCVar7 = (CDownloadListGenerator *)&sv;
DAT_003b8128 = 1;
lVar13 = (longdouble)CBaseServer::GetTime((CBaseServer *)&sv);
g_ServerGlobalVariables._12_4_ = (undefined4)lVar13;
}
uVar8 = SV_ActivateServer();
if ((char)uVar8 != '\0') {
if (DAT_003b8088 == '\0') {
COM_TimestampedLog("Stuff \'connect localhost\' to console");
iVar5 = DAT_003a1734;
if ((param_4) && (1 < DAT_003a1734)) {
uVar10 = NET_GetUDPPort(DAT_003b7f68);
V_snprintf((char *)&local_220,0x200,"connect_splitscreen localhost:%d %d",uVar10 & 0xffff,
iVar5);
}
else {
/* try { // try from 0017b583 to 0017b5a6 has its CatchHandler @ 0017b642 */
uVar10 = NET_GetUDPPort(DAT_003b7f68);
V_snprintf((char *)&local_220,0x200,"connect localhost:%d",uVar10 & 0xffff);
}
uVar11 = Cbuf_GetCurrentPlayer();
Cbuf_AddText(uVar11,&local_220,0);
}
else {
/* try { // try from 0017b307 to 0017b330 has its CatchHandler @ 0017b642 */
CTestScriptMgr::CheckPoint((CTestScriptMgr *)g_TestScriptMgr,"FinishedMapLoad");
}
iVar5 = MapReslistGenerator();
if (*(char *)(iVar5 + 1) != '\0') {
MapReslistGenerator();
CMapReslistGenerator::OnLevelLoadEnd();
}
pCVar7 = (CDownloadListGenerator *)DownloadListGenerator();
CDownloadListGenerator::OnLevelLoadEnd(pCVar7);
}
}
iVar5 = _DAT_0040b9d4;
if ((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) {
iVar12 = ThreadGetCurrentId(pCVar7);
if (iVar5 == iVar12) {
pCVar7 = _DAT_0040b030;
cVar2 = CVProfNode::ExitScope();
if (cVar2 != '\0') {
_DAT_0040b030 = *(CDownloadListGenerator **)(_DAT_0040b030 + 100);
}
DAT_0040b02c = _DAT_0040b030 == (CDownloadListGenerator *)0x40b034;
}
}
if (local_438 != (CDownloadListGenerator *)0x0) {
pCVar7 = local_438;
(**(code **)(local_438 + 0x54))(local_438,local_440,local_43c,0,0,0);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar8;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail(pCVar7);
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.