// // EditorUI::addObjectsToSmartTemplate from 0x488334 to 0x488bba (2182 bytes) // // 1 xrefs: // > SetupSmartBlockLayer::onCreateTemplate @ 0x67274a // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // 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 11:49:27 +0000 // cocos2d::CCDictionary *__fastcall EditorUI::addObjectsToSmartTemplate( cocos2d::CCDictionary *this, GJSmartTemplate *a2, cocos2d::CCArray *a3) { GJBaseGameLayer **v3; // r10 unsigned int v4; // r4 cocos2d::CCObject *v5; // r0 cocos2d::CCObject *v6; // r5 int v7; // r2 int v8; // r0 int v9; // r7 _DWORD *v10; // r5 int v11; // r0 int v12; // r0 int v13; // r3 int v14; // r8 size_t **v15; // r11 const cocos2d::CCPoint *v16; // r1 _DWORD *SmartNeighbor; // r9 _DWORD *v18; // r0 _DWORD *v19; // r7 int v20; // r3 int v21; // r3 int v22; // r3 int v23; // r3 int v24; // r3 int v25; // r3 cocos2d::CCArray *v26; // r0 _BYTE *v27; // r2 int v28; // r3 int v29; // r1 unsigned int v30; // r7 cocos2d::CCArray *StickyGroup; // r7 unsigned int j; // r6 cocos2d::CCObject *v33; // r8 int *v34; // r6 const cocos2d::CCPoint *v35; // r0 const cocos2d::CCPoint *v36; // r2 float v37; // r0 const cocos2d::CCPoint *v38; // r2 float v39; // s16 int v40; // r1 int v41; // r3 GameObject *v42; // r6 GameObject *Object; // r6 void (__fastcall *v44)(GameObject *, int); // r7 int v45; // r0 void (__fastcall *v46)(GameObject *, int); // r7 int v47; // r0 void (__fastcall *v48)(GameObject *, int); // r7 int v49; // r0 int v50; // r7 const cocos2d::CCPoint *v51; // r2 const cocos2d::CCPoint *v52; // r2 const cocos2d::CCPoint *v53; // r2 const cocos2d::CCPoint *v54; // r2 const cocos2d::CCPoint *v55; // r2 const cocos2d::CCPoint *v56; // r2 const cocos2d::CCPoint *v57; // r2 const cocos2d::CCPoint *v58; // r2 const cocos2d::CCPoint *v59; // r2 unsigned int i; // [sp+28h] [bp-16Ch] cocos2d::CCPoint *v62; // [sp+2Ch] [bp-168h] _DWORD *v63; // [sp+30h] [bp-164h] _DWORD *v64; // [sp+34h] [bp-160h] _DWORD *v65; // [sp+38h] [bp-15Ch] _DWORD *v66; // [sp+3Ch] [bp-158h] _DWORD *v67; // [sp+40h] [bp-154h] int v68; // [sp+44h] [bp-150h] int v69; // [sp+48h] [bp-14Ch] int v70; // [sp+4Ch] [bp-148h] int v71; // [sp+50h] [bp-144h] int v73; // [sp+5Ch] [bp-138h] int v74; // [sp+60h] [bp-134h] int v75; // [sp+64h] [bp-130h] int v76; // [sp+68h] [bp-12Ch] int v77; // [sp+6Ch] [bp-128h] cocos2d::CCDictionary *v78; // [sp+70h] [bp-124h] cocos2d::CCDictionary *v79; // [sp+74h] [bp-120h] int v80; // [sp+78h] [bp-11Ch] int v81; // [sp+7Ch] [bp-118h] int v82; // [sp+80h] [bp-114h] int v83; // [sp+84h] [bp-110h] int v84; // [sp+88h] [bp-10Ch] int v85; // [sp+8Ch] [bp-108h] int v86; // [sp+90h] [bp-104h] int v87; // [sp+94h] [bp-100h] int v88; // [sp+98h] [bp-FCh] int v89; // [sp+9Ch] [bp-F8h] float v90[2]; // [sp+ACh] [bp-E8h] BYREF _BYTE v91[8]; // [sp+B4h] [bp-E0h] BYREF _BYTE v92[8]; // [sp+BCh] [bp-D8h] BYREF _BYTE v93[8]; // [sp+C4h] [bp-D0h] BYREF _BYTE v94[8]; // [sp+CCh] [bp-C8h] BYREF _BYTE v95[8]; // [sp+D4h] [bp-C0h] BYREF _BYTE v96[8]; // [sp+DCh] [bp-B8h] BYREF _BYTE v97[8]; // [sp+E4h] [bp-B0h] BYREF _BYTE v98[8]; // [sp+ECh] [bp-A8h] BYREF _BYTE v99[8]; // [sp+F4h] [bp-A0h] BYREF _BYTE v100[8]; // [sp+FCh] [bp-98h] BYREF _BYTE v101[8]; // [sp+104h] [bp-90h] BYREF _BYTE v102[8]; // [sp+10Ch] [bp-88h] BYREF _BYTE v103[8]; // [sp+114h] [bp-80h] BYREF _BYTE v104[8]; // [sp+11Ch] [bp-78h] BYREF _BYTE v105[8]; // [sp+124h] [bp-70h] BYREF _BYTE v106[8]; // [sp+12Ch] [bp-68h] BYREF float v107[2]; // [sp+134h] [bp-60h] BYREF int v108; // [sp+13Ch] [bp-58h] BYREF int v109; // [sp+140h] [bp-54h] _BYTE *v110; // [sp+144h] [bp-50h] int v111; // [sp+148h] [bp-4Ch] BYREF int v112; // [sp+14Ch] [bp-48h] _BYTE *v113; // [sp+150h] [bp-44h] int v114[3]; // [sp+154h] [bp-40h] BYREF int v115[3]; // [sp+160h] [bp-34h] BYREF float v116; // [sp+16Ch] [bp-28h] BYREF float v117; // [sp+170h] [bp-24h] float v118; // [sp+174h] [bp-20h] float v119; // [sp+178h] [bp-1Ch] float v120[4]; // [sp+17Ch] [bp-18h] BYREF v3 = (GJBaseGameLayer **)this; if ( a2 ) { v4 = 0; v78 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(this); v79 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v78); while ( v4 < cocos2d::CCArray::count(a3) ) { v5 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a3, v4); v6 = v5; if ( *((_DWORD *)v5 + 271) == 5 ) { if ( (unsigned int)(*((_DWORD *)v5 + 223) - 2896) <= 1 ) GameObject::determineSlopeDirection(v5); v7 = *((_DWORD *)v6 + 185); if ( v7 > 0 ) cocos2d::CCDictionary::setObject(v79, v6, v7); ++v4; } else { cocos2d::CCArray::removeObjectAtIndex(a3, v4, 1); } } for ( i = 0; i < cocos2d::CCArray::count(a3); ++i ) { v8 = cocos2d::CCArray::objectAtIndex(a3, i); v9 = *(unsigned __int8 *)(v8 + 1167); v10 = (_DWORD *)v8; if ( !*(_BYTE *)(v8 + 1167) ) { cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)&flt_D2B938); v11 = GJSmartTemplate::smartObjectToType((int)v10, (cocos2d::CCPoint *)v120); GJSmartTemplate::offsetForType(v90, v11); v12 = (*(int (__fastcall **)(_DWORD *))(*v10 + 96))(v10); cocos2d::CCPoint::operator+(v91, v12, v90); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v92); if ( v90[0] == flt_D2B938 && v90[1] == flt_D2B93C ) { v13 = 1; v80 = v9; } else { v50 = (*(int (__fastcall **)(_DWORD *))(*v10 + 96))(v10); cocos2d::CCPoint::operator-(&v116, v90); cocos2d::CCPoint::operator+(v120, v50, &v116); cocos2d::CCPoint::operator=(v92, v120); v80 = 1; v13 = 2; } v108 = 0; v109 = 0; v14 = 0; v110 = nullptr; v15 = nullptr; v73 = v13; std::string::__init(&v108, &unk_B6B226, 0); v16 = (const cocos2d::CCPoint *)v91; while ( 1 ) { cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v107, v16); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); SmartNeighbor = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 1, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v62 = (cocos2d::CCPoint *)EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 2, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v63 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 3, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v64 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 4, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v65 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 5, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v66 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 6, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v67 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 7, a3); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); v18 = EditorUI::getSmartNeighbor((int)v3, (int)v10, (int)v120, 8, a3); v19 = v18; if ( SmartNeighbor ) v68 = *((unsigned __int8 *)SmartNeighbor + 1167) ^ 1; else v68 = 0; if ( v62 ) v20 = *((unsigned __int8 *)v62 + 1167) ^ 1; else v20 = 0; v69 = v20; if ( v63 ) v21 = *((unsigned __int8 *)v63 + 1167) ^ 1; else v21 = 0; v70 = v21; if ( v64 ) v22 = *((unsigned __int8 *)v64 + 1167) ^ 1; else v22 = 0; v71 = v22; if ( v65 ) v23 = *((unsigned __int8 *)v65 + 1167) ^ 1; else v23 = 0; v74 = v23; if ( v66 ) v24 = *((unsigned __int8 *)v66 + 1167) ^ 1; else v24 = 0; v75 = v24; if ( v67 ) v25 = *((unsigned __int8 *)v67 + 1167) ^ 1; else v25 = 0; v76 = v25; if ( v18 ) v77 = *((unsigned __int8 *)v18 + 1167) ^ 1; else v77 = 0; cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v116, v107[0] - 14.0, v107[1] - 14.0, 28.0, 28.0); if ( !v68 ) v119 = v119 + 14.0; if ( !v69 ) { v119 = v119 + 14.0; v117 = v117 - 14.0; } if ( !v70 ) { v118 = v118 + 14.0; v116 = v116 - 14.0; } if ( !v71 ) v118 = v118 + 14.0; v89 = (int)v3[236]; cocos2d::CCRect::CCRect((cocos2d::CCRect *)v120, (const cocos2d::CCRect *)&v116); v26 = LevelEditorLayer::objectsInRect(v89, v120, 1); if ( v15 ) { if ( v26 ) cocos2d::CCArray::addObjectsFromArray((cocos2d::CCArray *)v15, v26); } else { v15 = (size_t **)v26; } if ( !v14 ) { cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v120, (const cocos2d::CCPoint *)v107); GJSmartTemplate::keyFromNeighbors(&v111, v120, v10, SmartNeighbor, v62, v63, v64, v65, v66, v67, v19); v28 = v108 & 1; if ( (v108 & 1) != 0 ) { v27 = v110; v28 = 0; } else { BYTE1(v108) = v108 & 1; } if ( (v108 & 1) != 0 ) { *v27 = v28; v109 = v28; } else { LOBYTE(v108) = v28; } std::string::reserve(&v108, 0); v108 = v111; v109 = v112; v110 = v113; v111 = 0; v112 = 0; v113 = nullptr; std::string::~string((int)&v111); v88 = v77; v87 = v76; v86 = v75; v85 = v74; v84 = v71; v83 = v70; v82 = v69; v81 = v68; } if ( ++v14 == v73 ) break; if ( v14 ) v16 = (const cocos2d::CCPoint *)v92; else v16 = (const cocos2d::CCPoint *)v91; } v29 = v10[185]; if ( v29 > 0 ) { StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(v3[236], v29); if ( StickyGroup ) { for ( j = 0; j < cocos2d::CCArray::count(StickyGroup); ++j ) { v33 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(StickyGroup, j); if ( !cocos2d::CCArray::containsObject((cocos2d::CCArray *)v15, v33) ) cocos2d::CCArray::addObject((cocos2d::CCArray *)v15, v33); } } } if ( v15 ) { v30 = 0; while ( v30 < cocos2d::CCArray::count((cocos2d::CCArray *)v15) ) { v34 = (int *)cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)v15, v30); if ( v34[271] == 5 || cocos2d::CCDictionary::objectForKey(v78, v34[195]) ) goto LABEL_112; v35 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int *))(*v34 + 96))(v34); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, v35); v37 = COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v91, (const cocos2d::CCPoint *)v93, v36)); v39 = v37; if ( v80 && v37 > COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v92, (const cocos2d::CCPoint *)v93, v38)) ) v39 = COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v92, (const cocos2d::CCPoint *)v93, v51)); v40 = v34[185]; if ( v40 > 0 && v40 != v10[185] && cocos2d::CCDictionary::objectForKey(v79, v40) ) goto LABEL_112; v41 = v34[185]; if ( v41 && v41 == v10[185] ) goto LABEL_82; if ( v81 ) { GJSmartTemplate::offsetForDir(v94, 1, 0); cocos2d::CCPoint::operator+(v95, v91, v94); if ( COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v95, v52)) < v39 ) goto LABEL_112; } if ( v82 ) { GJSmartTemplate::offsetForDir(v96, 2, 0); cocos2d::CCPoint::operator+(v97, v91, v96); if ( COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v97, v53)) < v39 ) goto LABEL_112; } if ( v83 ) { GJSmartTemplate::offsetForDir(v98, 3, 0); cocos2d::CCPoint::operator+(v99, v91, v98); if ( COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v99, v54)) < v39 ) goto LABEL_112; } if ( v84 ) { GJSmartTemplate::offsetForDir(v100, 4, 0); cocos2d::CCPoint::operator+(v101, v91, v100); if ( COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v101, v55)) < v39 ) goto LABEL_112; } if ( v85 ) { GJSmartTemplate::offsetForDir(v102, 5, 0); cocos2d::CCPoint::operator+(v103, v91, v102); if ( COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v103, v56)) < v39 ) goto LABEL_112; } if ( v86 && (GJSmartTemplate::offsetForDir(v104, 6, 0), cocos2d::CCPoint::operator+(v105, v91, v104), COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v105, v57)) < v39) || v87 && (GJSmartTemplate::offsetForDir(v106, 7, 0), cocos2d::CCPoint::operator+(v107, v91, v106), COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v107, v58)) < v39) || v88 && (GJSmartTemplate::offsetForDir(&v116, 8, 0), cocos2d::CCPoint::operator+(v120, v91, &v116), COERCE_FLOAT(cocos2d::ccpDistance((cocos2d *)v93, (const cocos2d::CCPoint *)v120, v59)) < v39) ) { LABEL_112: cocos2d::CCArray::removeObjectAtIndex((cocos2d::CCArray *)v15, v30, 1); } else { LABEL_82: cocos2d::CCDictionary::setObject(v78, (cocos2d::CCObject *)v34, v34[195]); ++v30; } } if ( cocos2d::CCArray::count((cocos2d::CCArray *)v15) ) { v42 = (GameObject *)v10[223]; (*(void (__fastcall **)(float *, _DWORD *))(*v10 + 680))(v120, v10); Object = EditorUI::createObject((int)v3, v42, (const cocos2d::CCPoint *)v120); cocos2d::CCArray::addObject((cocos2d::CCArray *)v15, Object); v44 = *(void (__fastcall **)(GameObject *, int))(*(_DWORD *)Object + 180); v45 = (*(int (__fastcall **)(_DWORD *))(*v10 + 184))(v10); v44(Object, v45); v46 = *(void (__fastcall **)(GameObject *, int))(*(_DWORD *)Object + 620); v47 = (*(int (__fastcall **)(_DWORD *))(*v10 + 712))(v10); v46(Object, v47); v48 = *(void (__fastcall **)(GameObject *, int))(*(_DWORD *)Object + 624); v49 = (*(int (__fastcall **)(_DWORD *))(*v10 + 716))(v10); v48(Object, v49); *((_BYTE *)Object + 1006) = 1; qsort((void *)v15[13][3], *v15[13], 4u, smartPrefabSort); EditorUI::copyObjectsDetailed((EditorUI *)&v111, (cocos2d::CCArray *)v3); *((_BYTE *)Object + 1006) = 0; EditorUI::deleteObject((EditorUI *)v3, Object, 1); std::string::basic_string(v114, (int)&v108); std::string::basic_string(v115, (int)&v111); GJSmartTemplate::savePrefab(a2, v114, v115); std::string::~string((int)v115); std::string::~string((int)v114); std::string::~string((int)&v111); } } std::string::~string((int)&v108); } } GJSmartTemplate::logTemplateStatus((GJSmartTemplate *)v115, (bool)a2); return (cocos2d::CCDictionary *)std::string::~string((int)v115); } return this; }
GD Web Decomp Icon

GD Web Decomp

Raw Source