//
// FLAlertLayer::init from 0x57e2e0 to 0x57ed90 (2736 bytes)
//
// 2 xrefs:
// > FLAlertLayer::create @ 0x57eee4
// > ??> @ 0x74f88
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool FLAlertLayer::init(FLAlertLayer *a1, int a2)
{
__int64 v2; // x3
ButtonSprite *v3; // x4
ButtonSprite *v4; // x5
bool v5; // w6
float v6; // s0
float v7; // s2
float v8; // s8
float v9; // s10
FLAlertLayerProtocol *v10; // x23
__int64 v12; // x27
ButtonSprite *v13; // x24
bool v14; // w28
char v15; // w22
GameManager *v17; // x0
cocos2d::CCDirector *v18; // x0
cocos2d::CCLayer *v19; // x0
FLAlertLayer_vtbl *v20; // x2
float v21; // s9
float v22; // s4
cocos2d::CCNode *v23; // x25
void *v24; // x0
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
float v26; // s10
double v27; // d1
float v28; // s0
cocos2d::CCNode *v29; // x27
float v30; // s4
ScrollingLayer *v31; // x0
ScrollingLayer *m_scrollingLayer; // x28
const cocos2d::_ccColor4B *v33; // x1
float v34; // s9
__int64 v35; // x28
__int64 v36; // x25
__int64 v37; // x0
cocos2d::CCNode *v38; // x25
cocos2d::CCLabelBMFont *v39; // x26
__int64 v40; // x0
cocos2d::CCMenu *v41; // x0
cocos2d::CCLayer *m_mainLayer; // x3
bool v43; // w4
__int64 v44; // x5
const char *v45; // x6
ButtonSprite *v46; // x0
CCMenuItemSpriteExtra *v47; // x25
float v48; // s9
bool v49; // w4
__int64 v50; // x5
const char *v51; // x6
ButtonSprite *v52; // x0
CCMenuItemSpriteExtra *v53; // x24
cocos2d::CCArray *v54; // x0
float v55; // s0
cocos2d::CCMenu *m_buttonMenu; // x26
void (__fastcall *v57)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
__int64 v58; // x0
float v59; // s4
void *v60; // x0
void (__fastcall *v61)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *v62)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
__int64 v63; // x0
cocos2d::CCLayer *v64; // x26
cocos2d::CCSprite *v65; // x26
cocos2d::CCMenu *v66; // x27
CCMenuItemSpriteExtra_vtbl *v67; // x1
CCMenuItemSpriteExtra *v68; // x0
cocos2d::CCLayer *v69; // x25
const cocos2d::CCPoint *v70; // x0
void (__fastcall *v71)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v72; // x23
void (__fastcall *v73)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
unsigned int *v74; // x2
int v75; // w1
unsigned int *v76; // x2
int v77; // w1
float v78; // [xsp+90h] [xbp+90h]
void (__fastcall *v79)(__int64, cocos2d::CCRect *); // [xsp+90h] [xbp+90h]
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+90h] [xbp+90h]
void (__fastcall *v81)(__int64, cocos2d::CCRect *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *v84)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
ButtonSprite *v85; // [xsp+B0h] [xbp+B0h]
float v86; // [xsp+C8h] [xbp+C8h]
float v87; // [xsp+CCh] [xbp+CCh]
cocos2d::CCSize v88; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v89; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v90; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCRect v91; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::SEL_MenuHandler v92; // 0:x2.16
cocos2d::SEL_MenuHandler v93; // 0:x2.16
cocos2d::CCSize v94; // 0:s0.4,4:s1.4
cocos2d::CCPoint v95; // 0:s0.4,4:s1.4
cocos2d::CCPoint v96; // 0:s2.4,4:s3.4
cocos2d::CCPoint v97; // 0:s2.4,4:s3.4
cocos2d::CCPoint v98; // 0:s2.4,4:s3.4
cocos2d::CCRect v99; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v85 = v3;
v8 = v6;
v91.origin.x = -1.034e-25;
v9 = v7;
v10 = *(FLAlertLayerProtocol **)&a2;
v12 = v2;
v13 = v4;
v14 = v5;
v15 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v91);
if ( v15 )
{
v17 = GameManager::sharedState();
if ( GameManager::getGameVariable(v17, "0168") )
a1->m_noElasticity = 1;
a1->m_containsBorder = v14;
a1->m_alertProtocol = v10;
a1->m_reverseKeyBack = 0;
FLAlertLayer::incrementForcePrio(a1);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v18 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v18);
v19 = cocos2d::CCLayer::create();
v20 = a1->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v19;
((void (__fastcall *)(FLAlertLayer *))v20->addChild)(a1);
if ( a1->m_containsBorder )
{
cocos2d::CCSize::CCSize(&v88, 370.0, 180.0);
v21 = (float)(v88.width - 60.0) / 0.8;
cocos2d::CCPoint::CCPoint(&v89, v86 * 0.5, v87 * 0.5);
sub_D18D28(&v91, v12);
cocos2d::CCPoint::CCPoint(&v90, 0.5, 1.0);
v96.x = 20.0;
v23 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v91,
(std::string)"chatFont.fnt",
(const char *)&v90,
v9,
v21,
v96,
v22,
0);
v24 = (void *)(*(_QWORD *)&v91.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v91.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v74 = (unsigned int *)(*(_QWORD *)&v91.origin - 8LL);
do
v75 = __ldaxr(v74);
while ( __stlxr(v75 - 1, v74) );
}
else
{
v75 = *(_DWORD *)(*(_QWORD *)&v91.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v91.origin - 8LL) = v75 - 1;
}
if ( v75 <= 0 )
operator delete(v24);
}
setAnchorPoint = v23->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v91.origin, 0.5, 0.5);
setAnchorPoint(v23, &v91.origin);
v23->setScale(v23, 0.8);
v23->setPosition(v23, &v89);
v26 = (float)((float)(v9 * v23[1].m_sAdditionalTransform.a) * 0.5) + 10.0;
v27 = v88.height * 0.5 + -20.0;
v28 = v26 * 1.2;
if ( v27 >= (float)(v26 * 1.2) )
v28 = v27;
v78 = v28;
v29 = nullptr;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v90, &v88);
cocos2d::CCPoint::CCPoint(&v91.origin, &v89);
v94.width = v78;
v31 = ScrollingLayer::create(v94, v97, v30);
a1->m_scrollingLayer = v31;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v31, 10);
a1->m_scrollingLayer->m_parentLayer = a1->m_mainLayer;
a1->m_scrollingLayer->m_contentLayer->addChild(a1->m_scrollingLayer->m_contentLayer, v23);
m_scrollingLayer = a1->m_scrollingLayer;
cocos2d::CCPoint::CCPoint(&v91.origin, 0.0, v26 * -0.5);
ScrollingLayer::setStartOffset(m_scrollingLayer, v95);
v34 = 280.0;
}
else
{
sub_D18D28(&v91, v12);
cocos2d::CCPoint::CCPoint(&v90, 0.5, 0.5);
v98.x = 20.0;
v29 = (cocos2d::CCNode *)TextArea::create(
(TextArea *)&v91,
(std::string)"chatFont.fnt",
(const char *)&v90,
1.0,
v8 - 60.0,
v98,
v59,
0);
v60 = (void *)(*(_QWORD *)&v91.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v91.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v76 = (unsigned int *)(*(_QWORD *)&v91.origin - 8LL);
do
v77 = __ldaxr(v76);
while ( __stlxr(v77 - 1, v76) );
}
else
{
v77 = *(_DWORD *)(*(_QWORD *)&v91.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v91.origin - 8LL) = v77 - 1;
}
if ( v77 <= 0 )
operator delete(v60);
}
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v29, 3);
v34 = (float)(v29[1].m_sAdditionalTransform.a * v9) + 120.0;
if ( v34 <= 140.0 )
v34 = 140.0;
if ( v9 != 1.0 )
v29->setScale(v29, v9);
}
v91.origin.x = -1.7014e38;
v35 = cocos2d::CCLayerColor::create((cocos2d::CCLayerColor *)&v91, v33, v8, v34);
v81 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v35 + 184LL);
cocos2d::CCPoint::CCPoint(&v91.origin, (float)(v86 - v8) * 0.5, (float)(v87 - v34) * 0.5);
v81(v35, &v91);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v35 + 328LL))(v35, 0);
v91.origin.x = NAN;
v36 = cocos2d::CCLayerColor::create(
(cocos2d::CCLayerColor *)&v91,
(const cocos2d::_ccColor4B *)0xFFFFFF96LL,
v8 + 16.0,
v34 + 16.0);
v79 = *(void (__fastcall **)(__int64, cocos2d::CCRect *))(*(_QWORD *)v36 + 184LL);
*(float *)&v81 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 192LL))(v35) - 8.0;
v37 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 192LL))(v35);
cocos2d::CCPoint::CCPoint(&v91.origin, *(float *)&v81, *(float *)(v37 + 4) - 8.0);
v79(v36, &v91);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v36 + 328LL))(v36, 0);
cocos2d::CCRect::CCRect(&v91, 0.0, 0.0, 94.0, 94.0);
v38 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square01_001.png",
(const char *)&v91,
v99);
setContentSize = v38->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v91, v8, v34);
setContentSize(v38, (const cocos2d::CCSize *)&v91);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v38, 1);
setPosition = v38->setPosition;
cocos2d::CCPoint::CCPoint(&v91.origin, v86 * 0.5, v87 * 0.5);
setPosition(v38, &v91.origin);
v39 = cocos2d::CCLabelBMFont::create();
v84 = v39->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v91.origin, 0.5, 1.0);
v84(v39, &v91.origin);
v80 = v39->setPosition;
v40 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 192LL))(v35);
cocos2d::CCPoint::CCPoint(&v91.origin, v86 * 0.5, (float)(v34 + *(float *)(v40 + 4)) - 15.0);
v80(v39, &v91.origin);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v39, 3);
v39->setScale(v39, 0.9);
if ( !a1->m_containsBorder )
{
v61 = v29->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v91.origin, 0.5, 0.5);
v61(v29, &v91.origin);
v62 = v29->setPosition;
v63 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 192LL))(v35);
cocos2d::CCPoint::CCPoint(&v91.origin, v86 * 0.5, (float)(*(float *)(v63 + 4) + (float)(v34 * 0.5)) + 5.0);
v62(v29, &v91.origin);
}
v41 = cocos2d::CCMenu::create();
m_mainLayer = a1->m_mainLayer;
a1->m_buttonMenu = v41;
m_mainLayer->addChild_0(m_mainLayer, v41, 2);
v46 = (ButtonSprite *)ButtonSprite::create(v85, (const char *)&qword_58 + 2, 0, 0, 1.0, v43, v44, v45);
a1->m_button1 = v46;
v92.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v92.adj = (size_t)FLAlertLayer::onBtn1;
v47 = CCMenuItemSpriteExtra::create(v46, nullptr, v92);
v48 = a1->m_button1->getContentSize(a1->m_button1)->width + 0.0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v47);
if ( v13 )
{
v52 = (ButtonSprite *)ButtonSprite::create(v13, (const char *)&qword_58 + 2, 0, 0, 1.0, v49, v50, v51);
a1->m_button2 = v52;
v93.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v93.adj = (size_t)FLAlertLayer::onBtn2;
v53 = CCMenuItemSpriteExtra::create(v52, nullptr, v93);
v48 = v48 + a1->m_button2->getContentSize(a1->m_button2)->width;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v53);
}
else
{
v53 = nullptr;
a1->m_noAction = 1;
}
if ( a1->m_buttonMenu->getChildren(a1->m_buttonMenu) )
{
v54 = a1->m_buttonMenu->getChildren(a1->m_buttonMenu);
if ( (unsigned int)cocos2d::CCArray::count(v54) > 1 )
{
v55 = (float)(v8 - v48) * 0.5;
if ( v55 >= 15.0 )
v55 = 15.0;
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(a1->m_buttonMenu, v55);
}
}
m_buttonMenu = a1->m_buttonMenu;
v57 = m_buttonMenu->setPosition;
v58 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v35 + 192LL))(v35);
cocos2d::CCPoint::CCPoint(&v91.origin, v86 * 0.5, *(float *)(v58 + 4) + 30.0);
v57(m_buttonMenu, &v91.origin);
if ( PlatformToolbox::isControllerConnected() )
{
v64 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v91.origin, v86 * 0.5, v87 * 0.5);
cocos2d::CCNode::convertToNodeSpace(v64, &v91.origin);
v65 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v65, 10);
v66 = a1->m_buttonMenu;
v67 = v47->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v68 = v47;
v69 = a1->m_mainLayer;
v70 = v67->getPosition(v68);
cocos2d::CCNode::convertToWorldSpace(v66, v70);
cocos2d::CCNode::convertToNodeSpace(v69, &v91.origin);
v71 = v65->setPosition;
cocos2d::CCPoint::CCPoint(&v91.origin, v89.x - 116.0, v90.y);
v71(v65, &v91.origin);
if ( v53 )
{
v72 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_X_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v72, 10);
v73 = v72->setPosition;
cocos2d::CCPoint::CCPoint(&v91.origin, v89.x + 116.0, v90.y);
v73(v72, &v91.origin);
}
}
a1->m_joystickConnected = -1;
}
return v15;
}