//
// GJDropDownLayer::init from 0x1003b21f4 to 0x1003b25ec (1016 bytes)
//
// 3 xrefs:
// > RetryLevelLayer::create @ 0x1001b2ee0
// > EndLevelLayer::create @ 0x1002f57ac
// > GJDropDownLayer::init_1 @ 0x1003b25f8
//
// 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 GJDropDownLayer::init(GJDropDownLayer *a1, const char *a2, float a3, bool a4)
{
cocos2d::CCDirector *v8; // x0
cocos2d::CCTouchDispatcher *v9; // x0
_BOOL4 v10; // w21
cocos2d::CCDirector *v11; // x0
cocos2d::CCLayer *v12; // x0
__n128 v13; // q0
__n128 v14; // q1
__n128 v15; // q0
__n128 v16; // q1
double v17; // d0
GJListLayer *v18; // x0
__n128 v19; // q0
GJListLayer *m_listLayer; // x22
__n128 v21; // q1
cocos2d::CCSprite *v22; // x0
CCMenuItemSpriteExtra *v23; // x22
__int64 v24; // x1
__int64 v25; // x2
__int64 v26; // x3
__int64 v27; // x4
__int64 v28; // x5
__int64 v29; // x6
__int64 v30; // x7
cocos2d::CCMenu *v31; // x23
cocos2d::CCDirector *v32; // x0
float v33; // s9
cocos2d::CCDirector *v34; // x0
__n128 v35; // q1
__n128 v36; // q0
float v37; // s8
cocos2d::CCSprite *v38; // x24
__n128 v39; // q0
__n128 v40; // q1
__n128 v41; // q0
__n128 v42; // q1
cocos2d::CCSprite *v43; // x23
__n128 v44; // q0
__n128 v45; // q1
__n128 v46; // q0
__n128 v47; // q1
double v49; // [xsp+10h] [xbp-70h] BYREF
float v50; // [xsp+18h] [xbp-68h] BYREF
float v51; // [xsp+1Ch] [xbp-64h]
cocos2d::SEL_MenuHandler v52; // 0:x3.16
v8 = cocos2d::CCDirector::sharedDirector();
v9 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v8->getTouchDispatcher)(v8);
cocos2d::CCTouchDispatcher::registerForcePrio(v9, a1, 2);
v50 = 1.0634e37;
v10 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)&v50);
if ( v10 )
{
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v11);
v12 = cocos2d::CCLayer::create();
a1->m_mainLayer = v12;
v13 = ((__n128 (__fastcall *)(GJDropDownLayer *, cocos2d::CCLayer *))a1->addChild)(a1, v12);
v13.n128_u32[0] = 0;
v14.n128_u32[0] = 0;
sub_100022980(v13, v14, &v49);
v15.n128_f64[0] = sub_1000229D0(&a1->m_endPosition, &v49);
v16.n128_f32[0] = v51;
v15.n128_u32[0] = 0;
sub_100022980(v15, v16, &v49);
v17 = sub_1000229D0(&a1->m_startPosition, &v49);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCPoint *, double))a1->m_mainLayer->setPosition)(
a1->m_mainLayer,
&a1->m_startPosition,
v17);
v18 = GJListLayer::create(nullptr, a2, (cocos2d::ccColor4B)-1275068416, 356.0, a3, 0);
a1->m_listLayer = v18;
v19 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, GJListLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v18);
v19.n128_f32[0] = (float)(v50 + -356.0) * 0.5;
m_listLayer = a1->m_listLayer;
v21.n128_f32[0] = (float)((float)((float)(v51 - a3) * 0.5) + -10.0) + 5.0;
sub_100022980(v19, v21, &v49);
((void (__fastcall *)(GJListLayer *, double *))m_listLayer->setPosition)(m_listLayer, &v49);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v52.ptr = (void (__cdecl *)(cocos2d::CCObject *))1304;
v52.adj = 1;
v23 = CCMenuItemSpriteExtra::create(v22, nullptr, a1, v52);
CCMenuItemSpriteExtra::setSizeMult(v23, 1.6);
v31 = sub_1001D7ED0(v23, v24, v25, v26, v27, v28, v29, v30, 0);
a1->m_buttonMenu = v31;
v32 = cocos2d::CCDirector::sharedDirector();
v33 = sub_1001768D8((__int64)v32) + 24.0;
v34 = cocos2d::CCDirector::sharedDirector();
v35.n128_f32[0] = sub_1001768C8((__int64)v34) + -23.0;
v36.n128_f32[0] = v33;
sub_100022980(v36, v35, &v49);
((void (__fastcall *)(cocos2d::CCMenu *, double *))v31->setPosition)(v31, &v49);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
v37 = (float)(*(float *)(((__int64 (__fastcall *)(GJListLayer *))a1->m_listLayer->getPosition)(a1->m_listLayer) + 4)
+ a3)
+ 12.0;
v38 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
v39 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v38,
0xFFFFFFFFLL);
v39.n128_u32[0] = 0.5;
v40.n128_u32[0] = 0;
sub_100022980(v39, v40, &v49);
v41 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, double *))v38->setAnchorPoint)(v38, &v49);
v41.n128_f32[0] = (float)(v50 * 0.5) + -156.0;
v42.n128_f32[0] = v37;
sub_100022980(v41, v42, &v49);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v38->setPosition)(v38, &v49);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v38->setTag)(v38, 0);
v43 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
v44 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v43,
0xFFFFFFFFLL);
v44.n128_u32[0] = 0.5;
v45.n128_u32[0] = 0;
sub_100022980(v44, v45, &v49);
v46 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, double *))v43->setAnchorPoint)(v43, &v49);
v46.n128_f32[0] = (float)(v50 * 0.5) + 156.0;
v47.n128_f32[0] = v37;
sub_100022980(v46, v47, &v49);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v43->setPosition)(v43, &v49);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v43->setTag)(v43, 1);
a1->m_closeOnHide = 0;
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->hideLayer)(a1, 1);
a1->m_closeOnHide = 1;
((void (__fastcall *)(GJDropDownLayer *))a1->customSetup)(a1);
if ( PlatformToolbox::isControllerConnected() && !a4 )
GameToolbox::addBackButton(a1->m_mainLayer, v23);
}
return v10;
}