L L4D2node

CServerGameDLL::LevelInit

0x006cb580 · 1199 bytes · __thiscall

_ZN14CServerGameDLL9LevelInitEPKcS1_S1_S1_bb

Decompiled

undefined (7 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CServerGameDLL::LevelInit(char const*, char const*, char const*, char const*, bool, bool) */

undefined4 __thiscall
CServerGameDLL::LevelInit
          (CServerGameDLL *this,char *param_1,char *param_2,char *param_3,char *param_4,bool param_5
          ,bool param_6)

{
  int iVar1;
  char cVar2;
  undefined4 uVar3;
  CBaseEntity *pCVar4;
  int iVar5;
  bool bVar6;
  undefined1 *puVar7;
  int *piVar8;
  undefined **local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (___atan2f_finite == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_34,0,0,0,0,"/data/src/game/server/gameinterface.cpp",0x49d,
               &LevelInit(char_const*,char_const*,char_const*,char_const*,bool,bool)::tm_fmt,
               "(%s)%s","Unaccounted","CServerGameDLL::LevelInit");
    local_20 = ___atan2f_finite;
  }
  iVar1 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 006cb7d8 to 006cb827 has its CatchHandler @ 006cba4f */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar5 = ThreadGetCurrentId(), iVar1 == iVar5)) {
    if ((char *)*_DAT_0105d15c != "CServerGameDLL::LevelInit") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc903f6,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 006cb64b to 006cb7c0 has its CatchHandler @ 006cba64 */
  DebugDumpEntity("level_init\t%s",param_1);
  ResetWindspeed();
  UpdateChapterRestrictions(param_1);
  if (param_5) {
    if (param_3 == (char *)0x0) {
      *(undefined4 *)(gpGlobals + 0x48) = 1;
    }
    else {
      *(undefined4 *)(gpGlobals + 0x48) = 2;
    }
    BeginRestoreEntities();
    puVar7 = (undefined1 *)engine;
    uVar3 = (**(code **)(*engine + 0x110))(engine,param_1,1);
    if ((char)uVar3 == '\0') {
      if (param_3 == (char *)0x0) goto LAB_006cb95c;
      MapEntity_ParseAllEntities(param_2,(IMapEntityFilter *)0x0,false);
LAB_006cb6ce:
      (**(code **)(*engine + 0x114))(engine,param_3,param_4);
    }
    else if (param_3 != (char *)0x0) goto LAB_006cb6ce;
    if (g_OneWayTransition != '\0') {
                    /* try { // try from 006cba02 to 006cba07 has its CatchHandler @ 006cba64 */
      (**(code **)(*engine + 0x158))(engine);
    }
    if (((param_3 != (char *)0x0) && (*(int *)(sv_autosave._28_4_ + 0x30) != 0)) &&
       ((*(int *)(gpGlobals + 0x14) == 1 &&
        (pCVar4 = (CBaseEntity *)
                  CBaseEntity::Create("logic_autosave",(Vector *)&vec3_origin,(QAngle *)&vec3_angle,
                                      (CBaseEntity *)0x0), pCVar4 != (CBaseEntity *)0x0)))) {
      CEventQueue::AddEvent
                ((CEventQueue *)g_EventQueue,pCVar4,"Save",1.0,(CBaseEntity *)0x0,(CBaseEntity *)0x0
                 ,0);
      CEventQueue::AddEvent
                ((CEventQueue *)g_EventQueue,pCVar4,"Kill",1.1,(CBaseEntity *)0x0,(CBaseEntity *)0x0
                 ,0);
    }
  }
  else {
    if (param_6) {
      *(undefined4 *)(gpGlobals + 0x48) = 3;
    }
    else {
      *(undefined4 *)(gpGlobals + 0x48) = 0;
    }
    CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
    ::RemoveAll((CUtlLinkedList<CMapEntityRef,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>>
                 *)&g_MapEntityRefs);
    CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short>::Purge
              ((CUtlMemory<UtlLinkedListElem_t<CMapEntityRef,unsigned_short>,unsigned_short> *)
               &g_MapEntityRefs);
    DAT_00fe3118 = 0xffff;
    _DAT_00fe311c = 0;
    _DAT_00fe3120 = g_MapEntityRefs;
    DAT_00fe311e = 0xffff;
    local_38 = &PTR_ShouldCreateEntity_00c91a30;
                    /* try { // try from 006cb8a8 to 006cb956 has its CatchHandler @ 006cba64 */
    MapEntity_ParseAllEntities(param_2,(IMapEntityFilter *)&local_38,false);
    (*(code *)**(undefined4 **)g_pServerBenchmark)(g_pServerBenchmark);
    LevelInit_ParseAllEntities((char *)this);
  }
  CRagdollLowViolenceManager::SetLowViolence
            ((CRagdollLowViolenceManager *)&g_RagdollLVManager,param_1);
  PrecachePointTemplates();
  LoadMessageOfTheDay();
  puVar7 = gEntList;
  CGlobalEntityList::CleanupDeleteList();
  piVar8 = g_pGameRules;
  _DAT_00fbc734 = 0xffffffff;
  DAT_00fbc72c = 0xffffffff;
  g_AIFriendliesTalkSemaphore = 0;
  g_AIFoesTalkSemaphore = 0;
  bVar6 = g_pGameRules != (int *)0x0;
  g_OneWayTransition = '\0';
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
  if (bVar6) {
    (**(code **)(*piVar8 + 0x208))(piVar8);
    puVar7 = (undefined1 *)piVar8;
  }
  if (g_pServerDemoSystem != (int *)0x0) {
    puVar7 = (undefined1 *)g_pServerDemoSystem;
    (**(code **)(*g_pServerDemoSystem + 0x14))(g_pServerDemoSystem,param_1);
  }
  uVar3 = 1;
LAB_006cb95c:
  iVar1 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar5 = ThreadGetCurrentId(puVar7), iVar1 == iVar5)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  return uVar3;
}

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)