variant_t::Convert
0x0063df50 · 986 bytes · __thiscall
_ZN9variant_t7ConvertE11_fieldtypes
Decompiled
undefined (2 params)
/* variant_t::Convert(_fieldtypes) */
undefined4 __thiscall variant_t::Convert(variant_t *this,int param_2)
{
uint uVar1;
undefined4 uVar2;
undefined *puVar3;
char *pcVar4;
int iVar5;
CBaseEntity *pCVar6;
long lVar7;
double dVar8;
undefined4 local_34;
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20 [4];
iVar5 = *(int *)(this + 0x10);
if (iVar5 != param_2) {
if (param_2 == 0) {
Set(this,0,0);
return 1;
}
if (param_2 != 0x14) {
if (iVar5 == 2) {
switch(param_2) {
default:
return 0;
case 1:
if (*(char **)this == (char *)0x0) {
*(undefined4 *)this = 0;
*(undefined4 *)(this + 0x10) = 1;
}
else {
dVar8 = strtod(*(char **)this,(char **)0x0);
*(undefined4 *)(this + 0x10) = 1;
*(float *)this = (float)dVar8;
}
break;
case 3:
local_28 = vec3_origin;
local_24 = DAT_01053d4c;
local_20[0] = DAT_01053d50;
pcVar4 = *(char **)this;
if (pcVar4 == (char *)0x0) {
pcVar4 = "";
}
iVar5 = sscanf(pcVar4,"[%f %f %f]",&local_28,&local_24,local_20);
if (iVar5 == 0) {
pcVar4 = *(char **)this;
if (*(char **)this == (char *)0x0) {
pcVar4 = "";
}
sscanf(pcVar4,"%f %f %f",&local_28,&local_24,local_20);
}
*(undefined4 *)(this + 0x10) = 3;
*(undefined4 *)this = local_28;
*(undefined4 *)(this + 4) = local_24;
*(undefined4 *)(this + 8) = local_20[0];
break;
case 5:
if (*(char **)this == (char *)0x0) {
*(undefined4 *)this = 0;
*(undefined4 *)(this + 0x10) = 5;
}
else {
lVar7 = strtol(*(char **)this,(char **)0x0,10);
*(undefined4 *)(this + 0x10) = 5;
*(long *)this = lVar7;
}
break;
case 6:
if (*(char **)this == (char *)0x0) {
*this = (variant_t)0x0;
*(undefined4 *)(this + 0x10) = 6;
}
else {
lVar7 = strtol(*(char **)this,(char **)0x0,10);
*(undefined4 *)(this + 0x10) = 6;
*this = (variant_t)(lVar7 != 0);
}
break;
case 9:
local_34 = 0;
local_30 = 0;
local_2c = 0;
local_28 = 0xff;
pcVar4 = "";
if (*(char **)this != (char *)0x0) {
pcVar4 = *(char **)this;
}
sscanf(pcVar4,"%d %d %d %d",&local_34,&local_30,&local_2c,&local_28);
*(undefined4 *)(this + 0x10) = 9;
*this = SUB41(local_34,0);
this[1] = SUB41(local_30,0);
this[2] = SUB41(local_2c,0);
this[3] = SUB41(local_28,0);
break;
case 0xd:
if (*(char **)this == (char *)0x0) {
pCVar6 = (CBaseEntity *)0x0;
}
else {
pCVar6 = (CBaseEntity *)
CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,*(char **)this,
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
(IEntityFindFilter *)0x0);
}
SetEntity(this,pCVar6);
}
}
else if (iVar5 < 3) {
if (iVar5 != 1) {
return 0;
}
if (param_2 == 5) {
*(undefined4 *)(this + 0x10) = 5;
*(int *)this = (int)*(float *)this;
}
else {
if (param_2 != 6) {
return 0;
}
*(undefined4 *)(this + 0x10) = 6;
*this = (variant_t)(*(float *)this != 0.0);
}
}
else if (iVar5 == 5) {
if (param_2 == 1) {
*(undefined4 *)(this + 0x10) = 1;
*(float *)this = (float)*(int *)this;
}
else {
if (param_2 != 6) {
return 0;
}
*(undefined4 *)(this + 0x10) = 6;
*this = (variant_t)(*(int *)this != 0);
}
}
else {
if (iVar5 != 0xd) {
return 0;
}
if (param_2 != 2) {
return 0;
}
uVar1 = *(uint *)(this + 0xc);
if ((((uVar1 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar3 + 4) != 0)) {
uVar2 = *(undefined4 *)(*(int *)(puVar3 + 4) + 0x154);
*(undefined4 *)(this + 0x10) = 2;
*(undefined4 *)this = uVar2;
}
}
}
}
return 1;
}
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.