//
// SelectPremadeLayer::init from 0xb4c7b4 to 0xb4cbf0 (1084 bytes)
//
// 3 xrefs:
// > SelectPremadeLayer::create @ 0xb4cd48
// > ??> @ 0x100348
// > ??> @ 0x14bd500
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:01:57 +0000
//
__int64 __fastcall SelectPremadeLayer::init(cocos2d::CCNode **this)
{
cocos2d::CCDirector *v2; // x0
unsigned int v3; // w26
cocos2d::CCDirector *v5; // x0
int v6; // w24
__int64 v7; // x23
void (__fastcall *v8)(__int64, __int64 *); // x25
void (__fastcall *v9)(__int64, __int64 *); // x25
const char *v10; // x2
__int64 v11; // x23
void (__fastcall *v12)(__int64, __int64 *); // x25
cocos2d::CCMenu *v13; // x0
__int64 v14; // x0
cocos2d::CCNode *v15; // x23
const char *v16; // x6
ButtonSprite *v17; // x0
__int64 v18; // x0
__int64 v19; // x23
void (__fastcall *v20)(__int64, __int64 *); // x28
const char *v21; // x6
__int64 v22; // x0
__int64 v23; // x19
cocos2d::CCNode *v24; // x23
void (__fastcall *v25)(__int64, __int64 *); // x21
__int64 v26; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v27; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v28[8]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v29[2]; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v30[2]; // [xsp+D0h] [xbp+D0h] BYREF
void *v31; // [xsp+E0h] [xbp+E0h]
v2 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init((FLAlertLayer *)this, 150);
v3 = (unsigned __int8)v2;
if ( (_BYTE)v2 )
{
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v2);
v6 = 0;
cocos2d::CCDirector::getWinSize(&v26, v5);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v29, 0.0, 0.0, 80.0, 80.0);
v7 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v29);
v8 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v7 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v29, 360.0, 260.0);
v8(v7, v29);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v7, 0xFFFFFFFFLL);
v9 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v7 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, *(float *)&v26 * 0.5, *((float *)&v26 + 1) * 0.5);
v9(v7, v29);
v11 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Select Premade", "bigFont.fnt", v10);
v12 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v29,
*(float *)&v26 * 0.5,
(float)((float)(*((float *)&v26 + 1) * 0.5) + 130.0) - 20.0);
v12(v11, v29);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v11);
v13 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)v11 + 160LL))(v11, 0.9);
v14 = cocos2d::CCMenu::create(v13);
*(this + 69) = (cocos2d::CCNode *)v14;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v14, 10);
v15 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v29,
*(float *)&v26 * 0.5,
(float)((float)(*((float *)&v26 + 1) * 0.5) + 22.5) + 50.0);
cocos2d::CCNode::convertToNodeSpace(&v27, v15, (const cocos2d::CCPoint *)v29);
while ( 1 )
{
v30[0] = 0;
v30[1] = 0;
v31 = nullptr;
std::string::__init(v30, &byte_1191DE0, 1u);
if ( v6 )
{
std::string::assign(v30, "Homing\nBall");
if ( (v30[0] & 1) == 0 )
goto LABEL_6;
}
else
{
std::string::assign(v30, "Homing\nMissile");
if ( (v30[0] & 1) == 0 )
{
LABEL_6:
v17 = (ButtonSprite *)((char *)v30 + 1);
goto LABEL_7;
}
}
v17 = (ButtonSprite *)v31;
LABEL_7:
v18 = ButtonSprite::create(v17, (const char *)&qword_28, 0, 1, 0.8, "goldFont.fnt", "GJ_button_04.png", v16, 30.0);
v19 = CCMenuItemSpriteExtra::create(v18, 0, (__int64)this, (__int64)SelectPremadeLayer::onSelectPremade, 0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v19);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v19 + 72LL))(v19, (unsigned int)v6);
v20 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v19 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v28, (float)((float)((float)v6 * 110.0) + -110.0) + 55.0, -0.0);
cocos2d::CCPoint::operator+(v29, &v27);
v20(v19, v29);
if ( (v30[0] & 1) != 0 )
{
operator delete(v31);
if ( v6 )
{
LABEL_9:
v22 = ButtonSprite::create(
(ButtonSprite *)"Cancel",
(const char *)&qword_28,
0,
v6,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v21,
30.0);
v23 = CCMenuItemSpriteExtra::create(v22, 0, (__int64)this, (__int64)SelectPremadeLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v23);
v24 = *(this + 69);
v25 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v23 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v28,
*(float *)&v26 * 0.5,
(float)((float)(*((float *)&v26 + 1) * 0.5) + -130.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v29, v24, (const cocos2d::CCPoint *)v28);
v25(v23, v29);
return v3;
}
}
else if ( v6 )
{
goto LABEL_9;
}
v6 = 1;
}
}
return v3;
}