//
// SetupSmartBlockLayer::init from 0x672f50 to 0x6738cc (2428 bytes)
//
// 1 xrefs:
// > SetupSmartBlockLayer::create @ 0x673978
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:55:54 +0000
//
GameManager *__fastcall SetupSmartBlockLayer::init(cocos2d::CCMenu **this, SmartGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCObject *v6; // r0
cocos2d::CCDirector *started; // r0
int v8; // r5
void (__fastcall *v9)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)); // r9
void (__fastcall *v10)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)); // r9
const char *v11; // r2
int v12; // r9
void (__fastcall *v13)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)); // r10
ButtonSprite *v14; // r0
ButtonSprite *v15; // r0
ButtonSprite *v16; // r0
ButtonSprite *v17; // r0
int v18; // r10
ButtonSprite *v19; // r0
ButtonSprite *v20; // r0
ButtonSprite *v21; // r0
int v22; // r0
cocos2d::CCMenu *v23; // r0
int v24; // r5
void (__fastcall *v25)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)); // r8
int v26; // r9
const cocos2d::CCPoint *v27; // r10
void (__fastcall *v28)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)); // r8
int v29; // r9
const cocos2d::CCPoint *v30; // r11
int v31; // r10
int v32; // r9
const cocos2d::CCPoint *v33; // r10
int v34; // r8
int v35; // r9
const cocos2d::CCPoint *v36; // r10
int v37; // r8
cocos2d::CCNodeRGBA *ToggleButton; // r8
int v39; // r9
const cocos2d::CCPoint *v40; // r10
int v41; // r8
cocos2d::CCNodeRGBA *v42; // r8
int v43; // r9
const cocos2d::CCPoint *v44; // r10
int v45; // r8
int v46; // r9
const cocos2d::CCPoint *v47; // r10
int v48; // r8
int v49; // r8
const cocos2d::CCPoint *v50; // r9
int v51; // r10
float v53; // [sp+10h] [bp-104h]
float v54; // [sp+10h] [bp-104h]
float v55; // [sp+10h] [bp-104h]
float v56; // [sp+10h] [bp-104h]
float v57; // [sp+10h] [bp-104h]
float v58; // [sp+10h] [bp-104h]
float v59; // [sp+10h] [bp-104h]
cocos2d::CCMenu *v60; // [sp+34h] [bp-E0h]
cocos2d::CCMenuItem *v61; // [sp+38h] [bp-DCh]
GameManager *v62; // [sp+3Ch] [bp-D8h]
int v63; // [sp+40h] [bp-D4h]
int v64; // [sp+44h] [bp-D0h]
int v65; // [sp+48h] [bp-CCh]
float v66; // [sp+54h] [bp-C0h] BYREF
float v67; // [sp+58h] [bp-BCh]
_BYTE v68[8]; // [sp+5Ch] [bp-B8h] BYREF
_BYTE v69[8]; // [sp+64h] [bp-B0h] BYREF
_BYTE v70[8]; // [sp+6Ch] [bp-A8h] BYREF
_BYTE v71[8]; // [sp+74h] [bp-A0h] BYREF
int (__fastcall *v72)(cocos2d::CCArray **, cocos2d::CCObject *); // [sp+7Ch] [bp-98h]
int v73; // [sp+80h] [bp-94h]
int (__fastcall *v74)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+84h] [bp-90h]
int v75; // [sp+88h] [bp-8Ch]
int (__fastcall *v76)(cocos2d::CCObject **, cocos2d::CCObject *); // [sp+8Ch] [bp-88h]
int v77; // [sp+90h] [bp-84h]
int (__fastcall *v78)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+94h] [bp-80h]
int v79; // [sp+98h] [bp-7Ch]
int (__fastcall *v80)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+9Ch] [bp-78h]
int v81; // [sp+A0h] [bp-74h]
_DWORD (*v82)(SetupSmartBlockLayer *__hidden, cocos2d::CCObject *); // [sp+A4h] [bp-70h]
int v83; // [sp+A8h] [bp-6Ch]
_DWORD (*v84)(SetupSmartBlockLayer *__hidden, cocos2d::CCObject *); // [sp+ACh] [bp-68h]
int v85; // [sp+B0h] [bp-64h]
unsigned int (__fastcall *v86)(unsigned int, cocos2d::CCObject *); // [sp+B4h] [bp-60h]
int v87; // [sp+B8h] [bp-5Ch]
int (__fastcall *v88)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+BCh] [bp-58h]
int v89; // [sp+C0h] [bp-54h]
GameLevelManager *(__fastcall *v90)(GameLevelManager *, cocos2d::CCObject *); // [sp+C4h] [bp-50h]
int v91; // [sp+C8h] [bp-4Ch]
GameLevelManager *(__fastcall *v92)(GameLevelManager *, cocos2d::CCObject *); // [sp+CCh] [bp-48h]
int v93; // [sp+D0h] [bp-44h]
int (__fastcall *v94)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+D4h] [bp-40h] BYREF
int v95; // [sp+D8h] [bp-3Ch]
int (__fastcall *v96)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+DCh] [bp-38h] BYREF
int v97; // [sp+E0h] [bp-34h]
int v98[3]; // [sp+E4h] [bp-30h] BYREF
int v99; // [sp+F0h] [bp-24h] BYREF
int v100; // [sp+F4h] [bp-20h]
int v101; // [sp+F8h] [bp-1Ch]
int (__fastcall *v102)(SetupSmartBlockLayer *, cocos2d::CCObject *); // [sp+FCh] [bp-18h] BYREF
int v103; // [sp+100h] [bp-14h]
v62 = FLAlertLayer::init((FLAlertLayer *)this, 150);
if ( v62 )
{
if ( a2 )
{
*(this + 134) = a2;
v6 = a2;
}
else
{
if ( !a3 )
{
LABEL_7:
started = (cocos2d::CCDirector *)SetupSmartBlockLayer::determineStartValues(this);
*((_BYTE *)this + 468) = 1;
cocos2d::CCDirector::sharedDirector(started);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v66);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v102, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", &v102);
v9 = *(void (__fastcall **)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)))(*(_DWORD *)v8 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v102, 300.0, 240.0);
v9(v8, &v102);
(*(void (__fastcall **)(_DWORD, int, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), v8, -2);
v10 = *(void (__fastcall **)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, v66 * 0.5, v67 * 0.5);
v10(v8, &v102);
v12 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Create blocks", "goldFont.fnt", v11);
(*((void (__fastcall **)(cocos2d::CCMenu **, int))*this + 57))(this, v12);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v12 + 80))(v12, 1060320051);
v13 = *(void (__fastcall **)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)))(*(_DWORD *)v12 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, v66 * 0.5, (float)((float)(v67 * 0.5) + 120.0) - 18.0);
v13(v12, &v102);
v14 = ButtonSprite::create(
(ButtonSprite *)"Back",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(30.0),
v53);
v73 = 0;
v72 = SetupSmartBlockLayer::onClose;
v60 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(
(int)v14,
0,
(int)this,
(int)SetupSmartBlockLayer::onClose,
0);
v15 = ButtonSprite::create(
(ButtonSprite *)"Create",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
v54);
v75 = 0;
v74 = SetupSmartBlockLayer::onCreate;
v61 = (cocos2d::CCMenuItem *)CCMenuItemSpriteExtra::create(
(int)v15,
0,
(int)this,
(int)SetupSmartBlockLayer::onCreate,
0);
v16 = ButtonSprite::create(
(ButtonSprite *)"Template",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_02.png",
COERCE_CONST_CHAR_(30.0),
v55);
v77 = 0;
v76 = SetupSmartBlockLayer::onCreateTemplate;
v63 = CCMenuItemSpriteExtra::create((int)v16, 0, (int)this, (int)SetupSmartBlockLayer::onCreateTemplate, 0);
v17 = ButtonSprite::create(
(ButtonSprite *)"Special",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_02.png",
COERCE_CONST_CHAR_(30.0),
v56);
v79 = 0;
v78 = SetupSmartBlockLayer::onSelectPremade;
v18 = CCMenuItemSpriteExtra::create((int)v17, 0, (int)this, (int)SetupSmartBlockLayer::onSelectPremade, 0);
v19 = ButtonSprite::create(
(ButtonSprite *)"Browser",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
v57);
v81 = 0;
v80 = SetupSmartBlockLayer::onSelectTemplate;
v64 = CCMenuItemSpriteExtra::create((int)v19, 0, (int)this, (int)SetupSmartBlockLayer::onSelectTemplate, 0);
v20 = ButtonSprite::create(
(ButtonSprite *)"Paste\nTemplate",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
v58);
v83 = 0;
v82 = SetupSmartBlockLayer::onPasteTemplate;
v65 = CCMenuItemSpriteExtra::create((int)v20, 0, (int)this, (int)SetupSmartBlockLayer::onPasteTemplate, 0);
v21 = ButtonSprite::create(
(ButtonSprite *)"Create\nAll",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
v59);
v85 = 0;
v84 = SetupSmartBlockLayer::onCreateAll;
v22 = CCMenuItemSpriteExtra::create((int)v21, 0, (int)this, (int)SetupSmartBlockLayer::onCreateAll, 0);
v23 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v60, v61, v63, v18, v64, v22, v65, 0);
*(this + 111) = v23;
(*(void (__fastcall **)(_DWORD, cocos2d::CCMenu *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v23,
10);
cocos2d::CCMenu::alignItemsHorizontally(*(this + 111));
v24 = (int)*(this + 111);
v25 = *(void (__fastcall **)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)))(*(_DWORD *)v24 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, v66 * 0.5, (float)((float)(v67 * 0.5) - 120.0) + 24.0);
v25(v24, &v102);
memset(v98, 0, sizeof(v98));
std::string::__init(v98, "Help", 4u);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(
&v99,
"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);
v26 = InfoAlertButton::create((char *)v98, (int)&v99, 1065353216);
std::string::~string((int)&v99);
std::string::~string((int)v98);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v26);
v27 = *(this + 111);
v28 = *(void (__fastcall **)(int, int (__fastcall **)(SetupSmartBlockLayer *, cocos2d::CCObject *)))(*(_DWORD *)v26 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v96,
(float)((float)(v66 * 0.5) - 150.0) + 18.0,
(float)((float)(v67 * 0.5) + 120.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v102, v27);
v28(v26, &v102);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, (float)(v66 * 0.5) - 60.0, (float)(v67 * 0.5) + 70.0);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Reference Only", 0xEu);
v29 = *((unsigned __int8 *)this + 524);
v87 = 0;
v30 = *(this + 111);
v86 = SetupSmartBlockLayer::onReferenceOnly;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v94, 0.0, -0.0);
cocos2d::CCPoint::operator+(&v96, v68, &v94);
v31 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v99,
(int)v86,
v87,
v29,
v30,
(int)&v96,
(int)this,
v31,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Allow Rotation", 0xEu);
v32 = *((unsigned __int8 *)this + 525);
v89 = 0;
v33 = *(this + 111);
v88 = SetupSmartBlockLayer::onAllowRotation;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v94, 0.0, -22.0);
cocos2d::CCPoint::operator+(&v96, v68, &v94);
v34 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v99,
(int)v88,
v89,
v32,
v33,
(int)&v96,
(int)this,
v34,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Allow Flip X", 0xCu);
v35 = *((unsigned __int8 *)this + 526);
v91 = 0;
v90 = SetupSmartBlockLayer::onAllowFlipping;
v36 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v94, 0.0, -44.0);
cocos2d::CCPoint::operator+(&v96, v68, &v94);
v37 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(int)&v99,
(int)v90,
v91,
v35,
v36,
(int)&v96,
(int)this,
v37,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, int))(*(_DWORD *)ToggleButton + 36))(ToggleButton, 3);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Allow Flip Y", 0xCu);
v93 = 0;
v92 = SetupSmartBlockLayer::onAllowFlipping;
v39 = *((unsigned __int8 *)this + 527);
v40 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v94, 0.0, -66.0);
cocos2d::CCPoint::operator+(&v96, v68, &v94);
v41 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
v42 = GameToolbox::createToggleButton(
(int)&v99,
(int)v92,
v93,
v39,
v40,
(int)&v96,
(int)this,
v41,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
(*(void (__fastcall **)(cocos2d::CCNodeRGBA *, int))(*(_DWORD *)v42 + 36))(v42, 4);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Ignore Corners", 0xEu);
v95 = 0;
v43 = *((unsigned __int8 *)this + 530);
v94 = SetupSmartBlockLayer::onIgnoreCorners;
v44 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, 0.0, -88.0);
cocos2d::CCPoint::operator+(&v96, v68, v71);
v45 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v99,
(int)v94,
v95,
v43,
v44,
(int)&v96,
(int)this,
v45,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Use nearby as reference", 0x17u);
v46 = *((unsigned __int8 *)this + 528);
v97 = 0;
v96 = SetupSmartBlockLayer::onNearbyReference;
v47 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 0.0, -110.0);
cocos2d::CCPoint::operator+(v71, v68, v70);
v48 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v102, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v99,
(int)v96,
v97,
v46,
v47,
(int)v71,
(int)this,
v48,
0.6,
0.35,
0.0,
(int)&v102,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
v99 = 0;
v100 = 0;
v101 = 0;
std::string::__init(&v99, "Dont delete", 0xBu);
v103 = 0;
v49 = *((unsigned __int8 *)this + 529);
v102 = SetupSmartBlockLayer::onDontDelete;
v50 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, 0.0, -132.0);
cocos2d::CCPoint::operator+(v70, v68, v69);
v51 = (int)*(this + 115);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v99,
(int)v102,
v103,
v49,
v50,
(int)v70,
(int)this,
v51,
0.6,
0.35,
0.0,
(int)v71,
"bigFont.fnt",
0,
0,
nullptr);
std::string::~string((int)&v99);
*(this + 125) = (cocos2d::CCMenu *)-1;
return v62;
}
v6 = a3;
*(this + 135) = a3;
}
cocos2d::CCObject::retain(v6);
goto LABEL_7;
}
return v62;
}