//
// SetupSmartTemplateLayer::init from 0x674254 to 0x674850 (1532 bytes)
//
// 1 xrefs:
// > SetupSmartTemplateLayer::create @ 0x6748fc
//
// 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:55 +0000
//
GameManager *__fastcall SetupSmartTemplateLayer::init(SetupSmartTemplateLayer *this, GJSmartTemplate *a2)
{
GameManager *v4; // r0
GameManager *v5; // r9
int v6; // r6
void (__fastcall *v7)(int, _DWORD *); // r7
int (__fastcall *v8)(int, _DWORD *); // r7
cocos2d::CCMenu *v9; // r0
int v10; // r0
const char *v11; // r1
int v12; // r7
int v13; // r10
void (__fastcall *v14)(int, _DWORD *); // r11
int v15; // r10
const cocos2d::CCPoint *v16; // r11
void (__fastcall *v17)(int, _DWORD *); // r6
int v18; // r1
int v19; // r6
void (__fastcall *v20)(int, _DWORD *); // r2
int *v21; // r0
char *v22; // r1
int v23; // r6
size_t v24; // r0
const char *v25; // r2
int v26; // r1
cocos2d::CCLabelBMFont *v27; // r0
GameManager *v28; // r6
cocos2d::CCLabelBMFont *v29; // r8
void (__fastcall *v30)(cocos2d::CCLabelBMFont *, _DWORD *); // r6
ButtonSprite *v31; // r0
int v32; // r7
const cocos2d::CCPoint *v33; // r10
ButtonSprite *v34; // r0
int v35; // r5
const cocos2d::CCPoint *v36; // r8
void (__fastcall *v37)(int, _BYTE *); // r7
char *v39; // [sp+8h] [bp-8Ch]
cocos2d::CCPoint *v40; // [sp+10h] [bp-84h]
cocos2d::CCPoint *v41; // [sp+10h] [bp-84h]
cocos2d::CCPoint *v42; // [sp+10h] [bp-84h]
int v43; // [sp+1Ch] [bp-78h]
float v44; // [sp+20h] [bp-74h] BYREF
float v45; // [sp+24h] [bp-70h]
_BYTE v46[8]; // [sp+28h] [bp-6Ch] BYREF
_BYTE v47[8]; // [sp+30h] [bp-64h] BYREF
char v48[8]; // [sp+38h] [bp-5Ch] BYREF
_BYTE v49[8]; // [sp+40h] [bp-54h] BYREF
_DWORD (*v50)(SetupSmartTemplateLayer *__hidden, cocos2d::CCObject *); // [sp+48h] [bp-4Ch]
int v51; // [sp+4Ch] [bp-48h]
_DWORD v52[2]; // [sp+50h] [bp-44h] BYREF
int v53[2]; // [sp+58h] [bp-3Ch] BYREF
char *v54; // [sp+60h] [bp-34h]
int v55; // [sp+64h] [bp-30h] BYREF
int v56; // [sp+68h] [bp-2Ch]
int v57; // [sp+6Ch] [bp-28h]
int v58[2]; // [sp+70h] [bp-24h] BYREF
cocos2d::CCLabelBMFont *v59; // [sp+78h] [bp-1Ch]
_DWORD v60[4]; // [sp+7Ch] [bp-18h] BYREF
v4 = FLAlertLayer::init(this, 150);
v5 = v4;
if ( v4 )
{
if ( a2 )
{
*((_DWORD *)this + 131) = a2;
v4 = (GameManager *)cocos2d::CCObject::retain(a2);
}
*((_BYTE *)this + 468) = 1;
cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v44);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v60, 0.0, 0.0, 80.0, 80.0);
v6 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v60);
v7 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v6 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v60, 450.0, 280.0);
v7(v6, v60);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v6, -2);
v8 = *(int (__fastcall **)(int, _DWORD *))(*(_DWORD *)v6 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, v44 * 0.5, v45 * 0.5);
v9 = (cocos2d::CCMenu *)v8(v6, v60);
v10 = cocos2d::CCMenu::create(v9);
*((_DWORD *)this + 111) = v10;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v10, 10);
v12 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v11);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v12 + 80))(v12, 1060320051);
v50 = SetupSmartTemplateLayer::onBack;
v51 = 0;
v13 = CCMenuItemSpriteExtra::create(v12, 0, (int)this, (int)SetupSmartTemplateLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult(v13, 1.6);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v13);
v14 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v13 + 92);
v40 = *((cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v52,
(float)((float)(v44 * 0.5) - 225.0) + 6.0,
(float)((float)(v45 * 0.5) + 140.0) - 6.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v60, v40);
v14(v13, v60);
v55 = 0;
v56 = 0;
v57 = 0;
std::string::__init(&v55, "Help", 4u);
v58[0] = 0;
v58[1] = 0;
v59 = nullptr;
std::string::__init(
v58,
"Defined tells you how many variations you have in the template.\n"
"Click Browse to see your template's defined variations.",
0x87u);
v15 = InfoAlertButton::create((char *)&v55, (int)v58, 1065353216);
std::string::~string((int)v58);
std::string::~string((int)&v55);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v15);
v16 = *((const cocos2d::CCPoint **)this + 111);
v17 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v52,
(float)((float)(v44 * 0.5) + 225.0) - 18.0,
(float)((float)(v45 * 0.5) + 140.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v60, v16);
v17(v15, v60);
v18 = *((_DWORD *)this + 131);
if ( v18 )
{
std::string::basic_string(v53, v18 + 96);
}
else
{
v53[0] = 0;
v53[1] = 0;
v54 = nullptr;
std::string::__init(v53, "Unnamed", 7u);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v44 * 0.5, (float)((float)(v45 * 0.5) + 140.0) - 40.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v60, 0.0, 0.0, 80.0, 80.0);
v19 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v60);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 456))(v19, 75);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v47, 600.0, 80.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v19 + 160))(v19, v47);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v19, -1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v19 + 92))(v19, v46);
v20 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v19 + 480);
LOWORD(v60[0]) = 0;
BYTE2(v60[0]) = 0;
v20(v19, v60);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v19 + 80))(v19, 1056964608);
v21 = CCTextInputNode::create(
(CCTextInputNode *)0x438C0000,
50.0,
"Template Name",
"Thonburi",
(const char *)&dword_18,
"bigFont.fnt",
v39);
*((_DWORD *)this + 132) = v21;
(*(void (__fastcall **)(_DWORD, int *, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v21, 18);
*(_DWORD *)(*((_DWORD *)this + 132) + 420) = (char *)this + 440;
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 132) + 36))(*((_DWORD *)this + 132), 0);
(*(void (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 132) + 92))(*((_DWORD *)this + 132), v46);
*(_DWORD *)(*((_DWORD *)this + 132) + 424) = 20;
*(_BYTE *)(*((_DWORD *)this + 132) + 432) = 1;
v23 = *((_DWORD *)this + 132);
if ( (v53[0] & 1) == 0 )
v22 = (char *)v53 + 1;
v55 = 0;
if ( (v53[0] & 1) != 0 )
v22 = v54;
v56 = 0;
v57 = 0;
v41 = (cocos2d::CCPoint *)v22;
v24 = strlen(v22);
std::string::__init(&v55, v41, v24);
CCTextInputNode::setString(v23, (int)&v55);
std::string::~string((int)&v55);
LOWORD(v43) = -21896;
BYTE2(v43) = -16;
CCTextInputNode::setLabelPlaceholderColor(*((_DWORD *)this + 132), v43);
CCTextInputNode::setLabelPlaceholderScale(*((_DWORD *)this + 132), 0.7);
v26 = *((_DWORD *)this + 131);
if ( v26 )
{
GJSmartTemplate::logTemplateStatus((GJSmartTemplate *)v58, v26);
if ( (v58[0] & 1) != 0 )
v27 = v59;
else
v27 = (cocos2d::CCLabelBMFont *)((char *)v58 + 1);
v28 = v5;
}
else
{
v28 = nullptr;
v27 = (cocos2d::CCLabelBMFont *)"NA";
}
v29 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v27, "chatFont.fnt", v25);
if ( v28 )
std::string::~string((int)v58);
(*(void (__fastcall **)(_DWORD, cocos2d::CCLabelBMFont *, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v29,
18);
v30 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, _DWORD *))(*(_DWORD *)v29 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v52, 0.0, -40.0);
cocos2d::CCPoint::operator+(v60, v46, v52);
v30(v29, v60);
cocos2d::CCLabelBMFont::limitLabelWidth(v29, 300.0, 0.6, 0.0);
v31 = ButtonSprite::create(
(ButtonSprite *)"Browse",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
*(float *)&v41);
v52[1] = 0;
v52[0] = SetupSmartTemplateLayer::onClick;
v32 = CCMenuItemSpriteExtra::create((int)v31, 0, (int)this, (int)SetupSmartTemplateLayer::onClick, 0);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v32 + 36))(v32, 0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v32);
v33 = *((const cocos2d::CCPoint **)this + 111);
v42 = *(cocos2d::CCPoint **)(*(_DWORD *)v32 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, v44 * 0.5, v45 * 0.5);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v60, v33);
((void (__fastcall *)(int, _DWORD *))v42)(v32, v60);
v34 = ButtonSprite::create(
(ButtonSprite *)"Delete",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
*(float *)&v42);
v60[0] = SetupSmartTemplateLayer::onClick;
v60[1] = 0;
v35 = CCMenuItemSpriteExtra::create((int)v34, 0, (int)this, (int)SetupSmartTemplateLayer::onClick, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v35 + 36))(v35, 5);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v35);
v36 = *((const cocos2d::CCPoint **)this + 111);
v37 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v35 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v48, (float)(v44 * 0.5) + 100.0, v45 * 0.5);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v49, v36);
v37(v35, v49);
std::string::~string((int)v53);
}
return v5;
}