variant_t::ToString
0x0063e360 · 690 bytes · __thiscall
_ZNK9variant_t8ToStringEv
Decompiled
undefined (1 param)
/* variant_t::ToString() const */
char * __thiscall variant_t::ToString(variant_t *this)
{
uint uVar1;
char *pcVar2;
int iVar3;
undefined *puVar4;
switch(*(int *)(this + 0x10)) {
case 0:
ToString()::szBuf[0] = 0;
return ToString()::szBuf;
case 1:
V_snprintf(ToString()::szBuf,0x200,"%g",(double)*(float *)this);
return ToString()::szBuf;
case 2:
pcVar2 = *(char **)this;
if (pcVar2 == (char *)0x0) {
pcVar2 = "";
}
return pcVar2;
case 3:
V_snprintf(ToString()::szBuf,0x200,"[%g %g %g]",(double)*(float *)this,
(double)*(float *)(this + 4),(double)*(float *)(this + 8));
return ToString()::szBuf;
default:
pcVar2 = "No conversion to string";
break;
case 5:
V_snprintf(ToString()::szBuf,0x200,"%i",*(undefined4 *)this);
return ToString()::szBuf;
case 6:
if (*this == (variant_t)0x0) {
V_strncpy(ToString()::szBuf,"false",0x200);
pcVar2 = ToString()::szBuf;
}
else {
V_strncpy(ToString()::szBuf,"true",0x200);
pcVar2 = ToString()::szBuf;
}
break;
case 9:
V_snprintf(ToString()::szBuf,0x200,"%d %d %d %d",(uint)(byte)*this,(uint)(byte)this[1],
(uint)(byte)this[2],(uint)(byte)this[3]);
return ToString()::szBuf;
case 0xd:
if (*(int *)(this + 0x10) == 0xd) {
uVar1 = *(uint *)(this + 0xc);
if ((((uVar1 == 0xffffffff) ||
(puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar4 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar4 + 4) == 0)) {
pcVar2 = "<<null entity>>";
}
else {
if (*(int *)(this + 0x10) == 0xd) {
iVar3 = 0;
if (*(uint *)(puVar4 + 8) == uVar1 >> 0xc) {
iVar3 = *(int *)(puVar4 + 4);
}
}
else {
if ((Entity()::hNull == '\0') &&
(iVar3 = __cxa_guard_acquire(&Entity()::hNull), iVar3 != 0)) {
Entity()::hNull = 0xffffffff;
__cxa_guard_release(&Entity()::hNull);
}
Entity()::hNull = 0xffffffff;
iVar3 = 0;
}
pcVar2 = *(char **)(iVar3 + 0x154);
if (pcVar2 == (char *)0x0) {
pcVar2 = "";
}
}
}
else {
if ((Entity()::hNull == '\0') && (iVar3 = __cxa_guard_acquire(&Entity()::hNull), iVar3 != 0))
{
Entity()::hNull = 0xffffffff;
__cxa_guard_release(&Entity()::hNull);
}
Entity()::hNull = 0xffffffff;
pcVar2 = "<<null entity>>";
}
V_strncpy(ToString()::szBuf,pcVar2,0x200);
pcVar2 = ToString()::szBuf;
}
return pcVar2;
}
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.