L L4D2node

VOX_ReadSentenceFile

0x000f3930 · 914 bytes · unknown

Decompiled

undefined (0 params)

void VOX_ReadSentenceFile(char *param_1)

{
  code *pcVar1;
  bool bVar2;
  char cVar3;
  int iVar4;
  uint uVar5;
  char *pcVar6;
  size_t sVar7;
  undefined4 *puVar8;
  uint uVar9;
  char *pcVar10;
  char *pcVar11;
  char *pcVar12;
  char *pcVar13;
  char *pcVar14;
  int in_GS_OFFSET;
  int local_124;
  characterset_t local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  for (puVar8 = g_pSentenceFileList; puVar8 != (undefined4 *)0x0; puVar8 = (undefined4 *)puVar8[1])
  {
    iVar4 = strcmp(param_1,(char *)*puVar8);
    if (iVar4 == 0) {
      iVar4 = MapReslistGenerator();
      if ((*(char *)(iVar4 + 1) != '\0') && (*(char *)(iVar4 + 5) == '\0')) {
        VOX_AddSentenceWavesToResList();
      }
      goto LAB_000f3990;
    }
  }
  iVar4 = (**(code **)(g_pFileSystem[1] + 8))(g_pFileSystem + 1,param_1,&DAT_002a3e98,0);
  if (iVar4 == 0) {
    DevMsg("Couldn\'t load %s\n",param_1);
  }
  else {
    uVar5 = (**(code **)(g_pFileSystem[1] + 0x18))(g_pFileSystem + 1,iVar4);
    if ((int)uVar5 < 1) {
      pcVar6 = "VOX_ReadSentenceFile: %s has invalid size %i\n";
    }
    else {
      pcVar6 = (char *)(**(code **)(*g_pFileSystem + 0x14c))(g_pFileSystem,iVar4,uVar5 + 1,0);
      if (pcVar6 != (char *)0x0) {
        pcVar1 = *(code **)(*g_pFileSystem + 0x118);
        cVar3 = (**(code **)(*g_pFileSystem + 0x148))(g_pFileSystem,iVar4,&local_124,0,0);
        uVar9 = uVar5;
        if (cVar3 != '\0') {
          uVar9 = (uVar5 - 1) + local_124 & -local_124;
        }
        (*pcVar1)(g_pFileSystem,pcVar6,uVar9,uVar5,iVar4);
        (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar4);
        pcVar12 = pcVar6 + uVar5;
        *pcVar12 = '\0';
        CharacterSetBuild(local_120,"\n\r\t ");
        pcVar10 = (char *)0x0;
        pcVar13 = pcVar6;
joined_r0x000f3ade:
        pcVar11 = pcVar13;
        if (pcVar11 < pcVar12) {
          cVar3 = *pcVar11;
          if (pcVar11 < pcVar12) {
            do {
              if (local_120[cVar3] == (characterset_t)0x0) break;
              pcVar11 = pcVar11 + 1;
              cVar3 = *pcVar11;
            } while (pcVar11 != pcVar12);
          }
          if (cVar3 != '\0') {
            if (cVar3 != '/') goto code_r0x000f3b27;
            bVar2 = false;
            pcVar14 = (char *)0x0;
            goto LAB_000f3b9c;
          }
        }
        VOX_CompactSentenceFile();
        (**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,pcVar6);
        VOX_GroupInitAllLRUs();
        VOX_AddSentenceWavesToResList();
        sVar7 = strlen(param_1);
        puVar8 = malloc(sVar7 + 9);
        if (puVar8 != (undefined4 *)0x0) {
          _V_strcpy((char *)(puVar8 + 2),param_1);
          *puVar8 = puVar8 + 2;
          puVar8[1] = g_pSentenceFileList;
          g_pSentenceFileList = puVar8;
        }
        goto LAB_000f3990;
      }
      pcVar6 = "VOX_ReadSentenceFile: %s couldn\'t allocate %i bytes for data\n";
    }
    DevMsg(pcVar6,param_1,uVar5);
    (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar4);
  }
LAB_000f3990:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
code_r0x000f3b27:
  iVar4 = CUtlVector<sentence_t,CUtlMemory<sentence_t,int>>::InsertBefore
                    ((CUtlVector<sentence_t,CUtlMemory<sentence_t,int>> *)&g_Sentences,DAT_00350438)
  ;
  puVar8 = (undefined4 *)(g_Sentences + iVar4 * 0xc);
  *puVar8 = pcVar11;
  puVar8[1] = 0;
  *(undefined1 *)(puVar8 + 2) = 0;
  *(undefined2 *)((int)puVar8 + 10) = 0xffff;
  pcVar13 = pcVar11;
  if ((*pcVar11 != ' ') && (pcVar11 < pcVar12)) {
    do {
      pcVar13 = pcVar13 + 1;
      if (pcVar12 <= pcVar13) break;
    } while (*pcVar13 != ' ');
  }
  pcVar10 = pcVar11;
  if (pcVar13 < pcVar12) {
    pcVar14 = pcVar13 + 1;
    *pcVar13 = '\0';
    bVar2 = pcVar14 < pcVar12 && pcVar14 != (char *)0x0;
    pcVar11 = pcVar14;
LAB_000f3b9c:
    if (pcVar11 < pcVar12) {
      do {
        if ((*pcVar11 == '\n') || (*pcVar11 == '\r')) {
          *pcVar11 = '\0';
          pcVar11 = pcVar11 + 1;
          break;
        }
        pcVar11 = pcVar11 + 1;
      } while (pcVar11 != pcVar12);
    }
    pcVar13 = pcVar11;
    if (bVar2) {
      VOX_GroupAdd(pcVar10);
      VOX_ParseLineCommands(pcVar14,DAT_00350438 + -1);
    }
  }
  goto joined_r0x000f3ade;
}

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.



        
        

⚠ This function has no mangled symbol — it may be internal/static. The Linux gamedata field uses @-prefix symbol resolution which requires an exported mangled name. You'll need a Linux byte signature for this one (extract via extract_signature.java).


          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)