// // EditorUI::createPrefab from 0x100043800 to 0x100043d33 (1331 bytes) // // 2 xrefs: // > SetupSmartBlockLayer::onCreateAll @ 0x1004e72d1 // > BrowseSmartTemplateLayer::createPrefab @ 0x1004ea71b // // 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::createPrefab(EditorUI *a1, __int64 a2, std::string *a3, int a4) { const cocos2d::CCPoint *m_objectLayer; // r14 float m_gridSize; // xmm2_4 __m128 v6; // xmm0 __m128 v7; // xmm1 __m128 v8; // xmm0 std::string *v9; // r14 SmartBlockType v10; // ebx int v11; // r15d LevelEditorLayer *m_editorLayer; // r14 GameObject *Object; // rax GameObject *v14; // r14 std::string::size_type v15; // r13 __int64 v16; // rbx SmartBlockType v17; // r12d int v18; // eax int v19; // eax int v20; // r14d LevelEditorLayer *v21; // r15 GameObject *v22; // rax GameObject *v23; // r14 unsigned int v24; // ebx __int64 PrefabWithID; // rbx __m128 *v26; // rbx cocos2d::CCArray *v27; // rbx EditorUI *v28; // r15 __int128 v29; // [rsp+0h] [rbp-C0h] BYREF void *__p; // [rsp+10h] [rbp-B0h] BYREF std::string v31; // [rsp+20h] [rbp-A0h] BYREF float v32[2]; // [rsp+40h] [rbp-80h] BYREF _BYTE v33[8]; // [rsp+48h] [rbp-78h] BYREF __int64 v34; // [rsp+50h] [rbp-70h] void **p_p; // [rsp+58h] [rbp-68h] _BYTE v36[8]; // [rsp+64h] [rbp-5Ch] BYREF int v37; // [rsp+6Ch] [rbp-54h] std::string *v38; // [rsp+70h] [rbp-50h] EditorUI *v39; // [rsp+78h] [rbp-48h] float v40; // [rsp+80h] [rbp-40h] BYREF unsigned __int64 v41; // [rsp+88h] [rbp-38h] BYREF float v42; // [rsp+90h] [rbp-30h] BYREF float v43; // [rsp+94h] [rbp-2Ch] v37 = a4; v38 = a3; cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v32); m_objectLayer = (const cocos2d::CCPoint *)a1->m_editorLayer->m_objectLayer; sub_10028CBE0(&v41, v32[0] * 0.5, (float)(a1->m_toolbarHeight * 0.5) + (float)(v32[1] * 0.5)); cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v40, m_objectLayer); v40 = (float)((float)(4 * *(_DWORD *)(a2 + 196)) * 30.0) + v40; sub_10028CC60(&v42); m_gridSize = a1->m_editorLayer->m_drawGridLayer->m_gridSize; v6 = (__m128)LODWORD(v42); v7 = (__m128)LODWORD(v43); v6.f32[0] = v42 / m_gridSize; v7.f32[0] = v43 / m_gridSize; sub_10028CBE0( &v41, (float)(_mm_round_ss(v6, v6, 9).f32[0] + 0.5) * m_gridSize, (float)(_mm_round_ss(v7, v7, 9).f32[0] + 0.5) * m_gridSize); v39 = a1; if ( a1->m_editorLayer->m_levelSettings->m_dynamicLevelHeight ) v8 = (__m128)0x46EB1400u; else v8 = (__m128)0x451BA000u; _mm_storel_ps( (double *)&v41, _mm_min_ps(_mm_max_ps((__m128)v41, (__m128)xmmword_100815470), _mm_insert_ps((__m128)xmmword_100815490, v8, 16))); sub_10028CC60(v36); sub_10028CC90(); v34 = a2; ++*(_DWORD *)(a2 + 196); *(double *)v8.i64 = sub_10028CC60(v36); v9 = v38; v10 = *std::string::at(v38, 0); if ( v10 != 48 ) { GJSmartTemplate::offsetForType((SmartBlockType)&v42); sub_10028CC90(); v11 = GJSmartTemplate::smartTypeToObjectKey(v10); sub_10028CCE0(v33, &v40); m_editorLayer = v39->m_editorLayer; *(double *)v8.i64 = sub_10028CC60(&v41); Object = LevelEditorLayer::createObject(m_editorLayer, v11, *(cocos2d::CCPoint *)v8.f32, (bool)&v41); v14 = Object; if ( Object ) { v8.i64[0] = LODWORD(Object->m_pixelScaleX); if ( v8.f32[0] != 1.0 || Object->m_pixelScaleY != 1.0 ) { GameObject::updateCustomScaleX(Object, v8.f32[0]); v8.i64[0] = LODWORD(v14->m_pixelScaleY); GameObject::updateCustomScaleY(v14, v8.f32[0]); } } GJSmartTemplate::applyTransformationsForType(v10, v14); v9 = v38; } p_p = &__p; v15 = 1; v16 = 8; do { v17 = *std::string::at(v9, v15); if ( v17 != 48 ) { GJSmartTemplate::offsetForType((SmartBlockType)&v42); if ( (unsigned int)v15 <= 6 ) { v18 = 98; if ( _bittest(&v18, v15) ) v43 = v43 + 30.0; } if ( (unsigned int)v15 <= 8 ) { v19 = 388; if ( _bittest(&v19, v15) ) v43 = v43 + -30.0; } if ( v16 == 4 || (v15 & 0xB) == 3 ) v42 = v42 + -30.0; if ( v16 == 1 || (v15 & 0xD) == 4 ) v42 = v42 + 30.0; v20 = GJSmartTemplate::smartTypeToObjectKey(v17); sub_10028CCE0(v33, &v40); v21 = v39->m_editorLayer; *(double *)v8.i64 = sub_10028CC60(&v41); v22 = LevelEditorLayer::createObject(v21, v20, *(cocos2d::CCPoint *)v8.f32, (bool)&v41); v23 = v22; if ( v22 ) { v8.i64[0] = LODWORD(v22->m_pixelScaleX); if ( v8.f32[0] != 1.0 || v22->m_pixelScaleY != 1.0 ) { GameObject::updateCustomScaleX(v22, v8.f32[0]); v8.i64[0] = LODWORD(v23->m_pixelScaleY); GameObject::updateCustomScaleY(v23, v8.f32[0]); } } GJSmartTemplate::applyTransformationsForType(v17, v23); *(&v23->m_greenDebugDraw + 1) = 1; SmartGameObject::updateSmartFrame((SmartGameObject *)v23); v9 = v38; } ++v15; --v16; } while ( v16 ); v24 = v37; if ( v37 > 0 ) { if ( (*(_BYTE *)&v9->__r_.__value_.__s.0 & 1) != 0 ) { sub_100006B70(&v29, v9->__r_.__value_.__l.__data_, v9->__r_.__value_.__l.__size_, *(double *)v8.i64); } else { __p = v9->__r_.__value_.__l.__data_; v8 = *(__m128 *)&v9->__r_.__value_.__l.0; v29 = *(_OWORD *)&v9->__r_.__value_.__l.0; } PrefabWithID = GJSmartTemplate::getPrefabWithID(v34, &v29, v24); if ( (v29 & 1) != 0 ) operator delete(__p); if ( PrefabWithID ) { if ( (*(_BYTE *)(PrefabWithID + 80) & 1) != 0 ) { sub_100006B70(&v31, *(const void **)(PrefabWithID + 96), *(_QWORD *)(PrefabWithID + 88), *(double *)v8.i64); } else { v26 = (__m128 *)(PrefabWithID + 80); v31.__r_.__value_.__r.__words[2] = v26[1].u64[0]; v8 = *v26; *(__m128 *)&v31.__r_.__value_.__l.0 = *v26; } v27 = EditorUI::pasteObjects(v39, &v31, 0, 0); if ( (*(_BYTE *)&v31.__r_.__value_.__s.0 & 1) != 0 ) operator delete(v31.__r_.__value_.__l.__data_); sub_10028CCE0(&v41, &v40); v28 = v39; EditorUI::repositionObjectsToCenter(v39, v27, *(cocos2d::CCPoint *)v8.f32, (bool)&v41); EditorUI::deleteSmartBlocksFromObjects(v28, v27); } } }