V_MakeRelativePath
0x0004af70 · 367 bytes · __cdecl
_Z18V_MakeRelativePathPKcS0_Pci
Decompiled
undefined (4 params)
/* V_MakeRelativePath(char const*, char const*, char*, int) */
undefined4 V_MakeRelativePath(char *param_1,char *param_2,char *param_3,int param_4)
{
char cVar1;
bool bVar2;
int iVar3;
int iVar4;
int iVar5;
char cVar6;
char *local_2c;
char *local_28;
*param_3 = '\0';
cVar6 = *param_1;
if (cVar6 != '\0') {
local_2c = (char *)0x0;
local_28 = (char *)0x0;
do {
param_1 = param_1 + 1;
iVar4 = tolower((int)cVar6);
cVar1 = *param_2;
iVar5 = tolower((int)cVar1);
if (iVar4 == iVar5) {
if (cVar6 == '/') goto LAB_0004afb9;
}
else {
if ((cVar6 != '/') || ((cVar1 != '\0' && (cVar1 != '/')))) break;
LAB_0004afb9:
local_2c = param_2 + 1;
local_28 = param_1;
}
if (cVar1 == '\0') {
local_2c = local_2c + -1;
break;
}
cVar6 = *param_1;
param_2 = param_2 + 1;
} while (cVar6 != '\0');
if (local_28 != (char *)0x0) {
cVar6 = *local_2c;
if (cVar6 == '\0') {
iVar4 = 0;
}
else {
iVar5 = 0;
do {
while (bVar2 = false, cVar6 == '/') {
iVar4 = iVar5 + 2;
param_3[iVar5] = '.';
local_2c = local_2c + 1;
param_3[iVar5 + 1] = '.';
iVar5 = iVar5 + 3;
bVar2 = true;
param_3[iVar4] = '/';
cVar6 = *local_2c;
if (cVar6 == '\0') goto LAB_0004b072;
}
local_2c = local_2c + 1;
cVar6 = *local_2c;
} while (cVar6 != '\0');
LAB_0004b072:
iVar4 = iVar5;
if (!bVar2) {
param_3[iVar5] = '.';
param_3[iVar5 + 1] = '.';
iVar4 = iVar5 + 3;
param_3[iVar5 + 2] = '/';
}
}
cVar6 = *local_28;
iVar5 = iVar4;
if (cVar6 != '\0') {
iVar3 = iVar4 + 1;
do {
iVar5 = iVar3;
if (cVar6 == '/') {
param_3[iVar5 + -1] = '/';
}
else {
param_3[iVar5 + -1] = cVar6;
}
if (iVar5 == param_4 + -1) break;
cVar6 = local_28[iVar5 + 1 + (-1 - iVar4)];
iVar3 = iVar5 + 1;
} while (cVar6 != '\0');
}
param_3[iVar5] = '\0';
return 1;
}
}
return 0;
}
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.