//
// MoreSearchLayer::onSongMode from 0x14043fd50 to 0x140440241 (1265 bytes)
//
// 4 xrefs:
// > MoreSearchLayer::init @ 0x14043d70b
// > MoreSearchLayer::init @ 0x14043cd89
// > MoreSearchLayer::init @ 0x14043ceb8
// > ??> @ 0x140927044
//
// 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:32:21 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall MoreSearchLayer::onSongMode(_QWORD **a1, __int64 a2)
{
int v3; // r12d
unsigned __int8 v4; // r14
__int64 v5; // rbx
cocos2d::CCString *v6; // rax
char v7; // r15
void *v8; // r8
__int64 v9; // rbx
__int64 v10; // rbx
struct cocos2d::CCString *v11; // rax
void *v12; // rcx
__int64 v13; // rbx
__int64 v14; // rbx
struct cocos2d::CCString *v15; // rax
void *v16; // rcx
const char *v17; // rdi
const char *v18; // rbx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rbx
cocos2d::CCString *v22; // rax
bool v23; // bl
void *v24; // rcx
void *v25; // [rsp+30h] [rbp-50h]
void *v26; // [rsp+30h] [rbp-50h]
void *v27; // [rsp+30h] [rbp-50h]
void *v28; // [rsp+30h] [rbp-50h]
void *v29[2]; // [rsp+38h] [rbp-48h] BYREF
__int64 v30; // [rsp+48h] [rbp-38h]
unsigned __int64 v31; // [rsp+50h] [rbp-30h]
void *Block[2]; // [rsp+58h] [rbp-28h] BYREF
__int64 v33; // [rsp+68h] [rbp-18h]
unsigned __int64 v34; // [rsp+70h] [rbp-10h]
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v4 = v3 == 2;
v5 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v25 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v25);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v5 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
v33 = 17;
v34 = 31;
strcpy((char *)Block[0], "customsong_filter");
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v5 + 848), Block);
v7 = cocos2d::CCString::boolValue(v6);
if ( v34 > 0xF )
{
v8 = Block[0];
if ( v34 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v8);
}
v33 = 0;
v34 = 15;
LOBYTE(Block[0]) = 0;
v9 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v26 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v26);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v9 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)v29 = 0;
v29[0] = sub_14003D460(0x20u);
v30 = 17;
v31 = 31;
strcpy((char *)v29[0], "customsong_filter");
v10 = *(_QWORD *)(v9 + 848);
v11 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v4);
cocos2d::CCDictionary::setObject(v10, v11, v29);
if ( v31 > 0xF )
{
v12 = v29[0];
if ( v31 + 1 >= 0x1000 )
{
v12 = *((void **)v29[0] - 1);
if ( (unsigned __int64)((char *)v29[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
v30 = 0;
v31 = 15;
LOBYTE(v29[0]) = 0;
if ( v7 != v4 )
{
v13 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v27 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v27);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v13 = *(_QWORD *)&qword_14090BFB0;
}
v33 = 11;
v34 = 15;
Block[0] = (void *)0x6C69665F676E6F73LL;
Block[1] = (void *)7497076;
v14 = *(_QWORD *)(v13 + 848);
v15 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v3 != 2);
cocos2d::CCDictionary::setObject(v14, v15, Block);
if ( v34 > 0xF )
{
v16 = Block[0];
if ( v34 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
*(_OWORD *)v29 = 0;
v30 = 0;
v31 = 15;
LOBYTE(v29[0]) = 0;
CCTextInputNode::setString(a1[88], v29);
}
v17 = "GJ_button_04.png";
v18 = "GJ_button_01.png";
if ( v3 == 2 )
v18 = "GJ_button_04.png";
v19 = (*(__int64 (__fastcall **)(_QWORD *))(*a1[86] + 952LL))(a1[86]);
ButtonSprite::updateBGImage(v19, v18);
if ( v3 == 2 )
v17 = "GJ_button_01.png";
v20 = (*(__int64 (__fastcall **)(_QWORD *))(*a1[87] + 952LL))(a1[87]);
ButtonSprite::updateBGImage(v20, v17);
v21 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v28 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v28);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v21 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)v29 = 0;
v30 = 0;
v31 = 0;
v29[0] = sub_14003D460(0x20u);
v30 = 17;
v31 = 31;
strcpy((char *)v29[0], "enable_songFilter");
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v21 + 848), v29);
v23 = cocos2d::CCString::boolValue(v22);
if ( v31 > 0xF )
{
v24 = v29[0];
if ( v31 + 1 >= 0x1000 )
{
v24 = *((void **)v29[0] - 1);
if ( (unsigned __int64)((char *)v29[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
MoreSearchLayer::toggleSongNodes(a1, v4, !v23);
MoreSearchLayer::updateAudioLabel((__int64)a1);
}