// // BrowseSmartTemplateLayer::init from 0x1004e8e50 to 0x1004e9589 (1849 bytes) // // 1 xrefs: // > BrowseSmartTemplateLayer::create @ 0x1004e86a7 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // bool __fastcall BrowseSmartTemplateLayer::init(BrowseSmartTemplateLayer *a1, GJSmartTemplate *a2, SmartBrowseFilter a3) { BrowseSmartTemplateLayer *v3; // r13 bool result; // al __int64 v5; // rbx cocos2d::CCMenu *m_buttonMenu; // r14 cocos2d::CCArray *v7; // rbx int v8; // eax unsigned int v9; // r12d const std::string *p_dst; // r14 int v11; // r15d unsigned int v12; // esi char *v13; // r12 cocos2d::CCString *v14; // rax const char *CString; // r14 size_t v16; // rax size_t v17; // rbx char *v18; // r15 __int64 v19; // rax size_t v20; // r13 __int64 v21; // rbx int v22; // eax unsigned int v23; // r12d int v24; // ebx __int128 v25; // xmm0 __int128 v26; // kr00_16 __int64 v27; // r14 unsigned __int64 v28; // r13 __int64 v29; // rax __int64 v30; // rax __int64 *v31; // rax __int64 v32; // rcx std::string::size_type v33; // rbx std::string::size_type v34; // r14 void *v35; // rdi _BYTE v36[79]; // [rsp+0h] [rbp-1A0h] BYREF __int64 v37; // [rsp+50h] [rbp-150h] BYREF __int128 v38; // [rsp+58h] [rbp-148h] BYREF void *v39; // [rsp+68h] [rbp-138h] __int128 v40; // [rsp+70h] [rbp-130h] BYREF void *v41; // [rsp+80h] [rbp-120h] _QWORD v42[2]; // [rsp+88h] [rbp-118h] cocos2d::CCDictionary *m_prefabArrays; // [rsp+98h] [rbp-108h] char v44; // [rsp+A0h] [rbp-100h] BYREF char v45[15]; // [rsp+A1h] [rbp-FFh] BYREF void *v46; // [rsp+B0h] [rbp-F0h] _QWORD v47[2]; // [rsp+B8h] [rbp-E8h] BYREF void *__p; // [rsp+C8h] [rbp-D8h] std::string v49; // [rsp+D0h] [rbp-D0h] BYREF float v50[2]; // [rsp+E8h] [rbp-B8h] BYREF GJSmartTemplate *v51; // [rsp+F0h] [rbp-B0h] unsigned int v52; // [rsp+F8h] [rbp-A8h] int v53; // [rsp+FCh] [rbp-A4h] cocos2d::CCArray *v54; // [rsp+100h] [rbp-A0h] BrowseSmartTemplateLayer *v55; // [rsp+108h] [rbp-98h] std::string v56; // [rsp+110h] [rbp-90h] BYREF void *v57; // [rsp+128h] [rbp-78h] std::string v58; // [rsp+130h] [rbp-70h] BYREF _BYTE v59[15]; // [rsp+148h] [rbp-58h] __int128 __dst; // [rsp+158h] [rbp-48h] BYREF void *v61; // [rsp+168h] [rbp-38h] bool v62; // [rsp+177h] [rbp-29h] std::string::size_type size; // 0:xmm0_8.8 v3 = a1; result = FLAlertLayer::init_1(a1, 150); if ( result ) { v62 = result; BrowseSmartTemplateLayer::baseSetup(a1); cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v50); if ( a2 ) { a1->m_template = a2; cocos2d::CCObject::retain(a2); } v44 = 8; strcpy(v45, "Help"); __p = operator new(0xF8u); v47[0] = 249; v47[1] = 243; strcpy( (char *)__p, "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."); v5 = InfoAlertButton::create(&v44, v47, 1.0); if ( (v47[0] & 1) != 0 ) operator delete(__p); v51 = a2; if ( (v44 & 1) != 0 ) operator delete(v46); ((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v5); m_buttonMenu = a1->m_buttonMenu; sub_10028CBE0( (float *)&__dst, (float)((float)(v50[0] * 0.5) + 225.0) + -18.0, (float)((float)(0.5 * v50[1]) + 140.0) + -18.0); size = (std::string::size_type)cocos2d::CCNode::convertToNodeSpace( (cocos2d::CCNode *)&v56, (const cocos2d::CCPoint *)m_buttonMenu); (*(void (__fastcall **)(__int64, std::string *, double))(*(_QWORD *)v5 + 184LL))(v5, &v56, *(double *)&size); if ( !a1->m_template ) return v62; m_prefabArrays = v51->m_prefabArrays; v7 = cocos2d::CCDictionary::allKeys(m_prefabArrays); v8 = sub_100720070(v7); v55 = a1; if ( v8 ) { v9 = 0; p_dst = (const std::string *)&__dst; v11 = 0; v54 = v7; while ( 1 ) { v12 = v9; v13 = (char *)p_dst; v52 = v12; v14 = cocos2d::CCArray::stringAtIndex(v7, v12); CString = cocos2d::CCString::getCString(v14); v16 = strlen(CString); if ( v16 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100006BF0(*(double *)&size); v17 = v16; v53 = v11; if ( v16 >= 0x17 ) break; LOBYTE(__dst) = 2 * v16; v18 = (char *)&__dst + 1; if ( v16 ) goto LABEL_19; LABEL_20: v18[v17] = 0; p_dst = (const std::string *)v13; v21 = cocos2d::CCDictionary::objectForKey_1((__int64)m_prefabArrays, v13); v22 = sub_100720070(v21); v11 = v53; v23 = v52; if ( !v22 ) { v7 = v54; if ( (__dst & 1) != 0 ) goto LABEL_40; goto LABEL_11; } v56.__r_.__value_.__r.__words[0] = 0; LOWORD(v56.__r_.__value_.__r.__words[1]) = 0; *(_WORD *)&v58.__r_.__value_.__l.0 = 0; *(_DWORD *)v59 = 0; v59[4] = 0; *(_DWORD *)&v59[11] = 0; *(_DWORD *)&v59[8] = 0; std::string::operator=((std::string *)&v56.__r_.__value_.__r.__words[1], p_dst); std::string::operator=(&v58, p_dst); *(_DWORD *)v59 = sub_100720070(v21); if ( (__dst & 1) != 0 ) { sub_100006B70(&v49, v61, *((unsigned __int64 *)&__dst + 1), *(double *)&size); } else { v49.__r_.__value_.__r.__words[2] = (std::string::size_type)v61; size = __dst; *(_OWORD *)&v49.__r_.__value_.__l.0 = __dst; } v59[4] = GJSmartTemplate::isUnrequired((__int64)v51, &v49); if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v49.__r_.__value_.__l.__data_); *(_QWORD *)&v36[8] = v56.__r_.__value_.__r.__words[0]; if ( (v56.__r_.__value_.__s.__data_[7] & 1) != 0 ) { sub_100006B70(&v36[16], v57, v56.__r_.__value_.__r.__words[2], *(double *)&size); } else { *(_QWORD *)&v36[32] = v57; size = v56.__r_.__value_.__l.__size_; *(_OWORD *)&v36[16] = *(_OWORD *)&v56.__r_.__value_.__r.__words[1]; } if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) != 0 ) { sub_100006B70(&v36[40], v58.__r_.__value_.__l.__data_, v58.__r_.__value_.__l.__size_, *(double *)&size); } else { *(std::string *)&v36[40] = v58; size = v58.__r_.__value_.__r.__words[0]; } v7 = v54; *(_QWORD *)&v36[71] = *(_QWORD *)&v59[7]; *(_QWORD *)&v36[64] = *(_QWORD *)v59; BrowseSmartTemplateLayer::addPrefabMenuItem(v3, *(SmartPrefabResult *)v36, (int)&v36[8]); if ( (v36[40] & 1) != 0 ) { operator delete(*(void **)&v36[56]); if ( (v36[16] & 1) == 0 ) { LABEL_36: if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) == 0 ) goto LABEL_37; goto LABEL_43; } } else if ( (v36[16] & 1) == 0 ) { goto LABEL_36; } operator delete(*(void **)&v36[32]); if ( (*(_BYTE *)&v58.__r_.__value_.__s.0 & 1) == 0 ) { LABEL_37: if ( (v56.__r_.__value_.__s.__data_[7] & 1) == 0 ) goto LABEL_39; LABEL_38: operator delete(v57); goto LABEL_39; } LABEL_43: operator delete(v58.__r_.__value_.__l.__data_); if ( (v56.__r_.__value_.__s.__data_[7] & 1) != 0 ) goto LABEL_38; LABEL_39: ++v11; if ( (__dst & 1) != 0 ) LABEL_40: operator delete(v61); LABEL_11: v9 = v23 + 1; if ( v9 >= (unsigned int)sub_100720070(v7) ) goto LABEL_46; } v19 = v16 | 7; v20 = 26; if ( (v17 | 7) != 0x17 ) v20 = v19 + 1; v18 = (char *)operator new(v20); v61 = v18; *(_QWORD *)&__dst = v20 + 1; *((_QWORD *)&__dst + 1) = v17; v3 = v55; LABEL_19: memmove(v18, CString, v17); goto LABEL_20; } v11 = 0; LABEL_46: v24 = v11; *(_QWORD *)&v25 = 0; memset(&v56, 0, sizeof(v56)); GJSmartTemplate::getTemplateState(v3->m_template, (std::vector *)&v56); v26 = *(_OWORD *)&v56.__r_.__value_.__l.0; if ( v56.__r_.__value_.__l.__size_ != v56.__r_.__value_.__r.__words[0] ) { v27 = 60; v28 = 0; do { if ( !*(_DWORD *)(v26 + v27 - 4) && !*(_BYTE *)(v26 + v27) ) { v37 = *(_QWORD *)(v26 + v27 - 60); if ( (*(_BYTE *)(v26 + v27 - 52) & 1) != 0 ) { sub_100006B70(&v38, *(const void **)(v26 + v27 - 36), *(_QWORD *)(v26 + v27 - 44), *(double *)&v25); } else { v29 = v26 + v27 - 52; v39 = *(void **)(v29 + 16); v25 = *(_OWORD *)v29; v38 = *(_OWORD *)v29; } if ( (*(_BYTE *)(v26 + v27 - 28) & 1) != 0 ) { sub_100006B70(&v40, *(const void **)(v26 + v27 - 12), *(_QWORD *)(v26 + v27 - 20), *(double *)&v25); } else { v30 = v26 + v27 - 28; v41 = *(void **)(v30 + 16); v25 = *(_OWORD *)v30; v40 = *(_OWORD *)v30; } v31 = (__int64 *)(v26 + v27 - 4); v32 = *v31; *(_QWORD *)((char *)v42 + 7) = *(__int64 *)((char *)v31 + 7); v42[0] = v32; BrowseSmartTemplateLayer::addPrefabMenuItem(v55, *(SmartPrefabResult *)v36, (int)&v37); if ( (v40 & 1) != 0 ) operator delete(v41); if ( (v38 & 1) != 0 ) operator delete(v39); ++v24; v26 = *(_OWORD *)&v56.__r_.__value_.__l.0; } ++v28; v27 += 72; } while ( 0x8E38E38E38E38E39LL * ((__int64)(*((_QWORD *)&v26 + 1) - v26) >> 3) > v28 ); } BrowseSmartTemplateLayer::goToPage(v55, 0); v33 = v56.__r_.__value_.__r.__words[0]; if ( !v56.__r_.__value_.__r.__words[0] ) return v62; v34 = v56.__r_.__value_.__l.__size_; v35 = (void *)v56.__r_.__value_.__r.__words[0]; if ( v56.__r_.__value_.__l.__size_ == v56.__r_.__value_.__r.__words[0] ) { LABEL_72: v56.__r_.__value_.__l.__size_ = v33; operator delete(v35); return v62; } while ( 1 ) { if ( (*(_BYTE *)(v34 - 40) & 1) != 0 ) { operator delete(*(void **)(v34 - 24)); if ( (*(_BYTE *)(v34 - 64) & 1) != 0 ) LABEL_70: operator delete(*(void **)(v34 - 48)); } else if ( (*(_BYTE *)(v34 - 64) & 1) != 0 ) { goto LABEL_70; } v34 -= 72LL; if ( v34 == v33 ) { v35 = (void *)v56.__r_.__value_.__r.__words[0]; goto LABEL_72; } } } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source