L L4D2node

Script_FileToString

0x00b430c0 · 341 bytes · __cdecl

_ZL19Script_FileToStringPKc

Decompiled

undefined (1 param)

/* Script_FileToString(char const*) */

undefined1 * Script_FileToString(char *param_1)

{
  bool bVar1;
  int iVar2;
  uint uVar3;
  int iVar4;
  undefined1 *puVar5;
  int in_GS_OFFSET;
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  bVar1 = CreateAndValidateFileLocation<260u>(local_124,param_1);
  if (bVar1) {
    iVar2 = (**(code **)(*(int *)(g_pFullFileSystem + 4) + 8))
                      (g_pFullFileSystem + 4,local_124,"r","DEFAULT_WRITE_PATH");
    if (iVar2 - 1U < 0xfffffffe) {
      (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x10))(g_pFullFileSystem + 4,iVar2,0,2);
      uVar3 = (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x14))(g_pFullFileSystem + 4,iVar2);
      if (uVar3 < 0x4001) {
        (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0x10))(g_pFullFileSystem + 4,iVar2,0,0);
        iVar4 = (*(code *)**(undefined4 **)(g_pFullFileSystem + 4))
                          (g_pFullFileSystem + 4,fileReadBuf,uVar3,iVar2);
        fileReadBuf[iVar4] = 0;
        (**(code **)(*(int *)(g_pFullFileSystem + 4) + 0xc))(g_pFullFileSystem + 4,iVar2);
        puVar5 = fileReadBuf;
        goto LAB_00b431d5;
      }
      Warning("File %s (from %s) is len %d too long for a ScriptFileRead\n",local_124,param_1,uVar3)
      ;
    }
  }
  puVar5 = (undefined1 *)0x0;
LAB_00b431d5:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return puVar5;
  }
                    /* WARNING: Subroutine does not return */
  __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)