L L4D2node

Host_Changelevel

0x0017a9b0 · 523 bytes · __cdecl

_Z16Host_ChangelevelbPKcS0_

Decompiled

undefined (3 params)

/* Host_Changelevel(bool, char const*, char const*) */

void Host_Changelevel(bool param_1,char *param_2,char *param_3)

{
  code *pcVar1;
  char cVar2;
  undefined4 uVar3;
  CDownloadListGenerator *pCVar4;
  char *pcVar5;
  int in_GS_OFFSET;
  longdouble lVar6;
  char local_140 [96];
  char local_e0 [96];
  char local_80 [96];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (DAT_003b7f64 < 2) {
    ConMsg("Only the server may changelevel\n");
    goto LAB_0017aad2;
  }
  pcVar5 = (char *)0x0;
  (**(code **)(*g_pFileSystem + 0xa8))(g_pFileSystem,0);
  V_strncpy(local_140,param_2,0x60);
  if (param_3 != (char *)0x0) {
    pcVar5 = local_e0;
    V_strncpy(pcVar5,param_3,0x60);
  }
  Warning("---- Host_Changelevel ----\n");
  SV_CheckForFlushMemory(&DAT_003b7f70,param_2);
  V_strncpy(local_80,&DAT_003b7f70,0x60);
  (**(code **)(*(int *)g_pServerPluginHandler + 0x18))(g_pServerPluginHandler);
  CBaseServer::InactivateClients((CBaseServer *)&sv);
  cVar2 = IsUsingMasterLegacyMode();
  if ((cVar2 == '\0') || (g_pMaster == (undefined *)0x0)) {
LAB_0017aaf0:
    if (DAT_003b80ac == '\0') {
      pCVar4 = (CDownloadListGenerator *)DownloadListGenerator();
      CDownloadListGenerator::OnLevelLoadStart(pCVar4,local_140);
      cVar2 = CGameServer::SpawnServer((CGameServer *)&sv,local_140,pcVar5);
      if (cVar2 != '\0') {
        lVar6 = (longdouble)CBaseServer::GetTime((CBaseServer *)&sv);
        g_ServerGlobalVariables._12_4_ = (undefined4)lVar6;
        pcVar1 = *(code **)(*(int *)g_pServerPluginHandler + 0xc);
        uVar3 = CM_EntityString();
        (*pcVar1)(g_pServerPluginHandler,local_140,uVar3,0,0,0,0);
        SV_ActivateServer();
        NotifyDedicatedServerUI("UpdateMap");
        pCVar4 = (CDownloadListGenerator *)DownloadListGenerator();
        CDownloadListGenerator::OnLevelLoadEnd(pCVar4);
      }
      goto LAB_0017aad2;
    }
  }
  else {
    cVar2 = (**(code **)(*(int *)g_pMaster + 0x38))(g_pMaster);
    if (cVar2 == '\0') goto LAB_0017aaf0;
  }
  uVar3 = Cbuf_GetCurrentPlayer();
  Cbuf_Clear(uVar3);
  uVar3 = Cbuf_GetCurrentPlayer();
  Cbuf_AddText(uVar3,"quit\n",0);
LAB_0017aad2:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)