//
// CustomSongWidget::onPlayback from 0x74267c to 0x7429d8 (860 bytes)
//
// 3 xrefs:
// > ??> @ 0xb99d0
// > CustomSongWidget::init @ 0x745c3c
// > ??> @ 0x122e6f8
//
// 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 CustomSongWidget::onPlayback(CustomSongWidget *a1, cocos2d::CCObject *a2)
{
SongPlaybackDelegate *m_playbackDelegate; // x0
MusicDownloadManager *v4; // x0
FMODAudioEngine *v5; // x0
FMODAudioEngine *v6; // x0
FMODAudioEngine *v7; // x22
MusicDownloadManager *v8; // x0
void *v9; // x0
char *v10; // x0
MusicDownloadManager *v11; // x0
void *v12; // x0
unsigned int *v13; // x20
int v14; // w1
FMODAudioEngine *v15; // x0
FMODAudioEngine *v16; // x24
_BOOL4 isMusicPlaying; // w22
void *v18; // x0
FMODAudioEngine *v19; // x0
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
__int64 v26; // [xsp+48h] [xbp+48h] BYREF
__int64 v27; // [xsp+50h] [xbp+50h] BYREF
char *v28; // [xsp+58h] [xbp+58h] BYREF
__int64 v29; // [xsp+60h] [xbp+60h] BYREF
m_playbackDelegate = a1->m_playbackDelegate;
if ( m_playbackDelegate )
{
m_playbackDelegate->onPlayback(m_playbackDelegate, a1->m_songInfoObject);
}
else if ( a1->m_songInfoObject )
{
v4 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSong(&v26, v4, a1->m_songInfoObject->m_songID);
v5 = FMODAudioEngine::sharedEngine();
if ( FMODAudioEngine::isMusicPlaying(v5, 0) )
{
v16 = FMODAudioEngine::sharedEngine();
sub_D18D28(&v27);
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v16, (int)&v27);
v18 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v27 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v18);
}
if ( !isMusicPlaying )
{
v19 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v19, 1);
}
}
v6 = FMODAudioEngine::sharedEngine();
if ( FMODAudioEngine::isMusicPlaying(v6, 0) )
{
v15 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::stopAllMusic(v15, 1);
}
else if ( a1->m_songInfoObject )
{
v7 = FMODAudioEngine::sharedEngine();
v8 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSong((__int64 *)&v28, v8, a1->m_songInfoObject->m_songID);
sub_D153B8((int)&v29, v28);
FMODAudioEngine::playMusic(v7, (__int64)&v29, 0, 0, 0.0);
v9 = (void *)(v29 - 24);
if ( (__int64 *)(v29 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v29 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v29 - 8);
*(_DWORD *)(v29 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v9);
}
v10 = v28 - 24;
if ( v28 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v28 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v28 - 2);
*((_DWORD *)v28 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v10);
}
}
v11 = MusicDownloadManager::sharedState();
MusicDownloadManager::songStateChanged(v11);
v12 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v26 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
}
}