// // BrowseSmartTemplateLayer::init from 0x1004e3910 to 0x1004e4049 (1849 bytes) // // 1 xrefs: // > sub_1004E2F50 @ 0x1004e3101 // // This function is hookable on this platform (idp: pc, 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 12:31:19 +0000 // __int64 __fastcall BrowseSmartTemplateLayer::init(__int64 a1, __int64 a2) { __int64 v2; // r13 __int64 result; // rax __int64 v4; // rax __int64 v5; // rbx __int64 v6; // r14 __int64 v7; // rbx int v8; // eax unsigned int v9; // r12d const std::string *p_dst; // r14 unsigned int v11; // r15d __int64 v12; // rsi char *v13; // r12 __int64 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 int v23; // r12d unsigned int v24; // ebx __int128 v25; // kr00_16 __int64 v26; // r14 unsigned __int64 v27; // r13 __int64 v28; // rax __int64 v29; // rax __int64 *v30; // rax __int64 v31; // rcx std::string::size_type v32; // rbx std::string::size_type size; // r14 void *v34; // rdi std::string::size_type v35; // [rsp+8h] [rbp-198h] BYREF __int128 v36; // [rsp+10h] [rbp-190h] BYREF void *v37; // [rsp+20h] [rbp-180h] __int128 v38; // [rsp+28h] [rbp-178h] BYREF void *data; // [rsp+38h] [rbp-168h] _QWORD v40[2]; // [rsp+40h] [rbp-160h] __int64 v41; // [rsp+50h] [rbp-150h] BYREF __int128 v42; // [rsp+58h] [rbp-148h] BYREF void *v43; // [rsp+68h] [rbp-138h] __int128 v44; // [rsp+70h] [rbp-130h] BYREF void *v45; // [rsp+80h] [rbp-120h] _QWORD v46[2]; // [rsp+88h] [rbp-118h] __int64 v47; // [rsp+98h] [rbp-108h] char v48; // [rsp+A0h] [rbp-100h] BYREF char v49[15]; // [rsp+A1h] [rbp-FFh] BYREF void *v50; // [rsp+B0h] [rbp-F0h] _QWORD v51[2]; // [rsp+B8h] [rbp-E8h] BYREF void *__p; // [rsp+C8h] [rbp-D8h] std::string v53; // [rsp+D0h] [rbp-D0h] BYREF __int64 v54; // [rsp+E8h] [rbp-B8h] BYREF __int64 v55; // [rsp+F0h] [rbp-B0h] int v56; // [rsp+F8h] [rbp-A8h] unsigned int v57; // [rsp+FCh] [rbp-A4h] __int64 v58; // [rsp+100h] [rbp-A0h] __int64 v59; // [rsp+108h] [rbp-98h] std::string v60; // [rsp+110h] [rbp-90h] BYREF void *v61; // [rsp+128h] [rbp-78h] std::string v62; // [rsp+130h] [rbp-70h] BYREF _BYTE v63[15]; // [rsp+148h] [rbp-58h] __int128 __dst; // [rsp+158h] [rbp-48h] BYREF void *v65; // [rsp+168h] [rbp-38h] unsigned __int8 v66; // [rsp+177h] [rbp-29h] v2 = a1; result = FLAlertLayer::init_1((_BYTE *)a1, 150); if ( (_BYTE)result ) { v66 = result; BrowseSmartTemplateLayer::baseSetup(a1); v4 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(&v54, v4); if ( a2 ) { *(_QWORD *)(a1 + 664) = a2; cocos2d::CCObject::retain(a2); } v48 = 8; strcpy(v49, "Help"); __p = operator new(0xF8u); v51[0] = 249; v51[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(&v48, v51, 1.0); if ( (v51[0] & 1) != 0 ) operator delete(__p); v55 = a2; if ( (v48 & 1) != 0 ) operator delete(v50); (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v5); v6 = *(_QWORD *)(a1 + 552); sub_100278250( (float *)&__dst, (float)((float)(*(float *)&v54 * 0.5) + 225.0) + -18.0, (float)((float)(0.5 * *((float *)&v54 + 1)) + 140.0) + -18.0); cocos2d::CCNode::convertToNodeSpace((double *)&v60, v6, (unsigned int *)&__dst); (*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v5 + 184LL))(v5, &v60); if ( !*(_QWORD *)(a1 + 664) ) return v66; v47 = *(_QWORD *)(v55 + 56); v7 = cocos2d::CCDictionary::allKeys(v47); v8 = sub_1007FEF90(v7); v59 = a1; if ( v8 ) { v9 = 0; p_dst = (const std::string *)&__dst; v11 = 0; v58 = v7; while ( 1 ) { v12 = v9; v13 = (char *)p_dst; v56 = v12; v14 = cocos2d::CCArray::stringAtIndex(v7, v12); CString = (const char *)cocos2d::CCString::getCString(v14); v16 = strlen(CString); if ( v16 >= 0xFFFFFFFFFFFFFFF8LL ) sub_100003630(); v17 = v16; v57 = 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(v47, v13); v22 = sub_1007FEF90(v21); v11 = v57; v23 = v56; if ( !v22 ) { v7 = v58; if ( (__dst & 1) != 0 ) goto LABEL_40; goto LABEL_11; } v60.__r_.__value_.__r.__words[0] = 0; LOWORD(v60.__r_.__value_.__r.__words[1]) = 0; *(_WORD *)&v62.__r_.__value_.__l.0 = 0; *(_DWORD *)v63 = 0; v63[4] = 0; *(_DWORD *)&v63[11] = 0; *(_DWORD *)&v63[8] = 0; std::string::operator=((std::string *)&v60.__r_.__value_.__r.__words[1], p_dst); std::string::operator=(&v62, p_dst); *(_DWORD *)v63 = sub_1007FEF90(v21); if ( (__dst & 1) != 0 ) { sub_10001AD30(&v53, v65, *((unsigned __int64 *)&__dst + 1)); } else { v53.__r_.__value_.__r.__words[2] = (std::string::size_type)v65; *(_OWORD *)&v53.__r_.__value_.__l.0 = __dst; } v63[4] = GJSmartTemplate::isUnrequired(v55, &v53); if ( (*(_BYTE *)&v53.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v53.__r_.__value_.__l.__data_); v35 = v60.__r_.__value_.__r.__words[0]; if ( (v60.__r_.__value_.__s.__data_[7] & 1) != 0 ) { sub_10001AD30(&v36, v61, v60.__r_.__value_.__r.__words[2]); } else { v37 = v61; v36 = *(_OWORD *)&v60.__r_.__value_.__r.__words[1]; } if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) != 0 ) { sub_10001AD30(&v38, v62.__r_.__value_.__l.__data_, v62.__r_.__value_.__l.__size_); } else { data = v62.__r_.__value_.__l.__data_; v38 = *(_OWORD *)&v62.__r_.__value_.__l.0; } v7 = v58; *(_QWORD *)((char *)v40 + 7) = *(_QWORD *)&v63[7]; v40[0] = *(_QWORD *)v63; BrowseSmartTemplateLayer::addPrefabMenuItem(v2, &v35, v11); if ( (v38 & 1) != 0 ) { operator delete(data); if ( (v36 & 1) == 0 ) { LABEL_36: if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) == 0 ) goto LABEL_37; goto LABEL_43; } } else if ( (v36 & 1) == 0 ) { goto LABEL_36; } operator delete(v37); if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) == 0 ) { LABEL_37: if ( (v60.__r_.__value_.__s.__data_[7] & 1) == 0 ) goto LABEL_39; LABEL_38: operator delete(v61); goto LABEL_39; } LABEL_43: operator delete(v62.__r_.__value_.__l.__data_); if ( (v60.__r_.__value_.__s.__data_[7] & 1) != 0 ) goto LABEL_38; LABEL_39: ++v11; if ( (__dst & 1) != 0 ) LABEL_40: operator delete(v65); LABEL_11: v9 = v23 + 1; if ( v9 >= (unsigned int)sub_1007FEF90(v7) ) goto LABEL_46; } v19 = v16 | 7; v20 = 26; if ( (v17 | 7) != 0x17 ) v20 = v19 + 1; v18 = (char *)operator new(v20); v65 = v18; *(_QWORD *)&__dst = v20 + 1; *((_QWORD *)&__dst + 1) = v17; v2 = v59; LABEL_19: memmove(v18, CString, v17); goto LABEL_20; } v11 = 0; LABEL_46: v24 = v11; memset(&v60, 0, sizeof(v60)); GJSmartTemplate::getTemplateState(*(_BYTE **)(v2 + 664), (__int64)&v60); v25 = *(_OWORD *)&v60.__r_.__value_.__l.0; if ( v60.__r_.__value_.__l.__size_ != v60.__r_.__value_.__r.__words[0] ) { v26 = 60; v27 = 0; do { if ( !*(_DWORD *)(v25 + v26 - 4) && !*(_BYTE *)(v25 + v26) ) { v41 = *(_QWORD *)(v25 + v26 - 60); if ( (*(_BYTE *)(v25 + v26 - 52) & 1) != 0 ) { sub_10001AD30(&v42, *(const void **)(v25 + v26 - 36), *(_QWORD *)(v25 + v26 - 44)); } else { v28 = v25 + v26 - 52; v43 = *(void **)(v28 + 16); v42 = *(_OWORD *)v28; } if ( (*(_BYTE *)(v25 + v26 - 28) & 1) != 0 ) { sub_10001AD30(&v44, *(const void **)(v25 + v26 - 12), *(_QWORD *)(v25 + v26 - 20)); } else { v29 = v25 + v26 - 28; v45 = *(void **)(v29 + 16); v44 = *(_OWORD *)v29; } v30 = (__int64 *)(v25 + v26 - 4); v31 = *v30; *(_QWORD *)((char *)v46 + 7) = *(__int64 *)((char *)v30 + 7); v46[0] = v31; BrowseSmartTemplateLayer::addPrefabMenuItem(v59, &v41, v24); if ( (v44 & 1) != 0 ) operator delete(v45); if ( (v42 & 1) != 0 ) operator delete(v43); ++v24; v25 = *(_OWORD *)&v60.__r_.__value_.__l.0; } ++v27; v26 += 72; } while ( 0x8E38E38E38E38E39LL * ((__int64)(*((_QWORD *)&v25 + 1) - v25) >> 3) > v27 ); } BrowseSmartTemplateLayer::goToPage(v59, 0); v32 = v60.__r_.__value_.__r.__words[0]; if ( !v60.__r_.__value_.__r.__words[0] ) return v66; size = v60.__r_.__value_.__l.__size_; v34 = (void *)v60.__r_.__value_.__r.__words[0]; if ( v60.__r_.__value_.__l.__size_ == v60.__r_.__value_.__r.__words[0] ) { LABEL_72: v60.__r_.__value_.__l.__size_ = v32; operator delete(v34); return v66; } while ( 1 ) { if ( (*(_BYTE *)(size - 40) & 1) != 0 ) { operator delete(*(void **)(size - 24)); if ( (*(_BYTE *)(size - 64) & 1) != 0 ) LABEL_70: operator delete(*(void **)(size - 48)); } else if ( (*(_BYTE *)(size - 64) & 1) != 0 ) { goto LABEL_70; } size -= 72LL; if ( size == v32 ) { v34 = (void *)v60.__r_.__value_.__r.__words[0]; goto LABEL_72; } } } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source