pathmatch
0x0025a130 · 688 bytes · __cdecl
_Z9pathmatchPKcPPcbS1_j
Decompiled
undefined (5 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* pathmatch(char const*, char**, bool, char*, unsigned int) */
undefined4 pathmatch(char *param_1,char **param_2,bool param_3,char *param_4,uint param_5)
{
code *pcVar1;
char cVar2;
int iVar3;
size_t sVar4;
__int32_t **pp_Var5;
char *pcVar6;
undefined4 uVar7;
char *pcVar8;
bool bVar9;
if ((pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch == '\0') &&
(iVar3 = __cxa_guard_acquire(&pathmatch(char_const*,char**,bool,char*,unsigned_int)::
s_pszDbgPathMatch), iVar3 != 0)) {
pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch =
getenv("DBG_PATHMATCH");
__cxa_guard_release(&pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch);
}
pcVar8 = pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch;
*param_2 = (char *)0x0;
s_bShowDiag = pcVar8 != (char *)0x0;
uVar7 = 0;
iVar3 = access(param_1,0);
if (iVar3 != 0) {
sVar4 = strlen(param_1);
if (sVar4 < param_5) {
strncpy(param_4,param_1,param_5);
}
else {
param_4 = strdup(param_1);
}
uVar7 = 3;
if (param_4 != (char *)0x0) {
cVar2 = *param_4;
pcVar8 = param_4;
if (cVar2 != '\0') {
pcVar6 = param_4 + 1;
do {
while (cVar2 == '/') {
iVar3 = 0x2f;
pcVar8 = pcVar6;
LAB_0025a203:
pp_Var5 = __ctype_tolower_loc();
pcVar6[-1] = (char)(*pp_Var5)[iVar3];
cVar2 = *pcVar6;
pcVar6 = pcVar6 + 1;
if (cVar2 == '\0') goto LAB_0025a21b;
}
iVar3 = (int)cVar2;
if (iVar3 + 0x80U < 0x180) goto LAB_0025a203;
pcVar6[-1] = cVar2;
cVar2 = *pcVar6;
pcVar6 = pcVar6 + 1;
} while (cVar2 != '\0');
}
LAB_0025a21b:
iVar3 = access(param_4,0);
if (iVar3 != 0) {
if (param_3) {
cVar2 = *pcVar8;
pcVar6 = param_1 + ((int)pcVar8 - (int)param_4);
while (cVar2 != '\0') {
cVar2 = pcVar8[1];
*pcVar8 = *pcVar6;
pcVar6 = pcVar6 + 1;
pcVar8 = pcVar8 + 1;
}
}
pcVar8 = pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch;
if ((pathmatch(char_const*,char**,bool,char*,unsigned_int)::s_pszDbgPathMatch != (char *)0x0
) && (pcVar6 = strcasestr(pathmatch(char_const*,char**,bool,char*,unsigned_int)::
s_pszDbgPathMatch,param_1), pcVar6 != (char *)0x0)) {
if (s_bShowDiag != '\0') {
fprintf(_stderr,"Breaking \'%s\' in \'%s\'\n",param_1,pcVar8);
}
pcVar1 = (code *)swi(3);
uVar7 = (*pcVar1)();
return uVar7;
}
cVar2 = Descend(param_4,0,param_3,0);
if (cVar2 != '\0') {
bVar9 = s_bShowDiag != '\0';
*param_2 = param_4;
if (bVar9) {
fprintf(_stderr,"Matched \'%s\' -> \'%s\'\n",param_1,param_4);
}
return 2;
}
if (s_bShowDiag != '\0') {
fprintf(_stderr,"Unmatched %s\n",param_1);
}
return 3;
}
uVar7 = 1;
bVar9 = s_bShowDiag != '\0';
*param_2 = param_4;
if (bVar9) {
fprintf(_stderr,"Lowered \'%s\' -> \'%s\'\n",param_1,param_4);
}
}
}
return uVar7;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.