CSoundPatch::Init
0x004c0050 · 763 bytes · __thiscall
_ZN11CSoundPatch4InitEP16IRecipientFilterP11CBaseEntityiPKc12soundlevel_tPK6Vectorf
Decompiled
undefined (8 params)
/* CSoundPatch::Init(IRecipientFilter*, CBaseEntity*, int, char const*, soundlevel_t, Vector const*,
float) */
void __thiscall
CSoundPatch::Init(CSoundPatch *this,int *param_1,int *param_2,undefined4 param_3,char *param_4,
undefined4 param_6,undefined4 *param_7,undefined4 param_8)
{
char cVar1;
undefined4 *puVar2;
int iVar3;
int iVar4;
int in_GS_OFFSET;
undefined4 local_d0;
int local_cc;
undefined4 local_c8;
undefined4 local_c4;
undefined4 local_c0;
undefined4 local_bc;
undefined4 local_b8;
undefined4 local_b4;
undefined1 local_b0;
undefined4 local_ac;
char local_a8 [128];
undefined4 local_28;
undefined4 local_24;
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (param_2 == (int *)0x0) {
*(undefined4 *)(this + 0x38) = 0xffffffff;
}
else {
puVar2 = (undefined4 *)(**(code **)(*param_2 + 0xc))(param_2);
*(undefined4 *)(this + 0x38) = *puVar2;
if (param_2[0xc] == 0) {
iVar3 = 0;
}
else {
iVar3 = param_2[0xc] - *(int *)(gpGlobals + 0x58) >> 4;
}
*(int *)(this + 0x40) = iVar3;
}
local_c8 = 0;
local_c4 = 0x3f800000;
local_c0 = 100;
local_bc = 100;
*(undefined4 *)(this + 0x3c) = param_3;
local_b8 = 100;
local_b4 = 0x4b;
local_a8[0] = '\0';
local_b0 = 0;
local_ac = 0;
local_28 = 0;
local_24 = 0;
iVar3 = V_stristr(param_4,".wav");
if (iVar3 == 0) {
iVar3 = V_stristr(param_4,".mp3");
if (iVar3 == 0) {
cVar1 = CBaseEntity::GetParametersForSound(param_4,(CSoundParameters *)&local_c8,(char *)0x0);
if (cVar1 != '\0') {
*(undefined4 *)(this + 0x5c) = local_c4;
AllocPooledString((char *)&local_d0);
*(undefined4 *)(this + 0x34) = local_d0;
*(undefined4 *)(this + 0x24) = local_b4;
if (*(int *)(this + 0x3c) < 0x87) {
*(undefined4 *)(this + 0x3c) = local_c8;
}
param_4 = local_a8;
goto LAB_004c0171;
}
}
}
AllocPooledString((char *)&local_d0);
*(undefined4 *)(this + 0x34) = local_d0;
*(undefined4 *)(this + 0x5c) = param_8;
*(undefined4 *)(this + 0x24) = param_6;
LAB_004c0171:
AllocPooledString((char *)&local_d0);
*(undefined4 *)(this + 0x30) = local_d0;
if (*(float *)(this + 0x14) != 0.0) {
this[0x1c] = (CSoundPatch)0x1;
}
*(undefined4 *)(this + 0x14) = 0;
*(undefined4 *)(this + 0x10) = 0;
*(undefined4 *)(this + 0x18) = 0;
if (*(float *)(this + 4) != 0.0) {
this[0xc] = (CSoundPatch)0x1;
}
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)this = 0;
*(undefined4 *)(this + 8) = 0;
*(undefined4 *)(this + 0x58) = 0;
*(undefined4 *)(this + 0x28) = 0;
*(undefined4 *)(this + 0x2c) = 0;
*(undefined4 *)(this + 100) = 1;
cVar1 = (**(code **)(*param_1 + 8))(param_1,param_4);
if (cVar1 != '\0') {
*(uint *)(this + 100) = *(uint *)(this + 100) | 2;
}
cVar1 = (**(code **)(*param_1 + 0xc))(param_1);
if (cVar1 != '\0') {
*(uint *)(this + 100) = *(uint *)(this + 100) | 4;
}
iVar3 = 0;
while( true ) {
iVar4 = (**(code **)(*param_1 + 0x10))(param_1);
if (iVar4 <= iVar3) break;
local_cc = (**(code **)(*param_1 + 0x14))(param_1,iVar3);
if (-1 < local_cc) {
CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x68),*(int *)(this + 0x74),
&local_cc);
}
iVar3 = iVar3 + 1;
}
*(undefined4 *)(this + 0x54) = 0;
if (param_7 != (undefined4 *)0x0) {
*(undefined4 *)(this + 0x44) = *param_7;
*(undefined4 *)(this + 0x48) = param_7[1];
*(undefined4 *)(this + 0x4c) = param_7[2];
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.