//
// MoreSearchLayer::onSongFilter from 0x140315e70 to 0x14031654f (1759 bytes)
//
// 4 xrefs:
// > MoreSearchLayer::init @ 0x1403145b0
// > MoreSearchLayer::init @ 0x14031377a
// > ??> @ 0x1406d4934
// > ??> @ 0x1406d4940
//
// 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=8
void MoreSearchLayer::onSongFilter(MoreSearchLayer *a1, cocos2d::CCObject *a2)
{
unsigned int v3; // edi
__int64 v4; // rsi
cocos2d::CCString *v5; // rax
BOOL v6; // r14d
void *v7; // rcx
__int64 v8; // rsi
struct cocos2d::CCString *v9; // rax
void *v10; // rcx
__int64 v11; // rsi
cocos2d::CCString *v12; // rax
bool v13; // si
void *v14; // rcx
bool v15; // zf
__int64 v16; // rsi
cocos2d::CCString *v17; // rax
bool v18; // r14
void *v19; // rcx
unsigned int k; // esi
struct cocos2d::CCObject *v21; // rax
unsigned int m; // esi
struct cocos2d::CCObject *v23; // rax
struct cocos2d::CCObject *v24; // rax
__int64 v25; // rdx
struct cocos2d::CCString *v26; // rax
void *v27; // rcx
unsigned int i; // esi
struct cocos2d::CCObject *v29; // rax
unsigned int j; // esi
struct cocos2d::CCObject *v31; // rax
struct cocos2d::CCObject *v32; // rax
void *v33; // [rsp+20h] [rbp-29h]
void *v34; // [rsp+20h] [rbp-29h]
void *v35; // [rsp+20h] [rbp-29h]
void *v36; // [rsp+20h] [rbp-29h]
void *v37; // [rsp+20h] [rbp-29h]
void *v38[2]; // [rsp+28h] [rbp-21h] BYREF
__int64 v39; // [rsp+38h] [rbp-11h]
unsigned __int64 v40; // [rsp+40h] [rbp-9h]
void *Block[2]; // [rsp+48h] [rbp-1h] BYREF
__int64 v42; // [rsp+58h] [rbp+Fh]
unsigned __int64 v43; // [rsp+60h] [rbp+17h]
void *v44[2]; // [rsp+68h] [rbp+1Fh] BYREF
__int64 v45; // [rsp+78h] [rbp+2Fh]
unsigned __int64 v46; // [rsp+80h] [rbp+37h]
v3 = 0;
if ( a2 )
{
v4 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v33 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v33);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = qword_1406C2EC0;
}
*(_OWORD *)Block = 0;
v42 = 0;
v43 = 15;
Block[0] = sub_14003AA10(0x20u);
v42 = 17;
v43 = 31;
strcpy((char *)Block[0], "enable_songFilter");
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v4 + 344), Block);
v6 = cocos2d::CCString::boolValue(v5);
if ( v43 > 0xF )
{
v7 = Block[0];
if ( v43 + 1 >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
v42 = 0;
v43 = 15;
LOBYTE(Block[0]) = 0;
v8 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v34 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v34);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v8 = qword_1406C2EC0;
}
*(_OWORD *)v38 = 0;
v38[0] = sub_14003AA10(0x20u);
v39 = 17;
v40 = 31;
strcpy((char *)v38[0], "enable_songFilter");
v9 = cocos2d::CCString::createWithFormat("%i", !v6);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v8 + 344), v9, v38);
if ( v40 > 0xF )
{
v10 = v38[0];
if ( v40 + 1 >= 0x1000 )
{
v10 = *((void **)v38[0] - 1);
if ( (unsigned __int64)((char *)v38[0] - (char *)v10 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v10);
}
v39 = 0;
v40 = 15;
LOBYTE(v38[0]) = 0;
}
v11 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v35 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v35);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v11 = qword_1406C2EC0;
}
*(_OWORD *)v44 = 0;
v45 = 0;
v46 = 15;
v44[0] = sub_14003AA10(0x20u);
v45 = 17;
v46 = 31;
strcpy((char *)v44[0], "enable_songFilter");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v11 + 344), v44);
v13 = cocos2d::CCString::boolValue(v12);
if ( v46 > 0xF )
{
v14 = v44[0];
if ( v46 + 1 >= 0x1000 )
{
v14 = *((void **)v44[0] - 1);
if ( (unsigned __int64)((char *)v44[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
v45 = 0;
v46 = 15;
LOBYTE(v44[0]) = 0;
v15 = !v13;
v16 = qword_1406C2EC0;
if ( v15 )
{
if ( !qword_1406C2EC0 )
{
v37 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v16 = qword_1406C2EC0;
}
v39 = 11;
v40 = 15;
v38[0] = (void *)0x6C69665F676E6F73LL;
v38[1] = (void *)7497076;
v26 = cocos2d::CCString::createWithFormat("%i", 0);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v16 + 344), v26, v38);
if ( v40 > 0xF )
{
v27 = v38[0];
if ( v40 + 1 >= 0x1000 )
{
v27 = *((void **)v38[0] - 1);
if ( (unsigned __int64)((char *)v38[0] - (char *)v27 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v27);
}
for ( i = 0; i < cocos2d::CCArray::count(a1->m_normalSongNodes); ++i )
{
v29 = cocos2d::CCArray::objectAtIndex(a1->m_normalSongNodes, i);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v29->__vftable[4].update)(v29, 0);
}
for ( j = 0; j < cocos2d::CCArray::count(a1->m_customSongNodes); ++j )
{
v31 = cocos2d::CCArray::objectAtIndex(a1->m_customSongNodes, j);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v31->__vftable[4].update)(v31, 0);
}
if ( cocos2d::CCArray::count(a1->m_commonSongNodes) )
{
do
{
v32 = cocos2d::CCArray::objectAtIndex(a1->m_commonSongNodes, v3);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v32->__vftable[4].update)(v32, 0);
++v3;
}
while ( v3 < cocos2d::CCArray::count(a1->m_commonSongNodes) );
}
MoreSearchLayer::selectSong(a1, 0);
}
else
{
if ( !qword_1406C2EC0 )
{
v36 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v16 = qword_1406C2EC0;
}
*(_OWORD *)v38 = 0;
v39 = 0;
v40 = 15;
v38[0] = sub_14003AA10(0x20u);
v39 = 17;
v40 = 31;
strcpy((char *)v38[0], "customsong_filter");
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v16 + 344), v38);
v18 = cocos2d::CCString::boolValue(v17);
if ( v40 > 0xF )
{
v19 = v38[0];
if ( v40 + 1 >= 0x1000 )
{
v19 = *((void **)v38[0] - 1);
if ( (unsigned __int64)((char *)v38[0] - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v19);
}
v39 = 0;
v40 = 15;
LOBYTE(v38[0]) = 0;
for ( k = 0; k < cocos2d::CCArray::count(a1->m_normalSongNodes); ++k )
{
v21 = cocos2d::CCArray::objectAtIndex(a1->m_normalSongNodes, k);
((void (__fastcall *)(struct cocos2d::CCObject *, bool))v21->__vftable[4].update)(v21, !v18);
}
for ( m = 0; m < cocos2d::CCArray::count(a1->m_customSongNodes); ++m )
{
v23 = cocos2d::CCArray::objectAtIndex(a1->m_customSongNodes, m);
((void (__fastcall *)(struct cocos2d::CCObject *, bool))v23->__vftable[4].update)(v23, v18);
}
if ( cocos2d::CCArray::count(a1->m_commonSongNodes) )
{
do
{
v24 = cocos2d::CCArray::objectAtIndex(a1->m_commonSongNodes, v3);
LOBYTE(v25) = 1;
((void (__fastcall *)(struct cocos2d::CCObject *, __int64))v24->__vftable[4].update)(v24, v25);
++v3;
}
while ( v3 < cocos2d::CCArray::count(a1->m_commonSongNodes) );
}
}
}