//
// SongOptionsLayer::onPlayback from 0x1400c50b0 to 0x1400c5361 (689 bytes)
//
// 2 xrefs:
// > SongOptionsLayer::init @ 0x1400c4ef5
// > ??> @ 0x1406c8124
//
// 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=6
void SongOptionsLayer::onPlayback(SongOptionsLayer *a1, cocos2d::CCObject *a2)
{
FMODAudioEngine *v3; // rcx
__int64 v4; // rbx
cocos2d::CCLabelProtocol *v5; // rcx
const char *v6; // rax
size_t v7; // r8
const char *v8; // rcx
float v9; // xmm6_4
char *v10; // rcx
std::string *v11; // rbx
FMODAudioEngine *v12; // rcx
cocos2d::CCNode *v13; // rbx
FMODAudioEngine *v14; // rcx
bool isMusicPlaying_1; // al
cocos2d::CCNode_vtbl *v16; // rdi
cocos2d::CCSpriteFrameCache *v17; // rax
const char *v18; // rdx
struct cocos2d::CCSpriteFrame *v19; // rax
FMODAudioEngine *v20; // [rsp+20h] [rbp-58h]
FMODAudioEngine *v21; // [rsp+20h] [rbp-58h]
FMODAudioEngine *v22; // [rsp+28h] [rbp-50h]
FMODAudioEngine *v23; // [rsp+28h] [rbp-50h]
char *String[2]; // [rsp+30h] [rbp-48h] BYREF
__int64 v25; // [rsp+40h] [rbp-38h]
unsigned __int64 v26; // [rsp+48h] [rbp-30h]
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) )
{
v4 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v21 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v4 = qword_1406C2E88;
}
if ( *(_QWORD *)(v4 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v4 + 552));
sub_14005E0D0((_QWORD *)(v4 + 1064));
sub_14005E0D0((_QWORD *)(v4 + 1128));
sub_14005E0D0((_QWORD *)(v4 + 1192));
}
else
{
v5 = &a1->m_offsetInput->m_textField->cocos2d::CCLabelProtocol;
v6 = v5->getString(v5);
*(_OWORD *)String = 0;
v25 = 0;
v26 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003A930(String, v6, v7);
v8 = (const char *)String;
if ( v26 > 0xF )
v8 = String[0];
v9 = atof(v8);
if ( v26 > 0xF )
{
v10 = String[0];
if ( v26 + 1 >= 0x1000 )
{
v10 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
v11 = a1->m_delegate->getSongFileName(a1->m_delegate, String);
v12 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v22 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v12 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::loadAndPlayMusic(v12, (__int64)v11, (int)(float)(v9 * 1000.0));
}
v13 = a1->m_playbackButton->getNormalImage(a1->m_playbackButton);
v14 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v23 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v14 = (FMODAudioEngine *)qword_1406C2E88;
}
isMusicPlaying_1 = FMODAudioEngine::isMusicPlaying_1(v14, 0);
v16 = v13->__vftable;
if ( isMusicPlaying_1 )
{
v17 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v18 = "GJ_stopMusicBtn_001.png";
}
else
{
v17 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v18 = "GJ_playMusicBtn_001.png";
}
v19 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v17, v18);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCSpriteFrame *))v16[1].setScaleX)(v13, v19);
}