//
// SetupSmartBlockLayer::init from 0xb14e4c to 0xb15a24 (3032 bytes)
//
// 2 xrefs:
// > SetupSmartBlockLayer::create @ 0xb15bd0
// > ??> @ 0x94ba0
//
// 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:31 +0000
//
__int64 __fastcall SetupSmartBlockLayer::init(cocos2d::CCMenu **this, SmartGameObject *a2, cocos2d::CCArray *a3)
{
unsigned __int8 v5; // w0
unsigned int v6; // w27
cocos2d::CCDirector *started; // x0
cocos2d::CCDirector *v8; // x0
__int64 v9; // x21
void (__fastcall *v10)(__int64, __int64 *); // x24
void (__fastcall *v11)(__int64, __int64 *); // x24
const char *v12; // x2
__int64 v13; // x24
void (__fastcall *v14)(__int64, __int64 *); // x28
const char *v15; // x6
__int64 v16; // x0
const char *v17; // x6
__int64 v18; // x0
const char *v19; // x6
__int64 v20; // x0
const char *v21; // x6
__int64 v22; // x0
const char *v23; // x6
__int64 v24; // x0
__int64 v25; // x28
const char *v26; // x6
__int64 v27; // x0
const char *v28; // x6
__int64 v29; // x0
__int64 v30; // x0
__int64 v31; // x0
__int64 v32; // x21
void (__fastcall *v33)(__int64, __int64 *); // x23
__int64 v34; // x24
void (__fastcall *v35)(__int64, __int64 *); // x28
CCMenuItemToggler *ToggleButton; // x28
CCMenuItemToggler *v37; // x28
__int64 v38; // x23
cocos2d::CCMenu *v40; // [xsp+A8h] [xbp+78h]
cocos2d::CCMenuItem *v41; // [xsp+B0h] [xbp+80h]
__int64 v42; // [xsp+B8h] [xbp+88h]
__int64 v43; // [xsp+B8h] [xbp+88h]
__int64 v44; // [xsp+B8h] [xbp+88h]
__int64 v45; // [xsp+B8h] [xbp+88h]
__int64 v46; // [xsp+B8h] [xbp+88h]
__int64 v47; // [xsp+B8h] [xbp+88h]
__int64 v48; // [xsp+B8h] [xbp+88h]
__int64 v49; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v50; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v51; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v52; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v53; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v54; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v55; // [xsp+C0h] [xbp+90h]
cocos2d::CCNode *v56; // [xsp+C0h] [xbp+90h]
cocos2d::CCObject *v58; // [xsp+C8h] [xbp+98h]
cocos2d::CCObject *v59; // [xsp+C8h] [xbp+98h]
unsigned __int8 v60; // [xsp+C8h] [xbp+98h]
unsigned __int8 v61; // [xsp+C8h] [xbp+98h]
unsigned __int8 v62; // [xsp+C8h] [xbp+98h]
unsigned __int8 v63; // [xsp+C8h] [xbp+98h]
unsigned __int8 v64; // [xsp+C8h] [xbp+98h]
unsigned __int8 v65; // [xsp+C8h] [xbp+98h]
__int64 v66; // [xsp+D8h] [xbp+A8h] BYREF
_BYTE v67[8]; // [xsp+E0h] [xbp+B0h] BYREF
_BYTE v68[8]; // [xsp+E8h] [xbp+B8h] BYREF
__int64 v69; // [xsp+F0h] [xbp+C0h] BYREF
__int64 v70[2]; // [xsp+F8h] [xbp+C8h] BYREF
__int64 v71[2]; // [xsp+108h] [xbp+D8h] BYREF
void *v72; // [xsp+118h] [xbp+E8h]
__int64 v73; // [xsp+120h] [xbp+F0h] BYREF
__int64 v74; // [xsp+128h] [xbp+F8h]
void *v75; // [xsp+130h] [xbp+100h]
v5 = FLAlertLayer::init((FLAlertLayer *)this, 150);
v6 = v5;
if ( v5 )
{
if ( a2 )
{
*(this + 86) = a2;
cocos2d::CCObject::retain(a2);
}
else if ( a3 )
{
*(this + 87) = a3;
cocos2d::CCObject::retain(a3);
}
started = (cocos2d::CCDirector *)SetupSmartBlockLayer::determineStartValues(this);
*((_BYTE *)this + 596) = 1;
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(started);
cocos2d::CCDirector::getWinSize(&v66, v8);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v70, 0.0, 0.0, 80.0, 80.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v70);
v10 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v9 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v70, 300.0, 240.0);
v10(v9, v70);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v9, 4294967294LL);
v11 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v9 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, *(float *)&v66 * 0.5, *((float *)&v66 + 1) * 0.5);
v11(v9, v70);
v13 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Create blocks", "goldFont.fnt", v12);
(*((void (__fastcall **)(cocos2d::CCMenu **, __int64))*this + 57))(this, v13);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 160LL))(v13, 0.7);
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
*(float *)&v66 * 0.5,
(float)((float)(*((float *)&v66 + 1) * 0.5) + 120.0) - 18.0);
v14(v13, v70);
v16 = ButtonSprite::create(
(ButtonSprite *)"Back",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_05.png",
v15,
30.0);
v40 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(
v16,
0,
(__int64)this,
(__int64)SetupSmartBlockLayer::onClose,
0);
v18 = ButtonSprite::create(
(ButtonSprite *)"Create",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_01.png",
v17,
30.0);
v41 = (cocos2d::CCMenuItem *)CCMenuItemSpriteExtra::create(
v18,
0,
(__int64)this,
(__int64)SetupSmartBlockLayer::onCreate,
0);
v20 = ButtonSprite::create(
(ButtonSprite *)"Template",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_02.png",
v19,
30.0);
v42 = CCMenuItemSpriteExtra::create(v20, 0, (__int64)this, (__int64)SetupSmartBlockLayer::onCreateTemplate, 0);
v22 = ButtonSprite::create(
(ButtonSprite *)"Special",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_02.png",
v21,
30.0);
v49 = CCMenuItemSpriteExtra::create(v22, 0, (__int64)this, (__int64)SetupSmartBlockLayer::onSelectPremade, 0);
v24 = ButtonSprite::create(
(ButtonSprite *)"Browser",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_01.png",
v23,
30.0);
v25 = CCMenuItemSpriteExtra::create(v24, 0, (__int64)this, (__int64)SetupSmartBlockLayer::onSelectTemplate, 0);
v27 = ButtonSprite::create(
(ButtonSprite *)"Paste\nTemplate",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_01.png",
v26,
30.0);
v58 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v27,
0,
(__int64)this,
(__int64)SetupSmartBlockLayer::onPasteTemplate,
0);
v29 = ButtonSprite::create(
(ButtonSprite *)"Create\nAll",
(const char *)&off_18 + 1,
0,
1,
0.5,
"goldFont.fnt",
"GJ_button_01.png",
v28,
30.0);
v30 = CCMenuItemSpriteExtra::create(v29, 0, (__int64)this, (__int64)SetupSmartBlockLayer::onCreateAll, 0);
v31 = cocos2d::CCMenu::create(v40, v41, v42, v49, v25, v30, v58, 0);
*(this + 69) = (cocos2d::CCMenu *)v31;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v31, 10);
cocos2d::CCMenu::alignItemsHorizontally(*(this + 69));
v32 = (__int64)*(this + 69);
v33 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v32 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
*(float *)&v66 * 0.5,
(float)((float)(*((float *)&v66 + 1) * 0.5) + -120.0) + 24.0);
v33(v32, v70);
v71[0] = 0;
v71[1] = 0;
v72 = nullptr;
std::string::__init(v71, "Help", 4u);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(
&v73,
"Auto-builds structures with given templates.\n"
"Use Browser to start and select templates.\n"
"Click Template with a template made to save it.\n"
"Create structures with these blocks and click Create to paste the selected template.\n"
"Reference Only blocks are used as reference positions.\n"
"Allow Rotation, Flip X, and Flip Y allow rotating the design.\n"
"Dont Delete keeps these blocks when template is pasted.\n"
"The tool is in beta and will be enhanced in future updates.",
0x205u);
v34 = InfoAlertButton::create((char *)v71, (char *)&v73, 1.0);
if ( (v73 & 1) != 0 )
operator delete(v75);
if ( (v71[0] & 1) != 0 )
operator delete(v72);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v34);
v35 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 184LL);
v59 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v69,
(float)((float)(*(float *)&v66 * 0.5) + -150.0) + 18.0,
(float)((float)(*((float *)&v66 + 1) * 0.5) + 120.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v70, v59, (const cocos2d::CCPoint *)&v69);
v35(v34, v70);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
(float)(*(float *)&v66 * 0.5) + -60.0,
(float)(*((float *)&v66 + 1) * 0.5) + 70.0);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Reference Only", 0xEu);
LOBYTE(v59) = *((_BYTE *)this + 672);
v50 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -0.0);
cocos2d::CCPoint::operator+(&v69, v67);
v43 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onReferenceOnly,
0,
(unsigned __int8)v59,
v50,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v43,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Allow Rotation", 0xEu);
v60 = *((_BYTE *)this + 673);
v51 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -22.0);
cocos2d::CCPoint::operator+(&v69, v67);
v44 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onAllowRotation,
0,
v60,
v51,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v44,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Allow Flip X", 0xCu);
v52 = *(this + 69);
v61 = *((_BYTE *)this + 674);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -44.0);
cocos2d::CCPoint::operator+(&v69, v67);
v45 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onAllowFlipping,
0,
v61,
v52,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v45,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
(*(void (__fastcall **)(CCMenuItemToggler *, __int64))(*(_QWORD *)ToggleButton + 72LL))(ToggleButton, 3);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Allow Flip Y", 0xCu);
v53 = *(this + 69);
v62 = *((_BYTE *)this + 675);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -66.0);
cocos2d::CCPoint::operator+(&v69, v67);
v46 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
v37 = GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onAllowFlipping,
0,
v62,
v53,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v46,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
(*(void (__fastcall **)(CCMenuItemToggler *, __int64))(*(_QWORD *)v37 + 72LL))(v37, 4);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Ignore Corners", 0xEu);
v63 = *((_BYTE *)this + 678);
v54 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -88.0);
cocos2d::CCPoint::operator+(&v69, v67);
v47 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onIgnoreCorners,
0,
v63,
v54,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v47,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Use nearby as reference", 0x17u);
v64 = *((_BYTE *)this + 676);
v55 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -110.0);
cocos2d::CCPoint::operator+(&v69, v67);
v48 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onNearbyReference,
0,
v64,
v55,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v48,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
v73 = 0;
v74 = 0;
v75 = nullptr;
std::string::__init(&v73, "Dont delete", 0xBu);
v65 = *((_BYTE *)this + 677);
v56 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.0, -132.0);
cocos2d::CCPoint::operator+(&v69, v67);
v38 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v73,
(const char *)SetupSmartBlockLayer::onDontDelete,
0,
v65,
v56,
(const cocos2d::CCPoint *)&v69,
(__int64)this,
v38,
0.6,
0.35,
0.0,
(float *)v70,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v73 & 1) != 0 )
operator delete(v75);
*((_DWORD *)this + 160) = -1;
}
return v6;
}