CBaseEntity::EmitSound
0x004b3e10 · 2097 bytes · __cdecl
_ZN11CBaseEntity9EmitSoundER16IRecipientFilteriRK11EmitSound_t
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseEntity::EmitSound(IRecipientFilter&, int, EmitSound_t const&) */
void CBaseEntity::EmitSound(IRecipientFilter *param_1,int param_2,EmitSound_t *param_3)
{
uint *puVar1;
float *pfVar2;
float fVar3;
char cVar4;
short sVar5;
int iVar6;
int iVar7;
char *pcVar8;
int iVar9;
longdouble lVar10;
longdouble lVar11;
double dVar12;
char *pcVar13;
undefined4 uVar14;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_40;
undefined4 local_3c;
int local_38;
undefined4 local_34;
undefined4 local_30;
int *local_2c;
undefined4 local_28;
undefined4 local_24;
int *local_20;
local_5c = 0;
local_58 = 0;
if (_towlower == 0) {
local_38 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_5c,0,0,0,0,
"/data/src/game/server/../../game/shared/soundemittersystem.cpp",0x69b,
&EmitSound(IRecipientFilter&,int,EmitSound_t_const&)::tm_fmt,"(%s)%s",
"CBaseEntity::EmitSound","CBaseEntity::EmitSound");
local_38 = _towlower;
}
iVar6 = _DAT_0105db00;
local_40 = local_5c;
local_3c = local_58;
/* try { // try from 004b4196 to 004b41f6 has its CatchHandler @ 004b46d2 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
if ((char *)*_DAT_0105d15c != "CBaseEntity::EmitSound") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc1d7c1,(char *)0x0,0xc1d7c1);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
local_54 = 0;
local_50 = 0;
if (___atan2f_finite == (int *)0x0) {
local_2c = (int *)0x0;
}
else {
/* try { // try from 004b3f3e to 004b3f40 has its CatchHandler @ 004b46ce */
(*(code *)___atan2f_finite[0x14])
(___atan2f_finite,&local_54,0,0,0,0,
"/data/src/game/server/../../game/shared/soundemittersystem.cpp",0x2e4,
&CSoundEmitterSystem::EmitSound(IRecipientFilter&,int,EmitSound_t_const&)::tm_fmt,
"(%s)%s","Unaccounted","CSoundEmitterSystem::EmitSound (calls engine)");
local_2c = ___atan2f_finite;
}
iVar6 = _DAT_0105db00;
local_34 = local_54;
local_30 = local_50;
/* try { // try from 004b40a6 to 004b40f4 has its CatchHandler @ 004b4673 */
if (((_DAT_0105d154 == 0) && (DAT_0105d158 != '\0')) ||
(iVar7 = ThreadGetCurrentId(), iVar6 != iVar7)) {
pcVar13 = *(char **)(param_3 + 4);
pcVar8 = (char *)0x0;
if (pcVar13 == (char *)0x0) goto LAB_004b4107;
LAB_004b3f7b:
/* try { // try from 004b3f86 to 004b3fda has its CatchHandler @ 004b469f */
iVar6 = V_stristr(pcVar13,".wav");
if (iVar6 == 0) {
/* try { // try from 004b460e to 004b465d has its CatchHandler @ 004b469f */
iVar6 = V_stristr(*(char **)(param_3 + 4),".mp3");
pcVar8 = *(char **)(param_3 + 4);
if ((iVar6 == 0) && (*pcVar8 != '!')) goto LAB_004b4107;
}
else {
pcVar8 = *(char **)(param_3 + 4);
}
pcVar13 = (char *)param_2;
cVar4 = CEnvMicrophone::OnSoundPlayed
(param_2,pcVar8,*(undefined4 *)(param_3 + 0xc),*(undefined4 *)(param_3 + 8),
*(undefined4 *)(param_3 + 0x10),*(undefined4 *)(param_3 + 0x14),
*(undefined4 *)(param_3 + 0x18),*(undefined4 *)(param_3 + 0x1c),
param_3 + 0x2c);
if (cVar4 == '\0') {
/* try { // try from 004b4270 to 004b439b has its CatchHandler @ 004b469f */
lVar10 = (longdouble)Plat_FloatTime();
if ((param_3[0x26] != (EmitSound_t)0x0) &&
(iVar6 = V_stristr(*(char **)(param_3 + 4),".wav"), iVar6 != 0)) {
WaveTrace(*(char **)(param_3 + 4),"Emitsound");
}
uVar14 = *(undefined4 *)(param_3 + 4);
pcVar13 = *(char **)param_3;
iVar6 = param_2;
(**(code **)(*enginesound + 0x18))
(enginesound,param_1,param_2,pcVar13,uVar14,*(undefined4 *)(param_3 + 8),
*(undefined4 *)(param_3 + 0xc),*(undefined4 *)(param_3 + 0x10),
*(undefined4 *)(param_3 + 0x14),*(undefined4 *)(param_3 + 0x18),0,param_3 + 0x2c,1,
*(undefined4 *)(param_3 + 0x1c),*(undefined4 *)(param_3 + 0x28));
if (*(int *)(param_3 + 0x20) != 0) {
UTIL_LogPrintf("getting wav duration for %s\n",*(undefined4 *)(param_3 + 4));
local_4c = 0;
local_48 = 0;
if (___atan2f_finite == (int *)0x0) {
local_20 = (int *)0x0;
}
else {
pcVar13 = (char *)0x0;
uVar14 = 0;
iVar6 = 0;
(*(code *)___atan2f_finite[0x14])
(___atan2f_finite,&local_4c,0,0,0,0,
"/data/src/game/server/../../game/shared/soundemittersystem.cpp",0x31d,
&CSoundEmitterSystem::EmitSound(IRecipientFilter&,int,EmitSound_t_const&)::
tm_fmt,"(%s)%s","Unaccounted",
"CSoundEmitterSystem::EmitSound GetSoundDuration (calls engine)");
local_20 = ___atan2f_finite;
}
iVar7 = _DAT_0105db00;
local_28 = local_4c;
local_24 = local_48;
/* try { // try from 004b43c9 to 004b4413 has its CatchHandler @ 004b46af */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar9 = ThreadGetCurrentId(), iVar7 == iVar9)) {
if ((char *)*_DAT_0105d15c !=
"CSoundEmitterSystem::EmitSound GetSoundDuration (calls engine)") {
uVar14 = 0;
pcVar13 = "Unaccounted";
iVar6 = 1;
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc1ddc8,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
pfVar2 = *(float **)(param_3 + 0x20);
/* try { // try from 004b442f to 004b4431 has its CatchHandler @ 004b46be */
lVar11 = (longdouble)
(**(code **)(*enginesound + 0x10))
(enginesound,*(undefined4 *)(param_3 + 4),iVar6,pcVar13,uVar14);
*pfVar2 = (float)lVar11;
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_20 != (int *)0x0) {
(*(code *)local_20[0x15])(local_20,local_28,local_24,0,0,0);
}
}
pcVar13 = (char *)&g_SoundEmitterSystem;
/* try { // try from 004b44d0 to 004b4527 has its CatchHandler @ 004b469f */
(**(code **)(g_SoundEmitterSystem + 0x44))
(&g_SoundEmitterSystem,param_2,
"%f EmitSound: Raw wave emitted \'%s\' (ent %i) (vol %f)\n",
(double)*(float *)(gpGlobals + 0xc),*(undefined4 *)(param_3 + 4),param_2,
(double)*(float *)(param_3 + 8));
lVar11 = (longdouble)Plat_FloatTime();
fVar3 = ((float)lVar11 - (float)lVar10) * 1000.0;
if (50.0 < fVar3) {
dVar12 = (double)fVar3;
pcVar13 = "CSoundEmitterSystem::EmitSound(%s) took %f milliseconds (server)\n";
UTIL_LogPrintf("CSoundEmitterSystem::EmitSound(%s) took %f milliseconds (server)\n",
*(undefined4 *)(param_3 + 4),SUB84(dVar12,0),(int)((ulonglong)dVar12 >> 0x20)
);
}
}
LAB_004b3fe3:
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
pcVar13 = (char *)_DAT_0105d15c;
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_2c != (int *)0x0) {
pcVar13 = (char *)local_2c;
(*(code *)local_2c[0x15])(local_2c,local_34,local_30,0,0,0);
}
}
else {
if ((char *)*_DAT_0105d15c != "CSoundEmitterSystem::EmitSound (calls engine)") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc1dd98,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
pcVar13 = *(char **)(param_3 + 4);
pcVar8 = (char *)0x0;
if (pcVar13 != (char *)0x0) goto LAB_004b3f7b;
LAB_004b4107:
if (*(short *)(param_3 + 0x40) == -1) {
/* try { // try from 004b459f to 004b45a1 has its CatchHandler @ 004b469f */
pcVar13 = (char *)soundemitterbase;
sVar5 = (**(code **)(*soundemitterbase + 0x1c))(soundemitterbase,pcVar8);
*(short *)(param_3 + 0x40) = sVar5;
if (sVar5 == -1) goto LAB_004b3fe3;
}
pcVar13 = (char *)&g_SoundEmitterSystem;
/* try { // try from 004b412f to 004b4133 has its CatchHandler @ 004b469f */
CSoundEmitterSystem::EmitSoundByHandle
((CSoundEmitterSystem *)&g_SoundEmitterSystem,param_1,param_2,param_3,
(short *)(param_3 + 0x40));
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
pcVar13 = (char *)_DAT_0105d15c;
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_2c != (int *)0x0) {
pcVar13 = (char *)local_2c;
(*(code *)local_2c[0x15])(local_2c,local_34,local_30,0,0,0);
}
}
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar7 = ThreadGetCurrentId(pcVar13), iVar6 == iVar7)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_38 != 0) {
(**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
}
return;
}
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.