// // BrowseSmartTemplateLayer::init from 0xb18d10 to 0xb19520 (2064 bytes) // // 2 xrefs: // > BrowseSmartTemplateLayer::create @ 0xb19674 // > @ 0x4eeb0 // // 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:33 +0000 // __int64 __fastcall BrowseSmartTemplateLayer::init(__int64 a1, cocos2d::CCObject *a2) { cocos2d::CCDirector *v3; // x0 cocos2d::CCDirector *v4; // x0 __int64 v5; // x22 cocos2d::CCNode *v6; // x23 void (__fastcall *v7)(__int64, _BYTE **); // x20 unsigned int v8; // w22 int v9; // w25 cocos2d::CCArray *v10; // x24 cocos2d::CCString *v11; // x0 const char *CString; // x0 size_t v13; // x0 cocos2d::CCArray *v14; // x26 __int64 v15; // x0 _BYTE *v16; // x2 _BYTE *v17; // x4 __int64 v18; // x20 unsigned __int64 v19; // x21 size_t v20; // x1 char *v21; // x24 void *v22; // x1 char *v23; // x1 size_t v24; // x2 char *v25; // x1 size_t v26; // x2 void *v27; // x20 void **v28; // x19 unsigned __int8 v29; // [xsp+6Fh] [xbp+6Fh] cocos2d::CCDictionary *v32; // [xsp+88h] [xbp+88h] cocos2d::CCPoint *v33; // [xsp+90h] [xbp+90h] __int64 v34; // [xsp+A0h] [xbp+A0h] BYREF char v35[8]; // [xsp+A8h] [xbp+A8h] BYREF __int64 v36; // [xsp+B0h] [xbp+B0h] BYREF size_t v37; // [xsp+B8h] [xbp+B8h] void *v38; // [xsp+C0h] [xbp+C0h] __int64 v39; // [xsp+C8h] [xbp+C8h] BYREF size_t v40; // [xsp+D0h] [xbp+D0h] void *v41; // [xsp+D8h] [xbp+D8h] _BYTE *v42; // [xsp+E0h] [xbp+E0h] BYREF void *v43; // [xsp+E8h] [xbp+E8h] __int64 v44; // [xsp+F0h] [xbp+F0h] __int64 v45; // [xsp+F8h] [xbp+F8h] BYREF __int64 v46; // [xsp+100h] [xbp+100h] BYREF void *v47; // [xsp+108h] [xbp+108h] void *v48; // [xsp+110h] [xbp+110h] __int64 v49; // [xsp+118h] [xbp+118h] BYREF size_t v50; // [xsp+120h] [xbp+120h] void *v51; // [xsp+128h] [xbp+128h] int v52; // [xsp+130h] [xbp+130h] bool isUnrequired; // [xsp+134h] [xbp+134h] int v54; // [xsp+138h] [xbp+138h] char v55; // [xsp+13Ch] [xbp+13Ch] char v56; // [xsp+13Dh] [xbp+13Dh] char v57; // [xsp+13Eh] [xbp+13Eh] __int64 v58; // [xsp+140h] [xbp+140h] BYREF __int64 v59; // [xsp+148h] [xbp+148h] BYREF void *v60; // [xsp+150h] [xbp+150h] void *v61; // [xsp+158h] [xbp+158h] __int64 v62; // [xsp+160h] [xbp+160h] BYREF size_t v63; // [xsp+168h] [xbp+168h] void *v64; // [xsp+170h] [xbp+170h] int v65; // [xsp+178h] [xbp+178h] char v66; // [xsp+17Ch] [xbp+17Ch] int v67; // [xsp+180h] [xbp+180h] char v68; // [xsp+184h] [xbp+184h] char v69; // [xsp+185h] [xbp+185h] char v70; // [xsp+186h] [xbp+186h] v29 = FLAlertLayer::init((FLAlertLayer *)a1, 150); if ( !v29 ) return v29; v3 = (cocos2d::CCDirector *)BrowseSmartTemplateLayer::baseSetup((BrowseSmartTemplateLayer *)a1); v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3); cocos2d::CCDirector::getWinSize(&v34, v4); if ( a2 ) { *(_QWORD *)(a1 + 664) = a2; cocos2d::CCObject::retain(a2); } v45 = 0; v46 = 0; v47 = nullptr; std::string::__init(&v45, "Help", 4u); v58 = 0; v59 = 0; v60 = nullptr; std::string::__init( &v58, "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 *)&v45, (char *)&v58, 1.0); if ( (v58 & 1) != 0 ) { operator delete(v60); if ( (v45 & 1) == 0 ) goto LABEL_7; } else if ( (v45 & 1) == 0 ) { goto LABEL_7; } operator delete(v47); LABEL_7: (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v5); v6 = *(cocos2d::CCNode **)(a1 + 552); v7 = *(void (__fastcall **)(__int64, _BYTE **))(*(_QWORD *)v5 + 184LL); cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)v35, (float)((float)(*(float *)&v34 * 0.5) + 225.0) - 18.0, (float)((float)(*((float *)&v34 + 1) * 0.5) + 140.0) - 18.0); cocos2d::CCNode::convertToNodeSpace((__int64 *)&v42, v6, (const cocos2d::CCPoint *)v35); v7(v5, &v42); if ( !*(_QWORD *)(a1 + 664) ) return v29; v8 = 0; v9 = 0; v32 = *((cocos2d::CCDictionary **)a2 + 7); v10 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v32); if ( (unsigned int)cocos2d::CCArray::count(v10) ) { while ( 1 ) { v11 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v10, v8); CString = (const char *)cocos2d::CCString::getCString(v11); v36 = 0; v37 = 0; v38 = nullptr; v33 = (cocos2d::CCPoint *)CString; v13 = strlen(CString); std::string::__init(&v36, v33, v13); v14 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v32, &v36); if ( (unsigned int)cocos2d::CCArray::count(v14) ) break; LABEL_10: ++v8; if ( (v36 & 1) != 0 ) operator delete(v38); if ( v8 >= (unsigned int)cocos2d::CCArray::count(v10) ) goto LABEL_13; } v46 = 0; v47 = nullptr; v48 = nullptr; v45 = 0; std::string::__init(&v46, &byte_11B8890, 0); v49 = 0; v50 = 0; v51 = nullptr; std::string::__init(&v49, &byte_11B8890, 0); v52 = 0; isUnrequired = 0; v54 = 0; v55 = 0; v56 = 0; v57 = 0; if ( (v36 & 1) != 0 ) { v23 = (char *)v38; v24 = v37; } else { v24 = (unsigned __int8)v36 >> 1; v23 = (char *)&v36 + 1; } std::string::assign(&v46, v23, v24); if ( (v36 & 1) != 0 ) { v25 = (char *)v38; v26 = v37; } else { v26 = (unsigned __int8)v36 >> 1; v25 = (char *)&v36 + 1; } std::string::assign(&v49, v25, v26); v52 = cocos2d::CCArray::count(v14); v39 = 0; v40 = 0; v41 = nullptr; if ( (v36 & 1) != 0 ) { std::string::__init(&v39, v38, v37); } else { v41 = v38; v39 = v36; v40 = v37; } isUnrequired = GJSmartTemplate::isUnrequired((__int64)a2, (unsigned __int8 *)&v39); if ( (v39 & 1) != 0 ) operator delete(v41); v58 = v45; v59 = 0; v60 = nullptr; v61 = nullptr; if ( (v46 & 1) != 0 ) { std::string::__init(&v59, v48, (size_t)v47); } else { v61 = v48; v59 = v46; v60 = v47; } v62 = 0; v63 = 0; v64 = nullptr; if ( (v49 & 1) != 0 ) { std::string::__init(&v62, v51, v50); } else { v64 = v51; v62 = v49; v63 = v50; } v65 = v52; v66 = isUnrequired; v67 = v54; v68 = v55; v69 = v56; v70 = v57; BrowseSmartTemplateLayer::addPrefabMenuItem(a1, (__int64)&v58, v9); if ( (v62 & 1) != 0 ) { operator delete(v64); if ( (v59 & 1) == 0 ) { LABEL_43: ++v9; if ( (v49 & 1) == 0 ) goto LABEL_44; LABEL_52: operator delete(v51); LABEL_44: if ( (v46 & 1) != 0 ) operator delete(v48); goto LABEL_10; } } else if ( (v59 & 1) == 0 ) { goto LABEL_43; } ++v9; operator delete(v61); if ( (v49 & 1) == 0 ) goto LABEL_44; goto LABEL_52; } LABEL_13: v42 = nullptr; v15 = *(_QWORD *)(a1 + 664); v43 = nullptr; v44 = 0; GJSmartTemplate::getTemplateState(v15, (__int64 *)&v42); v16 = v42; v17 = v43; v18 = 0; v19 = 1; if ( 0x8E38E38E38E38E39LL * (((_BYTE *)v43 - v42) >> 3) ) { while ( 1 ) { v21 = &v16[v18]; if ( !*(_DWORD *)&v16[v18 + 56] && !v21[60] ) { v58 = *(_QWORD *)v21; v59 = 0; v60 = nullptr; v61 = nullptr; if ( (v21[8] & 1) != 0 ) { std::string::__init(&v59, *((void **)v21 + 3), *((_QWORD *)v21 + 2)); } else { v22 = *((void **)v21 + 2); v59 = *((_QWORD *)v21 + 1); v60 = v22; v61 = *((void **)v21 + 3); } v62 = 0; v63 = 0; v64 = nullptr; if ( (v21[32] & 1) != 0 ) { std::string::__init(&v62, *((void **)v21 + 6), *((_QWORD *)v21 + 5)); } else { v20 = *((_QWORD *)v21 + 5); v62 = *((_QWORD *)v21 + 4); v63 = v20; v64 = *((void **)v21 + 6); } v65 = *((_DWORD *)v21 + 14); v66 = v21[60]; v67 = *((_DWORD *)v21 + 16); v68 = v21[68]; v69 = v21[69]; v70 = v21[70]; BrowseSmartTemplateLayer::addPrefabMenuItem(a1, (__int64)&v58, v9); if ( (v62 & 1) != 0 ) operator delete(v64); if ( (v59 & 1) != 0 ) operator delete(v61); v16 = v42; ++v9; v17 = v43; } v18 += 72; if ( 0x8E38E38E38E38E39LL * ((v17 - v16) >> 3) <= v19 ) break; ++v19; } } BrowseSmartTemplateLayer::goToPage((BrowseSmartTemplateLayer *)a1, 0); v27 = v42; if ( v42 ) { v28 = (void **)v43; if ( v42 != v43 ) { do { v43 = v28 - 9; if ( (*(_BYTE *)(v28 - 5) & 1) != 0 ) operator delete(*(v28 - 3)); if ( (*(_BYTE *)(v28 - 8) & 1) != 0 ) operator delete(*(v28 - 6)); v28 = (void **)v43; } while ( v27 != v43 ); v28 = (void **)v42; } operator delete(v28); } return v29; }