CSoundEmitterSystem::EmitSoundByHandle
0x004bd430 · 1957 bytes · __thiscall
_ZN19CSoundEmitterSystem17EmitSoundByHandleER16IRecipientFilteriRK11EmitSound_tRs
Decompiled
undefined (5 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CSoundEmitterSystem::EmitSoundByHandle(IRecipientFilter&, int, EmitSound_t const&, short&) */
void __thiscall
CSoundEmitterSystem::EmitSoundByHandle
(CSoundEmitterSystem *this,IRecipientFilter *param_1,int param_2,EmitSound_t *param_3,
short *param_4)
{
byte *pbVar1;
code *pcVar2;
uint uVar3;
float *pfVar4;
char cVar5;
int *piVar6;
int iVar7;
int iVar8;
int *piVar9;
undefined4 *puVar10;
int iVar11;
byte *pbVar12;
int **ppiVar13;
int in_GS_OFFSET;
longdouble lVar14;
longdouble lVar15;
longdouble lVar16;
float fVar17;
int *local_160;
undefined4 local_d4;
undefined4 local_d0;
undefined4 local_cc;
int local_c8;
int local_c4;
int local_c0;
undefined4 local_bc;
undefined4 local_b8;
int local_b4;
undefined1 local_b0;
undefined4 local_ac;
char local_a8 [128];
int local_28;
int local_24;
int local_20;
ppiVar13 = (int **)&stack0xfffffea4;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (___atan2f_finite == 0) {
iVar11 = 0;
}
else {
local_160 = (int *)0x4bd4e0;
(**(code **)(___atan2f_finite + 0x50))();
iVar11 = ___atan2f_finite;
}
iVar7 = _DAT_0105db00;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 004bd6c6 to 004bd714 has its CatchHandler @ 004bdc39 */
local_160 = (int *)0x4bd6cb;
iVar8 = ThreadGetCurrentId();
if (iVar7 == iVar8) {
if ((char *)*_DAT_0105d15c != "EmitSoundByHandle") {
local_160 = (int *)0x4bd708;
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc1d7ac,(char *)0x1,0xbfafa1);
}
local_160 = (int *)0x4bd715;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
local_c8 = 0;
local_c4 = 0x3f800000;
local_c0 = 100;
local_bc = 100;
local_b8 = 100;
local_b4 = 0x4b;
local_a8[0] = '\0';
local_b0 = 0;
local_ac = 0;
local_28 = 0;
local_24 = 0;
pbVar1 = *(byte **)(gpGlobals + 0x58);
if ((uint)param_2 < 0x800) {
if (pbVar1 == (byte *)0x0) {
LAB_004bd785:
piVar6 = (int *)0x0;
}
else {
pbVar12 = pbVar1 + param_2 * 0x10;
if ((pbVar1[param_2 * 0x10] & 2) != 0) goto LAB_004bd77a;
LAB_004bd5ae:
if (*(int **)(pbVar12 + 0xc) == (int *)0x0) goto LAB_004bd785;
/* try { // try from 004bd5be to 004bd636 has its CatchHandler @ 004bdc15 */
local_160 = (int *)0x4bd5c1;
piVar6 = (int *)(**(code **)(**(int **)(pbVar12 + 0xc) + 0x18))();
if (piVar6 != (int *)0x0) {
local_160 = (int *)0x4bd5dd;
(**(code **)(*piVar6 + 0x20))();
local_160 = soundemitterbase;
iVar7 = (**(code **)(*soundemitterbase + 0x88))();
ppiVar13 = &local_160;
goto LAB_004bd605;
}
}
iVar7 = 0;
ppiVar13 = (int **)&stack0xfffffea4;
}
else {
piVar6 = (int *)0x0;
iVar7 = 0;
if (pbVar1 != (byte *)0x0) {
LAB_004bd77a:
pbVar12 = pbVar1;
if ((*pbVar1 & 2) == 0) goto LAB_004bd5ae;
goto LAB_004bd785;
}
}
LAB_004bd605:
iVar8 = *soundemitterbase;
ppiVar13[4] = (int *)iVar7;
ppiVar13[5] = (int *)0x1;
ppiVar13[3] = &local_c8;
ppiVar13[2] = (int *)param_4;
iVar7 = *(int *)(param_3 + 4);
*ppiVar13 = soundemitterbase;
ppiVar13[1] = (int *)iVar7;
pcVar2 = *(code **)(iVar8 + 0xa4);
ppiVar13[-1] = (int *)0x4bd637;
cVar5 = (*pcVar2)();
if ((cVar5 != '\0') && (local_a8[0] != '\0')) {
ppiVar13[2] = (int *)0x2;
ppiVar13[1] = (int *)&DAT_00c1d7be;
*ppiVar13 = (int *)local_a8;
/* try { // try from 004bd7b9 to 004bdaaa has its CatchHandler @ 004bdc15 */
ppiVar13[-1] = (int *)0x4bd7be;
iVar7 = V_strncasecmp((char *)*ppiVar13,(char *)ppiVar13[1],(int)ppiVar13[2]);
if ((iVar7 == 0) && ((local_c8 != 5 && (local_c8 != 2)))) {
iVar7 = *(int *)(param_3 + 4);
ppiVar13[1] = (int *)local_a8;
*ppiVar13 = (int *)
"EmitSound: Voice wave file %s doesn\'t specify CHAN_VOICE or CHAN_STREAM for sound %s\n"
;
ppiVar13[2] = (int *)iVar7;
ppiVar13[-1] = (int *)0x4bd7e9;
DevMsg((char *)*ppiVar13);
}
uVar3 = *(uint *)(param_3 + 0x10);
if ((uVar3 & 2) != 0) {
local_c0 = *(int *)(param_3 + 0x14);
}
if ((uVar3 & 1) != 0) {
local_c4 = *(int *)(param_3 + 8);
}
ppiVar13[8] = (int *)(param_3 + 0x2c);
ppiVar13[7] = (int *)*(int *)(param_3 + 0x1c);
iVar7 = *(int *)(param_3 + 0x18);
ppiVar13[4] = (int *)uVar3;
ppiVar13[5] = (int *)local_c0;
ppiVar13[3] = (int *)local_c4;
ppiVar13[1] = (int *)local_a8;
ppiVar13[6] = (int *)iVar7;
ppiVar13[2] = (int *)local_b4;
*ppiVar13 = (int *)param_2;
ppiVar13[-1] = (int *)0x4bd850;
cVar5 = CEnvMicrophone::OnSoundPlayed();
if (cVar5 == '\0') {
fVar17 = *(float *)(param_3 + 0x1c);
if ((fVar17 == 0.0) && (local_28 != 0)) {
fVar17 = (float)local_28 * 0.001 + *(float *)(gpGlobals + 0xc);
}
ppiVar13[-1] = (int *)0x4bd87e;
lVar14 = (longdouble)Plat_FloatTime();
iVar7 = *enginesound;
ppiVar13[0xe] = (int *)*(int *)(param_3 + 0x28);
ppiVar13[0xd] = (int *)fVar17;
ppiVar13[0xc] = (int *)0x1;
ppiVar13[10] = (int *)0x0;
ppiVar13[0xb] = (int *)(param_3 + 0x2c);
ppiVar13[9] = (int *)*(int *)(param_3 + 0x18);
ppiVar13[8] = (int *)local_c0;
iVar8 = *(int *)(param_3 + 0x10);
ppiVar13[5] = (int *)local_c4;
ppiVar13[4] = (int *)local_a8;
*ppiVar13 = enginesound;
ppiVar13[7] = (int *)iVar8;
ppiVar13[6] = (int *)local_b4;
ppiVar13[3] = (int *)local_c8;
ppiVar13[2] = (int *)param_2;
ppiVar13[1] = (int *)param_1;
pcVar2 = *(code **)(iVar7 + 0x18);
ppiVar13[-1] = (int *)0x4bd927;
(*pcVar2)();
if (*(int *)(param_3 + 0x20) != 0) {
ppiVar13[-1] = (int *)0x4bd937;
lVar15 = (longdouble)Plat_FloatTime();
pfVar4 = *(float **)(param_3 + 0x20);
iVar7 = *enginesound;
ppiVar13[1] = (int *)local_a8;
*ppiVar13 = enginesound;
pcVar2 = *(code **)(iVar7 + 0x10);
ppiVar13[-1] = (int *)0x4bd96f;
lVar16 = (longdouble)(*pcVar2)();
*pfVar4 = (float)lVar16;
ppiVar13[-1] = (int *)0x4bd98c;
lVar16 = (longdouble)Plat_FloatTime();
fVar17 = ((float)lVar16 - (float)lVar15) * 1000.0;
if (10.0 < fVar17) {
ppiVar13[1] = (int *)local_a8;
*ppiVar13 = (int *)"getting sound duration for %s took %f milliseconds\n";
*(double *)(ppiVar13 + 2) = (double)fVar17;
ppiVar13[-1] = (int *)0x4bdbf4;
UTIL_LogPrintf((char *)*ppiVar13);
}
}
ppiVar13[-1] = (int *)0x4bd9cb;
lVar15 = (longdouble)Plat_FloatTime();
fVar17 = ((float)lVar15 - (float)lVar14) * 1000.0;
if (50.0 < fVar17) {
*(double *)(ppiVar13 + 2) = (double)fVar17;
iVar7 = *(int *)(param_3 + 4);
*ppiVar13 = (int *)"EmitSoundByHandle(%s) took %f milliseconds (server)\n";
ppiVar13[1] = (int *)iVar7;
ppiVar13[-1] = (int *)0x4bda20;
UTIL_LogPrintf((char *)*ppiVar13);
}
iVar7 = *(int *)this;
ppiVar13[4] = (int *)local_a8;
ppiVar13[5] = (int *)param_2;
iVar8 = *(int *)(param_3 + 4);
ppiVar13[2] = (int *)"EmitSound: \'%s\' emitted as \'%s\' (ent %i)\n";
*ppiVar13 = (int *)this;
ppiVar13[1] = (int *)param_2;
ppiVar13[3] = (int *)iVar8;
pcVar2 = *(code **)(iVar7 + 0x44);
ppiVar13[-1] = (int *)0x4bda4f;
(*pcVar2)();
if (((byte)param_3[0x10] & 3) == 0) {
ppiVar13[4] = (int *)param_3;
ppiVar13[3] = &local_c8;
ppiVar13[2] = (int *)param_2;
ppiVar13[1] = (int *)param_1;
*ppiVar13 = (int *)this;
/* try { // try from 004bdbc8 to 004bdc0a has its CatchHandler @ 004bdc15 */
ppiVar13[-1] = (int *)0x4bdbcd;
EmitCloseCaption((CSoundEmitterSystem *)*ppiVar13,(IRecipientFilter *)ppiVar13[1],
(int)ppiVar13[2],(CSoundParameters *)ppiVar13[3],(EmitSound_t *)ppiVar13[4]
);
}
if ((piVar6 != (int *)0x0) && (local_24 != 0)) {
puVar10 = *(undefined4 **)(param_3 + 0x18);
if (puVar10 == (undefined4 *)0x0) {
iVar7 = *piVar6;
*ppiVar13 = piVar6;
pcVar2 = *(code **)(iVar7 + 0x288);
ppiVar13[-1] = (int *)0x4bdc0b;
puVar10 = (undefined4 *)(*pcVar2)();
}
local_d4 = *puVar10;
local_d0 = puVar10[1];
local_cc = puVar10[2];
ppiVar13[-1] = (int *)0x4bda8e;
piVar9 = (int *)TheNextBots();
iVar7 = *piVar9;
ppiVar13[1] = piVar6;
*ppiVar13 = piVar9;
ppiVar13[3] = (int *)local_24;
ppiVar13[2] = &local_d4;
pcVar2 = *(code **)(iVar7 + 4);
ppiVar13[-1] = (int *)0x4bdaab;
(*pcVar2)();
}
iVar7 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
ppiVar13[-1] = (int *)0x4bdb3b;
iVar8 = ThreadGetCurrentId();
if (iVar7 == iVar8) {
*ppiVar13 = _DAT_0105d15c;
ppiVar13[-1] = (int *)0x4bdb50;
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (iVar11 != 0) {
ppiVar13[5] = (int *)0x0;
ppiVar13[4] = (int *)0x0;
ppiVar13[3] = (int *)0x0;
*ppiVar13 = (int *)iVar11;
ppiVar13[1] = (int *)0x0;
ppiVar13[2] = (int *)0x0;
pcVar2 = *(code **)(iVar11 + 0x54);
ppiVar13[-1] = (int *)0x4bdafe;
(*pcVar2)();
}
goto LAB_004bd69e;
}
}
iVar7 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
ppiVar13[-1] = (int *)0x4bd733;
iVar8 = ThreadGetCurrentId();
if (iVar7 == iVar8) {
*ppiVar13 = _DAT_0105d15c;
ppiVar13[-1] = (int *)0x4bd748;
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (iVar11 != 0) {
ppiVar13[5] = (int *)0x0;
ppiVar13[4] = (int *)0x0;
ppiVar13[3] = (int *)0x0;
*ppiVar13 = (int *)iVar11;
ppiVar13[1] = (int *)0x0;
ppiVar13[2] = (int *)0x0;
pcVar2 = *(code **)(iVar11 + 0x54);
ppiVar13[-1] = (int *)0x4bd69e;
(*pcVar2)();
}
LAB_004bd69e:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
ppiVar13[-1] = (int *)&LAB_004bdc15;
__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.