L L4D2node

UTIL_GetModDir

0x006c97a0 · 202 bytes · __cdecl

_Z14UTIL_GetModDirPcj

Decompiled

undefined (2 params)

/* UTIL_GetModDir(char*, unsigned int) */

undefined4 UTIL_GetModDir(char *param_1,uint param_2)

{
  int *piVar1;
  char *__s;
  size_t sVar2;
  int iVar3;
  int iVar4;
  
  piVar1 = (int *)CommandLine_Tier0();
  __s = (char *)(**(code **)(*piVar1 + 0x18))(piVar1,"-game",&DAT_00bfafc2);
  sVar2 = strlen(__s);
  if (sVar2 <= param_2) {
    V_strncpy(param_1,__s,param_2);
    iVar3 = V_strnchr(param_1,'/',param_2);
    if ((iVar3 != 0) || (iVar3 = V_strnchr(param_1,'\\',param_2), iVar3 != 0)) {
      V_StripLastDir(param_1,param_2);
      iVar3 = _V_strlen(param_1);
      iVar4 = _V_strlen(__s);
      V_strncpy(param_1,__s + iVar3,(iVar4 - iVar3) + 1);
    }
    return 1;
  }
  return 0;
}

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)