L L4D2node

CNetworkStringTable::AddString

0x001a4160 · 740 bytes · __thiscall

_ZN19CNetworkStringTable9AddStringEbPKciPKv

Decompiled

undefined (5 params)

/* CNetworkStringTable::AddString(bool, char const*, int, void const*) */

int __thiscall
CNetworkStringTable::AddString
          (CNetworkStringTable *this,bool param_1,char *param_2,int param_3,void *param_4)

{
  CNetworkStringTable CVar1;
  bool bVar2;
  char cVar3;
  int iVar4;
  CNetworkStringTableItem *this_00;
  int *piVar5;
  uint uVar6;
  uint uVar7;
  undefined4 uVar8;
  
  if (param_2 == (char *)0x0) {
    uVar8 = (**(code **)(*(int *)this + 8))(this);
    ConMsg("Warning:  Can\'t add NULL string to table %s\n",uVar8);
    return 0xffff;
  }
  iVar4 = (**(code **)(**(int **)(this + 0x38) + 0x1c))(*(int **)(this + 0x38),param_2);
  if (param_1) {
LAB_001a4199:
    cVar3 = (**(code **)(**(int **)(this + 0x38) + 0x14))(*(int **)(this + 0x38),iVar4);
    piVar5 = *(int **)(this + 0x38);
    if (cVar3 == '\0') {
      uVar6 = (**(code **)(*piVar5 + 8))(piVar5);
      uVar7 = (**(code **)(*(int *)this + 0x14))(this);
      if (uVar7 <= uVar6) {
LAB_001a4350:
        uVar8 = (**(code **)(*(int *)this + 8))(this);
        ConMsg("Warning:  Table %s is full, can\'t add %s\n",uVar8,param_2);
        return 0xffff;
      }
      iVar4 = (**(code **)(**(int **)(this + 0x38) + 0x18))(*(int **)(this + 0x38),param_2);
      this_00 = (CNetworkStringTableItem *)
                (**(code **)(**(int **)(this + 0x38) + 0x28))(*(int **)(this + 0x38),iVar4);
      bVar2 = true;
      *(undefined4 *)(this_00 + 8) = *(undefined4 *)(this + 0x14);
      *(undefined4 *)(this_00 + 0xc) = *(undefined4 *)(this + 0x14);
      if (((byte)this[0x1c] & 1) != 0) {
        bVar2 = true;
        CNetworkStringTableItem::EnableChangeHistory(this_00);
      }
    }
    else {
      this_00 = (CNetworkStringTableItem *)(**(code **)(*piVar5 + 0x28))(piVar5,iVar4);
      bVar2 = false;
    }
    if (((param_3 < 0) ||
        (cVar3 = CNetworkStringTableItem::SetUserData(this_00,*(int *)(this + 0x14),param_3,param_4)
        , cVar3 == '\0')) && (!bVar2)) {
      return iVar4;
    }
    CVar1 = this[0x1c];
    goto joined_r0x001a4327;
  }
  cVar3 = (**(code **)(**(int **)(this + 0x38) + 0x14))(*(int **)(this + 0x38),iVar4);
  piVar5 = *(int **)(this + 0x3c);
  if (cVar3 == '\0') {
    if (piVar5 == (int *)0x0) {
      uVar8 = (**(code **)(*(int *)this + 8))(this);
      DevMsg("CNetworkStringTable::AddString:  client added string which server didn\'t put into table (consider SetAllowClientSideAddString?): %s %s\n"
             ,uVar8,param_2);
      piVar5 = *(int **)(this + 0x3c);
      goto joined_r0x001a4382;
    }
  }
  else {
joined_r0x001a4382:
    if (piVar5 == (int *)0x0) goto LAB_001a4199;
  }
  iVar4 = (**(code **)(*piVar5 + 0x1c))(piVar5,param_2);
  cVar3 = (**(code **)(**(int **)(this + 0x3c) + 0x14))(*(int **)(this + 0x3c),iVar4);
  piVar5 = *(int **)(this + 0x3c);
  if (cVar3 == '\0') {
    uVar6 = (**(code **)(*piVar5 + 8))(piVar5);
    uVar7 = (**(code **)(*(int *)this + 0x14))(this);
    if (uVar7 <= uVar6) goto LAB_001a4350;
    iVar4 = (**(code **)(**(int **)(this + 0x3c) + 0x18))(*(int **)(this + 0x3c),param_2);
    this_00 = (CNetworkStringTableItem *)
              (**(code **)(**(int **)(this + 0x3c) + 0x28))(*(int **)(this + 0x3c),iVar4);
    *(undefined4 *)(this_00 + 8) = *(undefined4 *)(this + 0x14);
    *(undefined4 *)(this_00 + 0xc) = *(undefined4 *)(this + 0x14);
    if (((byte)this[0x1c] & 1) != 0) {
      CNetworkStringTableItem::EnableChangeHistory(this_00);
    }
    bVar2 = true;
    if (-1 < param_3) goto LAB_001a42f4;
LAB_001a43a9:
    if (!bVar2) {
      return -iVar4;
    }
  }
  else {
    this_00 = (CNetworkStringTableItem *)(**(code **)(*piVar5 + 0x28))(piVar5,iVar4);
    bVar2 = false;
    if (param_3 < 0) goto LAB_001a43a9;
LAB_001a42f4:
    cVar3 = CNetworkStringTableItem::SetUserData(this_00,*(int *)(this + 0x14),param_3,param_4);
    if (cVar3 == '\0') goto LAB_001a43a9;
  }
  iVar4 = -iVar4;
  CVar1 = this[0x1c];
joined_r0x001a4327:
  if (((byte)CVar1 & 1) == 0) {
    DataChanged(this,iVar4,this_00);
  }
  return iVar4;
}

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)