//
// SelectPremadeLayer::init from 0x1000632d8 to 0x1000636a8 (976 bytes)
//
// 2 xrefs:
// > SelectPremadeLayer::create @ 0x100062fbc
// > ??> @ 0x100775480
//
// 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 SelectPremadeLayer::init(SelectPremadeLayer *a1)
{
_BOOL4 inited; // w0
cocos2d::CCDirector *v3; // x0
cocos2d::extension::CCScale9Sprite *v4; // x21
__n128 v5; // q0
__n128 v6; // q1
cocos2d::CCLabelBMFont *v7; // x21
__n128 v8; // q0
__n128 v9; // q1
cocos2d::CCMenu *v10; // x0
__n128 v11; // q0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v13; // q1
__int64 v14; // x25
char v15; // w8
char v16; // w21
const std::string::value_type *v17; // x1
std::string *v18; // x0
ButtonSprite *v19; // x0
CCMenuItemSpriteExtra *v20; // x26
__n128 v21; // q0
__n128 v22; // q1
double v23; // d0
ButtonSprite *v24; // x0
CCMenuItemSpriteExtra *v25; // x21
__n128 v26; // q0
cocos2d::CCMenu *v27; // x20
__n128 v28; // q1
bool v30; // [xsp+4h] [xbp-9Ch]
float32x2_t v31; // [xsp+8h] [xbp-98h] BYREF
float32x2_t v32; // [xsp+10h] [xbp-90h] BYREF
std::string v33; // [xsp+18h] [xbp-88h] BYREF
float32x2_t v34; // [xsp+30h] [xbp-70h] BYREF
float v35; // [xsp+38h] [xbp-68h]
float v36; // [xsp+3Ch] [xbp-64h]
cocos2d::CCPoint v37; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v38; // 0:x3.16
cocos2d::SEL_MenuHandler v39; // 0:x3.16
cocos2d::CCRect v40; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
inited = FLAlertLayer::init_1(a1, 150);
if ( inited )
{
v30 = inited;
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
sub_100022990((float *)&v33, 0.0, 0.0, 80.0, 80.0);
v4 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v40);
sub_100022988((float *)&v33, 360.0, 260.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v4->setContentSize)(v4, &v33);
v5 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v4,
0xFFFFFFFFLL);
v5.n128_f32[0] = v35 * 0.5;
v6.n128_f32[0] = v36 * 0.5;
sub_100022980(v5, v6, &v33);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v4->setPosition)(v4, &v33);
v7 = cocos2d::CCLabelBMFont::create_1("Select Premade", "bigFont.fnt");
v8.n128_f32[0] = v35 * 0.5;
v9.n128_f32[0] = (float)((float)(v36 * 0.5) + 130.0) + -20.0;
sub_100022980(v8, v9, &v33);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v7->setPosition)(v7, &v33);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v7);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v7->setScale)(v7, 0.9);
v10 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v10;
v11 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
10);
m_buttonMenu = a1->m_buttonMenu;
v11.n128_f32[0] = v35 * 0.5;
v13.n128_f32[0] = (float)((float)(v36 * 0.5) + 22.5) + 50.0;
sub_100022980(v11, v13, &v33);
cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)&v33);
v14 = 0;
v15 = 1;
do
{
v16 = v15;
sub_100009900(&v33, "-");
if ( (v14 & 1) != 0 )
v17 = "Homing\nBall";
else
v17 = "Homing\nMissile";
std::string::assign(&v33, v17);
if ( (v33.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &v33;
else
v18 = (std::string *)v33.__r_.__value_.__r.__words[0];
v19 = ButtonSprite::create_1((const char *)v18, 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_04.png", 30.0);
v38.ptr = (void (__cdecl *)(cocos2d::CCObject *))SelectPremadeLayer::onSelectPremade;
v38.adj = 0;
v20 = CCMenuItemSpriteExtra::create(v19, nullptr, a1, v38);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v20);
v21 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v20->setTag)(v20, v14);
v21.n128_f32[0] = (float)(45 * v14 - 90) + 22.5;
v22.n128_u64[0] = 0x8000000080000000LL;
sub_100022980(v21, v22, &v31);
*(float32x2_t *)&v23 = sub_1000229DC(&v34, &v31, &v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v20->setPosition)(v20, &v32, v23);
if ( SHIBYTE(v33.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v33.__r_.__value_.__l.__data_);
v15 = 0;
v14 = 1;
}
while ( (v16 & 1) != 0 );
v24 = ButtonSprite::create_1("Cancel", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v39.ptr = (void (__cdecl *)(cocos2d::CCObject *))SelectPremadeLayer::onClose;
v39.adj = 0;
v25 = CCMenuItemSpriteExtra::create(v24, nullptr, a1, v39);
v26 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v25);
v27 = a1->m_buttonMenu;
v26.n128_f32[0] = v35 * 0.5;
v28.n128_f32[0] = (float)((float)(v36 * 0.5) + -130.0) + 25.0;
sub_100022980(v26, v28, &v32);
v37 = cocos2d::CCNode::convertToNodeSpace(v27, (const cocos2d::CCPoint *)&v32);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v25->setPosition)(
v25,
&v33,
v37.x,
v37.y);
LOBYTE(inited) = v30;
}
return inited;
}