L L4D2node

CNetworkStringTableContainer::CreateStringTable

0x001a38b0 · 473 bytes · __thiscall

_ZN28CNetworkStringTableContainer17CreateStringTableEPKciiii

Decompiled

undefined (6 params)

/* CNetworkStringTableContainer::CreateStringTable(char const*, int, int, int, int) */

CNetworkStringTable * __thiscall
CNetworkStringTableContainer::CreateStringTable
          (CNetworkStringTableContainer *this,char *param_1,int param_2,int param_3,int param_4,
          int param_5)

{
  int iVar1;
  int iVar2;
  CNetworkStringTable *this_00;
  int iVar3;
  void *pvVar4;
  int iVar5;
  
  if (this[4] == (CNetworkStringTableContainer)0x0) {
    Sys_Error("Tried to create string table \'%s\' at wrong time\n",param_1);
    return (CNetworkStringTable *)0x0;
  }
  iVar2 = (**(code **)(*(int *)this + 0x10))(this,param_1);
  if (iVar2 != 0) {
    Sys_Error("Tried to create string table \'%s\' twice\n",param_1);
    return (CNetworkStringTable *)0x0;
  }
  iVar2 = *(int *)(this + 0x1c);
  if (0x1f < iVar2) {
    Sys_Error("Only %i string tables allowed, can\'t create\'%s\'",0x20,param_1);
    return (CNetworkStringTable *)0x0;
  }
  this_00 = operator_new(0x40);
                    /* try { // try from 001a3921 to 001a3925 has its CatchHandler @ 001a3aa5 */
  CNetworkStringTable::CNetworkStringTable(this_00,iVar2,param_1,param_2,param_3,param_4,param_5);
  if (this[0xd] != (CNetworkStringTableContainer)0x0) {
    this_00[0x1c] = (CNetworkStringTable)((byte)this_00[0x1c] | 1);
  }
  (**(code **)(*(int *)this_00 + 0x1c))(this_00,*(undefined4 *)(this + 8));
  iVar1 = *(int *)(this + 0x1c);
  iVar5 = *(int *)(this + 0x14);
  iVar2 = iVar1 + 1;
  if (iVar5 < iVar2) {
    iVar3 = *(int *)(this + 0x18);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar5 == 0) {
          if (iVar2 < 9) {
            iVar3 = 8;
            goto LAB_001a39c7;
          }
          iVar5 = 8;
        }
        do {
          iVar3 = iVar5 * 2;
          if (iVar2 <= iVar3) break;
          iVar3 = iVar5 * 4;
          iVar5 = iVar3;
        } while (iVar3 < iVar2);
      }
      else {
        for (iVar3 = (iVar1 / iVar3 + 1) * iVar3; iVar3 < iVar2; iVar3 = (iVar3 + iVar2) / 2) {
        }
      }
LAB_001a39c7:
      *(int *)(this + 0x14) = iVar3;
      if (*(void **)(this + 0x10) == (void *)0x0) {
        pvVar4 = malloc(iVar3 << 2);
        *(void **)(this + 0x10) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 0x10),iVar3 << 2);
        *(void **)(this + 0x10) = pvVar4;
        iVar2 = *(int *)(this + 0x1c) + 1;
      }
      goto LAB_001a394f;
    }
  }
  pvVar4 = *(void **)(this + 0x10);
LAB_001a394f:
  *(int *)(this + 0x1c) = iVar2;
  iVar2 = (iVar2 - iVar1) + -1;
  *(void **)(this + 0x20) = pvVar4;
  iVar1 = iVar1 * 4;
  if (0 < iVar2) {
    _V_memmove((void *)((int)pvVar4 + iVar1 + 4),(void *)((int)pvVar4 + iVar1),iVar2 * 4);
    pvVar4 = *(void **)(this + 0x10);
  }
  if ((undefined4 *)((int)pvVar4 + iVar1) != (undefined4 *)0x0) {
    *(undefined4 *)((int)pvVar4 + iVar1) = this_00;
  }
  return this_00;
}

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)