L L4D2node

CCommentarySystem::ParseEntKVBlock

0x0064cbb0 · 1937 bytes · __thiscall

_ZN17CCommentarySystem15ParseEntKVBlockEP11CBaseEntityP9KeyValues

Decompiled

undefined (3 params)

/* CCommentarySystem::ParseEntKVBlock(CBaseEntity*, KeyValues*) */

void __thiscall
CCommentarySystem::ParseEntKVBlock(CCommentarySystem *this,CBaseEntity *param_1,KeyValues *param_2)

{
  code *pcVar1;
  KeyValues *this_00;
  char *pcVar2;
  int iVar3;
  KeyValues *this_01;
  KeyValues *this_02;
  KeyValues *this_03;
  KeyValues *this_04;
  KeyValues *this_05;
  char *pcVar4;
  undefined4 uVar5;
  int in_GS_OFFSET;
  char local_420 [1024];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this_00 = (KeyValues *)KeyValues::GetFirstSubKey(param_2);
  do {
    if (this_00 == (KeyValues *)0x0) {
      if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
        __stack_chk_fail();
      }
      return;
    }
    pcVar2 = (char *)KeyValues::GetName(this_00);
    iVar3 = _V_strcmp(pcVar2,"connections");
    if (iVar3 == 0) {
      for (this_01 = (KeyValues *)KeyValues::GetFirstSubKey(this_00); this_01 != (KeyValues *)0x0;
          this_01 = (KeyValues *)KeyValues::GetNextKey(this_01)) {
        pcVar2 = (char *)KeyValues::GetName(this_01);
        iVar3 = _V_strcmp(pcVar2,"connections");
        if (iVar3 == 0) {
          for (this_02 = (KeyValues *)KeyValues::GetFirstSubKey(this_01);
              this_02 != (KeyValues *)0x0; this_02 = (KeyValues *)KeyValues::GetNextKey(this_02)) {
            pcVar2 = (char *)KeyValues::GetName(this_02);
            iVar3 = _V_strcmp(pcVar2,"connections");
            if (iVar3 == 0) {
              for (this_03 = (KeyValues *)KeyValues::GetFirstSubKey(this_02);
                  this_03 != (KeyValues *)0x0; this_03 = (KeyValues *)KeyValues::GetNextKey(this_03)
                  ) {
                pcVar2 = (char *)KeyValues::GetName(this_03);
                iVar3 = _V_strcmp(pcVar2,"connections");
                if (iVar3 == 0) {
                  for (this_04 = (KeyValues *)KeyValues::GetFirstSubKey(this_03);
                      this_04 != (KeyValues *)0x0;
                      this_04 = (KeyValues *)KeyValues::GetNextKey(this_04)) {
                    pcVar2 = (char *)KeyValues::GetName(this_04);
                    iVar3 = _V_strcmp(pcVar2,"connections");
                    if (iVar3 == 0) {
                      this_05 = (KeyValues *)KeyValues::GetFirstSubKey(this_04);
joined_r0x0064cd32:
                      if (this_05 != (KeyValues *)0x0) {
                        do {
                          pcVar2 = (char *)KeyValues::GetName(this_05);
                          iVar3 = _V_strcmp(pcVar2,"connections");
                          if (iVar3 == 0) {
                            ParseEntKVBlock(this,param_1,this_05);
                          }
                          else {
                            pcVar2 = (char *)KeyValues::GetString(this_05,(char *)0x0,"");
                            iVar3 = V_strnchr(pcVar2,'^',0x400);
                            if (iVar3 != 0) goto code_r0x0064cdc8;
                            pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                            uVar5 = KeyValues::GetName(this_05);
                            (*pcVar1)(param_1,uVar5,pcVar2);
                          }
                          this_05 = (KeyValues *)KeyValues::GetNextKey(this_05);
                          if (this_05 == (KeyValues *)0x0) break;
                        } while( true );
                      }
                      goto LAB_0064ce41;
                    }
                    pcVar2 = (char *)KeyValues::GetString(this_04,(char *)0x0,"");
                    iVar3 = V_strnchr(pcVar2,'^',0x400);
                    if (iVar3 == 0) {
                      pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                      uVar5 = KeyValues::GetName(this_04);
                      (*pcVar1)(param_1,uVar5,pcVar2);
                    }
                    else {
                      V_strncpy(local_420,pcVar2,0x400);
                      iVar3 = _V_strlen(local_420);
                      if (0 < iVar3) {
                        pcVar4 = local_420 + iVar3;
                        pcVar2 = local_420;
                        do {
                          while (*pcVar2 != '^') {
                            pcVar2 = pcVar2 + 1;
                            if (pcVar2 == pcVar4) goto LAB_0064cf76;
                          }
                          *pcVar2 = '\"';
                          pcVar2 = pcVar2 + 1;
                        } while (pcVar2 != pcVar4);
                      }
LAB_0064cf76:
                      pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                      uVar5 = KeyValues::GetName(this_04);
                      (*pcVar1)(param_1,uVar5,local_420);
                    }
LAB_0064ce41:
                  }
                }
                else {
                  pcVar2 = (char *)KeyValues::GetString(this_03,(char *)0x0,"");
                  iVar3 = V_strnchr(pcVar2,'^',0x400);
                  if (iVar3 == 0) {
                    pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                    uVar5 = KeyValues::GetName(this_03);
                    (*pcVar1)(param_1,uVar5,pcVar2);
                  }
                  else {
                    V_strncpy(local_420,pcVar2,0x400);
                    iVar3 = _V_strlen(local_420);
                    if (0 < iVar3) {
                      pcVar4 = local_420 + iVar3;
                      pcVar2 = local_420;
                      do {
                        while (*pcVar2 != '^') {
                          pcVar2 = pcVar2 + 1;
                          if (pcVar2 == pcVar4) goto LAB_0064d056;
                        }
                        *pcVar2 = '\"';
                        pcVar2 = pcVar2 + 1;
                      } while (pcVar2 != pcVar4);
                    }
LAB_0064d056:
                    pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                    uVar5 = KeyValues::GetName(this_03);
                    (*pcVar1)(param_1,uVar5,local_420);
                  }
                }
              }
            }
            else {
              pcVar2 = (char *)KeyValues::GetString(this_02,(char *)0x0,"");
              iVar3 = V_strnchr(pcVar2,'^',0x400);
              if (iVar3 == 0) {
                pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                uVar5 = KeyValues::GetName(this_02);
                (*pcVar1)(param_1,uVar5,pcVar2);
              }
              else {
                V_strncpy(local_420,pcVar2,0x400);
                iVar3 = _V_strlen(local_420);
                if (0 < iVar3) {
                  pcVar4 = local_420 + iVar3;
                  pcVar2 = local_420;
                  do {
                    while (*pcVar2 != '^') {
                      pcVar2 = pcVar2 + 1;
                      if (pcVar2 == pcVar4) goto LAB_0064d15e;
                    }
                    *pcVar2 = '\"';
                    pcVar2 = pcVar2 + 1;
                  } while (pcVar2 != pcVar4);
                }
LAB_0064d15e:
                pcVar1 = *(code **)(*(int *)param_1 + 0x84);
                uVar5 = KeyValues::GetName(this_02);
                (*pcVar1)(param_1,uVar5,local_420);
              }
            }
          }
        }
        else {
          pcVar2 = (char *)KeyValues::GetString(this_01,(char *)0x0,"");
          iVar3 = V_strnchr(pcVar2,'^',0x400);
          if (iVar3 == 0) {
            pcVar1 = *(code **)(*(int *)param_1 + 0x84);
            uVar5 = KeyValues::GetName(this_01);
            (*pcVar1)(param_1,uVar5,pcVar2);
          }
          else {
            V_strncpy(local_420,pcVar2,0x400);
            iVar3 = _V_strlen(local_420);
            if (0 < iVar3) {
              pcVar4 = local_420 + iVar3;
              pcVar2 = local_420;
              do {
                while (*pcVar2 != '^') {
                  pcVar2 = pcVar2 + 1;
                  if (pcVar2 == pcVar4) goto LAB_0064d236;
                }
                *pcVar2 = '\"';
                pcVar2 = pcVar2 + 1;
              } while (pcVar2 != pcVar4);
            }
LAB_0064d236:
            pcVar1 = *(code **)(*(int *)param_1 + 0x84);
            uVar5 = KeyValues::GetName(this_01);
            (*pcVar1)(param_1,uVar5,local_420);
          }
        }
      }
    }
    else {
      pcVar2 = (char *)KeyValues::GetString(this_00,(char *)0x0,"");
      iVar3 = V_strnchr(pcVar2,'^',0x400);
      if (iVar3 == 0) {
        pcVar1 = *(code **)(*(int *)param_1 + 0x84);
        uVar5 = KeyValues::GetName(this_00);
        (*pcVar1)(param_1,uVar5,pcVar2);
      }
      else {
        V_strncpy(local_420,pcVar2,0x400);
        iVar3 = _V_strlen(local_420);
        if (0 < iVar3) {
          pcVar2 = local_420;
          do {
            if (*pcVar2 == '^') {
              *pcVar2 = '\"';
            }
            pcVar2 = pcVar2 + 1;
          } while (pcVar2 != local_420 + iVar3);
        }
        pcVar1 = *(code **)(*(int *)param_1 + 0x84);
        uVar5 = KeyValues::GetName(this_00);
        (*pcVar1)(param_1,uVar5,local_420);
      }
    }
    this_00 = (KeyValues *)KeyValues::GetNextKey(this_00);
  } while( true );
code_r0x0064cdc8:
  V_strncpy(local_420,pcVar2,0x400);
  iVar3 = _V_strlen(local_420);
  if (0 < iVar3) {
    pcVar4 = local_420 + iVar3;
    pcVar2 = local_420;
    do {
      while (*pcVar2 != '^') {
        pcVar2 = pcVar2 + 1;
        if (pcVar2 == pcVar4) goto LAB_0064ce06;
      }
      *pcVar2 = '\"';
      pcVar2 = pcVar2 + 1;
    } while (pcVar2 != pcVar4);
  }
LAB_0064ce06:
  pcVar1 = *(code **)(*(int *)param_1 + 0x84);
  uVar5 = KeyValues::GetName(this_05);
  (*pcVar1)(param_1,uVar5,local_420);
  this_05 = (KeyValues *)KeyValues::GetNextKey(this_05);
  goto joined_r0x0064cd32;
}

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)