V_StrSubst
0x0025f260 · 272 bytes · __cdecl
_Z10V_StrSubstPKcS0_S0_Pcib
Decompiled
undefined (6 params)
/* V_StrSubst(char const*, char const*, char const*, char*, int, bool) */
bool V_StrSubst(char *param_1,char *param_2,char *param_3,char *param_4,int param_5,bool param_6)
{
char cVar1;
size_t sVar2;
size_t sVar3;
int iVar4;
size_t sVar5;
char *pcVar6;
char *pcVar7;
char *__n;
sVar2 = strlen(param_2);
sVar3 = strlen(param_3);
*param_4 = '\0';
pcVar7 = param_4;
while( true ) {
__n = param_4 + (param_5 - (int)pcVar7);
if (param_6) {
pcVar6 = strstr(param_1,param_2);
}
else {
pcVar6 = (char *)V_stristr(param_1,param_2);
}
if (pcVar6 == (char *)0x0) {
sVar2 = strlen(param_1);
strncpy(pcVar7,param_1,(size_t)__n);
if (0 < (int)__n) {
pcVar7[(int)(__n + -1)] = '\0';
}
return (int)sVar2 < (int)__n;
}
iVar4 = (int)pcVar6 - (int)param_1;
if (((__n == (char *)0x0) ||
(cVar1 = CopyToMaxChars(pcVar7,(int)__n,param_1,iVar4), cVar1 == '\0')) ||
((int)__n <= iVar4)) {
return false;
}
sVar5 = strlen(pcVar7);
pcVar7 = pcVar7 + sVar5;
if (param_4 + (param_5 - (int)pcVar7) == (char *)0x0) {
return false;
}
cVar1 = CopyToMaxChars(pcVar7,(int)(param_4 + (param_5 - (int)pcVar7)),param_3,sVar3);
if (cVar1 == '\0') break;
pcVar7 = pcVar7 + sVar3;
param_1 = param_1 + iVar4 + sVar2;
}
return false;
}
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.