// // EditorUI::addObjectsToSmartTemplate from 0x10047814c to 0x100478be8 (2716 bytes) // // 1 xrefs: // > SetupSmartBlockLayer::onCreateTemplate @ 0x1000785f8 // // 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 11:05:42 +0000 // void __fastcall EditorUI::addObjectsToSmartTemplate(__int64 a1, std::string *a2, __int64 a3) { __int64 v5; // x23 __int64 v6; // x19 __int64 v7; // x0 __int64 v8; // x21 __int64 v9; // x2 unsigned int v10; // w25 __int64 v11; // x0 _DWORD *v12; // x21 int v13; // w0 __n128 v14; // q0 __n128 v15; // q1 float32x2_t *v16; // x0 __n128 v17; // q0 _BOOL4 v18; // w8 __int64 v19; // x19 float32x2_t *v20; // x20 int v21; // w8 int v22; // w28 float32x2_t *v23; // x1 double v24; // d0 __int64 SmartNeighbor; // x27 double v26; // d0 double v27; // d0 __int64 v28; // x23 double v29; // d0 __int64 v30; // x25 double v31; // d0 __int64 v32; // x22 double v33; // d0 __int64 v34; // x24 double v35; // d0 __int64 v36; // x21 double v37; // d0 __int64 v38; // x0 __int64 v39; // x26 char v40; // w20 char v41; // w23 __int64 v42; // x20 _QWORD *v43; // x0 __int64 v44; // x0 unsigned int *v45; // x26 int v46; // w1 __int64 v47; // x0 __int64 v48; // x19 unsigned int i; // w21 __int64 v50; // x0 __int64 j; // x27 __int64 v52; // x0 unsigned int *v53; // x19 __n128 v54; // q0 __int64 v55; // x0 double *v56; // x0 float v57; // s8 __int64 v58; // x1 __int64 v59; // x0 __int64 v60; // x19 _BYTE *Object; // x19 __int64 v62; // x0 __int64 v63; // x0 __n128 v64; // q0 __int64 v66; // [xsp+20h] [xbp-1C0h] __int64 v67; // [xsp+28h] [xbp-1B8h] _BOOL4 v68; // [xsp+34h] [xbp-1ACh] unsigned int v69; // [xsp+38h] [xbp-1A8h] char v70; // [xsp+3Ch] [xbp-1A4h] char v71; // [xsp+40h] [xbp-1A0h] char v72; // [xsp+44h] [xbp-19Ch] char v73; // [xsp+48h] [xbp-198h] char v74; // [xsp+4Ch] [xbp-194h] char v75; // [xsp+50h] [xbp-190h] char v76; // [xsp+54h] [xbp-18Ch] char v77; // [xsp+58h] [xbp-188h] int v78; // [xsp+5Ch] [xbp-184h] __int64 v79; // [xsp+60h] [xbp-180h] __int64 v80; // [xsp+68h] [xbp-178h] char v81; // [xsp+70h] [xbp-170h] char v82; // [xsp+74h] [xbp-16Ch] char v83; // [xsp+78h] [xbp-168h] char v84; // [xsp+7Ch] [xbp-164h] __int64 v85; // [xsp+80h] [xbp-160h] char v86; // [xsp+8Ch] [xbp-154h] char v87; // [xsp+90h] [xbp-150h] char v88; // [xsp+94h] [xbp-14Ch] __int64 v89; // [xsp+98h] [xbp-148h] __int64 v90; // [xsp+A0h] [xbp-140h] void *v91; // [xsp+A8h] [xbp-138h] BYREF char v92; // [xsp+BFh] [xbp-121h] std::string __p; // [xsp+C0h] [xbp-120h] BYREF std::string __dst; // [xsp+E0h] [xbp-100h] BYREF __int64 v95; // [xsp+F8h] [xbp-E8h] BYREF std::string v96; // [xsp+100h] [xbp-E0h] BYREF float32x2_t v97; // [xsp+118h] [xbp-C8h] BYREF float v98; // [xsp+120h] [xbp-C0h] float v99; // [xsp+124h] [xbp-BCh] float32x2_t v100; // [xsp+128h] [xbp-B8h] BYREF std::string v101; // [xsp+130h] [xbp-B0h] BYREF float32x2_t v102; // [xsp+148h] [xbp-98h] BYREF float32x2_t v103; // [xsp+150h] [xbp-90h] BYREF float32x2_t v104; // [xsp+158h] [xbp-88h] BYREF if ( a2 ) { v5 = cocos2d::CCDictionary::create(a1); v66 = cocos2d::CCDictionary::create(v5); if ( (unsigned int)sub_1002E757C(a3) ) { v6 = 0; do { v7 = sub_1002E75A0(a3, v6); if ( *(_DWORD *)(v7 + 1248) == 5 ) { v8 = v7; if ( (*(_DWORD *)(v7 + 1028) & 0xFFFFFFFE) == 0xB50 ) GameObject::determineSlopeDirection(v7); v9 = *(unsigned int *)(v8 + 872); if ( (int)v9 >= 1 ) cocos2d::CCDictionary::setObject_1(v66, v8, v9); v6 = (unsigned int)(v6 + 1); } else { sub_1002E7664(a3, v6, 1); } } while ( (unsigned int)v6 < (unsigned int)sub_1002E757C(a3) ); } if ( (unsigned int)sub_1002E757C(a3) ) { v10 = 0; v90 = a3; v79 = a1; v67 = v5; LABEL_14: v11 = sub_1002E75A0(a3, v10); if ( (*(_BYTE *)(v11 + 1347) & 1) != 0 ) goto LABEL_115; v12 = (_DWORD *)v11; sub_1000262F4(&v101, (double *)&dword_1009F7800); v13 = sub_1000075D8(v12, (float *)&v101); sub_1000078A0(v13, (__int64)&v104, v14, v15); v16 = (float32x2_t *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v12 + 192LL))(v12); sub_100026318(v16, &v104, &v103); sub_1000262EC(&v102); v17.n128_u32[0] = v104.i32[0]; v18 = v104.f32[0] != *(float *)&dword_1009F7800; if ( v104.f32[1] != *(float *)&dword_1009F7804 ) v18 = 1; v68 = v18; v69 = v10; v19 = (__int64)v12; if ( v18 ) { v20 = (float32x2_t *)(*(__int64 (__fastcall **)(_DWORD *, __n128))(*(_QWORD *)v12 + 192LL))(v12, v17); sub_100026340(&v104, (float32x2_t *)&v96); sub_100026318(v20, (float32x2_t *)&v96, (float32x2_t *)&v101); sub_10002630C(&v102, (double *)&v101); v21 = 2; } else { v21 = 1; } v78 = v21; sub_100009900(&v101, ""); v85 = 0; v22 = 0; while ( 1 ) { if ( v22 ) v23 = &v102; else v23 = &v103; sub_1000262F4(&v100, (double *)v23); v24 = sub_1000262F4(&v96, (double *)&v100); SmartNeighbor = EditorUI::getSmartNeighbor(v24); v26 = sub_1000262F4(&v96, (double *)&v100); v89 = EditorUI::getSmartNeighbor(v26); v27 = sub_1000262F4(&v96, (double *)&v100); v28 = EditorUI::getSmartNeighbor(v27); v29 = sub_1000262F4(&v96, (double *)&v100); v30 = EditorUI::getSmartNeighbor(v29); v31 = sub_1000262F4(&v96, (double *)&v100); v32 = EditorUI::getSmartNeighbor(v31); v33 = sub_1000262F4(&v96, (double *)&v100); v34 = EditorUI::getSmartNeighbor(v33); v35 = sub_1000262F4(&v96, (double *)&v100); v36 = EditorUI::getSmartNeighbor(v35); v37 = sub_1000262F4(&v96, (double *)&v100); v38 = EditorUI::getSmartNeighbor(v37); v39 = v38; if ( SmartNeighbor ) v88 = *(_BYTE *)(SmartNeighbor + 1347) ^ 1; else v88 = 0; if ( v89 ) { v40 = *(_BYTE *)(v89 + 1347) ^ 1; if ( v28 ) goto LABEL_29; } else { v40 = 0; if ( v28 ) { LABEL_29: v87 = *(_BYTE *)(v28 + 1347) ^ 1; if ( v30 ) goto LABEL_30; goto LABEL_37; } } v87 = 0; if ( v30 ) { LABEL_30: v86 = *(_BYTE *)(v30 + 1347) ^ 1; if ( v32 ) goto LABEL_31; goto LABEL_38; } LABEL_37: v86 = 0; if ( v32 ) { LABEL_31: v84 = *(_BYTE *)(v32 + 1347) ^ 1; if ( v34 ) goto LABEL_32; goto LABEL_39; } LABEL_38: v84 = 0; if ( v34 ) { LABEL_32: v83 = *(_BYTE *)(v34 + 1347) ^ 1; if ( v36 ) goto LABEL_33; goto LABEL_40; } LABEL_39: v83 = 0; if ( v36 ) { LABEL_33: v82 = *(_BYTE *)(v36 + 1347) ^ 1; if ( v38 ) goto LABEL_34; goto LABEL_41; } LABEL_40: v82 = 0; if ( v38 ) { LABEL_34: v81 = *(_BYTE *)(v38 + 1347) ^ 1; goto LABEL_42; } LABEL_41: v81 = 0; LABEL_42: sub_1000262CC((float *)&v97, v100.f32[0] + -14.0, v100.f32[1] + -14.0, 28.0, 28.0); if ( (v88 & 1) == 0 ) v99 = v99 + 14.0; if ( (v40 & 1) == 0 ) { v99 = v99 + 14.0; v97.f32[1] = v97.f32[1] + -14.0; } v80 = v28; if ( (v87 & 1) == 0 ) { v98 = v98 + 14.0; v97.f32[0] = v97.f32[0] + -14.0; } v41 = v40; if ( (v86 & 1) == 0 ) v98 = v98 + 14.0; v42 = *(_QWORD *)(v79 + 1440); sub_1000264D4(&v96, (__int64)&v97); v43 = LevelEditorLayer::objectsInRect(v42, (float *)&v96, 1); if ( v85 ) { if ( v43 ) sub_1002E7570(v85, (__int64)v43); if ( v22 ) goto LABEL_59; LABEL_56: sub_1000262F4(&v95, (double *)&v100); sub_10000710C(v44, v19, SmartNeighbor, v89, v80, v30, v32, v34, &v96, v36, v39); if ( SHIBYTE(v101.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v101.__r_.__value_.__l.__data_); v101 = v96; v70 = v81; v71 = v82; v72 = v83; v73 = v84; v74 = v86; v75 = v87; v76 = v41; v77 = v88; goto LABEL_59; } v85 = (__int64)v43; if ( !v22 ) goto LABEL_56; LABEL_59: if ( v78 == ++v22 ) { v45 = (unsigned int *)v19; v46 = *(_DWORD *)(v19 + 872); a3 = v90; v10 = v69; if ( v46 > 0 ) { GJBaseGameLayer::getStickyGroup(*(_QWORD *)(v79 + 1440), v46); v48 = v47; if ( v47 ) { for ( i = 0; i < (unsigned int)sub_1002E757C(v48); ++i ) { v50 = sub_1002E75A0(v48, i); if ( (sub_1002E7638(v85, v50) & 1) == 0 ) sub_1002E74E0(v85); } } } if ( v85 ) { for ( j = 0; ; j = (unsigned int)(j + 1) ) { while ( 1 ) { if ( (unsigned int)j >= (unsigned int)sub_1002E757C(v85) ) { if ( (unsigned int)sub_1002E757C(v85) ) { v60 = v45[257]; (*(void (__fastcall **)(std::string *__return_ptr, unsigned int *))(*(_QWORD *)v45 + 1360LL))( &v96, v45); Object = (_BYTE *)EditorUI::createObject(v79, v60, (double *)&v96); sub_1002E74E0(v85); (*(void (__fastcall **)(unsigned int *))(*(_QWORD *)v45 + 368LL))(v45); (*(void (__fastcall **)(_BYTE *))(*(_QWORD *)Object + 360LL))(Object); v62 = (*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)v45 + 1424LL))(v45); (*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)Object + 1240LL))(Object, v62); v63 = (*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)v45 + 1432LL))(v45); (*(void (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)Object + 1248LL))(Object, v63); Object[1150] = 1; qsort( *(void **)(*(_QWORD *)(v85 + 56) + 16LL), **(unsigned int **)(v85 + 56), 8u, (int (__cdecl *)(const void *, const void *))sub_1001A8AA0); sub_10018A770(v79, v85, &v96); Object[1150] = 0; EditorUI::deleteObject(v79, (__int64)Object, 1, v64); if ( SHIBYTE(v101.__r_.__value_.__r.__words[2]) < 0 ) sub_1000097D0(&__dst, v101.__r_.__value_.__l.__data_, v101.__r_.__value_.__l.__size_); else __dst = v101; if ( SHIBYTE(v96.__r_.__value_.__r.__words[2]) < 0 ) sub_1000097D0(&__p, v96.__r_.__value_.__l.__data_, v96.__r_.__value_.__l.__size_); else __p = v96; sub_100004478(a2, (__int64)&__dst, &__p); if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 ) operator delete(__p.__r_.__value_.__l.__data_); if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 ) operator delete(__dst.__r_.__value_.__l.__data_); if ( SHIBYTE(v96.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v96.__r_.__value_.__l.__data_); } goto LABEL_113; } v52 = sub_1002E75A0(v85, j); v53 = (unsigned int *)v52; if ( *(_DWORD *)(v52 + 1248) != 5 ) { v54 = cocos2d::CCDictionary::objectForKey_1(v67, *(unsigned int *)(v52 + 916)); if ( !v55 ) break; } LABEL_72: sub_1002E7664(v85, j, 1); } v56 = (double *)(*(__int64 (__fastcall **)(unsigned int *, __n128))(*(_QWORD *)v53 + 192LL))(v53, v54); sub_1000262F4(&v96, v56); v57 = cocos2d::ccpDistance(&v103, (float32x2_t *)&v96); if ( v68 && v57 > cocos2d::ccpDistance(&v102, (float32x2_t *)&v96) ) v57 = cocos2d::ccpDistance(&v102, (float32x2_t *)&v96); v58 = v53[218]; if ( (int)v58 >= 1 ) { if ( (_DWORD)v58 == v45[218] ) goto LABEL_82; cocos2d::CCDictionary::objectForKey_1(v66, v58); if ( v59 ) goto LABEL_72; LODWORD(v58) = v53[218]; } if ( !(_DWORD)v58 || (_DWORD)v58 != v45[218] ) { if ( (v77 & 1) != 0 ) { GJSmartTemplate::offsetForDir(1, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v76 & 1) != 0 ) { GJSmartTemplate::offsetForDir(2, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v75 & 1) != 0 ) { GJSmartTemplate::offsetForDir(3, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v74 & 1) != 0 ) { GJSmartTemplate::offsetForDir(4, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v73 & 1) != 0 ) { GJSmartTemplate::offsetForDir(5, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v72 & 1) != 0 ) { GJSmartTemplate::offsetForDir(6, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v71 & 1) != 0 ) { GJSmartTemplate::offsetForDir(7, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } if ( (v70 & 1) != 0 ) { GJSmartTemplate::offsetForDir(8, 0, (__int64)&v100); sub_100026318(&v103, &v100, &v97); if ( cocos2d::ccpDistance((float32x2_t *)&v96, &v97) < v57 ) goto LABEL_72; } } LABEL_82: cocos2d::CCDictionary::setObject_1(v67, v53, v53[229]); } } LABEL_113: if ( SHIBYTE(v101.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v101.__r_.__value_.__l.__data_); LABEL_115: if ( ++v10 >= (unsigned int)sub_1002E757C(a3) ) break; goto LABEL_14; } } } sub_100007BBC((__int64)a2, (int)&v91); if ( v92 < 0 ) operator delete(v91); } }
GD Web Decomp Icon

GD Web Decomp

Raw Source