//
// SelectListIconLayer::init from 0x1003613d0 to 0x1003618af (1247 bytes)
//
// 1 xrefs:
// > SelectListIconLayer::create @ 0x100360564
//
// 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
//
bool __fastcall SelectListIconLayer::init(SelectListIconLayer *a1, int a2)
{
bool result; // al
cocos2d::CCLayer *v4; // rax
cocos2d::extension::CCScale9Sprite *v5; // r14
cocos2d::CCLabelBMFont *v6; // r14
cocos2d::CCArray *v7; // rax
cocos2d::CCArray *v8; // rdi
cocos2d::CCMenu *v9; // rax
cocos2d::CCMenu *m_buttonMenu; // r14
unsigned int v11; // r13d
bool v12; // cf
unsigned int v13; // r12d
const char *p_g; // rdi
cocos2d::CCSprite *v15; // rsi
CCMenuItemSpriteExtra *v16; // r15
unsigned int v17; // ecx
unsigned int v18; // r14d
ButtonSprite *v19; // rax
CCMenuItemSpriteExtra *v20; // r15
cocos2d::CCMenu *v21; // r12
__int64 v22; // rax
__int64 v23; // rdi
cocos2d::ccColor4B *v24; // rsi
__int64 v25; // r13
int m_currentDifficulty; // r15d
unsigned __int64 v27; // [rsp+8h] [rbp-78h] BYREF
unsigned __int64 v28; // [rsp+10h] [rbp-70h] BYREF
__int64 v29; // [rsp+18h] [rbp-68h]
double v30; // [rsp+24h] [rbp-5Ch] BYREF
int v31; // [rsp+2Ch] [rbp-54h]
cocos2d::ccColor4B v32[4]; // [rsp+30h] [rbp-50h] BYREF
void *__p; // [rsp+40h] [rbp-40h]
float v34; // [rsp+4Ch] [rbp-34h] BYREF
float v35; // [rsp+50h] [rbp-30h]
bool v36; // [rsp+57h] [rbp-29h]
double v37; // 0:xmm0_8.8
double v38; // 0:xmm0_8.8
cocos2d::CCRect v39; // 0:xmm0_8.8,8:xmm1_8.8
v32[0] = (cocos2d::ccColor4B)-1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, v32);
if ( result )
{
v36 = result;
FLAlertLayer::incrementForcePrio(a1);
a1->m_currentDifficulty = a2;
((void (__fastcall *)(SelectListIconLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(SelectListIconLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v37 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v34);
v4 = cocos2d::CCLayer::create();
a1->m_mainLayer = v4;
((void (__fastcall *)(SelectListIconLayer *, cocos2d::CCLayer *, double))a1->addChild)(a1, v4, v37);
v39.origin = 0;
v39.size = 0;
sub_10028CC00((__int64)v32, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v5 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v39);
sub_10028CBF0((float *)&v32[0].r, 360.0, 240.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::ccColor4B *))v5->setContentSize)(v5, v32);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v5,
0xFFFFFFFFLL);
sub_10028CBE0((float *)&v32[0].r, v34 * 0.5, v35 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::ccColor4B *))v5->setPosition)(v5, v32);
v6 = cocos2d::CCLabelBMFont::create_3("Select Icon", "bigFont.fnt");
sub_10028CBE0((float *)&v32[0].r, v34 * 0.5, (float)((float)(v35 * 0.5) + 120.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::ccColor4B *))v6->setPosition)(v6, v32);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v6);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v6->setScale)(v6, 0.80000001);
v7 = (cocos2d::CCArray *)sub_10071F9E0(v6, v6);
a1->m_difficulties = v7;
v8 = v7;
cocos2d::CCObject::retain(v7);
v29 = sub_10071F9E0(v8, v6);
v9 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v9;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v9,
10);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0((float *)&v32[0].r, v34 * 0.5, (float)((float)(v35 * 0.5) + 30.0) + 5.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v27, (const cocos2d::CCPoint *)m_buttonMenu);
v11 = 0;
v31 = 11;
do
{
v12 = v31-- == 0;
v13 = v11;
if ( v12 )
v13 = -1;
GJLevelList::frameForListDifficulty(v32, v11, 1);
p_g = (const char *)&v32[0].g;
if ( (v32[0].r & 1) != 0 )
p_g = (const char *)__p;
v15 = cocos2d::CCSprite::createWithSpriteFrameName(p_g);
sub_10071FCD0(a1->m_difficulties, v15);
((void (__fastcall *)(cocos2d::CCSprite *, float))v15->setScale)(v15, 1.0);
v16 = CCMenuItemSpriteExtra::create(
v15,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SelectListIconLayer::onSelect);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v15->setTag)(v15, v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v16->setTag)(v16, v13);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v16);
sub_10071FCD0(v29, v16);
v17 = v11 - 6;
if ( v11 < 6 )
v17 = v11;
sub_10028CBE0((float *)&v28, (float)(int)(52 * v17 - 130), flt_100819D20[v11 >= 6]);
sub_10028CCE0(&v30, &v27, &v28);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *))v16->setPosition)(v16, &v30);
if ( (v32[0].r & 1) != 0 )
operator delete(__p);
++v11;
}
while ( v11 != 12 );
a1->m_joystickConnected = -1;
sub_100720270(v29);
v18 = 0;
v19 = ButtonSprite::create_1("OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SelectListIconLayer::onClose);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v20);
v21 = a1->m_buttonMenu;
sub_10028CBE0((float *)&v30, v34 * 0.5, (float)((float)(0.5 * v35) + -120.0) + 25.0);
*(cocos2d::CCPoint *)&v38 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v32,
(const cocos2d::CCPoint *)v21);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::ccColor4B *, double))v20->setPosition)(v20, v32, v38);
if ( (unsigned int)sub_100720070(a1->m_difficulties) )
{
do
{
v25 = sub_1007200C0(a1->m_difficulties, v18);
m_currentDifficulty = a1->m_currentDifficulty;
if ( m_currentDifficulty == (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v25 + 64LL))(v25) )
{
v22 = *(_QWORD *)v25;
v23 = v25;
v24 = (cocos2d::ccColor4B *)&unk_100819D28;
}
else
{
memset(v32, 125, 3);
v22 = *(_QWORD *)v25;
v23 = v25;
v24 = v32;
}
(*(void (__fastcall **)(__int64, cocos2d::ccColor4B *))(v22 + 944))(v23, v24);
++v18;
}
while ( v18 < (unsigned int)sub_100720070(a1->m_difficulties) );
}
a1->m_noElasticity = 1;
return v36;
}
return result;
}