{"type": "func", "start": 3817664, "end": 3818214, "name": "EditorUI::createPrefab", "pseudocode": "// \n// EditorUI::createPrefab from 0x3a40c0 to 0x3a42e6 (550 bytes)\n// \n// 2 xrefs:\n// > SetupSmartBlockLayer::onCreateAll @ 0x53d2e4\n// > BrowseSmartTemplateLayer::createPrefab @ 0x53f186\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid __fastcall EditorUI::createPrefab(EditorUI *a1, GJSmartTemplate *a2, int a3, int a4)\n{\n  cocos2d::CCDirector *v8; // r0\n  cocos2d::CCNode *m_objectLayer; // r6\n  int v10; // r11\n  cocos2d::CCPoint v11; // r2\n  int v12; // r2\n  bool v13; // r3\n  SmartBlockType v14; // r8\n  int v15; // r2\n  bool v16; // r3\n  cocos2d::CCPoint v17; // r2\n  int PrefabWithID; // r6\n  cocos2d::CCArray *v19; // r6\n  bool v20; // [sp+0h] [bp-44h]\n  SmartGameObject *v21; // [sp+Ch] [bp-38h]\n  SmartGameObject *Object; // [sp+Ch] [bp-38h]\n  cocos2d::CCSize v23; // [sp+14h] [bp-30h] BYREF\n  cocos2d::CCPoint v24; // [sp+1Ch] [bp-28h] BYREF\n  cocos2d::CCPoint v25; // [sp+24h] [bp-20h] BYREF\n  cocos2d::CCPoint v26; // [sp+2Ch] [bp-18h] BYREF\n  cocos2d::CCPoint v27; // [sp+34h] [bp-10h] BYREF\n\n  v8 = cocos2d::CCDirector::sharedDirector();\n  cocos2d::CCDirector::getWinSize(&v23, v8);\n  m_objectLayer = a1->m_editorLayer->m_objectLayer;\n  cocos2d::CCPoint::CCPoint(&v27, v23.width * 0.5, (float)(a1->m_toolbarHeight * 0.5) + (float)(v23.height * 0.5));\n  cocos2d::CCNode::convertToNodeSpace(&v24, m_objectLayer, &v27);\n  v10 = 0;\n  v24.x = v24.x + (float)((float)(4 * a2->m_prefabIndex) * 30.0);\n  cocos2d::CCPoint::CCPoint(&v26, &v24);\n  LODWORD(v11.x) = &v26;\n  EditorUI::getGridSnappedPos(&v27, a1, v11);\n  cocos2d::CCPoint::operator=((PlayerObject *)&v24, COERCE_FLOAT(&v27), v12, v13);\n  ++a2->m_prefabIndex;\n  cocos2d::CCPoint::CCPoint(&v25, (const cocos2d::CCPoint *)&flt_AC5D38);\n  do\n  {\n    v14 = *(unsigned __int8 *)sub_7757BC(a3, v10);\n    if ( v14 == 48 )\n      goto LABEL_19;\n    GJSmartTemplate::offsetForType(&v26, v14);\n    if ( !v10 )\n    {\n      cocos2d::CCPoint::operator=((PlayerObject *)&v25, COERCE_FLOAT(&v26), v15, v16);\nLABEL_9:\n      if ( (unsigned int)(v10 - 7) > 1 )\n        goto LABEL_11;\n      goto LABEL_10;\n    }\n    if ( v10 == 1 || (unsigned int)(v10 - 5) <= 1 )\n      v26.y = v26.y + 30.0;\n    if ( v10 != 2 )\n      goto LABEL_9;\nLABEL_10:\n    v26.y = v26.y - 30.0;\nLABEL_11:\n    if ( (v10 & 0xFFFFFFFB) == 3 || v10 == 5 )\n      v26.x = v26.x - 30.0;\n    if ( (v10 & 0xFFFFFFFD) == 4 || v10 == 8 )\n      v26.x = v26.x + 30.0;\n    v21 = (SmartGameObject *)GJSmartTemplate::smartTypeToObjectKey(v14);\n    cocos2d::CCPoint::operator+(&v27, &v24, &v26);\n    LODWORD(v17.x) = &v27;\n    Object = (SmartGameObject *)EditorUI::createObject(a1, (int)v21, v17);\n    GJSmartTemplate::applyTransformationsForType(v14, Object);\n    if ( v10 )\n    {\n      Object->m_referenceOnly = 1;\n      SmartGameObject::updateSmartFrame(Object);\n    }\nLABEL_19:\n    ++v10;\n  }\n  while ( v10 != 9 );\n  if ( a4 > 0 )\n  {\n    sub_775C20(&v27, a3);\n    PrefabWithID = GJSmartTemplate::getPrefabWithID(a2, (std::string)&v27, a4);\n    sub_774008(&v27);\n    if ( PrefabWithID )\n    {\n      sub_775C20(&v27, PrefabWithID + 56);\n      v19 = EditorUI::pasteObjects(a1, &v27, 0, 0);\n      sub_774008(&v27);\n      cocos2d::CCPoint::operator+(&v27, &v24, &v25);\n      EditorUI::repositionObjectsToCenter(a1, v19, (cocos2d::CCPoint)(unsigned int)&v27, v20);\n      EditorUI::deleteSmartBlocksFromObjects(a1, v19);\n    }\n  }\n}", "assembly": "; \n; EditorUI::createPrefab from 0x3a40c0 to 0x3a42e6 (550 bytes)\n; \n; 2 xrefs:\n; > SetupSmartBlockLayer::onCreateAll @ 0x53d2e4\n; > BrowseSmartTemplateLayer::createPrefab @ 0x53f186\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nLDR.W           R12, =(__stack_chk_guard_ptr - 0x3A40CC)               ; +0x0, 0x3a40c0\nPUSH.W          {R4-R11,LR}                                            ; +0x4, 0x3a40c4\nADD             R12, PC; __stack_chk_guard_ptr                         ; +0x8, 0x3a40c8\nLDR.W           R12, [R12]; __stack_chk_guard                          ; +0xa, 0x3a40ca\nVPUSH           {D8}                                                   ; +0xe, 0x3a40ce\nMOV             R9, R3                                                 ; +0x12, 0x3a40d2\nLDR.W           R3, [R12]                                              ; +0x14, 0x3a40d4\nMOV             R7, R1                                                 ; +0x18, 0x3a40d8\nMOV             R5, R0                                                 ; +0x1a, 0x3a40da\nMOV             R10, R2                                                ; +0x1c, 0x3a40dc\nVMOV.F32        S16, #30.0                                             ; +0x1e, 0x3a40de\nSUB             SP, SP, #0x44                                          ; +0x22, 0x3a40e2\nADD             R4, SP, #0x44+var_10                                   ; +0x24, 0x3a40e4\nADD.W           R8, SP, #0x44+var_28                                   ; +0x26, 0x3a40e6\nSTR.W           R12, [SP,#0x44+var_40]                                 ; +0x2a, 0x3a40ea\nSTR             R3, [SP,#0x44+var_8]                                   ; +0x2e, 0x3a40ee\nBL              _ZN7cocos2d10CCDirector14sharedDirectorEv; cocos2d::CCDirector::sharedDirector(void) ; +0x30, 0x3a40f0\nMOV             R1, R0                                                 ; +0x34, 0x3a40f4\nADD             R0, SP, #0x44+var_30; this                             ; +0x36, 0x3a40f6\nBL              _ZN7cocos2d10CCDirector10getWinSizeEv; cocos2d::CCDirector::getWinSize(void) ; +0x38, 0x3a40f8\nVMOV.F32        S14, #0.5                                              ; +0x3c, 0x3a40fc\nVLDR            S13, [SP,#0x44+var_30]                                 ; +0x40, 0x3a4100\nMOV             R0, R4; this                                           ; +0x44, 0x3a4104\nLDR.W           R3, [R5,#0x340]                                        ; +0x46, 0x3a4106\nVLDR            S15, [R5,#0x23C]                                       ; +0x4a, 0x3a410a\nLDR.W           R6, [R3,#0x9F0]                                        ; +0x4e, 0x3a410e\nVMUL.F32        S13, S13, S14                                          ; +0x52, 0x3a4112\nVMUL.F32        S15, S15, S14                                          ; +0x56, 0x3a4116\nVMOV            R1, S13; float                                         ; +0x5a, 0x3a411a\nVLDR            S13, [SP,#0x44+var_2C]                                 ; +0x5e, 0x3a411e\nVMLA.F32        S15, S13, S14                                          ; +0x62, 0x3a4122\nVMOV            R2, S15; float                                         ; +0x66, 0x3a4126\nBL              _ZN7cocos2d7CCPointC1Eff; cocos2d::CCPoint::CCPoint(float,float) ; +0x6a, 0x3a412a\nMOV             R1, R6; cocos2d::CCPoint *                             ; +0x6e, 0x3a412e\nMOV             R2, R4                                                 ; +0x70, 0x3a4130\nMOV             R0, R8; this                                           ; +0x72, 0x3a4132\nBL              _ZN7cocos2d6CCNode18convertToNodeSpaceERKNS_7CCPointE; cocos2d::CCNode::convertToNodeSpace(cocos2d::CCPoint const&) ; +0x74, 0x3a4134\nLDR             R6, [R7,#0x78]                                         ; +0x78, 0x3a4138\nVLDR            S14, [SP,#0x44+var_28]                                 ; +0x7a, 0x3a413a\nMOV             R1, R8; cocos2d::CCPoint *                             ; +0x7e, 0x3a413e\nMOV.W           R11, R6,LSL#2                                          ; +0x80, 0x3a4140\nADD             R6, SP, #0x44+var_18                                   ; +0x84, 0x3a4144\nVMOV            S15, R11                                               ; +0x86, 0x3a4146\nMOV             R0, R6; this                                           ; +0x8a, 0x3a414a\nMOV.W           R11, #0                                                ; +0x8c, 0x3a414c\nVCVT.F32.S32    S15, S15                                               ; +0x90, 0x3a4150\nVMLA.F32        S14, S15, S16                                          ; +0x94, 0x3a4154\nVSTR            S14, [SP,#0x44+var_28]                                 ; +0x98, 0x3a4158\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0x9c, 0x3a415c\nMOV             R2, R6                                                 ; +0xa0, 0x3a4160\nMOV             R0, R4                                                 ; +0xa2, 0x3a4162\nMOV             R1, R5                                                 ; +0xa4, 0x3a4164\nBL              _ZN8EditorUI17getGridSnappedPosEN7cocos2d7CCPointE; EditorUI::getGridSnappedPos(cocos2d::CCPoint) ; +0xa6, 0x3a4166\nMOV             R1, R4                                                 ; +0xaa, 0x3a416a\nMOV             R0, R8                                                 ; +0xac, 0x3a416c\nBL              _ZN7cocos2d7CCPointaSERKS0_; cocos2d::CCPoint::operator=(cocos2d::CCPoint const&) ; +0xae, 0x3a416e\nLDR             R3, [R7,#0x78]                                         ; +0xb2, 0x3a4172\nLDR             R1, =(flt_AC5D38 - 0x3A4180)                           ; +0xb4, 0x3a4174\nADD             R0, SP, #0x44+var_20; this                             ; +0xb6, 0x3a4176\nADDS            R3, #1                                                 ; +0xb8, 0x3a4178\nSTR             R3, [R7,#0x78]                                         ; +0xba, 0x3a417a\nADD             R1, PC; flt_AC5D38 ; cocos2d::CCPoint *                ; +0xbc, 0x3a417c\nBL              _ZN7cocos2d7CCPointC1ERKS0_; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const&) ; +0xbe, 0x3a417e\nSTR.W           R8, [SP,#0x44+var_3C]                                  ; +0xc2, 0x3a4182\nMOV             R0, R10                                                ; +0xc6, 0x3a4186\nMOV             R1, R11                                                ; +0xc8, 0x3a4188\nBL              sub_7757BC                                             ; +0xca, 0x3a418a\nLDRB.W          R8, [R0]                                               ; +0xce, 0x3a418e\nCMP.W           R8, #0x30 ; '0'                                        ; +0xd2, 0x3a4192\nBEQ             loc_3A4258                                             ; +0xd6, 0x3a4196\nMOV             R0, R6                                                 ; +0xd8, 0x3a4198\nMOV             R1, R8                                                 ; +0xda, 0x3a419a\nBL              _ZN15GJSmartTemplate13offsetForTypeE14SmartBlockType; GJSmartTemplate::offsetForType(SmartBlockType) ; +0xdc, 0x3a419c\nCMP.W           R11, #0                                                ; +0xe0, 0x3a41a0\nBNE             loc_3A41B0                                             ; +0xe4, 0x3a41a4\nADD             R0, SP, #0x44+var_20                                   ; +0xe6, 0x3a41a6\nMOV             R1, R6                                                 ; +0xe8, 0x3a41a8\nBL              _ZN7cocos2d7CCPointaSERKS0_; cocos2d::CCPoint::operator=(cocos2d::CCPoint const&) ; +0xea, 0x3a41aa\nB               loc_3A41D0                                             ; +0xee, 0x3a41ae\nCMP.W           R11, #1                                                ; +0xf0, 0x3a41b0\nBEQ             loc_3A41BE                                             ; +0xf4, 0x3a41b4\nSUB.W           R2, R11, #5                                            ; +0xf6, 0x3a41b6\nCMP             R2, #1                                                 ; +0xfa, 0x3a41ba\nBHI             loc_3A41CA                                             ; +0xfc, 0x3a41bc\nVLDR            S15, [SP,#0x44+var_14]                                 ; +0xfe, 0x3a41be\nVADD.F32        S15, S15, S16                                          ; +0x102, 0x3a41c2\nVSTR            S15, [SP,#0x44+var_14]                                 ; +0x106, 0x3a41c6\nCMP.W           R11, #2                                                ; +0x10a, 0x3a41ca\nBEQ             loc_3A41D8                                             ; +0x10e, 0x3a41ce\nSUB.W           R2, R11, #7                                            ; +0x110, 0x3a41d0\nCMP             R2, #1                                                 ; +0x114, 0x3a41d4\nBHI             loc_3A41E4                                             ; +0x116, 0x3a41d6\nVLDR            S15, [SP,#0x44+var_14]                                 ; +0x118, 0x3a41d8\nVSUB.F32        S15, S15, S16                                          ; +0x11c, 0x3a41dc\nVSTR            S15, [SP,#0x44+var_14]                                 ; +0x120, 0x3a41e0\nBIC.W           R2, R11, #4                                            ; +0x124, 0x3a41e4\nCMP             R2, #3                                                 ; +0x128, 0x3a41e8\nBEQ             loc_3A41F2                                             ; +0x12a, 0x3a41ea\nCMP.W           R11, #5                                                ; +0x12c, 0x3a41ec\nBNE             loc_3A41FE                                             ; +0x130, 0x3a41f0\nVLDR            S15, [SP,#0x44+var_18]                                 ; +0x132, 0x3a41f2\nVSUB.F32        S15, S15, S16                                          ; +0x136, 0x3a41f6\nVSTR            S15, [SP,#0x44+var_18]                                 ; +0x13a, 0x3a41fa\nBIC.W           R2, R11, #2                                            ; +0x13e, 0x3a41fe\nCMP             R2, #4                                                 ; +0x142, 0x3a4202\nBEQ             loc_3A420C                                             ; +0x144, 0x3a4204\nCMP.W           R11, #8                                                ; +0x146, 0x3a4206\nBNE             loc_3A4218                                             ; +0x14a, 0x3a420a\nVLDR            S15, [SP,#0x44+var_18]                                 ; +0x14c, 0x3a420c\nVADD.F32        S15, S15, S16                                          ; +0x150, 0x3a4210\nVSTR            S15, [SP,#0x44+var_18]                                 ; +0x154, 0x3a4214\nMOV             R0, R8                                                 ; +0x158, 0x3a4218\nBL              _ZN15GJSmartTemplate20smartTypeToObjectKeyE14SmartBlockType; GJSmartTemplate::smartTypeToObjectKey(SmartBlockType) ; +0x15a, 0x3a421a\nLDR             R1, [SP,#0x44+var_3C]                                  ; +0x15e, 0x3a421e\nMOV             R2, R6                                                 ; +0x160, 0x3a4220\nSTR             R0, [SP,#0x44+var_38]                                  ; +0x162, 0x3a4222\nMOV             R0, R4                                                 ; +0x164, 0x3a4224\nBL              _ZNK7cocos2d7CCPointplERKS0_; cocos2d::CCPoint::operator+(cocos2d::CCPoint const&) ; +0x166, 0x3a4226\nLDR.W           R12, [SP,#0x44+var_38]                                 ; +0x16a, 0x3a422a\nMOV             R2, R4                                                 ; +0x16e, 0x3a422e\nMOV             R0, R5                                                 ; +0x170, 0x3a4230\nMOV             R1, R12                                                ; +0x172, 0x3a4232\nBL              _ZN8EditorUI12createObjectEiN7cocos2d7CCPointE; EditorUI::createObject(int,cocos2d::CCPoint) ; +0x174, 0x3a4234\nMOV             R2, R0                                                 ; +0x178, 0x3a4238\nMOV             R0, R8; int                                            ; +0x17a, 0x3a423a\nMOV             R1, R2; this                                           ; +0x17c, 0x3a423c\nSTR             R2, [SP,#0x44+var_38]                                  ; +0x17e, 0x3a423e\nBL              _ZN15GJSmartTemplate27applyTransformationsForTypeE14SmartBlockTypePN7cocos2d8CCSpriteE; GJSmartTemplate::applyTransformationsForType(SmartBlockType,cocos2d::CCSprite *) ; +0x180, 0x3a4240\nCMP.W           R11, #0                                                ; +0x184, 0x3a4244\nBEQ             loc_3A4258                                             ; +0x188, 0x3a4248\nLDR             R2, [SP,#0x44+var_38]                                  ; +0x18a, 0x3a424a\nMOVS            R3, #1                                                 ; +0x18c, 0x3a424c\nMOV             R0, R2; this                                           ; +0x18e, 0x3a424e\nSTRB.W          R3, [R2,#0x487]                                        ; +0x190, 0x3a4250\nBL              _ZN15SmartGameObject16updateSmartFrameEv; SmartGameObject::updateSmartFrame(void) ; +0x194, 0x3a4254\nADD.W           R11, R11, #1                                           ; +0x198, 0x3a4258\nCMP.W           R11, #9                                                ; +0x19c, 0x3a425c\nBNE             loc_3A4186                                             ; +0x1a0, 0x3a4260\nCMP.W           R9, #0                                                 ; +0x1a2, 0x3a4262\nBLE             loc_3A42CE                                             ; +0x1a6, 0x3a4266\nMOV             R1, R10                                                ; +0x1a8, 0x3a4268\nMOV             R0, R4                                                 ; +0x1aa, 0x3a426a\nBL              sub_775C20                                             ; +0x1ac, 0x3a426c\nMOV             R0, R7                                                 ; +0x1b0, 0x3a4270\nMOV             R1, R4                                                 ; +0x1b2, 0x3a4272\nMOV             R2, R9                                                 ; +0x1b4, 0x3a4274\nBL              _ZN15GJSmartTemplate15getPrefabWithIDESsi; GJSmartTemplate::getPrefabWithID(std::string,int) ; +0x1b6, 0x3a4276\nMOV             R6, R0                                                 ; +0x1ba, 0x3a427a\nMOV             R0, R4                                                 ; +0x1bc, 0x3a427c\nBL              sub_774008                                             ; +0x1be, 0x3a427e\nCBZ             R6, loc_3A42CE                                         ; +0x1c2, 0x3a4282\nADD.W           R1, R6, #0x38 ; '8'                                    ; +0x1c4, 0x3a4284\nMOV             R0, R4                                                 ; +0x1c8, 0x3a4288\nBL              sub_775C20                                             ; +0x1ca, 0x3a428a\nMOVS            R2, #0                                                 ; +0x1ce, 0x3a428e\nMOV             R0, R5; int                                            ; +0x1d0, 0x3a4290\nMOV             R1, R4; int                                            ; +0x1d2, 0x3a4292\nMOV             R3, R2                                                 ; +0x1d4, 0x3a4294\nBL              _ZN8EditorUI12pasteObjectsESsbb; EditorUI::pasteObjects(std::string,bool,bool) ; +0x1d6, 0x3a4296\nMOV             R6, R0                                                 ; +0x1da, 0x3a429a\nMOV             R0, R4                                                 ; +0x1dc, 0x3a429c\nBL              sub_774008                                             ; +0x1de, 0x3a429e\nMOV             R0, R4                                                 ; +0x1e2, 0x3a42a2\nADD             R1, SP, #0x44+var_28                                   ; +0x1e4, 0x3a42a4\nADD             R2, SP, #0x44+var_20                                   ; +0x1e6, 0x3a42a6\nBL              _ZNK7cocos2d7CCPointplERKS0_; cocos2d::CCPoint::operator+(cocos2d::CCPoint const&) ; +0x1e8, 0x3a42a8\nMOV             R0, R5                                                 ; +0x1ec, 0x3a42ac\nMOV             R1, R6                                                 ; +0x1ee, 0x3a42ae\nMOV             R2, R4                                                 ; +0x1f0, 0x3a42b0\nMOVS            R3, #0                                                 ; +0x1f2, 0x3a42b2\nBL              _ZN8EditorUI25repositionObjectsToCenterEPN7cocos2d7CCArrayENS0_7CCPointEb; EditorUI::repositionObjectsToCenter(cocos2d::CCArray *,cocos2d::CCPoint,bool) ; +0x1f4, 0x3a42b4\nMOV             R0, R5; this                                           ; +0x1f8, 0x3a42b8\nMOV             R1, R6; cocos2d::CCArray *                             ; +0x1fa, 0x3a42ba\nBL              _ZN8EditorUI28deleteSmartBlocksFromObjectsEPN7cocos2d7CCArrayE; EditorUI::deleteSmartBlocksFromObjects(cocos2d::CCArray *) ; +0x1fc, 0x3a42bc\nB               loc_3A42CE                                             ; +0x200, 0x3a42c0\nB               loc_3A42C4                                             ; +0x202, 0x3a42c2\nMOV             R0, R4                                                 ; +0x204, 0x3a42c4\nBL              sub_774008                                             ; +0x206, 0x3a42c6\nBL              __cxa_end_cleanup                                      ; +0x20a, 0x3a42ca\nLDR             R3, [SP,#0x44+var_40]                                  ; +0x20e, 0x3a42ce\nLDR             R2, [SP,#0x44+var_8]                                   ; +0x210, 0x3a42d0\nLDR             R3, [R3]                                               ; +0x212, 0x3a42d2\nCMP             R2, R3                                                 ; +0x214, 0x3a42d4\nBEQ             loc_3A42DC                                             ; +0x216, 0x3a42d6\nBLX             __stack_chk_fail                                       ; +0x218, 0x3a42d8\nADD             SP, SP, #0x44 ; 'D'                                    ; +0x21c, 0x3a42dc\nVPOP            {D8}                                                   ; +0x21e, 0x3a42de\nPOP.W           {R4-R11,PC}                                            ; +0x222, 0x3a42e2", "xrefs": ["SetupSmartBlockLayer::onCreateAll @ 0x53d2e4", "BrowseSmartTemplateLayer::createPrefab @ 0x53f186"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}