//
// FLAlertLayer::init from 0x1002abf7c to 0x1002ac8c0 (2372 bytes)
//
// 1 xrefs:
// > FLAlertLayer::create @ 0x1002abe28
//
// 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 FLAlertLayer::init(
FLAlertLayer *a1,
FLAlertLayerProtocol *a2,
const char *a3,
__int64 a4,
const char *a5,
const char *a6,
bool a7,
float a8,
double a9,
float a10)
{
_BOOL8 v19; // x20
GameManager *v20; // x0
cocos2d::CCDirector *v21; // x0
cocos2d::CCLayer *v22; // x0
__n128 v23; // q1
float v24; // s10
__n128 v25; // q0
__n128 v26; // q1
__n128 v27; // q1
__n128 v28; // q0
__n128 v29; // q0
float *v30; // x24
__n128 v31; // q0
__n128 v32; // q1
float v33; // s10
double v34; // d0
float v35; // s9
float v36; // s4
ScrollingLayer *v37; // x0
ScrollingLayer *m_scrollingLayer; // x8
__n128 v39; // q0
ScrollingLayer *v40; // x24
__n128 v41; // q1
float *v42; // x25
float v43; // s10
cocos2d::CCLayerColor *v44; // x24
__n128 v45; // q0
__n128 v46; // q1
cocos2d::CCLayerColor *v47; // x26
float v48; // s9
__n128 v49; // q1
__n128 v50; // q0
cocos2d::extension::CCScale9Sprite *v51; // x26
__n128 v52; // q0
__n128 v53; // q1
cocos2d::CCLabelBMFont *v54; // x23
__n128 v55; // q0
__n128 v56; // q1
float v57; // s9
__n128 v58; // q1
__n128 v59; // q0
__n128 v60; // q0
__n128 v61; // q1
float v62; // s9
__n128 v63; // q1
__n128 v64; // q0
cocos2d::CCMenu *v65; // x0
ButtonSprite *v66; // x0
CCMenuItemSpriteExtra *v67; // x22
float v68; // s9
ButtonSprite *v69; // x0
CCMenuItemSpriteExtra *v70; // x21
bool v71; // w25
__int64 v72; // x0
cocos2d::CCMenu *m_buttonMenu; // x21
float v74; // s8
__n128 v75; // q1
__n128 v76; // q0
__n128 v77; // q0
__n128 v78; // q1
cocos2d::CCNode *m_mainLayer; // x21
cocos2d::CCSprite *v80; // x21
cocos2d::CCNode *v81; // x23
cocos2d::CCNode *v82; // x24
const cocos2d::CCPoint *v83; // x0
__n128 v84; // q0
__n128 v85; // q1
cocos2d::CCSprite *v86; // x21
__n128 v87; // q0
__n128 v88; // q1
__int64 v90[2]; // [xsp+0h] [xbp-D0h] BYREF
__int64 v91; // [xsp+10h] [xbp-C0h] BYREF
cocos2d::CCPoint v92; // [xsp+18h] [xbp-B8h] BYREF
void *__p[2]; // [xsp+20h] [xbp-B0h] BYREF
__int64 v94; // [xsp+30h] [xbp-A0h]
cocos2d::CCPoint v95; // [xsp+38h] [xbp-98h] BYREF
void *__dst[2]; // [xsp+40h] [xbp-90h] BYREF
__int64 v97; // [xsp+50h] [xbp-80h]
float v98; // [xsp+58h] [xbp-78h]
float v99; // [xsp+5Ch] [xbp-74h]
cocos2d::SEL_MenuHandler v100; // 0:x3.16
cocos2d::SEL_MenuHandler v101; // 0:x3.16
cocos2d::CCSize v102; // 0:s0.4,4:s1.4
cocos2d::CCPoint v103; // 0:s0.4,4:s1.4
cocos2d::CCPoint v104; // 0:s2.4,4:s3.4
cocos2d::CCRect v105; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
LODWORD(v90[0]) = -1778384896;
v19 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)v90);
if ( v19 )
{
v20 = GameManager::sharedState();
if ( GameManager::getGameVariable(v20, "0168") )
a1->m_noElasticity = 1;
a1->m_containsBorder = a7;
a1->m_alertProtocol = a2;
a1->m_reverseKeyBack = 0;
FLAlertLayer::incrementForcePrio(a1);
((void (__fastcall *)(FLAlertLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(FLAlertLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(FLAlertLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v21 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v21);
v22 = cocos2d::CCLayer::create();
a1->m_mainLayer = v22;
((void (__fastcall *)(FLAlertLayer *, cocos2d::CCLayer *))a1->addChild)(a1, v22);
if ( a1->m_containsBorder )
{
sub_100022988((float *)v90, 370.0, 180.0);
v24 = *(float *)v90;
v25.n128_f32[0] = v98 * 0.5;
v26.n128_f32[0] = v99 * 0.5;
sub_100022980(v25, v26, &v95);
if ( *(char *)(a4 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a4, *(_QWORD *)(a4 + 8));
}
else
{
v28 = *(__n128 *)a4;
*(_OWORD *)__p = *(_OWORD *)a4;
v94 = *(_QWORD *)(a4 + 16);
}
v28.n128_u32[0] = 0.5;
v27.n128_u32[0] = 1.0;
sub_100022980(v28, v27, &v92);
v30 = (float *)TextArea::create(
(__int64)__p,
(__int64)"chatFont.fnt",
(__int64 *)&v92,
0,
a10,
(float)(v24 + -60.0) / 0.8,
20.0);
if ( SHIBYTE(v94) < 0 )
operator delete(__p[0]);
v31.n128_u32[0] = 0.5;
v32.n128_u32[0] = 0.5;
sub_100022980(v31, v32, &v92);
(*(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_QWORD *)v30 + 280LL))(v30, &v92);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v30 + 160LL))(v30, 0.8);
(*(void (__fastcall **)(float *, cocos2d::CCPoint *))(*(_QWORD *)v30 + 184LL))(v30, &v95);
v33 = (float)((float)(v30[109] * a10) * 0.5) + 10.0;
v34 = *((float *)v90 + 1) * 0.5 + -20.0;
if ( v34 >= (float)(v33 * 1.2) )
v35 = v34;
else
v35 = v33 * 1.2;
sub_100022AFC(&v92, (double *)v90);
sub_1000229B8(&v91, (__int64 *)&v95);
v102.width = v35;
v37 = ScrollingLayer::create(v102, v104, v36);
a1->m_scrollingLayer = v37;
((void (__fastcall *)(cocos2d::CCLayer *, ScrollingLayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v37,
10);
m_scrollingLayer = a1->m_scrollingLayer;
m_scrollingLayer->m_parentLayer = a1->m_mainLayer;
v39 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, float *))m_scrollingLayer->m_contentLayer->addChild)(
m_scrollingLayer->m_contentLayer,
v30);
v40 = a1->m_scrollingLayer;
v41.n128_f32[0] = v33 * -0.5;
v39.n128_u32[0] = 0;
sub_100022980(v39, v41, &v92);
ScrollingLayer::setStartOffset(v40, v103);
v42 = nullptr;
v43 = 280.0;
}
else
{
if ( *(char *)(a4 + 23) < 0 )
{
sub_1000097D0(__dst, *(void **)a4, *(_QWORD *)(a4 + 8));
}
else
{
v29 = *(__n128 *)a4;
*(_OWORD *)__dst = *(_OWORD *)a4;
v97 = *(_QWORD *)(a4 + 16);
}
v29.n128_u32[0] = 0.5;
v23.n128_u32[0] = 0.5;
sub_100022980(v29, v23, v90);
v42 = (float *)TextArea::create((__int64)__dst, (__int64)"chatFont.fnt", v90, 0, 1.0, a8 + -60.0, 20.0);
if ( SHIBYTE(v97) < 0 )
operator delete(__dst[0]);
((void (__fastcall *)(cocos2d::CCLayer *, float *, __int64))a1->m_mainLayer->addChild_0)(a1->m_mainLayer, v42, 3);
v43 = fmaxf((float)(v42[109] * a10) + 120.0, 140.0);
if ( a10 != 1.0 )
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v42 + 160LL))(v42, a10);
}
LODWORD(v90[0]) = -16777216;
v44 = cocos2d::CCLayerColor::create((const cocos2d::ccColor4B *)v90, a8, v43);
v45.n128_f32[0] = (float)(v98 - a8) * 0.5;
v46.n128_f32[0] = (float)(v99 - v43) * 0.5;
sub_100022980(v45, v46, v90);
((void (__fastcall *)(cocos2d::CCLayerColor *, __int64 *))v44->setPosition)(v44, v90);
((void (__fastcall *)(cocos2d::CCLayerColor *, _QWORD))v44->setVisible)(v44, 0);
LODWORD(v90[0]) = -6908266;
v47 = cocos2d::CCLayerColor::create((const cocos2d::ccColor4B *)v90, a8 + 16.0, v43 + 16.0);
v48 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLayerColor *))v44->getPosition)(v44) + -8.0;
v49.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(cocos2d::CCLayerColor *))v44->getPosition)(v44) + 4) + -8.0;
v50.n128_f32[0] = v48;
sub_100022980(v50, v49, v90);
((void (__fastcall *)(cocos2d::CCLayerColor *, __int64 *))v47->setPosition)(v47, v90);
((void (__fastcall *)(cocos2d::CCLayerColor *, _QWORD))v47->setVisible)(v47, 0);
sub_100022990((float *)v90, 0.0, 0.0, 94.0, 94.0);
v51 = cocos2d::extension::CCScale9Sprite::create("square01_001.png", v105);
sub_100022988((float *)v90, a8, v43);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64 *))v51->setContentSize)(v51, v90);
v52 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v51,
1);
v52.n128_f32[0] = v98 * 0.5;
v53.n128_f32[0] = v99 * 0.5;
sub_100022980(v52, v53, v90);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64 *))v51->setPosition)(v51, v90);
v54 = cocos2d::CCLabelBMFont::create_1(a3, "goldFont.fnt");
v55.n128_u32[0] = 0.5;
v56.n128_u32[0] = 1.0;
sub_100022980(v55, v56, v90);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64 *))v54->setAnchorPoint)(v54, v90);
v57 = v98 * 0.5;
v58.n128_f32[0] = (float)(v43
+ *(float *)(((__int64 (__fastcall *)(cocos2d::CCLayerColor *))v44->getPosition)(v44) + 4))
+ -15.0;
v59.n128_f32[0] = v57;
sub_100022980(v59, v58, v90);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64 *))v54->setPosition)(v54, v90);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v54,
3);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v54->setScale)(v54, 0.9);
if ( !a1->m_containsBorder )
{
v60.n128_u32[0] = 0.5;
v61.n128_u32[0] = 0.5;
sub_100022980(v60, v61, v90);
(*(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v42 + 280LL))(v42, v90);
v62 = v98 * 0.5;
v63.n128_f32[0] = (float)((float)(v43 * 0.5)
+ *(float *)(((__int64 (__fastcall *)(cocos2d::CCLayerColor *))v44->getPosition)(v44) + 4))
+ 5.0;
v64.n128_f32[0] = v62;
sub_100022980(v64, v63, v90);
(*(void (__fastcall **)(float *, __int64 *))(*(_QWORD *)v42 + 184LL))(v42, v90);
}
v65 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v65;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v65,
2);
v66 = sub_10005F2BC(a5, 90, 0, 0, 1.0);
a1->m_button1 = v66;
v100.ptr = (void (__cdecl *)(cocos2d::CCObject *))FLAlertLayer::onBtn1;
v100.adj = 0;
v67 = CCMenuItemSpriteExtra::create(v66, nullptr, a1, v100);
v68 = *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->m_button1->getContentSize)(a1->m_button1) + 0.0;
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v67);
if ( a6 )
{
v69 = sub_10005F2BC(a6, 90, 0, 0, 1.0);
a1->m_button2 = v69;
v101.ptr = (void (__cdecl *)(cocos2d::CCObject *))FLAlertLayer::onBtn2;
v101.adj = 0;
v70 = CCMenuItemSpriteExtra::create(v69, nullptr, a1, v101);
v68 = v68 + *(float *)((__int64 (__fastcall *)(ButtonSprite *))a1->m_button2->getContentSize)(a1->m_button2);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v70);
v71 = v70 == nullptr;
}
else
{
v71 = 1;
a1->m_noAction = 1;
}
if ( ((__int64 (__fastcall *)(cocos2d::CCMenu *))a1->m_buttonMenu->getChildren)(a1->m_buttonMenu) )
{
v72 = ((__int64 (__fastcall *)(cocos2d::CCMenu *))a1->m_buttonMenu->getChildren)(a1->m_buttonMenu);
if ( (unsigned int)sub_10024A36C(v72) >= 2 )
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(a1->m_buttonMenu, fminf((float)(a8 - v68) * 0.5, 15.0));
}
m_buttonMenu = a1->m_buttonMenu;
v74 = v98 * 0.5;
v75.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(cocos2d::CCLayerColor *))v44->getPosition)(v44) + 4) + 30.0;
v76.n128_f32[0] = v74;
sub_100022980(v76, v75, v90);
((void (__fastcall *)(cocos2d::CCMenu *, __int64 *))m_buttonMenu->setPosition)(m_buttonMenu, v90);
if ( PlatformToolbox::isControllerConnected() )
{
m_mainLayer = a1->m_mainLayer;
v77.n128_f32[0] = v98 * 0.5;
v78.n128_f32[0] = v99 * 0.5;
sub_100022980(v77, v78, &v95);
cocos2d::CCNode::convertToNodeSpace(m_mainLayer, &v95);
v80 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_B_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v80,
10);
v81 = a1->m_mainLayer;
v82 = a1->m_buttonMenu;
v83 = (const cocos2d::CCPoint *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v67->getPosition)(v67);
cocos2d::CCNode::convertToWorldSpace(v82, v83);
cocos2d::CCNode::convertToNodeSpace(v81, &v92);
v84.n128_f32[0] = *(float *)v90 + -116.0;
v85.n128_u32[0] = LODWORD(v95.y);
sub_100022980(v84, v85, &v92);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *))v80->setPosition)(v80, &v92);
if ( !v71 )
{
v86 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_X_001.png");
v87 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v86,
10);
v87.n128_f32[0] = *(float *)v90 + 116.0;
v88.n128_u32[0] = LODWORD(v95.y);
sub_100022980(v87, v88, &v92);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCPoint *))v86->setPosition)(v86, &v92);
}
}
a1->m_joystickConnected = -1;
}
return v19;
}