L L4D2node

TryLocateGameInfoFile

0x000d7ce0 · 334 bytes · __regparm3

_ZL21TryLocateGameInfoFilePcib

Decompiled

undefined (3 params)

/* TryLocateGameInfoFile(char*, int, bool) */

undefined4 __regparm3 TryLocateGameInfoFile(char *param_1,int param_2,bool param_3)

{
  char *pcVar1;
  char cVar2;
  char *pcVar3;
  char *pcVar4;
  undefined4 *puVar5;
  undefined4 uVar6;
  
  pcVar3 = operator_new__(param_2);
                    /* try { // try from 000d7d05 to 000d7e2b has its CatchHandler @ 000d7e44 */
  V_strncpy(pcVar3,param_1,param_2);
  pcVar1 = pcVar3 + param_2;
  pcVar3[param_2 + -1] = '\0';
  pcVar4 = pcVar3;
  if (pcVar3 < pcVar1) {
    do {
      while (*pcVar4 != '\\') {
        pcVar4 = pcVar4 + 1;
        if (pcVar4 == pcVar1) goto LAB_000d7d40;
      }
      *pcVar4 = '/';
      pcVar4 = pcVar4 + 1;
    } while (pcVar4 != pcVar1);
  }
LAB_000d7d40:
  do {
    cVar2 = DoesFileExistIn(param_1,"gameinfo.txt");
    if (cVar2 != '\0') goto LAB_000d7e40;
  } while ((param_3) && (cVar2 = V_StripLastDir(param_1,param_2), cVar2 != '\0'));
  V_strncpy(param_1,pcVar3,param_2);
  param_1[param_2 + -1] = '\0';
  puVar5 = (undefined4 *)V_stristr(param_1,"/content/");
  if (puVar5 != (undefined4 *)0x0) {
    *puVar5 = 0x6d61672f;
    *(undefined2 *)(puVar5 + 1) = 0x2f65;
    *(undefined1 *)((int)puVar5 + 6) = 0;
    memmove((void *)((int)puVar5 + 6),(void *)((int)puVar5 + 9),
            (size_t)(param_1 + ((param_2 + -9) - (int)puVar5)));
    do {
      cVar2 = DoesFileExistIn(param_1,"gameinfo.txt");
      if (cVar2 != '\0') goto LAB_000d7e40;
    } while ((param_3) && (cVar2 = V_StripLastDir(param_1,param_2), cVar2 != '\0'));
  }
  uVar6 = 1;
LAB_000d7df5:
  if (pcVar3 != (char *)0x0) {
    operator_delete__(pcVar3);
  }
  operator_delete((void *)0x0);
  return uVar6;
LAB_000d7e40:
  uVar6 = 0;
  goto LAB_000d7df5;
}

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)