// // EditorUI::createSmartObjectsFromTemplate from 0x100042a20 to 0x100043357 (2359 bytes) // // 2 xrefs: // > SetupSmartBlockLayer::onCreate @ 0x1004e6dc8 // > SetupSmartBlockLayer::onPasteTemplate @ 0x1004e70ed // // 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 // void __fastcall EditorUI::createSmartObjectsFromTemplate( EditorUI *a1, GJSmartTemplate *a2, cocos2d::CCArray *a3, bool a4, bool a5, bool a6, bool a7) { _BOOL4 v7; // ebx cocos2d::CCArray *v8; // r15 EditorUI *v9; // r13 int v10; // eax unsigned int v11; // ebx unsigned int v12; // eax GameObject *v13; // r14 __int64 v14; // r12 double v15; // xmm0_8 LevelEditorLayer *m_editorLayer; // r14 cocos2d::CCArray *v17; // rax cocos2d::CCArray *v18; // r12 unsigned int v19; // r13d __int64 v20; // rax __int64 v21; // r14 unsigned int v22; // ebx GameObject *v23; // rax unsigned int i; // r14d __int64 v25; // rax __int64 v26; // r12 __int64 v27; // rbx cocos2d::CCPoint v28; // xmm0_8 cocos2d::CCPoint v29; // xmm0_8 cocos2d::CCPoint v30; // xmm0_8 cocos2d::CCPoint v31; // xmm0_8 cocos2d::CCPoint v32; // xmm0_8 cocos2d::CCPoint v33; // xmm0_8 cocos2d::CCPoint v34; // xmm0_8 SmartGameObject *v35; // r15 cocos2d::CCPoint v36; // xmm0_8 SmartGameObject *v37; // rbx double v38; // xmm0_8 cocos2d::CCArray *v39; // rbx cocos2d::CCPoint v40; // xmm0_8 int v41; // r13d cocos2d::CCPoint v42; // xmm0_8 cocos2d::CCDictElement *j; // r14 cocos2d::CCObject *m_pObject; // rbx __int64 v45; // r14 unsigned int v46; // ebx SmartGameObject *v47; // rax EditorUI *v48; // rdi cocos2d::CCArray *v49; // rsi cocos2d::CCArray *v50; // r14 UndoObject *v51; // rax unsigned int v52; // ebx GameObject *v53; // rax UndoObject *v54; // rsi __int64 v55; // [rsp+30h] [rbp-190h] BYREF char v56; // [rsp+38h] [rbp-188h] void *v57; // [rsp+48h] [rbp-178h] __int128 v58; // [rsp+50h] [rbp-170h] void *v59; // [rsp+60h] [rbp-160h] int v60; // [rsp+70h] [rbp-150h] char v61; // [rsp+74h] [rbp-14Ch] char v62; // [rsp+75h] [rbp-14Bh] std::string __str; // [rsp+78h] [rbp-148h] BYREF SmartGameObject *SmartNeighbor; // [rsp+90h] [rbp-130h] SmartGameObject *v65; // [rsp+98h] [rbp-128h] SmartGameObject *v66; // [rsp+A0h] [rbp-120h] SmartGameObject *v67; // [rsp+A8h] [rbp-118h] SmartGameObject *v68; // [rsp+B0h] [rbp-110h] SmartGameObject *v69; // [rsp+B8h] [rbp-108h] __int128 v70; // [rsp+C0h] [rbp-100h] BYREF void *__p; // [rsp+D0h] [rbp-F0h] std::string v72; // [rsp+E0h] [rbp-E0h] BYREF std::string v73; // [rsp+100h] [rbp-C0h] BYREF _BYTE v74[8]; // [rsp+118h] [rbp-A8h] BYREF __int64 v75; // [rsp+120h] [rbp-A0h] __int128 v76; // [rsp+128h] [rbp-98h] BYREF void *v77; // [rsp+138h] [rbp-88h] float v78; // [rsp+144h] [rbp-7Ch] BYREF float v79; // [rsp+148h] [rbp-78h] unsigned int v80; // [rsp+14Ch] [rbp-74h] _BOOL4 v81; // [rsp+150h] [rbp-70h] _BOOL4 v82; // [rsp+154h] [rbp-6Ch] cocos2d::CCDictionary *v83; // [rsp+158h] [rbp-68h] GJSmartTemplate *v84; // [rsp+160h] [rbp-60h] cocos2d::CCArray *v85; // [rsp+168h] [rbp-58h] cocos2d::CCArray *v86; // [rsp+170h] [rbp-50h] cocos2d::CCArray *v87; // [rsp+178h] [rbp-48h] _BYTE v88[8]; // [rsp+184h] [rbp-3Ch] BYREF _BOOL4 v89; // [rsp+18Ch] [rbp-34h] EditorUI *v90; // [rsp+190h] [rbp-30h] cocos2d::CCRect v91; // 0:xmm0_8.8,8:xmm1_8.8 v81 = a6; v89 = a4; if ( a3 ) { v7 = a5; v8 = a3; v9 = a1; v84 = a2; v10 = sub_100720070(a3); if ( a2 ) { if ( v10 ) { v82 = v7; GJSmartTemplate::resetScannedPrefabs(a2); EditorUI::deselectAll(a1); v86 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2); v85 = (cocos2d::CCArray *)sub_10071F9E0(a1, a2); v75 = sub_10071F9E0(a1, a2); v83 = cocos2d::CCDictionary::create(); v87 = v8; v90 = a1; if ( (unsigned int)sub_100720070(v8) ) { if ( v89 ) { v11 = 0; do { v13 = (GameObject *)sub_1007200C0(v8, v11); if ( (v13->m_objectID & 0xFFFFFFFE) == 0xB50 ) GameObject::determineSlopeDirection(v13); v14 = ((__int64 (__fastcall *)(GameObject *))v13->getPosition)(v13); GJSmartTemplate::offsetForObject((SmartGameObject *)&v55); sub_10028CCE0(&v78, v14); *(_QWORD *)&v15 = LODWORD(v78); *(float *)&v15 = v78 + -37.5; v91.size = (cocos2d::CCSize)LODWORD(v79); v91.size.width = v79 + -37.5; sub_10028CC00(&v55, v15, *(double *)&v91.size, 75.0, 75.0); m_editorLayer = v9->m_editorLayer; *(double *)&v91.origin = sub_10028D180(&v76); v17 = LevelEditorLayer::objectsInRect(m_editorLayer, v91, (bool)&v76); if ( v17 ) { v18 = v17; if ( (unsigned int)sub_100720070(v17) ) { if ( (unsigned int)sub_100720070(v18) ) { v19 = 0; do { v20 = sub_1007200C0(v18, v19); if ( *(_DWORD *)(v20 + 1248) == 5 ) { v21 = v20; if ( !(unsigned __int8)sub_100720160(v87, v20) ) { sub_10071FCD0(v87, v21); cocos2d::CCDictionary::setObject(v83, (cocos2d::CCObject *)v21, *(unsigned int *)(v21 + 916)); (*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v21 + 72LL))( v21, *(unsigned __int8 *)(v21 + 1347)); *(_BYTE *)(v21 + 1347) = 1; } } ++v19; } while ( v19 < (unsigned int)sub_100720070(v18) ); } } } ++v11; v8 = v87; v12 = sub_100720070(v87); v9 = v90; } while ( v11 < v12 ); } else { v22 = 0; do { v23 = (GameObject *)sub_1007200C0(v8, v22); if ( (v23->m_objectID & 0xFFFFFFFE) == 0xB50 ) GameObject::determineSlopeDirection(v23); ++v22; } while ( v22 < (unsigned int)sub_100720070(v8) ); } } if ( (unsigned int)sub_100720070(v8) ) { for ( i = 0; i < (unsigned int)sub_100720070(v8); ++i ) { v25 = sub_1007200C0(v8, i); v26 = v25; if ( *(_BYTE *)(v25 + 1347) ) { if ( !cocos2d::CCDictionary::objectForKey(v83, *(unsigned int *)(v25 + 916)) ) sub_10071FCD0(v85, v26); continue; } v80 = i; v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 192LL))(v25); GJSmartTemplate::offsetForObject((SmartGameObject *)&v55); sub_10028CCE0(&v78, v27); *(double *)&v28 = sub_10028CC60(&v55); SmartNeighbor = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v28, (GJSmartDirection)&v55, (cocos2d::CCArray *)1); *(double *)&v29 = sub_10028CC60(&v55); v65 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v29, (GJSmartDirection)&v55, (cocos2d::CCArray *)2); *(double *)&v30 = sub_10028CC60(&v55); v66 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v30, (GJSmartDirection)&v55, (cocos2d::CCArray *)3); *(double *)&v31 = sub_10028CC60(&v55); v67 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v31, (GJSmartDirection)&v55, (cocos2d::CCArray *)4); *(double *)&v32 = sub_10028CC60(&v55); v68 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v32, (GJSmartDirection)&v55, (cocos2d::CCArray *)5); *(double *)&v33 = sub_10028CC60(&v55); v69 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v33, (GJSmartDirection)&v55, (cocos2d::CCArray *)6); *(double *)&v34 = sub_10028CC60(&v55); v35 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v34, (GJSmartDirection)&v55, (cocos2d::CCArray *)7); *(double *)&v36 = sub_10028CC60(&v55); v37 = EditorUI::getSmartNeighbor( (EditorUI *)&v55, (SmartGameObject *)v26, v36, (GJSmartDirection)&v55, (cocos2d::CCArray *)8); v38 = sub_10028CC60(&v55); GJSmartTemplate::keyFromNeighbors( (unsigned int)&v76, (unsigned int)&v55, v26, (_DWORD)SmartNeighbor, (_DWORD)v65, (_DWORD)v66, (__int64)v67, (__int64)v68, (__int64)v69, (__int64)v35, (__int64)v37); if ( (v76 & 1) != 0 ) { sub_100006B70(&v70, v77, *((unsigned __int64 *)&v76 + 1), v38); } else { __p = v77; v38 = *(double *)&v76; v70 = v76; } GJSmartTemplate::scanForPrefab(&v55, v84, &v70); v9 = v90; v8 = v87; i = v80; if ( (v70 & 1) != 0 ) operator delete(__p); if ( v55 ) { sub_10071FCD0(v75, v26); if ( (v58 & 1) != 0 ) { sub_100006B70(&v72, v59, *((unsigned __int64 *)&v58 + 1), v38); } else { v72.__r_.__value_.__r.__words[2] = (std::string::size_type)v59; v38 = *(double *)&v58; *(_OWORD *)&v72.__r_.__value_.__l.0 = v58; } std::string::operator=((std::string *)(v26 + 1352), &v72); if ( (*(_BYTE *)&v72.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v72.__r_.__value_.__l.__data_); if ( !a7 ) { if ( (*(_BYTE *)(v55 + 80) & 1) != 0 ) sub_100006B70(&v73, *(const void **)(v55 + 96), *(_QWORD *)(v55 + 88), v38); else v73 = *(std::string *)(v55 + 80); v39 = EditorUI::pasteObjects(v9, &v73, 0, 1); if ( (*(_BYTE *)&v73.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v73.__r_.__value_.__l.__data_); if ( v39 && (unsigned int)sub_100720070(v39) ) { (*(void (__fastcall **)(__int64))(*(_QWORD *)v26 + 192LL))(v26); sub_10028CC60(v74); *(double *)&v40 = sub_10028CC60(v88); EditorUI::repositionObjectsToCenter(v90, v39, v40, (bool)v88); if ( v62 == 1 ) EditorUI::flipObjectsY(v90, v39); if ( v61 == 1 ) EditorUI::flipObjectsX(v90, v39); v41 = v60; if ( v60 > 0 ) { sub_10028CC60(v88); EditorUI::rotateObjects(v90, v39, (float)-v41, (cocos2d::CCPoint)v91.size); } *(double *)&v42 = sub_10028CC60(v88); EditorUI::repositionObjectsToCenter(v90, v39, v42, (bool)v88); EditorUI::deleteSmartBlocksFromObjects(v90, v39); sub_100720050(v86, v39); sub_10071FCD0(v85, v26); v9 = v90; } } } else { *(_WORD *)&__str.__r_.__value_.__l.0 = 0; std::string::operator=((std::string *)(v26 + 1352), &__str); if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 ) operator delete(__str.__r_.__value_.__l.__data_); } if ( (v58 & 1) != 0 ) { operator delete(v59); if ( (v56 & 1) == 0 ) { LABEL_58: if ( (v76 & 1) != 0 ) goto LABEL_62; continue; } } else if ( (v56 & 1) == 0 ) { goto LABEL_58; } operator delete(v57); if ( (v76 & 1) != 0 ) LABEL_62: operator delete(v77); } } if ( v83 != nullptr && v89 ) { for ( j = v83->m_pElements; j; BYTE3(m_pObject[24].__vftable) = ((unsigned int (__fastcall *)(cocos2d::CCObject *))m_pObject->getTag)(m_pObject) != 0 ) { m_pObject = j->m_pObject; j = (cocos2d::CCDictElement *)j->hh.next; } } EditorUI::deselectAll(v9); if ( v81 ) { v45 = v75; if ( (unsigned int)sub_100720070(v75) ) { v46 = 0; do { v47 = (SmartGameObject *)sub_1007200C0(v45, v46); v47->m_referenceOnly = 1; SmartGameObject::updateSmartFrame(v47); ++v46; } while ( v46 < (unsigned int)sub_100720070(v45) ); } } else if ( !v82 ) { v50 = v85; v51 = UndoObject::createWithArray(v85, DeleteMulti); v52 = 0; LevelEditorLayer::addToUndoList(v9->m_editorLayer, v51, 0); if ( (unsigned int)sub_100720070(v50) ) { do { v53 = (GameObject *)sub_1007200C0(v50, v52); EditorUI::deleteObject(v9, v53, 1); ++v52; } while ( v52 < (unsigned int)sub_100720070(v50) ); } v48 = v9; v49 = v86; goto LABEL_76; } v48 = v9; v49 = v8; LABEL_76: EditorUI::selectObjects(v48, v49, 1); v54 = UndoObject::createWithArray(v86, Paste); LevelEditorLayer::addToUndoList(v9->m_editorLayer, v54, 0); EditorUI::updateButtons(v9); EditorUI::updateObjectInfoLabel(v9); ((void (__fastcall *)(EditorUI *))v9->updateScaleControl)(v9); } } } }