L L4D2node

KeyValues::WriteConvertedString

0x00041130 · 250 bytes · __thiscall

_ZN9KeyValues20WriteConvertedStringEP15IBaseFileSystemPvP10CUtlBufferPKc

Decompiled

undefined (5 params)

/* KeyValues::WriteConvertedString(IBaseFileSystem*, void*, CUtlBuffer*, char const*) */

void __thiscall
KeyValues::WriteConvertedString
          (KeyValues *this,IBaseFileSystem *param_1,void *param_2,CUtlBuffer *param_3,char *param_4)

{
  uint *puVar1;
  char cVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  char *pcVar9;
  char *pcVar10;
  uint *puVar11;
  uint *puVar12;
  int in_GS_OFFSET;
  int iStackY_60;
  undefined4 uStack_40;
  CUtlBuffer *local_38;
  void *local_34;
  IBaseFileSystem *local_30;
  int local_20;
  
  local_30 = param_1;
  local_34 = param_2;
  local_38 = param_3;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iStackY_60 = 0x41164;
  iVar5 = _V_strlen(param_4);
  iVar3 = -(iVar5 * 2 + 0x20U & 0xfffffff0);
  puVar1 = (uint *)((int)&uStack_40 + iVar3);
  puVar12 = puVar1;
  if (-1 < iVar5) {
    iVar6 = 0;
    pcVar9 = param_4;
    do {
      while ((cVar2 = *pcVar9, cVar2 == '\"' || ((this[0x11] != (KeyValues)0x0 && (cVar2 == '\\'))))
            ) {
        *(undefined1 *)((int)puVar1 + iVar6) = 0x5c;
        pcVar10 = pcVar9 + 1;
        *(char *)((int)puVar1 + iVar6 + 1) = *pcVar9;
        iVar6 = iVar6 + 2;
        pcVar9 = pcVar10;
        if (pcVar10 == param_4 + iVar5 + 1) goto LAB_000411c2;
      }
      pcVar9 = pcVar9 + 1;
      *(char *)((int)puVar1 + iVar6) = cVar2;
      iVar6 = iVar6 + 1;
    } while (pcVar9 != param_4 + iVar5 + 1);
  }
LAB_000411c2:
  do {
    puVar11 = puVar12;
    uVar7 = *puVar11 + 0xfefefeff & ~*puVar11;
    uVar8 = uVar7 & 0x80808080;
    puVar12 = puVar11 + 1;
  } while (uVar8 == 0);
  *(uint **)(&stack0xffffffb4 + iVar3) = puVar1;
  *(KeyValues **)(&stack0xffffffa4 + iVar3) = this;
  if ((uVar7 & 0x8080) == 0) {
    puVar12 = (uint *)((int)puVar11 + 6);
    uVar8 = uVar8 >> 0x10;
  }
  *(CUtlBuffer **)(&stack0xffffffb0 + iVar3) = local_38;
  pvVar4 = local_34;
  *(uint *)(&stack0xffffffb8 + iVar3) =
       (int)puVar12 + ((-3 - (uint)CARRY1((byte)uVar8,(byte)uVar8)) - (int)puVar1);
  *(void **)(&stack0xffffffac + iVar3) = pvVar4;
  *(IBaseFileSystem **)(&stack0xffffffa8 + iVar3) = local_30;
  *(undefined4 *)((int)&iStackY_60 + iVar3) = 0x41217;
  InternalWrite(*(KeyValues **)(&stack0xffffffa4 + iVar3),
                *(IBaseFileSystem **)(&stack0xffffffa8 + iVar3),*(void **)(&stack0xffffffac + iVar3)
                ,*(CUtlBuffer **)(&stack0xffffffb0 + iVar3),*(void **)(&stack0xffffffb4 + iVar3),
                *(int *)(&stack0xffffffb8 + iVar3));
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  *(code **)((int)&iStackY_60 + iVar3) = RecursiveSaveToFile;
  __stack_chk_fail();
}

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)