// // EditorUI::addObjectsToSmartTemplate from 0x7cbc84 to 0x7cc9e0 (3420 bytes) // // 2 xrefs: // > SetupSmartBlockLayer::onCreateTemplate @ 0xb142f8 // > @ 0xc7e28 // // 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 12:54:12 +0000 // __int64 __fastcall EditorUI::addObjectsToSmartTemplate(EditorUI *this, GJSmartTemplate *a2, cocos2d::CCArray *a3) { unsigned int v5; // w19 cocos2d::CCObject *v6; // x0 cocos2d::CCObject *v7; // x1 __int64 v8; // x24 __int64 v9; // x0 __int64 v10; // x0 long double v11; // q1 long double v12; // q0 int v13; // w21 cocos2d::CCArray *v14; // x28 const cocos2d::CCPoint *v15; // x1 _DWORD *v16; // x25 _DWORD *v17; // x22 cocos2d::CCArray *v18; // x0 int v19; // w1 cocos2d::CCArray *StickyGroup; // x25 unsigned int v21; // w21 cocos2d::CCObject *v22; // x22 unsigned int v23; // w22 unsigned int *v24; // x21 const cocos2d::CCPoint *v25; // x0 const cocos2d::CCPoint *v26; // x2 const cocos2d::CCPoint *v27; // x2 float v28; // s0 float v29; // s9 int v30; // w1 const cocos2d::CCPoint *v31; // x2 float v32; // s0 float v33; // s0 const cocos2d::CCPoint *v34; // x2 float v35; // s0 const cocos2d::CCPoint *v36; // x2 float v37; // s0 unsigned int v38; // w21 float *Object; // x21 void (__fastcall *v40)(float *); // x22 void (__fastcall *v41)(float *, _QWORD); // x22 unsigned int v42; // w0 void (__fastcall *v43)(float *, _QWORD); // x22 unsigned int v44; // w0 __int64 v45; // x22 const cocos2d::CCPoint *v46; // x2 float v47; // s0 int v48; // w2 const cocos2d::CCPoint *v49; // x2 float v50; // s0 const cocos2d::CCPoint *v51; // x2 float v52; // s0 const cocos2d::CCPoint *v54; // x2 float v55; // s0 const cocos2d::CCPoint *v56; // x2 float v57; // s0 const cocos2d::CCPoint *v58; // x2 float v59; // s0 int v60; // [xsp+84h] [xbp+74h] int v62; // [xsp+90h] [xbp+80h] int v63; // [xsp+94h] [xbp+84h] int v64; // [xsp+A8h] [xbp+98h] int v65; // [xsp+ACh] [xbp+9Ch] int v66; // [xsp+C0h] [xbp+B0h] int v67; // [xsp+C4h] [xbp+B4h] cocos2d::CCDictionary *v68; // [xsp+C8h] [xbp+B8h] int v69; // [xsp+D0h] [xbp+C0h] unsigned int v70; // [xsp+D4h] [xbp+C4h] cocos2d::CCDictionary *v71; // [xsp+D8h] [xbp+C8h] int v72; // [xsp+E0h] [xbp+D0h] int v73; // [xsp+E4h] [xbp+D4h] int v74; // [xsp+E8h] [xbp+D8h] int v75; // [xsp+ECh] [xbp+DCh] int v76; // [xsp+F0h] [xbp+E0h] int v77; // [xsp+F4h] [xbp+E4h] __int64 v78; // [xsp+108h] [xbp+F8h] _DWORD *v79; // [xsp+110h] [xbp+100h] _DWORD *v80; // [xsp+118h] [xbp+108h] _DWORD *v81; // [xsp+120h] [xbp+110h] cocos2d::CCPoint *v82; // [xsp+128h] [xbp+118h] cocos2d::CCPoint *v83; // [xsp+130h] [xbp+120h] _DWORD *SmartNeighbor; // [xsp+138h] [xbp+128h] int v85; // [xsp+140h] [xbp+130h] int v86; // [xsp+148h] [xbp+138h] int v87; // [xsp+150h] [xbp+140h] int v88; // [xsp+158h] [xbp+148h] cocos2d::CCObject *v89; // [xsp+158h] [xbp+148h] float v90; // [xsp+168h] [xbp+158h] BYREF float v91; // [xsp+16Ch] [xbp+15Ch] __int64 v92; // [xsp+170h] [xbp+160h] BYREF char v93[8]; // [xsp+178h] [xbp+168h] BYREF char v94[8]; // [xsp+180h] [xbp+170h] BYREF __int64 v95; // [xsp+188h] [xbp+178h] BYREF __int64 v96; // [xsp+190h] [xbp+180h] BYREF __int64 v97; // [xsp+198h] [xbp+188h] BYREF __int64 v98; // [xsp+1A0h] [xbp+190h] BYREF __int64 v99; // [xsp+1A8h] [xbp+198h] BYREF __int64 v100; // [xsp+1B0h] [xbp+1A0h] BYREF __int64 v101; // [xsp+1B8h] [xbp+1A8h] BYREF __int64 v102; // [xsp+1C0h] [xbp+1B0h] BYREF __int64 v103; // [xsp+1C8h] [xbp+1B8h] BYREF __int64 v104; // [xsp+1D0h] [xbp+1C0h] BYREF __int64 v105; // [xsp+1D8h] [xbp+1C8h] BYREF __int64 v106; // [xsp+1E0h] [xbp+1D0h] BYREF __int64 v107; // [xsp+1E8h] [xbp+1D8h] BYREF __int64 v108; // [xsp+1F0h] [xbp+1E0h] BYREF __int64 v109; // [xsp+1F8h] [xbp+1E8h] BYREF float v110; // [xsp+200h] [xbp+1F0h] float v111; // [xsp+204h] [xbp+1F4h] float v112[4]; // [xsp+208h] [xbp+1F8h] BYREF __int64 v113; // [xsp+218h] [xbp+208h] BYREF size_t v114; // [xsp+220h] [xbp+210h] void *v115; // [xsp+228h] [xbp+218h] __int64 v116; // [xsp+230h] [xbp+220h] BYREF size_t v117; // [xsp+238h] [xbp+228h] void *v118; // [xsp+240h] [xbp+230h] __int64 v119; // [xsp+248h] [xbp+238h] BYREF size_t v120; // [xsp+250h] [xbp+240h] void *v121; // [xsp+258h] [xbp+248h] __int64 v122; // [xsp+260h] [xbp+250h] BYREF size_t v123; // [xsp+268h] [xbp+258h] void *v124; // [xsp+270h] [xbp+260h] if ( !a2 ) return _stack_chk_guard; v5 = 0; v71 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(_stack_chk_guard); v68 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v71); while ( v5 < (unsigned int)cocos2d::CCArray::count(a3) ) { while ( 1 ) { v6 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a3, v5); v7 = v6; if ( *((_DWORD *)v6 + 312) == 5 ) break; cocos2d::CCArray::removeObjectAtIndex(a3, v5, 1); if ( v5 >= (unsigned int)cocos2d::CCArray::count(a3) ) goto LABEL_6; } if ( (unsigned int)(*((_DWORD *)v6 + 257) - 2896) <= 1 ) { v89 = v6; GameObject::determineSlopeDirection(v6); v7 = v89; } v48 = *((_DWORD *)v7 + 218); if ( v48 > 0 ) cocos2d::CCDictionary::setObject(v68, v7, v48); ++v5; } LABEL_6: v70 = 0; LABEL_8: if ( v70 < (unsigned int)cocos2d::CCArray::count(a3) ) { v8 = cocos2d::CCArray::objectAtIndex(a3, v70); if ( *(_BYTE *)(v8 + 1347) ) goto LABEL_7; cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&dword_155C778); v9 = GJSmartTemplate::smartObjectToType(v8, (cocos2d::CCPoint *)v112); GJSmartTemplate::offsetForType(v9); v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 192LL))(v8); cocos2d::CCPoint::operator+(&v92, v10); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93); *(float *)&v11 = v90; LODWORD(v12) = dword_155C778; if ( v90 == *(float *)&dword_155C778 && (*(float *)&v11 = v91, LODWORD(v12) = dword_155C77C, v91 == *(float *)&dword_155C77C) ) { v72 = 0; v77 = 1; } else { v72 = 1; v77 = 2; v45 = (*(__int64 (__fastcall **)(__int64, long double, long double))(*(_QWORD *)v8 + 192LL))(v8, v12, v11); cocos2d::CCPoint::operator-(&v109, &v90); cocos2d::CCPoint::operator+(v112, v45); cocos2d::CCPoint::operator=(v93, v112); } v13 = 0; v113 = 0; v14 = nullptr; v114 = 0; v115 = nullptr; std::string::__init(&v113, &byte_11B8890, 0); v15 = (const cocos2d::CCPoint *)&v92; while ( 1 ) { cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v108, v15); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); SmartNeighbor = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 1u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v16 = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 2u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v83 = (cocos2d::CCPoint *)EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 3u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v82 = (cocos2d::CCPoint *)EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 4u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v17 = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 5u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v81 = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 6u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v80 = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 7u, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); v79 = EditorUI::getSmartNeighbor((__int64)this, v8, (__int64)v112, 8u, a3); if ( SmartNeighbor ) v88 = *((unsigned __int8 *)SmartNeighbor + 1347) ^ 1; else v88 = 0; if ( v16 ) v86 = *((unsigned __int8 *)v16 + 1347) ^ 1; else v86 = 0; if ( v83 ) v85 = *((unsigned __int8 *)v83 + 1347) ^ 1; else v85 = 0; if ( v82 ) v87 = *((unsigned __int8 *)v82 + 1347) ^ 1; else v87 = 0; if ( v17 ) v76 = *((unsigned __int8 *)v17 + 1347) ^ 1; else v76 = 0; if ( v81 ) v74 = *((unsigned __int8 *)v81 + 1347) ^ 1; else v74 = 0; if ( v80 ) v73 = *((unsigned __int8 *)v80 + 1347) ^ 1; else v73 = 0; if ( v79 ) v75 = *((unsigned __int8 *)v79 + 1347) ^ 1; else v75 = 0; cocos2d::CCRect::CCRect( (cocos2d::CCRect *)&v109, *(float *)&v108 - 14.0, *((float *)&v108 + 1) - 14.0, 28.0, 28.0); if ( !v88 ) v111 = v111 + 14.0; if ( !v86 ) { v111 = v111 + 14.0; *((float *)&v109 + 1) = *((float *)&v109 + 1) - 14.0; } if ( !v85 ) { v110 = v110 + 14.0; *(float *)&v109 = *(float *)&v109 - 14.0; } if ( !v87 ) v110 = v110 + 14.0; v78 = *((_QWORD *)this + 180); cocos2d::CCRect::CCRect((cocos2d::CCRect *)v112, (const cocos2d::CCRect *)&v109); v18 = LevelEditorLayer::objectsInRect(v78, v112, 1u); if ( v14 ) { if ( v18 ) cocos2d::CCArray::addObjectsFromArray(v14, v18); if ( v13 ) { LABEL_42: if ( ++v13 == v77 ) goto LABEL_50; goto LABEL_43; } } else { v14 = v18; if ( v13 ) goto LABEL_42; } cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, (const cocos2d::CCPoint *)&v108); GJSmartTemplate::keyFromNeighbors(&v116, v112, v8, SmartNeighbor, v16, v83, v82, v17, v81, v80, v79); if ( (v113 & 1) != 0 ) { *(_BYTE *)v115 = 0; v114 = 0; } else { LOWORD(v113) = 0; } ++v13; v60 = v75; v62 = v73; std::string::reserve(&v113, 0); v115 = v118; v63 = v74; v64 = v76; v65 = v87; v66 = v85; v113 = v116; v114 = v117; v67 = v86; v69 = v88; if ( v13 == v77 ) { LABEL_50: v19 = *(_DWORD *)(v8 + 872); if ( v19 > 0 ) { StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(*((GJBaseGameLayer **)this + 180), v19); v21 = 0; if ( StickyGroup ) { while ( v21 < (unsigned int)cocos2d::CCArray::count(StickyGroup) ) { v22 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(StickyGroup, v21); if ( !(unsigned __int8)cocos2d::CCArray::containsObject(v14, v22) ) cocos2d::CCArray::addObject(v14, v22); ++v21; } } } v23 = 0; if ( v14 ) { while ( 2 ) { while ( 2 ) { if ( v23 >= (unsigned int)cocos2d::CCArray::count(v14) ) { if ( (unsigned int)cocos2d::CCArray::count(v14) ) { v38 = *(_DWORD *)(v8 + 1028); (*(void (__fastcall **)(float *__return_ptr, __int64))(*(_QWORD *)v8 + 1360LL))(v112, v8); Object = EditorUI::createObject((__int64)this, v38, (const cocos2d::CCPoint *)v112); cocos2d::CCArray::addObject(v14, (cocos2d::CCObject *)Object); v40 = *(void (__fastcall **)(float *))(*(_QWORD *)Object + 360LL); (*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 368LL))(v8); v40(Object); v41 = *(void (__fastcall **)(float *, _QWORD))(*(_QWORD *)Object + 1240LL); v42 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 1424LL))(v8); v41(Object, v42); v43 = *(void (__fastcall **)(float *, _QWORD))(*(_QWORD *)Object + 1248LL); v44 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v8 + 1432LL))(v8); v43(Object, v44); *((_BYTE *)Object + 1150) = 1; qsort( *(void **)(*((_QWORD *)v14 + 7) + 16LL), **((unsigned int **)v14 + 7), 8u, (int (*)(const void *, const void *))smartPrefabSort); EditorUI::copyObjectsDetailed(&v116, this, v14); *((_BYTE *)Object + 1150) = 0; EditorUI::deleteObject(this, (GameObject *)Object, 1); v119 = 0; v120 = 0; v121 = nullptr; if ( (v113 & 1) != 0 ) { std::string::__init(&v119, v115, v114); } else { v121 = v115; v119 = v113; v120 = v114; } v122 = 0; v123 = 0; v124 = nullptr; if ( (v116 & 1) != 0 ) { std::string::__init(&v122, v118, v117); } else { v124 = v118; v122 = v116; v123 = v117; } GJSmartTemplate::savePrefab(a2, &v119, &v122); if ( (v122 & 1) != 0 ) operator delete(v124); if ( (v119 & 1) != 0 ) operator delete(v121); if ( (v116 & 1) != 0 ) operator delete(v118); } goto LABEL_103; } v24 = (unsigned int *)cocos2d::CCArray::objectAtIndex(v14, v23); if ( v24[312] == 5 || cocos2d::CCDictionary::objectForKey(v71, v24[229]) ) { LABEL_66: cocos2d::CCArray::removeObjectAtIndex(v14, v23, 1); continue; } break; } v25 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)v24 + 192LL))(v24); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v94, v25); cocos2d::ccpDistance((cocos2d *)&v92, (const cocos2d::CCPoint *)v94, v26); v29 = v28; if ( v72 ) { cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v94, v27); if ( v29 > v32 ) { cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v94, v31); v29 = v33; } } v30 = v24[218]; if ( v30 <= 0 ) { LABEL_75: if ( !v30 || *(_DWORD *)(v8 + 872) != v30 ) { if ( v69 ) { GJSmartTemplate::offsetForDir(&v95, 1, 0); cocos2d::CCPoint::operator+(&v96, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v96, v34); if ( v29 > v35 ) goto LABEL_66; } if ( v67 ) { GJSmartTemplate::offsetForDir(&v97, 2, 0); cocos2d::CCPoint::operator+(&v98, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v98, v36); if ( v29 > v37 ) goto LABEL_66; } if ( v66 ) { GJSmartTemplate::offsetForDir(&v99, 3, 0); cocos2d::CCPoint::operator+(&v100, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v100, v46); if ( v29 > v47 ) goto LABEL_66; } if ( v65 ) { GJSmartTemplate::offsetForDir(&v101, 4, 0); cocos2d::CCPoint::operator+(&v102, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v102, v49); if ( v29 > v50 ) goto LABEL_66; } if ( v64 ) { GJSmartTemplate::offsetForDir(&v103, 5, 0); cocos2d::CCPoint::operator+(&v104, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v104, v51); if ( v29 > v52 ) goto LABEL_66; } if ( v63 ) { GJSmartTemplate::offsetForDir(&v105, 6, 0); cocos2d::CCPoint::operator+(&v106, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v106, v54); if ( v29 > v55 ) goto LABEL_66; } if ( v62 ) { GJSmartTemplate::offsetForDir(&v107, 7, 0); cocos2d::CCPoint::operator+(&v108, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)&v108, v56); if ( v29 > v57 ) goto LABEL_66; } if ( v60 ) { GJSmartTemplate::offsetForDir(&v109, 8, 0); cocos2d::CCPoint::operator+(v112, &v92); cocos2d::ccpDistance((cocos2d *)v94, (const cocos2d::CCPoint *)v112, v58); if ( v29 > v59 ) goto LABEL_66; } } } else if ( v30 != *(_DWORD *)(v8 + 872) ) { if ( cocos2d::CCDictionary::objectForKey(v68, v30) ) goto LABEL_66; v30 = v24[218]; goto LABEL_75; } cocos2d::CCDictionary::setObject(v71, (cocos2d::CCObject *)v24, v24[229]); ++v23; continue; } } LABEL_103: if ( (v113 & 1) != 0 ) operator delete(v115); LABEL_7: ++v70; goto LABEL_8; } LABEL_43: v15 = (const cocos2d::CCPoint *)v93; if ( !v13 ) v15 = (const cocos2d::CCPoint *)&v92; } } GJSmartTemplate::logTemplateStatus(&v122, a2, 1); if ( (v122 & 1) != 0 ) operator delete(v124); return _stack_chk_guard; }
GD Web Decomp Icon

GD Web Decomp

Raw Source