//
// SelectListIconLayer::init from 0x140431360 to 0x140431b4d (2029 bytes)
//
// 2 xrefs:
// > LevelListLayer::onSelectIcon @ 0x14042fc55
// > ??> @ 0x140926cc0
//
// 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:15 +0000
//
// Hidden C++ exception states: #wind=4
bool __fastcall SelectListIconLayer::init(__int64 a1, int a2)
{
unsigned int v4; // esi
bool result; // al
__int64 v6; // rdx
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 *v12; // rdi
__int64 v13; // rbx
__int64 v14; // rax
__int64 v15; // rbx
__int64 v16; // rax
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rcx
cocos2d::CCObject *v21; // rax
__int64 v22; // rcx
cocos2d::CCArray *v23; // r13
__int64 v24; // rcx
__int64 v25; // rax
__int64 v26; // rbx
__int64 v27; // rax
int v28; // edi
bool v29; // zf
unsigned int v30; // ebx
int v31; // edx
cocos2d::CCString *v32; // rax
const char *CString; // rax
size_t v34; // r8
const char *v35; // rcx
struct cocos2d::CCObject *v36; // r12
cocos2d::CCObject *v37; // r14
cocos2d::CCString *v38; // rax
float v39; // xmm0_4
__int64 v40; // rax
void *v41; // rcx
cocos2d::CCObject *v42; // rbx
cocos2d::CCObject *v43; // r14
__int64 v44; // rdi
__int64 v45; // rbx
__int64 v46; // rax
__int64 v47; // rax
struct cocos2d::CCObject *v48; // rbx
int v49; // eax
void (__fastcall *v50)(char *, __int16 *); // r8
__int16 *v51; // rdx
int v52; // [rsp+58h] [rbp-B0h] BYREF
float v53; // [rsp+60h] [rbp-A8h] BYREF
float v54; // [rsp+64h] [rbp-A4h]
__int64 v55; // [rsp+68h] [rbp-A0h]
__int64 v56[2]; // [rsp+70h] [rbp-98h] BYREF
_BYTE v57[8]; // [rsp+80h] [rbp-88h] BYREF
void *v58; // [rsp+88h] [rbp-80h] BYREF
__int128 v59; // [rsp+90h] [rbp-78h] BYREF
__int64 v60; // [rsp+A0h] [rbp-68h]
unsigned __int64 v61; // [rsp+A8h] [rbp-60h]
v4 = 0;
v52 = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((cocos2d::CCLayerColor *)a1, (const struct cocos2d::_ccColor4B *)&v52);
if ( !result )
return result;
FLAlertLayer::incrementForcePrio((struct cocos2d::CCObject *)a1);
*(_DWORD *)(a1 + 672) = a2;
LOBYTE(v6) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 920LL))(a1, v6);
LOBYTE(v7) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v7);
v9 = cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(v9, &v53);
v10 = cocos2d::CCLayer::create();
*(_QWORD *)(a1 + 584) = v10;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v10);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v56, 0.0, 0.0, 80.0, 80.0);
v12 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v11);
v13 = *v12;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v52, 360.0, 240.0);
(*(void (__fastcall **)(__int64 *, __int64))(v13 + 312))(v12, v14);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v12,
0xFFFFFFFFLL);
v15 = *v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v53 * 0.5, v54 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v15 + 184))(v12, v16);
v17 = cocos2d::CCLabelBMFont::create("Select Icon", (const char *)&qword_140704F78);
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v53 * 0.5, (float)((float)(v54 * 0.5) + 120.0) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v18 + 184))(v17, v19);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v17);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 160LL))(v17);
v21 = (cocos2d::CCObject *)cocos2d::CCArray::create(v20);
*(_QWORD *)(a1 + 664) = v21;
cocos2d::CCObject::retain(v21);
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v22);
v25 = cocos2d::CCMenu::create(v24);
*(_QWORD *)(a1 + 552) = v25;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v25, 10);
v26 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v53 * 0.5, (float)((float)(v54 * 0.5) + 30.0) + 5.0);
cocos2d::CCNode::convertToNodeSpace(v26, v57, v27);
v28 = 0;
v29 = 0;
do
{
if ( v29 )
{
v30 = -1;
LABEL_5:
v31 = 0;
goto LABEL_6;
}
v30 = v28;
if ( v28 )
{
if ( (unsigned int)v28 > 0xA )
goto LABEL_5;
v31 = v28;
if ( v28 == 6 || v28 == 7 )
{
v31 = v28 + 1;
}
else if ( v28 == 8 )
{
v31 = 6;
goto LABEL_23;
}
if ( v31 <= 5 )
{
LABEL_6:
v32 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn_001.png", v31);
CString = cocos2d::CCString::getCString(v32);
v59 = 0;
v60 = 0;
v61 = 0;
v34 = -1;
do
++v34;
while ( CString[v34] );
LABEL_8:
sub_14003D230(&v59, CString, v34);
goto LABEL_9;
}
LABEL_23:
v38 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn2_001.png", v31);
CString = cocos2d::CCString::getCString(v38);
v59 = 0;
v60 = 0;
v61 = 0;
v34 = -1;
do
++v34;
while ( CString[v34] );
goto LABEL_8;
}
v59 = 0;
v60 = 0;
v61 = 0;
*(_QWORD *)&v59 = sub_14003D460(0x20u);
v60 = 27;
v61 = 31;
strcpy((char *)v59, "difficulty_auto_btn_001.png");
LABEL_9:
v35 = (const char *)&v59;
if ( v61 > 0xF )
v35 = (const char *)v59;
v36 = cocos2d::CCSprite::createWithSpriteFrameName(v35);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 664), v36);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v36 + 160LL))(v36);
v58 = operator new(0x208u);
v37 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v58);
if ( v37 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v37, (__int64 *)v36, 0, a1, (__int64)SelectListIconLayer::onSelect) )
{
cocos2d::CCObject::autorelease(v37);
goto LABEL_28;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v37 + 8LL))(v37, 1);
}
v37 = nullptr;
LABEL_28:
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v36 + 64LL))(v36, v30);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v37 + 64LL))(v37, v30);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v37);
cocos2d::CCArray::addObject(v23, v37);
v39 = floorf((float)(v28 / 6)) * -60.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, (float)((float)((float)(v28 % 6) * 52.0) - 156.0) + 26.0, v39);
cocos2d::CCPoint::operator+(v57, &v52, v40);
(*(void (__fastcall **)(cocos2d::CCObject *, int *))(*(_QWORD *)v37 + 184LL))(v37, &v52);
if ( v61 > 0xF )
{
v41 = (void *)v59;
if ( v61 + 1 >= 0x1000 )
{
v41 = *(void **)(v59 - 8);
if ( (unsigned __int64)(v59 - (_QWORD)v41 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v41);
}
v29 = ++v28 == 11;
}
while ( v28 <= 11 );
*(_DWORD *)(a1 + 640) = -1;
cocos2d::CCArray::removeAllObjects(v23);
v56[0] = (__int64)operator new(0x2C8u);
v42 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v56[0]);
if ( v42 )
{
if ( ButtonSprite::init_1(
(__int64)v42,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v42);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v42 + 8LL))(v42, 1);
v42 = nullptr;
}
}
v56[0] = (__int64)operator new(0x208u);
v43 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v56[0]);
if ( v43 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v43, (__int64 *)v42, 0, a1, (__int64)SelectListIconLayer::onClose) )
{
cocos2d::CCObject::autorelease(v43);
goto LABEL_43;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v43 + 8LL))(v43, 1);
}
v43 = nullptr;
LABEL_43:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v43);
v44 = *(_QWORD *)v43;
v45 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56, v53 * 0.5, (float)((float)(v54 * 0.5) - 120.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v45, &v58, v46);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v44 + 184))(v43, v47);
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 664)) )
{
do
{
v48 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 664), v4);
v49 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v48 + 56LL))(v48);
v50 = **((void (__fastcall ***)(char *, __int16 *))v48 + 40);
if ( *(_DWORD *)(a1 + 672) == v49 )
{
v51 = &word_140703BB8;
}
else
{
LOWORD(v55) = 32125;
memset(&v52, 125, 3);
v51 = (__int16 *)&v52;
}
v50((char *)v48 + 320, v51);
++v4;
}
while ( v4 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 664)) );
}
*(_BYTE *)(a1 + 596) = 1;
return 1;
}