//
// CustomSongWidget::onPlayback from 0x869184 to 0x8693ec (616 bytes)
//
// 3 xrefs:
// > ??> @ 0xf22c0
// > CustomSongWidget::init @ 0x86b3f8
// > ??> @ 0x1547560
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:55:41 +0000
//
__int64 __fastcall CustomSongWidget::onPlayback(CustomSongWidget *this, cocos2d::CCObject *a2)
{
void (__fastcall ***v3)(_QWORD, _QWORD); // x0
MusicDownloadManager *v5; // x0
MusicDownloadManager *v6; // x0
FMODAudioEngine *v7; // x0
FMODAudioEngine *v8; // x0
__int64 isMusicPlaying; // x0
FMODAudioEngine *v10; // x0
_BOOL8 v11; // x0
__int64 v12; // x0
MusicDownloadManager *v13; // x21
MusicDownloadManager *v14; // x0
const char *v15; // x1
size_t v16; // x0
int v17; // w4
int v18; // w5
int v19; // w6
int v20; // w7
MusicDownloadManager *v21; // x0
FMODAudioEngine *v22; // x0
FMODAudioEngine *v23; // x23
int v24; // w21
FMODAudioEngine *v25; // x0
char v26; // [xsp+0h] [xbp+0h]
char *v27; // [xsp+48h] [xbp+48h]
__int64 v28; // [xsp+58h] [xbp+58h] BYREF
size_t v29; // [xsp+60h] [xbp+60h]
void *v30; // [xsp+68h] [xbp+68h]
__int64 v31; // [xsp+70h] [xbp+70h] BYREF
size_t v32; // [xsp+78h] [xbp+78h]
void *v33; // [xsp+80h] [xbp+80h]
__int64 v34[2]; // [xsp+88h] [xbp+88h] BYREF
void *v35; // [xsp+98h] [xbp+98h]
__int64 v36[2]; // [xsp+A0h] [xbp+A0h] BYREF
void *v37; // [xsp+B0h] [xbp+B0h]
v3 = *((void (__fastcall ****)(_QWORD, _QWORD))this + 65);
if ( v3 )
{
(**v3)(v3, *((_QWORD *)this + 42));
}
else
{
v5 = *((MusicDownloadManager **)this + 42);
if ( v5 )
{
v6 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v5);
v7 = (FMODAudioEngine *)MusicDownloadManager::pathForSong(&v28, v6, *(_DWORD *)(*((_QWORD *)this + 42) + 316LL));
v8 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(v7);
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v8, 0);
if ( (_BYTE)isMusicPlaying )
{
v23 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)isMusicPlaying);
v31 = 0;
v32 = 0;
v33 = nullptr;
if ( (v28 & 1) != 0 )
{
std::string::__init(&v31, v30, v29);
}
else
{
v33 = v30;
v31 = v28;
v32 = v29;
}
isMusicPlaying = FMODAudioEngine::isMusicPlaying(v23, (__int64)&v31, 0);
v24 = (unsigned __int8)isMusicPlaying;
if ( (v31 & 1) != 0 )
operator delete(v33);
if ( !v24 )
{
v25 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)isMusicPlaying);
isMusicPlaying = FMODAudioEngine::stopAllMusic(v25, 1);
}
}
v10 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)isMusicPlaying);
v11 = FMODAudioEngine::isMusicPlaying(v10, 0);
if ( v11 )
{
v22 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)v11);
v12 = FMODAudioEngine::stopAllMusic(v22, 1);
}
else
{
v12 = *((_QWORD *)this + 42);
if ( v12 )
{
v13 = (MusicDownloadManager *)FMODAudioEngine::sharedEngine((FMODAudioEngine *)v12);
v14 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v13);
MusicDownloadManager::pathForSong(v34, v14, *(_DWORD *)(*((_QWORD *)this + 42) + 316LL));
v15 = (char *)v34 + 1;
if ( (v34[0] & 1) != 0 )
v15 = (const char *)v35;
v27 = (char *)v15;
v36[0] = 0;
v36[1] = 0;
v37 = nullptr;
v16 = strlen(v15);
std::string::__init(v36, v27, v16);
FMODAudioEngine::playMusic(v13, (char *)v36, 0, 0, v17, v18, v19, v20, 0.0, v26);
if ( (v36[0] & 1) != 0 )
operator delete(v37);
v12 = LOBYTE(v34[0]);
if ( (v34[0] & 1) != 0 )
operator delete(v35);
}
}
v21 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)v12);
MusicDownloadManager::songStateChanged(v21);
if ( (v28 & 1) != 0 )
operator delete(v30);
}
}
return _stack_chk_guard;
}