//
// FMODAudioEngine::updateQueuedMusic from 0x10013929c to 0x1001394fc (608 bytes)
//
// 1 xrefs:
// > FMODAudioEngine::update @ 0x100138e40
//
// 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
//
void __fastcall FMODAudioEngine::updateQueuedMusic(FMODAudioEngine *a1)
{
std::__hash_node_base, void *> *>::__next_pointer next; // x20
char isPersistentMatchPlaying; // w0
char v4; // w22
int v6; // w8
__int64 v7; // x22
__int128 v8; // q0
__int128 v9; // q1
__int128 v10; // q2
std::__hash_node_base, void *> *> *v11; // x22
__int128 v12; // q1
FMODQueuedMusic v13; // [xsp+0h] [xbp-F0h] BYREF
void *__p[2]; // [xsp+60h] [xbp-90h] BYREF
std::__hash_node_base, void *> *>::__next_pointer v15; // [xsp+70h] [xbp-80h]
__int128 __dst; // [xsp+80h] [xbp-70h] BYREF
std::__hash_node_base, void *> *>::__next_pointer v17; // [xsp+90h] [xbp-60h]
std::__hash_node_base, void *> *>::__next_pointer v18; // [xsp+A8h] [xbp-48h] BYREF
next = a1->m_audioState.m_queuedMusicForChannels1.__table_.__p1_.__value_.__next_;
if ( next )
{
do
{
if ( !next[13].__next_ )
goto LABEL_31;
if ( LOBYTE(next[14].__next_) == 1 )
{
if ( SHIBYTE(next[5].__next_) < 0 )
{
sub_1000097D0(&__dst, next[3].__next_, (unsigned __int64)next[4].__next_);
}
else
{
__dst = *(_OWORD *)&next[3].__next_;
v17 = next[5].__next_;
}
isPersistentMatchPlaying = FMODAudioEngine::isPersistentMatchPlaying(a1, &__dst, LODWORD(next[11].__next_));
v4 = isPersistentMatchPlaying;
if ( SHIBYTE(v17) < 0 )
{
operator delete((void *)__dst);
if ( (v4 & 1) != 0 )
goto LABEL_31;
}
else if ( (isPersistentMatchPlaying & 1) != 0 )
{
goto LABEL_31;
}
}
a1->m_lastResult = FMOD::Sound::getOpenState(
(FMOD::Sound *)next[13].__next_,
(FMOD_OPENSTATE *)&v18,
nullptr,
nullptr,
nullptr);
if ( (unsigned int)v18 <= 6 && ((1 << (char)v18) & 0x45) != 0 )
{
v6 = (int)next[12].__next_;
if ( v6 == 1 )
{
if ( BYTE4(next[11].__next_) == 1 )
{
if ( SHIBYTE(next[5].__next_) < 0 )
sub_1000097D0(&v13, next[3].__next_, (unsigned __int64)next[4].__next_);
else
v13.m_filePath = *(std::string *)&next[3].__next_;
v12 = *(_OWORD *)&next[10].__next_;
*(_OWORD *)&v13.m_end = *(_OWORD *)&next[8].__next_;
*(_OWORD *)&v13.m_musicID = v12;
*(_OWORD *)&v13.m_queuedStatus = *(_OWORD *)&next[12].__next_;
v13.m_dontReset = (bool)next[14].__next_;
*(_OWORD *)&v13.m_pitch = *(_OWORD *)&next[6].__next_;
FMODAudioEngine::triggerQueuedMusic(a1, &v13);
if ( v13.m_filePath.m_data.m_short.shortStorage.__elems_[22] < 0 )
operator delete((void *)v13.m_filePath.m_data.m_long.capacitym1);
}
else
{
v18 = next + 2;
v7 = sub_10013FC28(&a1->m_audioState.m_queuedMusicForChannels2);
std::string::operator=((std::string *)(v7 + 24), (const std::string *)&next[3]);
*(_OWORD *)(v7 + 48) = *(_OWORD *)&next[6].__next_;
v9 = *(_OWORD *)&next[10].__next_;
v8 = *(_OWORD *)&next[12].__next_;
v10 = *(_OWORD *)&next[8].__next_;
*(_BYTE *)(v7 + 112) = next[14].__next_;
*(_OWORD *)(v7 + 80) = v9;
*(_OWORD *)(v7 + 96) = v8;
*(_OWORD *)(v7 + 64) = v10;
}
LABEL_31:
v11 = next->__next_;
sub_100140A98(&a1->m_audioState.m_queuedMusicForChannels1, next);
goto LABEL_32;
}
if ( v6 )
goto LABEL_31;
if ( SHIBYTE(next[5].__next_) < 0 )
{
sub_1000097D0(__p, next[3].__next_, (unsigned __int64)next[4].__next_);
}
else
{
*(_OWORD *)__p = *(_OWORD *)&next[3].__next_;
v15 = next[5].__next_;
}
FMODAudioEngine::loadMusic(
a1,
__p,
BYTE4(next[9].__next_),
LODWORD(next[10].__next_),
0,
LOBYTE(next[14].__next_),
*(float *)&next[6].__next_,
*((float *)&next[6].__next_ + 1),
*(float *)&next[7].__next_);
if ( SHIBYTE(v15) < 0 )
operator delete(__p[0]);
FMODAudioEngine::setMusicTimeMS(a1, HIDWORD(next[7].__next_), 1, (int)next[10].__next_);
LODWORD(next[12].__next_) = 1;
}
v11 = next->__next_;
LABEL_32:
next = v11;
}
while ( v11 );
}
}