Descend
0x00259dc0 · 792 bytes · __regparm3
_ZL7DescendPcjbj
Decompiled
undefined (4 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Descend(char*, unsigned int, bool, unsigned int) */
bool __regparm3 Descend(char *param_1,uint param_2,bool param_3,uint param_4)
{
char cVar1;
char cVar2;
char *pcVar3;
uint uVar4;
int iVar5;
int *piVar6;
dirent *pdVar7;
char *pcVar8;
char *pcVar9;
uint uVar10;
uint uVar11;
char *__s2;
bool bVar12;
int local_40;
DIR *local_2c;
char *local_20;
if (s_bShowDiag != '\0') {
pcVar3 = "true";
if (!param_3) {
pcVar3 = "false ";
}
fprintf(_stderr,"(%zu) Descend: %s, (%s), %s\n",param_4,param_1,param_1 + param_2,pcVar3);
}
uVar11 = param_2 + 1;
pcVar3 = param_1 + uVar11;
cVar2 = *pcVar3;
if (cVar2 != '\0') {
uVar4 = uVar11;
if (cVar2 != '/') {
do {
uVar4 = uVar4 + 1;
cVar2 = param_1[uVar4];
pcVar3 = param_1 + uVar4;
if (cVar2 == '/') break;
} while (cVar2 != '\0');
}
bVar12 = cVar2 == '/';
*pcVar3 = '\0';
/* try { // try from 00259e6e to 00259e72 has its CatchHandler @ 0025a0f9 */
iVar5 = access(param_1,0);
*pcVar3 = cVar2;
if ((iVar5 != 0) ||
((bVar12 && (cVar2 = Descend(param_1,uVar4,param_3,param_4 + 1), cVar2 == '\0')))) {
if (param_2 == 0) {
pcVar3 = ".";
uVar10 = 0;
if (*param_1 == '/') {
pcVar3 = "/";
uVar10 = uVar11;
}
local_2c = opendir(pcVar3);
uVar11 = uVar10;
}
else {
pcVar3 = param_1 + param_2;
cVar2 = *pcVar3;
*pcVar3 = '\0';
/* try { // try from 0025a085 to 0025a089 has its CatchHandler @ 0025a103 */
local_2c = opendir(param_1);
*pcVar3 = cVar2;
}
piVar6 = __errno_location();
*piVar6 = 0;
if (local_2c == (DIR *)0x0) {
local_40 = uVar4 - uVar11;
}
else {
/* try { // try from 00259ec0 to 00259f9c has its CatchHandler @ 0025a0e4 */
pdVar7 = readdir(local_2c);
local_40 = uVar4 - uVar11;
pcVar3 = param_1 + uVar11;
if (pdVar7 != (dirent *)0x0) {
pcVar9 = pcVar3 + local_40;
do {
cVar2 = *pcVar9;
if (s_bShowDiag != '\0') {
*pcVar9 = '\0';
/* try { // try from 0025a018 to 0025a01c has its CatchHandler @ 0025a10f */
fprintf(_stderr,"\t(%zu) comparing %s with %s\n",param_4,pdVar7->d_name,pcVar3);
}
__s2 = pdVar7->d_name;
*pcVar9 = '\0';
iVar5 = strcasecmp(pcVar3,__s2);
if (iVar5 == 0) {
iVar5 = strcmp(pcVar3,__s2);
*pcVar9 = cVar2;
if (iVar5 != 0) {
cVar2 = pdVar7->d_name[0];
if ((cVar2 != '\0') && (pcVar8 = pcVar3, cVar2 != '/')) {
do {
__s2 = __s2 + 1;
*pcVar8 = cVar2;
cVar2 = *__s2;
if (cVar2 == '/') break;
pcVar8 = pcVar8 + 1;
} while (cVar2 != '\0');
}
if ((!bVar12) || (cVar2 = Descend(param_1,uVar4,param_3,param_4 + 1), cVar2 != '\0')
) {
bVar12 = true;
goto LAB_0025a027;
}
}
}
else {
*pcVar9 = cVar2;
}
pdVar7 = readdir(local_2c);
} while (pdVar7 != (dirent *)0x0);
}
}
local_20 = param_1 + uVar11;
if ((bVar12) && (s_bShowDiag != '\0')) {
cVar2 = *local_20;
*local_20 = '\0';
pcVar3 = local_20 + local_40;
cVar1 = *pcVar3;
*pcVar3 = '\0';
/* try { // try from 0025a0cf to 0025a0d3 has its CatchHandler @ 0025a119 */
fprintf(_stderr,"(%zu) readdir failed to find \'%s\' in \'%s\'\n",param_4,local_20,param_1);
*pcVar3 = cVar1;
*local_20 = cVar2;
}
bVar12 = !bVar12 && param_3;
if (local_2c == (DIR *)0x0) {
return bVar12;
}
LAB_0025a027:
closedir(local_2c);
return bVar12;
}
}
return true;
}
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.