AllocateStringHelper2
0x005906e0 · 168 bytes · __cdecl
_Z21AllocateStringHelper2PKcPc
Decompiled
undefined (2 params)
/* AllocateStringHelper2(char const*, char*) */
void * AllocateStringHelper2(char *param_1,char *param_2)
{
char *__n;
uint uVar1;
uint uVar2;
void *__dest;
uint *puVar3;
uint *puVar4;
int in_GS_OFFSET;
uint local_220 [128];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
vsnprintf((char *)local_220,0x200,param_1,param_2);
puVar4 = local_220;
do {
puVar3 = puVar4;
uVar1 = *puVar3 + 0xfefefeff & ~*puVar3;
uVar2 = uVar1 & 0x80808080;
puVar4 = puVar3 + 1;
} while (uVar2 == 0);
if ((uVar1 & 0x8080) == 0) {
puVar4 = (uint *)((int)puVar3 + 6);
uVar2 = uVar2 >> 0x10;
}
__n = (char *)((int)puVar4 + (-(int)local_220 - (uint)CARRY1((byte)uVar2,(byte)uVar2)) + -2);
__dest = operator_new__((uint)__n);
memcpy(__dest,local_220,(size_t)__n);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return __dest;
}
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.