//
// GJDropDownLayer::init from 0x1005e8080 to 0x1005e8473 (1011 bytes)
//
// 5 xrefs:
// > EndLevelLayer::create @ 0x1004bfc6d
// > EndLevelLayer::init @ 0x1004bfcd0
// > RetryLevelLayer::create @ 0x1004f81ae
// > GJDropDownLayer::create @ 0x1005e8023
// > GJDropDownLayer::init_1 @ 0x1005e84af
//
// 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)
{
_BOOL4 v4; // r14d
cocos2d::CCDirector *v5; // rax
cocos2d::CCTouchDispatcher *v6; // rax
bool result; // al
cocos2d::CCLayer *v8; // rax
double v9; // xmm0_8
GJListLayer *v10; // rax
GJListLayer *m_listLayer; // r15
cocos2d::CCSprite *v12; // rax
CCMenuItemSpriteExtra *v13; // r15
int v14; // edx
int v15; // ecx
int v16; // r8d
int v17; // r9d
cocos2d::CCMenu *v18; // r12
cocos2d::CCDirector *v19; // rax
cocos2d::CCDirector *v20; // rax
float v21; // xmm1_4
__int64 v22; // rax
cocos2d::CCSprite *v23; // r13
cocos2d::CCSprite *v24; // r12
float v25; // [rsp+Ch] [rbp-44h] BYREF
float v26; // [rsp+10h] [rbp-40h]
double v27; // [rsp+14h] [rbp-3Ch] BYREF
float v28; // [rsp+1Ch] [rbp-34h]
float v29; // [rsp+20h] [rbp-30h]
bool v30; // [rsp+27h] [rbp-29h]
double v31; // 0:xmm0_8.8
v4 = *(_BOOL4 *)&a4;
v29 = a3;
v5 = cocos2d::CCDirector::sharedDirector();
v6 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v5->getTouchDispatcher)(v5);
cocos2d::CCTouchDispatcher::registerForcePrio(v6, a1, 2);
v25 = 1.0633824e37;
result = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)&v25);
if ( result )
{
v30 = result;
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v31 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v25);
v8 = cocos2d::CCLayer::create();
a1->m_mainLayer = v8;
((void (__fastcall *)(GJDropDownLayer *, cocos2d::CCLayer *, double))a1->addChild)(a1, v8, v31);
sub_10028CBE0((float *)&v27, 0.0, 0.0);
sub_10028CC90(&a1->m_endPosition, &v27);
sub_10028CBE0((float *)&v27, 0.0, v26);
v9 = sub_10028CC90(&a1->m_startPosition, &v27);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCPoint *, double))a1->m_mainLayer->setPosition)(
a1->m_mainLayer,
&a1->m_startPosition,
v9);
v10 = GJListLayer::create(nullptr, a2, (cocos2d::ccColor4B)-1275068416, 356.0, v29, 0);
a1->m_listLayer = v10;
((void (__fastcall *)(cocos2d::CCLayer *, GJListLayer *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v10);
m_listLayer = a1->m_listLayer;
sub_10028CBE0((float *)&v27, (float)(v25 + -356.0) * 0.5, (float)((float)((float)(v26 - v29) * 0.5) + -10.0) + 5.0);
((void (__fastcall *)(GJListLayer *, double *))m_listLayer->setPosition)(m_listLayer, &v27);
v12 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v13 = CCMenuItemSpriteExtra::create(v12, nullptr, a1, (cocos2d::SEL_MenuHandler)0x519uLL);
CCMenuItemSpriteExtra::setSizeMult(v13, 1.6);
v18 = (cocos2d::CCMenu *)sub_100792C50((_DWORD)v13, 0, v14, v15, v16, v17);
a1->m_buttonMenu = v18;
v19 = cocos2d::CCDirector::sharedDirector();
v28 = sub_100484D90((__int64)v19) + 24.0;
v20 = cocos2d::CCDirector::sharedDirector();
v21 = sub_100484D70((__int64)v20) + -23.0;
sub_10028CBE0((float *)&v27, v28, v21);
((void (__fastcall *)(cocos2d::CCMenu *, double *))v18->setPosition)(v18, &v27);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_buttonMenu,
10);
v22 = ((__int64 (__fastcall *)(GJListLayer *))a1->m_listLayer->getPosition)(a1->m_listLayer);
v29 = (float)(v29 + *(float *)(v22 + 4)) + 12.0;
v23 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v23,
0xFFFFFFFFLL);
v28 = *(float *)&v4;
sub_10028CBE0((float *)&v27, 0.5, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v23->setAnchorPoint)(v23, &v27);
sub_10028CBE0((float *)&v27, (float)(v25 * 0.5) + -156.0, v29);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v23->setPosition)(v23, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v23->setTag)(v23, 0);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("chain_01_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v24,
0xFFFFFFFFLL);
sub_10028CBE0((float *)&v27, 0.5, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v24->setAnchorPoint)(v24, &v27);
sub_10028CBE0((float *)&v27, (float)(0.5 * v25) + 156.0, v29);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v24->setPosition)(v24, &v27);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v24->setTag)(v24, 1);
a1->m_closeOnHide = 0;
((void (__fastcall *)(GJDropDownLayer *, __int64))a1->hideLayer)(a1, 1);
a1->m_closeOnHide = 1;
((void (__fastcall *)(GJDropDownLayer *))a1->customSetup)(a1);
if ( !(LOBYTE(v28) | !PlatformToolbox::isControllerConnected()) )
GameToolbox::addBackButton(a1->m_mainLayer, v13);
return v30;
}
return result;
}