//
// SetupSmartTemplateLayer::init from 0xb16950 to 0xb171f0 (2208 bytes)
//
// 2 xrefs:
// > SetupSmartTemplateLayer::create @ 0xb17370
// > ??> @ 0xd9b40
//
// 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:32 +0000
//
__int64 __fastcall SetupSmartTemplateLayer::init(SetupSmartTemplateLayer *this, GJSmartTemplate *a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w27
cocos2d::CCDirector *v6; // x0
__int64 v7; // x22
void (__fastcall *v8)(__int64, __int64 *); // x25
__int64 (__fastcall *v9)(__int64, __int64 *); // x25
cocos2d::CCMenu *v10; // x0
__int64 v11; // x0
const char *v12; // x1
__int64 v13; // x22
__int64 v14; // x22
cocos2d::CCNode *v15; // x28
void (__fastcall *v16)(__int64, __int64 *); // x25
__int64 v17; // x22
cocos2d::CCNode *v18; // x28
void (__fastcall *v19)(__int64, __int64 *); // x25
__int64 v20; // x0
char v21; // w1
__int64 v22; // x2
__int64 v23; // x0
__int64 v24; // x1
__int64 v25; // t2
__int64 v26; // x22
void (__fastcall *v27)(__int64, __int64 *); // x2
const char *v28; // x4
__int64 v29; // x0
__int64 v30; // x3
char v31; // w0
const char *v32; // x1
_QWORD *v33; // x22
size_t v34; // x0
const char *v35; // x2
GJSmartTemplate *v36; // x0
cocos2d::CCLabelBMFont *v37; // x0
int v38; // w22
cocos2d::CCLabelBMFont *v39; // x24
void (__fastcall *v40)(cocos2d::CCLabelBMFont *, __int64 *); // x22
const char *v41; // x6
__int64 v42; // x0
__int64 v43; // x22
cocos2d::CCNode *v44; // x28
const char *v45; // x6
__int64 v46; // x0
__int64 v47; // x22
cocos2d::CCNode *v48; // x24
void (__fastcall *v49)(__int64, __int64 *); // x19
char *v51; // [xsp+90h] [xbp+90h]
int v52; // [xsp+98h] [xbp+98h]
void (__fastcall *v53)(__int64, __int64 *); // [xsp+98h] [xbp+98h]
int v54; // [xsp+A8h] [xbp+A8h]
__int64 v55; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v56[8]; // [xsp+B8h] [xbp+B8h] BYREF
_BYTE v57[8]; // [xsp+C0h] [xbp+C0h] BYREF
_BYTE v58[8]; // [xsp+C8h] [xbp+C8h] BYREF
__int64 v59[2]; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v60; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v61; // [xsp+E8h] [xbp+E8h]
void *v62; // [xsp+F0h] [xbp+F0h]
__int64 v63; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v64; // [xsp+100h] [xbp+100h]
void *v65; // [xsp+108h] [xbp+108h]
__int64 v66[2]; // [xsp+110h] [xbp+110h] BYREF
cocos2d::CCLabelBMFont *v67; // [xsp+120h] [xbp+120h]
v4 = FLAlertLayer::init(this, 150);
v52 = v4;
v5 = v4;
if ( !v4 )
return v5;
if ( a2 )
{
*((_QWORD *)this + 84) = a2;
cocos2d::CCObject::retain(a2);
}
*((_BYTE *)this + 596) = (unsigned __int8)&dword_0 + 1;
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)((char *)&dword_0 + 1));
cocos2d::CCDirector::getWinSize(&v55, v6);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v59, 0.0, 0.0, 80.0, 80.0);
v7 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v59);
v8 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v7 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v59, 450.0, 280.0);
v8(v7, v59);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v7,
4294967294LL);
v9 = *(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v7 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, *(float *)&v55 * 0.5, *((float *)&v55 + 1) * 0.5);
v10 = (cocos2d::CCMenu *)v9(v7, v59);
v11 = cocos2d::CCMenu::create(v10);
*((_QWORD *)this + 69) = v11;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(*((_QWORD *)this + 73), v11, 10);
v13 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v12);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 160LL))(v13, 0.7);
v14 = CCMenuItemSpriteExtra::create(v13, 0, (__int64)this, (__int64)SetupSmartTemplateLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult(v14, 1.6);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v14);
v15 = *((cocos2d::CCNode **)this + 69);
v16 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v14 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
(float)((float)(*(float *)&v55 * 0.5) + -225.0) + 6.0,
(float)((float)(*((float *)&v55 + 1) * 0.5) + 140.0) - 6.0);
cocos2d::CCNode::convertToNodeSpace(v59, v15, (const cocos2d::CCPoint *)v58);
v16(v14, v59);
v63 = 0;
v64 = 0;
v65 = nullptr;
std::string::__init(&v63, "Help", 4u);
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
std::string::__init(
v66,
"Defined tells you how many variations you have in the template.\n"
"Click Browse to see your template's defined variations.",
0x87u);
v17 = InfoAlertButton::create((char *)&v63, (char *)v66, 1.0);
if ( (v66[0] & 1) != 0 )
{
operator delete(v67);
if ( (v63 & 1) == 0 )
goto LABEL_6;
LABEL_24:
operator delete(v65);
goto LABEL_6;
}
if ( (v63 & 1) != 0 )
goto LABEL_24;
LABEL_6:
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v17);
v18 = *((cocos2d::CCNode **)this + 69);
v19 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
(float)((float)(*(float *)&v55 * 0.5) + 225.0) - 18.0,
(float)((float)(*((float *)&v55 + 1) * 0.5) + 140.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v59, v18, (const cocos2d::CCPoint *)v58);
v19(v17, v59);
v20 = *((_QWORD *)this + 84);
if ( v20 )
{
v21 = *(_BYTE *)(v20 + 144);
v60 = 0;
v22 = v20 + 144;
v61 = 0;
v62 = nullptr;
if ( (v21 & 1) != 0 )
{
std::string::__init(&v60, *(void **)(v20 + 160), *(_QWORD *)(v20 + 152));
}
else
{
v25 = v20 + 144;
v23 = *(_QWORD *)(v20 + 144);
v24 = *(_QWORD *)(v25 + 8);
v62 = *(void **)(v22 + 16);
v60 = v23;
v61 = v24;
}
}
else
{
v60 = 0;
v61 = 0;
v62 = nullptr;
std::string::__init(&v60, "Unnamed", 7u);
}
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v56,
*(float *)&v55 * 0.5,
(float)((float)(*((float *)&v55 + 1) * 0.5) + 140.0) - 40.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v59, 0.0, 0.0, 80.0, 80.0);
v26 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v59);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v26 + 912LL))(v26, 75);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v57, 600.0, 80.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v26 + 320LL))(v26, v57);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v26,
0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v26 + 184LL))(v26, v56);
v27 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v26 + 960LL);
LOWORD(v59[0]) = 0;
BYTE2(v59[0]) = 0;
v27(v26, v59);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v26 + 160LL))(v26, 0.5);
v29 = CCTextInputNode::create(
(CCTextInputNode *)"Template Name",
280.0,
50.0,
"Thonburi",
(const char *)&off_18,
"bigFont.fnt",
v28);
v30 = *((_QWORD *)this + 73);
*((_QWORD *)this + 85) = v29;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v30 + 464LL))(v30, v29, 18);
*(_QWORD *)(*((_QWORD *)this + 85) + 584LL) = (char *)this + 544;
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 85) + 72LL))(*((_QWORD *)this + 85), 0);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**((_QWORD **)this + 85) + 184LL))(*((_QWORD *)this + 85), v56);
v31 = v60;
*(_DWORD *)(*((_QWORD *)this + 85) + 592LL) = 20;
v32 = (char *)&v60 + 1;
*(_BYTE *)(*((_QWORD *)this + 85) + 608LL) = 1;
v33 = *((_QWORD **)this + 85);
if ( (v31 & 1) != 0 )
v32 = (const char *)v62;
v51 = (char *)v32;
v63 = 0;
v64 = 0;
v65 = nullptr;
v34 = strlen(v32);
std::string::__init(&v63, v51, v34);
CCTextInputNode::setString(v33, (char *)&v63);
if ( (v63 & 1) != 0 )
operator delete(v65);
LOWORD(v54) = -21896;
BYTE2(v54) = -16;
CCTextInputNode::setLabelPlaceholderColor(*((_QWORD *)this + 85), v54);
CCTextInputNode::setLabelPlaceholderScale(*((CCTextInputNode **)this + 85), 0.7);
v36 = *((GJSmartTemplate **)this + 84);
if ( v36 )
{
GJSmartTemplate::logTemplateStatus(v66, v36);
if ( (v66[0] & 1) != 0 )
{
v37 = v67;
v38 = v52;
}
else
{
v38 = v52;
v37 = (cocos2d::CCLabelBMFont *)((char *)v66 + 1);
}
}
else
{
v38 = 0;
v37 = (cocos2d::CCLabelBMFont *)"NA";
}
v39 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v37, "chatFont.fnt", v35);
if ( v38 && (v66[0] & 1) != 0 )
operator delete(v67);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v39,
18);
v40 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64 *))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, 0.0, -40.0);
cocos2d::CCPoint::operator+(v59, v56);
v40(v39, v59);
cocos2d::CCLabelBMFont::limitLabelWidth(v39, 300.0, 0.6, 0.0);
v42 = ButtonSprite::create(
(ButtonSprite *)"Browse",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v41,
30.0);
v43 = CCMenuItemSpriteExtra::create(v42, 0, (__int64)this, (__int64)SetupSmartTemplateLayer::onClick, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v43 + 72LL))(v43, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v43);
v44 = *((cocos2d::CCNode **)this + 69);
v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v43 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, *(float *)&v55 * 0.5, *((float *)&v55 + 1) * 0.5);
cocos2d::CCNode::convertToNodeSpace(v59, v44, (const cocos2d::CCPoint *)v58);
v53(v43, v59);
v46 = ButtonSprite::create(
(ButtonSprite *)"Delete",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v45,
30.0);
v47 = CCMenuItemSpriteExtra::create(v46, 0, (__int64)this, (__int64)SetupSmartTemplateLayer::onClick, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v47 + 72LL))(v47, 5);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v47);
v48 = *((cocos2d::CCNode **)this + 69);
v49 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v47 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (float)(*(float *)&v55 * 0.5) + 100.0, *((float *)&v55 + 1) * 0.5);
cocos2d::CCNode::convertToNodeSpace(v59, v48, (const cocos2d::CCPoint *)v58);
v49(v47, v59);
if ( (v60 & 1) != 0 )
operator delete(v62);
return v5;
}