//
// FLAlertLayer::init from 0x2eafb0 to 0x2eb736 (1926 bytes)
//
// 1 xrefs:
// > FLAlertLayer::create @ 0x2eb82a
//
// 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 FLAlertLayer::init(FLAlertLayer *a1, int a2)
{
int v2; // r3
int v3; // r9
CCMenuItemSpriteExtra *v6; // r8
int v7; // r10
GameManager *v8; // r0
cocos2d::CCDirector *v9; // r0
cocos2d::CCLayer *v10; // r0
FLAlertLayer_vtbl *v11; // r3
cocos2d::CCNode *v12; // r7
float v13; // r3
float v14; // s17
float v15; // s17
float *v16; // r7
void (__fastcall *v17)(float *, cocos2d::CCRect *); // r6
float v18; // s17
double v19; // d7
float v20; // s19
cocos2d::CCSize v21; // r0
cocos2d::CCPoint v22; // r2
ScrollingLayer *v23; // r0
cocos2d::CCNode *v24; // r1
float v25; // s15
ScrollingLayer *m_scrollingLayer; // r6
cocos2d::CCPoint v27; // r1
int v28; // r6
int v29; // r11
float v30; // s20
float v31; // r0
cocos2d::CCNode *v32; // r9
cocos2d::CCLabelBMFont *v33; // r9
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11
void (__fastcall *v35)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
float v36; // s21
int v37; // r0
void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
float v40; // s21
int v41; // r0
cocos2d::CCMenu *v42; // r0
ButtonSprite *v43; // r0
CCMenuItemSpriteExtra *v44; // r7
float v45; // s17
ButtonSprite *v46; // r0
cocos2d::CCArray *v47; // r0
cocos2d::CCMenu *m_buttonMenu; // r9
void (__fastcall *v49)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
float v50; // s16
int v51; // r0
cocos2d::CCLayer *m_mainLayer; // r6
cocos2d::CCSprite *v53; // r6
cocos2d::CCLayer *v54; // r9
cocos2d::CCMenu *v55; // r11
const cocos2d::CCPoint *v56; // r0
void (__fastcall *v57)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v58; // r6
void (__fastcall *v59)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
float v61; // r1
float v62; // r2
float v63; // r3
float v64; // [sp+0h] [bp-64h]
bool v65; // [sp+4h] [bp-60h]
bool v66; // [sp+4h] [bp-60h]
void (__fastcall *v67)(int, cocos2d::CCRect *); // [sp+1Ch] [bp-48h]
void (__fastcall *v68)(int, cocos2d::CCRect *); // [sp+1Ch] [bp-48h]
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // [sp+1Ch] [bp-48h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-48h]
cocos2d::CCSize v71; // [sp+24h] [bp-40h] BYREF
cocos2d::CCPoint v72; // [sp+2Ch] [bp-38h] BYREF
cocos2d::CCPoint v73; // [sp+34h] [bp-30h] BYREF
cocos2d::CCPoint v74; // [sp+3Ch] [bp-28h] BYREF
cocos2d::CCSize v75; // [sp+44h] [bp-20h] BYREF
cocos2d::CCRect v76; // [sp+4Ch] [bp-18h] BYREF
ButtonSprite *v77; // [sp+A0h] [bp+3Ch]
ButtonSprite *v78; // [sp+A4h] [bp+40h]
const cocos2d::_ccColor4B *v79; // [sp+A8h] [bp+44h]
char v80; // [sp+ACh] [bp+48h]
const char *v81; // [sp+B4h] [bp+50h]
cocos2d::CCSize v82; // 0:^0.8
cocos2d::CCRect v83; // 0:kr00_16.16
v3 = v2;
v6 = (CCMenuItemSpriteExtra *)v78;
v76.origin.x = -1.034e-25;
v7 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v76);
if ( v7 )
{
v8 = GameManager::sharedState();
if ( GameManager::getGameVariable(v8, "0168") )
a1->m_noElasticity = 1;
a1->m_alertProtocol = (FLAlertLayerProtocol *)a2;
a1->m_containsBorder = v80;
a1->m_reverseKeyBack = 0;
FLAlertLayer::incrementForcePrio(a1);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v71, v9);
v10 = cocos2d::CCLayer::create();
v11 = a1->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v10;
v11->addChild(a1, v10);
if ( a1->m_containsBorder )
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v73, 370.0, 180.0);
v15 = (float)(v73.x - 60.0) / 0.8;
cocos2d::CCPoint::CCPoint(&v74, v71.width * 0.5, v71.height * 0.5);
sub_775C20(&v75, v3);
cocos2d::CCPoint::CCPoint(&v76.origin, 0.5, 1.0);
v16 = (float *)TextArea::create(
(TextArea *)&v75,
(std::string)"chatFont.fnt",
v81,
v15,
COERCE_FLOAT(&v76),
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v75);
v17 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v16 + 140);
cocos2d::CCPoint::CCPoint(&v76.origin, 0.5, 0.5);
v17(v16, &v76);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v16 + 80))(v16, 1061997773);
(*(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_DWORD *)v16 + 92))(v16, &v74);
v18 = (float)((float)(*(float *)&v81 * v16[87]) * 0.5) + 10.0;
v19 = v73.y * 0.5 - 20.0;
v20 = v18 * 1.2;
if ( v19 >= (float)(v18 * 1.2) )
v20 = v19;
cocos2d::CCSize::CCSize(&v75, (const cocos2d::CCSize *)&v73);
cocos2d::CCPoint::CCPoint(&v76.origin, &v74);
LODWORD(v21.width) = &v75;
LODWORD(v21.height) = &v76;
v22.x = v20;
v23 = ScrollingLayer::create(v21, v22, v64);
a1->m_scrollingLayer = v23;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, 10);
v24 = (cocos2d::CCNode *)v16;
v12 = nullptr;
a1->m_scrollingLayer->m_parentLayer = a1->m_mainLayer;
a1->m_scrollingLayer->m_contentLayer->addChild(a1->m_scrollingLayer->m_contentLayer, v24);
v25 = -(float)(v18 * 0.5);
m_scrollingLayer = a1->m_scrollingLayer;
v14 = 280.0;
cocos2d::CCPoint::CCPoint(&v76.origin, 0.0, v25);
LODWORD(v27.x) = &v76;
ScrollingLayer::setStartOffset(m_scrollingLayer, v27);
}
else
{
sub_775C20(&v75, v3);
cocos2d::CCPoint::CCPoint(&v76.origin, 0.5, 0.5);
v12 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v75,
(std::string)"chatFont.fnt",
(const char *)0x3F800000,
*(float *)&v79 - 60.0,
COERCE_FLOAT(&v76),
(cocos2d::CCPoint)1101004800LL);
sub_774008(&v75);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v12, 3);
v14 = (float)(*(float *)&v81 * v12[1].m_fSkewY) + 120.0;
if ( v14 <= 140.0 )
v14 = 140.0;
if ( *(float *)&v81 != 1.0 )
((void (__fastcall *)(cocos2d::CCNode *, const char *))v12->setScale)(v12, v81);
}
v76.origin.x = -1.7014e38;
v28 = cocos2d::CCLayerColor::create((cocos2d::CCLayerColor *)&v76, v79, v14, v13);
v67 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v28 + 92);
cocos2d::CCPoint::CCPoint(&v76.origin, (float)(v71.width - *(float *)&v79) * 0.5, (float)(v71.height - v14) * 0.5);
v67(v28, &v76);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v28 + 164))(v28, 0);
v76.origin.x = NAN;
v29 = cocos2d::CCLayerColor::create(
(cocos2d::CCLayerColor *)&v76,
COERCE_CONST_COCOS2D_CCCOLOR4B_(*(float *)&v79 + 16.0),
v14 + 16.0,
COERCE_FLOAT(150));
v68 = *(void (__fastcall **)(int, cocos2d::CCRect *))(*(_DWORD *)v29 + 92);
v30 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
v31 = (*(float (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint(&v76.origin, v30 - 8.0, *(float *)(LODWORD(v31) + 4) - 8.0);
v68(v29, &v76);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v29 + 164))(v29, 0);
cocos2d::CCRect::CCRect(&v76, 0.0, 0.0, 94.0, 94.0);
v83.origin.x = v62;
v83.origin.y = v63;
v83.size = v82;
v32 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square01_001.png",
(const char *)&v76,
v83);
setContentSize = v32->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v76, *(float *)&v79, v14);
setContentSize(v32, (const cocos2d::CCSize *)&v76);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v32, 1);
setPosition = v32->setPosition;
cocos2d::CCPoint::CCPoint(&v76.origin, v71.width * 0.5, v71.height * 0.5);
setPosition(v32, &v76.origin);
v33 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v33->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v76.origin, 0.5, 1.0);
setAnchorPoint(v33, &v76.origin);
v35 = v33->setPosition;
v36 = v71.width * 0.5;
v37 = (*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint(&v76.origin, v36, (float)(v14 + *(float *)(v37 + 4)) - 15.0);
v35(v33, &v76.origin);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v33, 3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v33->setScale)(v33, 1063675494);
if ( !a1->m_containsBorder )
{
v38 = v12->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v76.origin, 0.5, 0.5);
v38(v12, &v76.origin);
v39 = v12->setPosition;
v40 = v71.width * 0.5;
v41 = (*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint(&v76.origin, v40, (float)(*(float *)(v41 + 4) + (float)(v14 * 0.5)) + 5.0);
v39(v12, &v76.origin);
}
v42 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v42;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v42, 2);
v43 = ButtonSprite::create(v77, (const char *)&dword_58 + 2, 0, 1.0, 0.0, v65);
LODWORD(v75.width) = FLAlertLayer::onBtn1;
v75.height = 0.0;
a1->m_button1 = v43;
v44 = CCMenuItemSpriteExtra::create(
v43,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FLAlertLayer::onBtn1, (unsigned int)a1));
v45 = a1->m_button1->getContentSize(a1->m_button1)->width + 0.0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v44);
if ( v78 )
{
v46 = ButtonSprite::create(v78, (const char *)&dword_58 + 2, 0, 1.0, 0.0, v66);
LODWORD(v76.origin.x) = FLAlertLayer::onBtn2;
v76.origin.y = 0.0;
a1->m_button2 = v46;
v6 = CCMenuItemSpriteExtra::create(
v46,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(FLAlertLayer::onBtn2, (unsigned int)a1));
v45 = v45 + a1->m_button2->getContentSize(a1->m_button2)->width;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v6);
}
else
{
a1->m_noAction = 1;
}
if ( a1->m_buttonMenu->getChildren(a1->m_buttonMenu) )
{
v47 = a1->m_buttonMenu->getChildren(a1->m_buttonMenu);
if ( cocos2d::CCArray::count(v47) > 1u )
{
if ( (float)((float)(*(float *)&v79 - v45) * 0.5) < 15.0 )
v61 = (float)(*(float *)&v79 - v45) * 0.5;
else
v61 = 15.0;
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(a1->m_buttonMenu, v61);
}
}
m_buttonMenu = a1->m_buttonMenu;
v49 = m_buttonMenu->setPosition;
v50 = v71.width * 0.5;
v51 = (*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint(&v74, v50, *(float *)(v51 + 4) + 30.0);
v49(m_buttonMenu, &v74);
if ( PlatformToolbox::isControllerConnected() )
{
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v74, v71.width * 0.5, v71.height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v72, m_mainLayer, &v74);
v53 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v53, 10);
v54 = a1->m_mainLayer;
v55 = a1->m_buttonMenu;
v56 = v44->getPosition(v44);
cocos2d::CCNode::convertToWorldSpace(&v74, v55, v56);
cocos2d::CCNode::convertToNodeSpace(&v73, v54, &v74);
v57 = v53->setPosition;
cocos2d::CCPoint::CCPoint(&v74, v72.x - 116.0, v73.y);
v57(v53, &v74);
if ( v6 )
{
v58 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_X_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v58, 10);
v59 = v58->setPosition;
cocos2d::CCPoint::CCPoint(&v74, v72.x + 116.0, v73.y);
v59(v58, &v74);
}
}
a1->m_joystickConnected = -1;
}
return v7;
}