//
// BrowseSmartTemplateLayer::init from 0x6753dc to 0x6756b0 (724 bytes)
//
// 1 xrefs:
// > BrowseSmartTemplateLayer::create @ 0x675750
//
// 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 BrowseSmartTemplateLayer::init(const cocos2d::CCPoint **a1, cocos2d::CCObject *a2)
{
cocos2d::CCDirector *v4; // r0
int v5; // r7
const cocos2d::CCPoint *v6; // r10
void (__fastcall *v7)(int, char **); // r8
unsigned int v8; // r8
int v9; // r7
cocos2d::CCString *v10; // r0
const char *CString; // r0
const char *v12; // r11
size_t v13; // r0
cocos2d::CCDictionary *v14; // r0
unsigned int i; // r4
const SmartPrefabResult *v16; // r1
GameManager *v18; // [sp+0h] [bp-B4h]
cocos2d::CCDictionary *v19; // [sp+4h] [bp-B0h]
cocos2d::CCArray *v20; // [sp+8h] [bp-ACh]
cocos2d::CCArray *v21; // [sp+Ch] [bp-A8h]
float v22[2]; // [sp+20h] [bp-94h] BYREF
char v23[8]; // [sp+28h] [bp-8Ch] BYREF
int v24[3]; // [sp+30h] [bp-84h] BYREF
int v25[3]; // [sp+3Ch] [bp-78h] BYREF
char *v26; // [sp+48h] [bp-6Ch] BYREF
int v27; // [sp+4Ch] [bp-68h]
int v28; // [sp+50h] [bp-64h]
int v29; // [sp+54h] [bp-60h] BYREF
int v30; // [sp+58h] [bp-5Ch] BYREF
int v31; // [sp+5Ch] [bp-58h]
int v32; // [sp+60h] [bp-54h]
int v33[3]; // [sp+64h] [bp-50h] BYREF
int v34; // [sp+70h] [bp-44h]
char isUnrequired; // [sp+74h] [bp-40h]
int v36; // [sp+78h] [bp-3Ch]
char v37; // [sp+7Ch] [bp-38h]
char v38; // [sp+7Dh] [bp-37h]
char v39; // [sp+7Eh] [bp-36h]
int v40[11]; // [sp+80h] [bp-34h] BYREF
v18 = FLAlertLayer::init((FLAlertLayer *)a1, 150);
if ( v18 )
{
v4 = (cocos2d::CCDirector *)BrowseSmartTemplateLayer::baseSetup(a1);
cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v22);
if ( a2 )
{
a1[130] = a2;
cocos2d::CCObject::retain(a2);
}
v29 = 0;
v30 = 0;
v31 = 0;
std::string::__init(&v29, "Help", 4u);
memset(v40, 0, 12);
std::string::__init(
v40,
"Shows the auto-build designs in the current template.\n"
"These will be used when the template is pasted.\n"
"Click on an empty design to paste it into editor.\n"
"Click an added design to change the chance of different variations.",
0xF3u);
v5 = InfoAlertButton::create((char *)&v29, (int)v40, 1065353216);
std::string::~string((int)v40);
std::string::~string((int)&v29);
(*(void (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)a1[111] + 228))(a1[111], v5);
v6 = a1[111];
v7 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v5 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v23,
(float)((float)(v22[0] * 0.5) + 225.0) - 18.0,
(float)((float)(v22[1] * 0.5) + 140.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v26, v6);
v7(v5, &v26);
if ( a1[130] )
{
v8 = 0;
v9 = 0;
v19 = *((cocos2d::CCDictionary **)a2 + 13);
v20 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v19);
while ( v8 < cocos2d::CCArray::count(v20) )
{
v10 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v20, v8);
CString = (const char *)cocos2d::CCString::getCString(v10);
memset(v24, 0, sizeof(v24));
v12 = CString;
v13 = strlen(CString);
std::string::__init(v24, v12, v13);
v21 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v19, v24);
if ( cocos2d::CCArray::count(v21) )
{
v29 = 0;
v30 = 0;
v31 = 0;
v32 = 0;
std::string::__init(&v30, &unk_B6B226, 0);
memset(v33, 0, sizeof(v33));
std::string::__init(v33, &unk_B6B226, 0);
v34 = 0;
isUnrequired = 0;
v36 = 0;
v37 = 0;
v38 = 0;
v39 = 0;
std::string::operator=((unsigned __int8 *)&v30, (unsigned __int8 *)v24);
std::string::operator=((unsigned __int8 *)v33, (unsigned __int8 *)v24);
v34 = cocos2d::CCArray::count(v21);
std::string::basic_string(v25, (int)v24);
isUnrequired = GJSmartTemplate::isUnrequired((int)a2, (unsigned __int8 *)v25);
std::string::~string((int)v25);
SmartPrefabResult::SmartPrefabResult((SmartPrefabResult *)v40, (const SmartPrefabResult *)&v29);
BrowseSmartTemplateLayer::addPrefabMenuItem((cocos2d::CCDirector *)a1, v40, v9++);
SmartPrefabResult::~SmartPrefabResult((SmartPrefabResult *)v40);
SmartPrefabResult::~SmartPrefabResult((SmartPrefabResult *)&v29);
}
++v8;
std::string::~string((int)v24);
}
v14 = a1[130];
v26 = nullptr;
v27 = 0;
v28 = 0;
GJSmartTemplate::getTemplateState(v14, (int *)&v26);
for ( i = 0; i < -1171354717 * ((v27 - (int)v26) >> 2); ++i )
{
v16 = (const SmartPrefabResult *)&v26[44 * i];
if ( !*((_DWORD *)v16 + 7) && !*((_BYTE *)v16 + 32) )
{
SmartPrefabResult::SmartPrefabResult((SmartPrefabResult *)v40, v16);
BrowseSmartTemplateLayer::addPrefabMenuItem((cocos2d::CCDirector *)a1, v40, v9++);
SmartPrefabResult::~SmartPrefabResult((SmartPrefabResult *)v40);
}
}
BrowseSmartTemplateLayer::goToPage((BrowseSmartTemplateLayer *)a1, 0);
std::__vector_base::~__vector_base((void **)&v26);
}
}
return v18;
}