L L4D2node

CCommand::Tokenize

0x00b6bb00 · 460 bytes · __thiscall

_ZN8CCommand8TokenizeEPKcP14characterset_t

Decompiled

undefined (3 params)

/* CCommand::Tokenize(char const*, characterset_t*) */

undefined4 __thiscall CCommand::Tokenize(CCommand *this,char *param_1,characterset_t *param_2)

{
  CCommand *pCVar1;
  undefined1 *puVar2;
  int iVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  int iVar7;
  CUtlBuffer local_54 [12];
  int local_48;
  char local_40;
  
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  this[8] = (CCommand)0x0;
  if (param_1 == (char *)0x0) {
    return 0;
  }
  puVar2 = s_BreakSet;
  if (param_2 != (characterset_t *)0x0) {
    puVar2 = param_2;
  }
  iVar3 = _V_strlen(param_1);
  if (0x1fe < iVar3) {
    Warning(
           "CCommand::Tokenize: Encountered command which overflows the tokenizer buffer.. Skipping!\n"
           );
    return 0;
  }
  iVar7 = 0;
  memcpy(this + 8,param_1,iVar3 + 1);
  CUtlBuffer::CUtlBuffer(local_54,this + 8,iVar3,9);
  do {
    iVar3 = local_48;
    if (((local_40 != '\0') || (0x3f < *(int *)this)) || (0x1ff < iVar7)) {
LAB_00b6bc1f:
      uVar5 = 1;
      goto LAB_00b6bc24;
    }
    pCVar1 = this + iVar7 + 0x208;
                    /* try { // try from 00b6bbd5 to 00b6bc4b has its CatchHandler @ 00b6bce2 */
    iVar4 = CUtlBuffer::ParseToken
                      (local_54,(characterset_t *)puVar2,(char *)pCVar1,0x200 - iVar7,true);
    if (iVar4 < 0) goto LAB_00b6bc1f;
    if (0x200 - iVar7 == iVar4) break;
    iVar6 = *(int *)this;
    if (iVar6 == 1) {
      *(int *)(this + 4) = local_48;
      iVar6 = local_48;
      if (this[local_48 + 7] == (CCommand)0x22) {
        iVar6 = local_48 + -1;
      }
      iVar6 = iVar6 - iVar4;
      *(int *)(this + 4) = iVar6;
      if ((iVar3 < iVar6) && (this[iVar6 + 7] == (CCommand)0x22)) {
        *(int *)(this + 4) = iVar6 + -1;
      }
      *(undefined4 *)this = 2;
      *(CCommand **)(this + 0x40c) = pCVar1;
    }
    else {
      *(int *)this = iVar6 + 1;
      *(CCommand **)(this + iVar6 * 4 + 0x408) = pCVar1;
      if (0x3f < iVar6 + 1) {
        Warning(
               "CCommand::Tokenize: Encountered command which overflows the argument buffer.. Clamped!\n"
               );
      }
    }
    iVar7 = iVar7 + 1 + iVar4;
  } while (iVar7 < 0x201);
  *(undefined4 *)this = 0;
  uVar5 = 0;
  *(undefined4 *)(this + 4) = 0;
  this[8] = (CCommand)0x0;
LAB_00b6bc24:
  CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
  return uVar5;
}

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)