//
// FMODAudioEngine::countActiveMusic from 0x5ab560 to 0x5ab690 (304 bytes)
//
// 3 xrefs:
// > FMODAudioEngine::countActiveEffects @ 0x5ab6a0
// > PlayLayer::updateInfoLabel @ 0x5dae30
// > ??> @ 0x6de00
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int FMODAudioEngine::countActiveMusic(FMODAudioEngine *a1)
{
std::__detail::_Hash_node_base *M_nxt; // x20
int v2; // w27
__int64 *v3; // x0
char v4; // w2
unsigned int *v5; // x1
int v6; // w2
int v8; // [xsp+78h] [xbp+78h]
__int64 v9; // [xsp+88h] [xbp+88h] BYREF
char v10; // [xsp+90h] [xbp+90h]
char v11; // [xsp+91h] [xbp+91h]
M_nxt = a1->m_fmodMusic._M_h._M_before_begin._M_nxt;
if ( !M_nxt )
return 0;
v2 = 0;
do
{
while ( 1 )
{
v8 = (int)M_nxt[2]._M_nxt;
sub_D18D28(&v9, &M_nxt[4]);
v3 = (__int64 *)(v9 - 24);
v4 = BYTE1(M_nxt[5]._M_nxt);
if ( v8 > 0 )
++v2;
v10 = (char)M_nxt[5]._M_nxt;
v11 = v4;
if ( v3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v5 = (unsigned int *)(v9 - 8);
do
v6 = __ldaxr(v5);
while ( __stlxr(v6 - 1, v5) );
}
else
{
v6 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v6 - 1;
}
if ( v6 <= 0 )
break;
}
M_nxt = M_nxt->_M_nxt;
if ( !M_nxt )
return v2;
}
operator delete(v3);
M_nxt = M_nxt->_M_nxt;
}
while ( M_nxt );
return v2;
}