//
// LevelSearchLayer::demonFilterSelectClosed from 0x140436860 to 0x140436ac8 (616 bytes)
//
// 2 xrefs:
// > ??> @ 0x140791508
// > ??> @ 0x140926dd4
//
// 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:17 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall LevelSearchLayer::demonFilterSelectClosed(__int64 a1, unsigned int a2)
{
__int64 v4; // rbx
__int64 v5; // rbx
struct cocos2d::CCString *v6; // rax
void *v7; // rcx
char *v8; // rax
__int64 v9; // rdx
__int64 v10; // rcx
cocos2d::CCString *v11; // rax
char *CString; // rax
size_t v13; // r8
void **v14; // rsi
__int64 v15; // rdi
__int64 v16; // rbx
cocos2d::CCSpriteFrameCache *v17; // rax
struct cocos2d::CCSpriteFrame *v18; // rax
void *v19; // rcx
void *v20; // [rsp+30h] [rbp-68h]
void *v21[2]; // [rsp+38h] [rbp-60h] BYREF
__int64 v22; // [rsp+48h] [rbp-50h]
unsigned __int64 v23; // [rsp+50h] [rbp-48h]
char Block[13]; // [rsp+58h] [rbp-40h] BYREF
char v25; // [rsp+65h] [rbp-33h]
__int16 v26; // [rsp+66h] [rbp-32h]
__int64 v27; // [rsp+68h] [rbp-30h]
unsigned __int64 v28; // [rsp+70h] [rbp-28h]
v4 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v20 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v20);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v4 = *(_QWORD *)&qword_14090BFB0;
}
v25 = 0;
v26 = 0;
v27 = 12;
v28 = 15;
strcpy(Block, "demon_filter");
v5 = *(_QWORD *)(v4 + 848);
v6 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, a2);
cocos2d::CCDictionary::setObject(v5, v6, Block);
if ( v28 > 0xF )
{
v7 = *(void **)Block;
if ( v28 + 1 >= 0x1000 )
{
v7 = *(void **)(*(_QWORD *)Block - 8LL);
if ( (unsigned __int64)(*(_QWORD *)Block - (_QWORD)v7 - 8LL) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
*(_OWORD *)v21 = 0;
v22 = 0;
v23 = 15;
LOBYTE(v21[0]) = 0;
if ( a2 )
{
v11 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn2_001.png", a2);
CString = (char *)cocos2d::CCString::getCString(v11);
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_1400405A0(v21, CString, v13);
v8 = (char *)v21[0];
}
else
{
v8 = (char *)sub_14003D460(0x20u);
v22 = 25;
v23 = 31;
strcpy(v8, "difficulty_06_btn_001.png");
v10 = 103;
v21[0] = v8;
}
v14 = v21;
if ( v23 > 0xF )
v14 = (void **)v8;
v15 = **(_QWORD **)(a1 + 64);
v16 = *(_QWORD *)(a1 + 64);
v17 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v10, v9);
v18 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v17, (const char *)v14);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(v15 + 1008))(v16, v18);
if ( v23 > 0xF )
{
v19 = v21[0];
if ( v23 + 1 >= 0x1000 )
{
v19 = *((void **)v21[0] - 1);
if ( (unsigned __int64)((char *)v21[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
}