//
// MusicBrowser::update from 0x140339480 to 0x140339778 (760 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405ac0e0
// > ??> @ 0x1406d5318
//
// 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
//
// Hidden C++ exception states: #wind=3
void MusicBrowser::update(MusicBrowser *a1, float a2)
{
FMODAudioEngine *v3; // rcx
_BOOL8 v4; // rdx
Slider *m_playSlider; // rbx
__int64 v6; // rax
_BOOL8 v7; // rdx
int v8; // edx
FMODAudioEngine *v9; // rcx
int v10; // edx
unsigned int MusicTimeMS; // esi
FMODAudioEngine *v12; // rcx
unsigned int MusicLengthMS; // ebp
cocos2d::CCLabelProtocol_vtbl *v14; // rbx
cocos2d::CCString *v15; // rax
const char *CString; // rax
Slider *v17; // rcx
Slider *v18; // rbx
__int64 v19; // rax
FMODAudioEngine *v20; // [rsp+50h] [rbp+18h] BYREF
__int16 v21; // [rsp+58h] [rbp+20h]
v3 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v20 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v3 = (FMODAudioEngine *)qword_1406C2E88;
}
if ( FMODAudioEngine::isMusicPlaying_1(v3, 0) )
{
m_playSlider = a1->m_playSlider;
if ( !m_playSlider->m_enabled )
{
m_playSlider->m_enabled = 1;
LOBYTE(v4) = 1;
m_playSlider->m_touchLogic->setTouchEnabled(m_playSlider->m_touchLogic, v4);
m_playSlider->m_sliderBar->setColor(
&m_playSlider->m_sliderBar->cocos2d::CCRGBAProtocol,
(const cocos2d::ccColor3B *)&unk_1405299C0);
m_playSlider->m_groove->setColor(
&m_playSlider->m_groove->cocos2d::CCRGBAProtocol,
(const cocos2d::ccColor3B *)&unk_1405299C0);
v6 = (__int64)m_playSlider->m_touchLogic->m_thumb->getNormalImage(m_playSlider->m_touchLogic->m_thumb);
if ( v6 )
(**(void (__fastcall ***)(__int64, void *))(v6 + 320))(v6 + 320, &unk_1405299C0);
}
LOBYTE(v4) = 1;
a1->m_playLabel->setVisible(a1->m_playLabel, v4);
LOBYTE(v7) = 1;
a1->m_playButton->setVisible(a1->m_playButton, v7);
v9 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v20 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v9 = (FMODAudioEngine *)qword_1406C2E88;
}
MusicTimeMS = FMODAudioEngine::getMusicTimeMS(v9, v8);
v12 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v20 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v12 = (FMODAudioEngine *)qword_1406C2E88;
}
MusicLengthMS = FMODAudioEngine::getMusicLengthMS(v12, v10);
v14 = a1->m_playLabel->__vftable;
v15 = cocos2d::CCString::createWithFormat("%i/%is", MusicTimeMS / 0x3E8, MusicLengthMS / 0x3E8);
CString = cocos2d::CCString::getCString(v15);
v14->setString(&a1->m_playLabel->cocos2d::CCLabelProtocol, CString);
v17 = a1->m_playSlider;
if ( !v17->m_touchLogic->m_activateThumb )
Slider::setValue(v17, (float)(int)MusicTimeMS / (float)(int)MusicLengthMS);
}
else
{
a1->m_playLabel->setVisible(a1->m_playLabel, 0);
v18 = a1->m_playSlider;
if ( v18->m_enabled )
{
v18->m_enabled = 0;
v18->m_touchLogic->setTouchEnabled(v18->m_touchLogic, 0);
Slider::setValue(v18, 0.0);
v21 = -26986;
LOWORD(v20) = -26986;
BYTE2(v20) = -106;
v18->m_sliderBar->setColor(&v18->m_sliderBar->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v20);
v18->m_groove->setColor(&v18->m_groove->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v20);
v19 = (__int64)v18->m_touchLogic->m_thumb->getNormalImage(v18->m_touchLogic->m_thumb);
if ( v19 )
(**(void (__fastcall ***)(__int64, FMODAudioEngine **))(v19 + 320))(v19 + 320, &v20);
}
a1->m_playButton->setVisible(a1->m_playButton, 0);
}
}