//
// MoreSearchLayer::onClose from 0x140317540 to 0x140317936 (1014 bytes)
//
// 3 xrefs:
// > MoreSearchLayer::keyBackClicked @ 0x140317949
// > MoreSearchLayer::init @ 0x140312e02
// > ??> @ 0x1406d49ac
//
// 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=5
void MoreSearchLayer::onClose(MoreSearchLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCLabelProtocol *v3; // rcx
const char *v4; // rax
size_t v5; // r8
const char *v6; // rcx
int v7; // r14d
char *v8; // rcx
__int64 v9; // rdi
cocos2d::CCString *v10; // rax
bool v11; // si
void *v12; // rcx
__int64 v13; // rdi
cocos2d::CCString *v14; // rax
bool v15; // di
char *v16; // rcx
__int64 v17; // rdi
struct cocos2d::CCString *v18; // rax
void *v19; // rcx
_BOOL8 v20; // rdx
void *v21; // [rsp+20h] [rbp-50h]
void *v22; // [rsp+20h] [rbp-50h]
void *v23; // [rsp+20h] [rbp-50h]
char *String[2]; // [rsp+28h] [rbp-48h] BYREF
__int64 v25; // [rsp+38h] [rbp-38h]
unsigned __int64 v26; // [rsp+40h] [rbp-30h]
void *Block[2]; // [rsp+48h] [rbp-28h] BYREF
__int64 v28; // [rsp+58h] [rbp-18h]
unsigned __int64 v29; // [rsp+60h] [rbp-10h]
a1->m_enterSongID->onClickTrackNode(a1->m_enterSongID, 0);
v3 = &a1->m_enterSongID->m_textField->cocos2d::CCLabelProtocol;
v4 = v3->getString(v3);
*(_OWORD *)String = 0;
v25 = 0;
v26 = 0;
v5 = -1;
do
++v5;
while ( v4[v5] );
sub_14003A930(String, v4, v5);
v6 = (const char *)String;
if ( v26 > 0xF )
v6 = String[0];
v7 = atoi(v6);
if ( v26 > 0xF )
{
v8 = String[0];
if ( v26 + 1 >= 0x1000 )
{
v8 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v25 = 0;
v26 = 15;
LOBYTE(String[0]) = 0;
v9 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v21 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v9 = qword_1406C2EC0;
}
*(_OWORD *)Block = 0;
v28 = 0;
v29 = 15;
Block[0] = sub_14003AA10(0x20u);
v28 = 17;
v29 = 31;
strcpy((char *)Block[0], "customsong_filter");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v9 + 344), Block);
v11 = cocos2d::CCString::boolValue(v10);
if ( v29 > 0xF )
{
v12 = Block[0];
if ( v29 + 1 >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
v28 = 0;
v29 = 15;
LOBYTE(Block[0]) = 0;
v13 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v22 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v13 = qword_1406C2EC0;
}
*(_OWORD *)String = 0;
v25 = 0;
v26 = 15;
String[0] = (char *)sub_14003AA10(0x20u);
v25 = 17;
v26 = 31;
strcpy(String[0], "enable_songFilter");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v13 + 344), String);
v15 = cocos2d::CCString::boolValue(v14);
if ( v26 > 0xF )
{
v16 = String[0];
if ( v26 + 1 >= 0x1000 )
{
v16 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
v25 = 0;
v26 = 15;
LOBYTE(String[0]) = 0;
if ( v15 && v11 )
{
v17 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v23 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v17 = qword_1406C2EC0;
}
v28 = 11;
v29 = 15;
Block[0] = (void *)0x6C69665F676E6F73LL;
Block[1] = (void *)7497076;
v18 = cocos2d::CCString::createWithFormat("%i", v7);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v17 + 344), v18, Block);
if ( v29 > 0xF )
{
v19 = Block[0];
if ( v29 + 1 >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v19);
}
}
a1->setKeypadEnabled(a1, 0);
LOBYTE(v20) = 1;
a1->removeFromParentAndCleanup(a1, v20);
}