L L4D2node

CSave::WriteHeader

0x004a81c0 · 309 bytes · __thiscall

_ZN5CSave11WriteHeaderEPKci

Decompiled

undefined (3 params)

/* CSave::WriteHeader(char const*, int) */

void __thiscall CSave::WriteHeader(CSave *this,char *param_1,int param_2)

{
  undefined4 *puVar1;
  char cVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  char *pcVar9;
  undefined2 local_20;
  undefined2 local_1e [7];
  
  local_20 = (undefined2)param_2;
  cVar2 = *param_1;
  if (cVar2 == '\0') {
    uVar3 = 0;
  }
  else {
    uVar3 = 0;
    pcVar9 = param_1;
    do {
      iVar6 = 4;
      do {
        uVar4 = uVar3 >> 1;
        uVar8 = uVar3 & 1;
        uVar3 = uVar4;
        if (uVar8 != 0) {
          uVar3 = uVar4 | 0x80000000;
        }
        iVar6 = iVar6 + -1;
      } while (iVar6 != 0);
      pcVar9 = pcVar9 + 1;
      uVar3 = uVar3 ^ (int)cVar2;
      cVar2 = *pcVar9;
    } while (cVar2 != '\0');
  }
  uVar4 = *(uint *)(*(int *)(this + 0x18) + 0x10);
  if (0 < (int)uVar4) {
    iVar6 = *(int *)(*(int *)(this + 0x18) + 0x14);
    uVar8 = uVar3 % uVar4 & 0xffff;
    uVar3 = uVar4 + uVar8;
    do {
      uVar7 = uVar8 - uVar4;
      if ((int)uVar8 < (int)uVar4) {
        uVar7 = uVar8;
      }
      puVar1 = (undefined4 *)(iVar6 + uVar7 * 4);
      pcVar9 = (char *)*puVar1;
      if (pcVar9 == (char *)0x0) {
LAB_004a8285:
        *puVar1 = param_1;
        goto LAB_004a8292;
      }
      iVar5 = strcmp(param_1,pcVar9);
      if (iVar5 == 0) goto LAB_004a8285;
      uVar8 = uVar8 + 1;
    } while (uVar8 != uVar3);
  }
  Warning("CSaveRestoreBuffer::TokenHash() is COMPLETELY FULL!");
  uVar7 = 0;
LAB_004a8292:
  local_1e[0] = (undefined2)uVar7;
  if (0x7fff < (uint)param_2) {
    Warning("CSave::WriteHeader() size parameter exceeds \'short\'!\n");
  }
  BufferData(this,(char *)&local_20,2);
  BufferData(this,(char *)local_1e,2);
  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)