L L4D2node

CCSGameRules::CCSGameRules

0x004393d0 · 1317 bytes · __thiscall

_ZN12CCSGameRulesC1Ev

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CCSGameRules::CCSGameRules() */

void __thiscall CCSGameRules::CCSGameRules(CCSGameRules *this)

{
  int iVar1;
  code *pcVar2;
  char cVar3;
  int *piVar4;
  undefined4 uVar5;
  undefined1 *puVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  undefined4 *puVar10;
  byte bVar11;
  
  bVar11 = 0;
  CTeamplayRules::CTeamplayRules((CTeamplayRules *)this);
  *(undefined ***)this = &PTR_Name_00c0e648;
  *(undefined4 *)(this + 0x2c8) = 0xffffffff;
  *(undefined4 *)(this + 0x2d8) = 0xffffffff;
  if (*(int *)(this + 0x240) != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x240) = 0;
  }
  *(undefined4 *)(this + 600) = 0;
  *(undefined4 *)(this + 0x264) = 0;
  if (*(float *)(this + 0x244) != 0.0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x244) = 0;
  }
  this[0x2dc] = (CCSGameRules)0x1;
  if (this[0x23d] != (CCSGameRules)0x1) {
                    /* try { // try from 00439440 to 00439914 has its CatchHandler @ 0043992e */
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x23d] = (CCSGameRules)0x1;
  }
  *(undefined4 *)(this + 0x270) = 0;
  *(undefined4 *)(this + 0x26c) = 0;
  *(undefined4 *)(this + 0x268) = 0x3dcccccd;
  *(undefined4 *)(this + 0x278) = 0;
  *(undefined4 *)(this + 0x274) = 0;
  this[0x27c] = (CCSGameRules)0x0;
  this[0x27d] = (CCSGameRules)0x0;
  *(undefined4 *)(this + 0x284) = 0;
  *(undefined4 *)(this + 0x280) = 0;
  *(undefined2 *)(this + 0x288) = 0;
  *(undefined2 *)(this + 0x28a) = 0;
  *(undefined4 *)(this + 0x28c) = 0;
  *(undefined4 *)(this + 0x290) = 0;
  this[0x2d0] = (CCSGameRules)0x0;
  this[0x2d1] = (CCSGameRules)0x0;
  *(undefined4 *)(this + 0x25c) = 0xffffffff;
  *(undefined4 *)(this + 0x260) = 0;
  if (*(float *)(this + 0x248) != 0.0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x248) = 0;
  }
  if (*(int *)(this + 0x24c) != 0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    *(undefined4 *)(this + 0x24c) = 0;
  }
  this[0x255] = (CCSGameRules)0x0;
  if (this[0x252] != (CCSGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x252] = (CCSGameRules)0x0;
  }
  *(undefined4 *)(this + 0x2a4) = 0;
  if (this[0x250] != (CCSGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x250] = (CCSGameRules)0x0;
  }
  if (this[0x251] != (CCSGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x251] = (CCSGameRules)0x0;
  }
  iVar8 = gpGlobals;
  *(undefined4 *)(this + 0x2b0) = 0;
  *(undefined4 *)(this + 0x294) = 0;
  *(undefined4 *)(this + 0x298) = 0;
  this[0x29c] = (CCSGameRules)0x0;
  this[0x29d] = (CCSGameRules)0x0;
  this[0x29e] = (CCSGameRules)0x0;
  *(undefined4 *)(this + 0x2a0) = 0;
  *(undefined4 *)(this + 0x2a8) = 0;
  *(undefined4 *)(this + 0x2ac) = 0;
  *(undefined4 *)(this + 0x2b4) = 0;
  this[0x2b8] = (CCSGameRules)0x0;
  *(undefined4 *)(this + 700) = 0;
  *(undefined4 *)(this + 0x2c0) = 0;
  *(undefined4 *)(this + 0x2c4) = 0;
  *(undefined4 *)(this + 0x2c8) = 0xffffffff;
  *(undefined4 *)(this + 0x2cc) = 0;
  this[0x2d2] = (CCSGameRules)0x0;
  this[0x2d3] = (CCSGameRules)0x0;
  this[0x2d4] = (CCSGameRules)0x0;
  *(undefined4 *)(this + 0x2d8) = 0xffffffff;
  this[0x2dc] = (CCSGameRules)0x1;
  *(undefined4 *)(this + 0x2b0) = *(undefined4 *)(iVar8 + 0xc);
  ReadMultiplayCvars(this);
  *(undefined4 *)(this + 0x2e4) = 0;
  if (this[0x253] != (CCSGameRules)0x0) {
    CGameRulesProxy::NotifyNetworkStateChanged();
    this[0x253] = (CCSGameRules)0x0;
  }
  this[0x254] = (CCSGameRules)0x0;
  iVar8 = 0;
  do {
    piVar4 = (int *)CreateEntityByName("cs_team_manager",-1,true);
    (**(code **)(*piVar4 + 0x324))(piVar4,(&sTeamNames)[iVar8],iVar8);
    iVar1 = DAT_00ff98e4;
    iVar9 = DAT_00ff98e4 + 1;
    if ((DAT_00ff98dc < iVar9) && (-1 < DAT_00ff98e0)) {
      if (DAT_00ff98e0 == 0) {
        iVar7 = DAT_00ff98dc;
        if (DAT_00ff98dc == 0) {
          if (iVar9 < 9) {
            DAT_00ff98dc = 8;
            goto LAB_00439707;
          }
          iVar7 = 8;
        }
        do {
          DAT_00ff98dc = iVar7 * 2;
          if (iVar9 <= DAT_00ff98dc) break;
          DAT_00ff98dc = iVar7 * 4;
          iVar7 = DAT_00ff98dc;
        } while (DAT_00ff98dc < iVar9);
      }
      else {
        for (DAT_00ff98dc = (DAT_00ff98e4 / DAT_00ff98e0 + 1) * DAT_00ff98e0; DAT_00ff98dc < iVar9;
            DAT_00ff98dc = (DAT_00ff98dc + iVar9) / 2) {
        }
      }
LAB_00439707:
      if (g_Teams == (void *)0x0) {
        g_Teams = malloc(DAT_00ff98dc << 2);
      }
      else {
        g_Teams = realloc(g_Teams,DAT_00ff98dc << 2);
        iVar9 = DAT_00ff98e4 + 1;
      }
    }
    iVar7 = (iVar9 - iVar1) + -1;
    iVar1 = iVar1 * 4;
    DAT_00ff98e4 = iVar9;
    _DAT_00ff98e8 = g_Teams;
    if (0 < iVar7) {
      _V_memmove((void *)((int)g_Teams + iVar1 + 4),(void *)((int)g_Teams + iVar1),iVar7 * 4);
    }
    if ((undefined4 *)(iVar1 + (int)g_Teams) != (undefined4 *)0x0) {
      *(undefined4 *)(iVar1 + (int)g_Teams) = piVar4;
    }
    iVar8 = iVar8 + 1;
    if (iVar8 == 5) {
      pcVar2 = *(code **)(*(int *)(filesystem + 4) + 0x28);
      puVar6 = &DAT_00d539c2;
      if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
        puVar6 = *(undefined1 **)(gpGlobals + 0x3c);
      }
      uVar5 = UTIL_VarArgs("maps/cfg/%s.cfg",puVar6);
      cVar3 = (*pcVar2)(filesystem + 4,uVar5,0);
      if (cVar3 != '\0') {
        pcVar2 = *(code **)(*engine + 0x94);
        puVar6 = &DAT_00d539c2;
        if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
          puVar6 = *(undefined1 **)(gpGlobals + 0x3c);
        }
        uVar5 = UTIL_VarArgs("exec \"%s.cfg\" */maps\n",puVar6);
        (*pcVar2)(engine,uVar5);
      }
      if (g_flGameStatsUpdateTime == 0.0) {
        g_flGameStatsUpdateTime = 79200.0;
        puVar10 = &g_iWeaponPurchases;
        for (iVar8 = 0x1c; iVar8 != 0; iVar8 = iVar8 + -1) {
          *puVar10 = 0;
          puVar10 = puVar10 + (uint)bVar11 * -2 + 1;
        }
        puVar10 = &g_iTerroristVictories;
        for (iVar8 = 9; iVar8 != 0; iVar8 = iVar8 + -1) {
          *puVar10 = 0;
          puVar10 = puVar10 + (uint)bVar11 * -2 + 1;
        }
        puVar10 = &g_iCounterTVictories;
        for (iVar8 = 9; iVar8 != 0; iVar8 = iVar8 + -1) {
          *puVar10 = 0;
          puVar10 = puVar10 + (uint)bVar11 * -2 + 1;
        }
      }
      return;
    }
  } while( true );
}

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)