L L4D2node

V_StripExtension

0x00b7c4a0 · 146 bytes · __cdecl

_Z16V_StripExtensionPKcPci

Decompiled

undefined (3 params)

/* V_StripExtension(char const*, char*, int) */

void V_StripExtension(char *param_1,char *param_2,int param_3)

{
  char cVar1;
  size_t sVar2;
  size_t sVar3;
  
  if (param_1 != (char *)0x0) {
    sVar2 = strlen(param_1);
    sVar3 = sVar2 - 1;
    if (0 < (int)sVar3) {
      cVar1 = param_1[sVar2 - 1];
      while (cVar1 != '.') {
        if ((cVar1 == '/') || (sVar3 = sVar3 - 1, sVar3 == 0)) goto LAB_00b7c4e1;
        cVar1 = param_1[sVar3];
      }
      if ((int)sVar3 < param_3) {
        sVar2 = param_3 - 1U;
        if ((int)sVar3 <= (int)(param_3 - 1U)) {
          sVar2 = sVar3;
        }
        if (param_2 != param_1) {
          memcpy(param_2,param_1,sVar2);
        }
        param_2[sVar2] = '\0';
        return;
      }
    }
  }
LAB_00b7c4e1:
  if ((param_2 != param_1) && (strncpy(param_2,param_1,param_3), 0 < param_3)) {
    param_2[param_3 + -1] = '\0';
  }
  return;
}

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)