//
// SongOptionsLayer::onPlayback from 0x140166190 to 0x140166459 (713 bytes)
//
// 2 xrefs:
// > SongOptionsLayer::init @ 0x140166006
// > ??> @ 0x140917f30
//
// This function is hookable on this platform (idp: pc, 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 11:27:27 +0000
//
// Hidden C++ exception states: #wind=6
__int64 __fastcall SongOptionsLayer::onPlayback(__int64 a1)
{
_QWORD *v2; // rcx
_QWORD *v3; // rbx
__int64 v4; // rcx
__int64 v5; // rcx
_BYTE *v6; // rax
size_t v7; // r8
const char *v8; // rcx
float v9; // xmm6_4
char *v10; // rcx
__int64 v11; // rbx
_QWORD *v12; // rcx
__int64 *v13; // rbx
_QWORD *v14; // rcx
bool isMusicPlaying_1; // al
__int64 v16; // rdi
cocos2d::CCSpriteFrameCache *v17; // rax
const char *v18; // rdx
struct cocos2d::CCSpriteFrame *v19; // rax
void *v21; // [rsp+30h] [rbp-58h]
void *v22; // [rsp+30h] [rbp-58h]
void *v23; // [rsp+38h] [rbp-50h]
void *v24; // [rsp+38h] [rbp-50h]
char *String[2]; // [rsp+40h] [rbp-48h] BYREF
__int64 v26; // [rsp+50h] [rbp-38h]
unsigned __int64 v27; // [rsp+58h] [rbp-30h]
v2 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v21 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v2 = (_QWORD *)qword_14090BF60;
}
if ( FMODAudioEngine::isMusicPlaying_1(v2, 0) )
{
v3 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v22 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v3 = (_QWORD *)qword_14090BF60;
}
v4 = v3[69];
if ( v4 )
FMOD::ChannelControl::stop(v4);
sub_14003EB60(v3 + 137);
sub_14003EB60(v3 + 145);
sub_14003EB60(v3 + 153);
}
else
{
v5 = *(_QWORD *)(*(_QWORD *)(a1 + 672) + 592LL) + 600LL;
v6 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 8LL))(v5);
*(_OWORD *)String = 0;
v26 = 0;
v27 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003D230(String, v6, v7);
v8 = (const char *)String;
if ( v27 > 0xF )
v8 = String[0];
v9 = atof(v8);
if ( v27 > 0xF )
{
v10 = String[0];
if ( v27 + 1 >= 0x1000 )
{
v10 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
v11 = (*(__int64 (__fastcall **)(_QWORD, char **))(**(_QWORD **)(a1 + 664) + 16LL))(*(_QWORD *)(a1 + 664), String);
v12 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v23 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v12 = (_QWORD *)qword_14090BF60;
}
FMODAudioEngine::loadAndPlayMusic(v12, v11, (int)(float)(v9 * 1000.0));
}
v13 = (__int64 *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 680) + 952LL))(*(_QWORD *)(a1 + 680));
v14 = (_QWORD *)qword_14090BF60;
if ( !qword_14090BF60 )
{
v24 = operator new(0x8A8u);
qword_14090BF60 = FMODAudioEngine::FMODAudioEngine((__int64)v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BF60 + 72LL))(qword_14090BF60);
v14 = (_QWORD *)qword_14090BF60;
}
isMusicPlaying_1 = FMODAudioEngine::isMusicPlaying_1(v14, 0);
v16 = *v13;
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);
return (*(__int64 (__fastcall **)(__int64 *, struct cocos2d::CCSpriteFrame *))(v16 + 1008))(v13, v19);
}