//
// MoreSearchLayer::onSongFilter from 0x14043ef40 to 0x14043f672 (1842 bytes)
//
// 3 xrefs:
// > MoreSearchLayer::init @ 0x14043d40a
// > MoreSearchLayer::init @ 0x14043c580
// > ??> @ 0x140927008
//
// 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:20 +0000
//
// Hidden C++ exception states: #wind=7
unsigned int __fastcall MoreSearchLayer::onSongFilter(cocos2d::CCArray **a1, __int64 a2)
{
unsigned int v3; // esi
__int64 v4; // rbx
cocos2d::CCString *v5; // rax
BOOL v6; // r14d
void *v7; // r8
__int64 v8; // rbx
__int64 v9; // rbx
struct cocos2d::CCString *v10; // rax
void *v11; // rcx
__int64 v12; // rbx
cocos2d::CCString *v13; // rax
bool v14; // bl
void *v15; // r8
bool v16; // zf
__int64 v17; // rbx
cocos2d::CCString *v18; // rax
bool v19; // r14
void *v20; // rax
unsigned int k; // ebx
struct cocos2d::CCObject *v22; // rax
unsigned int m; // ebx
struct cocos2d::CCObject *v24; // rax
unsigned int result; // eax
struct cocos2d::CCObject *v26; // rax
__int64 v27; // rdx
__int64 v28; // rbx
struct cocos2d::CCString *v29; // rax
void *v30; // rcx
unsigned int i; // ebx
struct cocos2d::CCObject *v32; // rax
unsigned int j; // ebx
struct cocos2d::CCObject *v34; // rax
struct cocos2d::CCObject *v35; // rax
void *v36; // [rsp+30h] [rbp-50h]
void *v37; // [rsp+30h] [rbp-50h]
void *v38; // [rsp+30h] [rbp-50h]
void *v39; // [rsp+30h] [rbp-50h]
void *v40; // [rsp+30h] [rbp-50h]
void *v41[2]; // [rsp+38h] [rbp-48h] BYREF
__int64 v42; // [rsp+48h] [rbp-38h]
unsigned __int64 v43; // [rsp+50h] [rbp-30h]
void *Block[2]; // [rsp+58h] [rbp-28h] BYREF
__int64 v45; // [rsp+68h] [rbp-18h]
unsigned __int64 v46; // [rsp+70h] [rbp-10h]
v3 = 0;
if ( a2 )
{
v4 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v36 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v36);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v4 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
v45 = 17;
v46 = 31;
strcpy((char *)Block[0], "enable_songFilter");
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v4 + 848), Block);
v6 = cocos2d::CCString::boolValue(v5);
if ( v46 > 0xF )
{
v7 = Block[0];
if ( v46 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
v45 = 0;
v46 = 15;
LOBYTE(Block[0]) = 0;
v8 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v37 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v37);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v8 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)v41 = 0;
v41[0] = sub_14003D460(0x20u);
v42 = 17;
v43 = 31;
strcpy((char *)v41[0], "enable_songFilter");
v9 = *(_QWORD *)(v8 + 848);
v10 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, !v6);
cocos2d::CCDictionary::setObject(v9, v10, v41);
if ( v43 > 0xF )
{
v11 = v41[0];
if ( v43 + 1 >= 0x1000 )
{
v11 = *((void **)v41[0] - 1);
if ( (unsigned __int64)((char *)v41[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v42 = 0;
v43 = 15;
LOBYTE(v41[0]) = 0;
}
v12 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v38 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v38);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v12 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)Block = 0;
v45 = 0;
v46 = 0;
Block[0] = sub_14003D460(0x20u);
v45 = 17;
v46 = 31;
strcpy((char *)Block[0], "enable_songFilter");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v12 + 848), Block);
v14 = cocos2d::CCString::boolValue(v13);
if ( v46 > 0xF )
{
v15 = Block[0];
if ( v46 + 1 >= 0x1000 )
{
v15 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
v45 = 0;
v46 = 15;
LOBYTE(Block[0]) = 0;
v16 = !v14;
v17 = *(_QWORD *)&qword_14090BFB0;
if ( v16 )
{
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v40 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v40);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v17 = *(_QWORD *)&qword_14090BFB0;
}
v42 = 11;
v43 = 15;
v41[0] = (void *)0x6C69665F676E6F73LL;
v41[1] = (void *)7497076;
v28 = *(_QWORD *)(v17 + 848);
v29 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, 0);
cocos2d::CCDictionary::setObject(v28, v29, v41);
if ( v43 > 0xF )
{
v30 = v41[0];
if ( v43 + 1 >= 0x1000 )
{
v30 = *((void **)v41[0] - 1);
if ( (unsigned __int64)((char *)v41[0] - (char *)v30 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v30);
}
for ( i = 0; i < cocos2d::CCArray::count(a1[90]); ++i )
{
v32 = cocos2d::CCArray::objectAtIndex(a1[90], i);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v32 + 336LL))(v32, 0);
}
for ( j = 0; j < cocos2d::CCArray::count(a1[91]); ++j )
{
v34 = cocos2d::CCArray::objectAtIndex(a1[91], j);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v34 + 336LL))(v34, 0);
}
if ( cocos2d::CCArray::count(a1[89]) )
{
do
{
v35 = cocos2d::CCArray::objectAtIndex(a1[89], v3);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v35 + 336LL))(v35, 0);
++v3;
}
while ( v3 < cocos2d::CCArray::count(a1[89]) );
}
return MoreSearchLayer::selectSong(a1, 0);
}
else
{
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v39 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v39);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v17 = *(_QWORD *)&qword_14090BFB0;
}
*(_OWORD *)v41 = 0;
v42 = 0;
v43 = 0;
v41[0] = sub_14003D460(0x20u);
v42 = 17;
v43 = 31;
strcpy((char *)v41[0], "customsong_filter");
v18 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v17 + 848), v41);
v19 = cocos2d::CCString::boolValue(v18);
if ( v43 > 0xF )
{
v20 = v41[0];
if ( v43 + 1 >= 0x1000 )
{
v20 = *((void **)v41[0] - 1);
if ( (unsigned __int64)((char *)v41[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
for ( k = 0; k < cocos2d::CCArray::count(a1[90]); ++k )
{
v22 = cocos2d::CCArray::objectAtIndex(a1[90], k);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v22 + 336LL))(v22, !v19);
}
for ( m = 0; m < cocos2d::CCArray::count(a1[91]); ++m )
{
v24 = cocos2d::CCArray::objectAtIndex(a1[91], m);
(*(void (__fastcall **)(struct cocos2d::CCObject *, bool))(*(_QWORD *)v24 + 336LL))(v24, v19);
}
result = cocos2d::CCArray::count(a1[89]);
if ( result )
{
do
{
v26 = cocos2d::CCArray::objectAtIndex(a1[89], v3);
LOBYTE(v27) = 1;
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v26 + 336LL))(v26, v27);
++v3;
result = cocos2d::CCArray::count(a1[89]);
}
while ( v3 < result );
}
}
return result;
}