L L4D2node

KeyValues::ReadToken

0x00040d90 · 665 bytes · __thiscall

_ZN9KeyValues9ReadTokenER10CUtlBufferRbS2_

Decompiled

undefined (4 params)

/* KeyValues::ReadToken(CUtlBuffer&, bool&, bool&) */

undefined1 * __thiscall
KeyValues::ReadToken(KeyValues *this,CUtlBuffer *param_1,bool *param_2,bool *param_3)

{
  undefined4 *puVar1;
  bool bVar2;
  bool bVar3;
  char cVar4;
  char *pcVar5;
  int *piVar6;
  CUtlCharConversion *pCVar7;
  int iVar8;
  int iVar9;
  undefined4 uVar10;
  
  *param_2 = false;
  *param_3 = false;
  if (param_1[0x14] == (CUtlBuffer)0x0) {
    do {
      CUtlBuffer::EatWhiteSpace(param_1);
      if (param_1[0x14] != (CUtlBuffer)0x0) {
        return (undefined1 *)0x0;
      }
      cVar4 = CUtlBuffer::EatCPPComment(param_1);
    } while (cVar4 != '\0');
    pcVar5 = (char *)CUtlBuffer::PeekGet(param_1,1,0);
    if (pcVar5 != (char *)0x0) {
      cVar4 = *pcVar5;
      if (cVar4 == '\"') {
        *param_2 = true;
        if (this[0x11] == (KeyValues)0x0) {
          pCVar7 = (CUtlCharConversion *)GetNoEscCharConversion();
        }
        else {
          pCVar7 = (CUtlCharConversion *)GetCStringCharConversion();
        }
        CUtlBuffer::GetDelimitedString(param_1,pCVar7,&s_pTokenBuf,0x400);
        return &s_pTokenBuf;
      }
      if ((cVar4 == '}') || (cVar4 == '{')) {
        DAT_000d39a1 = 0;
        s_pTokenBuf = cVar4;
        CUtlBuffer::SeekGet(param_1,1,1);
        return &s_pTokenBuf;
      }
      bVar3 = false;
      iVar8 = 0;
      bVar2 = false;
      while ((((pcVar5 = (char *)CUtlBuffer::PeekGet(param_1,1,0), pcVar5 != (char *)0x0 &&
               (cVar4 = *pcVar5, cVar4 != '\0')) && (cVar4 != '{')) &&
             ((cVar4 != '\"' && (cVar4 != '}'))))) {
        if (cVar4 == '[') {
          bVar3 = true;
        }
        else {
          if (cVar4 == ']') {
            if (!bVar3) goto LAB_00040e8e;
            bVar3 = false;
            *param_3 = true;
            cVar4 = *pcVar5;
          }
          if ((((int)cVar4 - 9U < 0x18) &&
              ((1 << ((byte)((int)cVar4 - 9U) & 0x1f) & 0x80001fU) != 0)) && (!bVar3)) break;
        }
LAB_00040e8e:
        if (iVar8 < 0x3ff) {
          (&s_pTokenBuf)[iVar8] = cVar4;
          iVar8 = iVar8 + 1;
        }
        else if (!bVar2) {
          pcVar5 = " ReadToken overflow";
          iVar9 = 0;
          uVar10 = DAT_000d34a0;
          Warning("KeyValues Error: %s in file %s\n"," ReadToken overflow",DAT_000d34a0);
          if (0 < DAT_000d34a8) {
            do {
              while ((0x3f < iVar9 || ((&g_KeyValuesErrorStack)[iVar9] == -1))) {
LAB_00040f38:
                iVar9 = iVar9 + 1;
                if (DAT_000d34a8 <= iVar9) goto LAB_00040f90;
              }
              if (iVar9 < DAT_000d34a4) {
                piVar6 = (int *)KeyValuesSystem();
                pcVar5 = (char *)(**(code **)(*piVar6 + 0x18))
                                           (piVar6,(&g_KeyValuesErrorStack)[iVar9]);
                Warning(&DAT_000b2b56,pcVar5,uVar10);
                goto LAB_00040f38;
              }
              piVar6 = (int *)KeyValuesSystem();
              puVar1 = &g_KeyValuesErrorStack + iVar9;
              iVar9 = iVar9 + 1;
              pcVar5 = (char *)(**(code **)(*piVar6 + 0x18))(piVar6,*puVar1);
              Warning(&DAT_000b2b5b,pcVar5,uVar10);
            } while (iVar9 < DAT_000d34a8);
          }
LAB_00040f90:
          bVar2 = true;
          Warning(&DAT_000b32c1,pcVar5,uVar10);
        }
        CUtlBuffer::SeekGet(param_1,1,1);
      }
      (&s_pTokenBuf)[iVar8] = 0;
      return &s_pTokenBuf;
    }
  }
  return (undefined1 *)0x0;
}

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)