L L4D2node

CNetworkStringTableContainer::WriteBaselines

0x001a7880 · 770 bytes · __thiscall

_ZN28CNetworkStringTableContainer14WriteBaselinesEPKcR8bf_write

Decompiled

undefined (3 params)

/* CNetworkStringTableContainer::WriteBaselines(char const*, bf_write&) */

void __thiscall
CNetworkStringTableContainer::WriteBaselines
          (CNetworkStringTableContainer *this,char *param_1,bf_write *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  char cVar4;
  char *pcVar5;
  char *pcVar6;
  CNetworkStringTable *this_00;
  undefined4 uVar7;
  uint uVar8;
  int in_GS_OFFSET;
  int local_1e4;
  uint local_1d0;
  SVC_CreateStringTable local_1cc [144];
  char *local_13c [3];
  int local_130;
  char local_12c;
  undefined1 local_124;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  cVar4 = CNetworkStringTableDictionaryManager::ShouldRecreateDictionary
                    ((char *)&g_StringTableDictionary);
  if (cVar4 != '\0') {
    (**(code **)(*(int *)this + 0x20))(this,param_1);
  }
  SVC_CreateStringTable::SVC_CreateStringTable(local_1cc);
  pcVar5 = operator_new__(0x6f540);
  local_1e4 = 0;
  if (0 < *(int *)(this + 0x1c)) {
    do {
      this_00 = (CNetworkStringTable *)(**(code **)(*(int *)this + 0x14))(this,local_1e4);
      iVar2 = *(int *)(param_2 + 0xc);
      cVar4 = CNetworkStringTable::WriteBaselines(this_00,local_1cc,pcVar5,0x6f540);
      if (cVar4 == '\0') {
        if (pcVar5 != (char *)0x0) {
          operator_delete__(pcVar5);
        }
        uVar7 = (**(code **)(*(int *)this_00 + 8))(this_00);
        Host_Error("Index error writing string table baseline %s\n",uVar7);
      }
      if (local_12c != '\0') {
        uVar7 = (**(code **)(*(int *)this_00 + 8))(this_00);
        Warning("Warning:  Overflowed writing uncompressed string table data for %s\n",uVar7);
      }
      uVar8 = local_130 + 7 >> 3;
      local_1d0 = uVar8;
      pcVar6 = operator_new__(uVar8);
      cVar4 = NET_BufferToBufferCompress(pcVar6,&local_1d0,local_13c[0],uVar8);
      if (cVar4 == '\0') {
        local_124 = 0;
      }
      else {
        local_124 = 1;
        bf_write::Reset((bf_write *)local_13c);
        bf_write::WriteLong((bf_write *)local_13c,uVar8);
        bf_write::WriteLong((bf_write *)local_13c,local_1d0);
        bf_write::WriteBits((bf_write *)local_13c,pcVar6,local_1d0 << 3);
      }
      if (pcVar6 != (char *)0x0) {
        operator_delete__(pcVar6);
      }
      cVar4 = SVC_CreateStringTable::WriteToBuffer(local_1cc,param_2);
      if (cVar4 == '\0') {
        if (pcVar5 != (char *)0x0) {
          operator_delete__(pcVar5);
        }
        uVar7 = (**(code **)(*(int *)this_00 + 8))(this_00);
        Host_Error("Overflow error writing string table baseline %s\n",uVar7);
      }
      iVar1 = *(int *)(param_2 + 0xc);
      if (*(int *)(sv_dumpstringtables._28_4_ + 0x30) != 0) {
        iVar3 = *(int *)(param_2 + 8);
        uVar7 = (**(code **)(*(int *)this_00 + 8))(this_00);
        DevMsg("CNetworkStringTableContainer::WriteBaselines wrote %d bytes for table %s [space remaining %d bytes]\n"
               ,(iVar1 + 7 >> 3) - (iVar2 + 7 >> 3),uVar7,iVar3 - iVar1 >> 3);
      }
      local_1e4 = local_1e4 + 1;
    } while (local_1e4 < *(int *)(this + 0x1c));
  }
  if (pcVar5 != (char *)0x0) {
    operator_delete__(pcVar5);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

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)