{"type": "func", "start": 5370568352, "end": 5370568959, "name": "EditorUI::doPasteObjects", "pseudocode": "// \n// EditorUI::doPasteObjects from 0x1401c5ea0 to 0x1401c60ff (607 bytes)\n// \n// 4 xrefs:\n// > EditorCommandsPopup::onCommand @ 0x14017dcb8\n// > EditorUI::handleEditorAction @ 0x1401c35a5\n// > EditorUI::onPaste @ 0x1401c5e8d\n// > <???> @ 0x14091a774\n// \n// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:28:05 +0000\n// \n\n// Hidden C++ exception states: #wind=3\nvoid __fastcall EditorUI::doPasteObjects(__int64 a1, unsigned __int8 a2)\n{\n  __int64 v4; // r8\n  __int64 v5; // rdx\n  int v6; // r9d\n  __int64 v7; // rsi\n  __int64 v8; // rax\n  cocos2d::CCArray *v9; // rbp\n  __int64 v10; // r8\n  int v11; // eax\n  int v12; // ecx\n  int v13; // edx\n  __int64 v14; // rcx\n  __int64 v15; // rax\n  __int64 v16; // rbx\n  __int64 v17; // rax\n  float *v18; // rax\n  __int64 GridSnappedPos; // rax\n  __int64 v20; // rax\n  _BYTE v21[8]; // [rsp+20h] [rbp-48h] BYREF\n  _BYTE v22[8]; // [rsp+28h] [rbp-40h] BYREF\n  _BYTE v23[56]; // [rsp+30h] [rbp-38h] BYREF\n  void *v24; // [rsp+80h] [rbp+18h] BYREF\n  float v25; // [rsp+88h] [rbp+20h] BYREF\n  float v26; // [rsp+8Ch] [rbp+24h]\n\n  v4 = qword_14090BFD0;\n  if ( !qword_14090BFD0 )\n  {\n    v24 = operator new(0x6E8u);\n    qword_14090BFD0 = GameManager::GameManager(v24);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);\n    v4 = qword_14090BFD0;\n  }\n  if ( *(_QWORD *)(v4 + 536) )\n  {\n    v5 = *(_QWORD *)(a1 + 1512);\n    v6 = *(_DWORD *)(v4 + 552) + *(_DWORD *)(v5 + 14928) - *(_DWORD *)(v5 + 14932);\n    if ( v6 > 80000 && !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1297LL) )\n    {\n      EditorUI::showMaxError(a1);\n      return;\n    }\n    v7 = a1 + 1512;\n    if ( v6 > 40000 )\n    {\n      if ( !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1296LL) )\n      {\n        EditorUI::showMaxBasicError(a1);\n        return;\n      }\n      v7 = a1 + 1512;\n    }\n    v8 = sub_14003F4F0((__int64)v23, v4 + 520);\n    v9 = (cocos2d::CCArray *)EditorUI::pasteObjects(a1, v8, a2, 0);\n    v10 = *(_QWORD *)(a1 + 1512);\n    v11 = *(_DWORD *)(v10 + 15504);\n    if ( v11 >= 0 )\n    {\n      v12 = *(_DWORD *)(v10 + 15440) - v11;\n      v13 = 0;\n      if ( v12 > 1 )\n      {\n        do\n        {\n          if ( v13 >= 7 )\n            break;\n          v12 = (unsigned int)v12 >> 1;\n          ++v13;\n        }\n        while ( (unsigned int)v12 > 1 );\n      }\n      ++*(_DWORD *)(v10 + 4LL * v13 + 15472);\n      v7 = a1 + 1512;\n    }\n    *(_DWORD *)(v10 + 15504) = *(_DWORD *)(v10 + 15440);\n    if ( v9 )\n    {\n      if ( cocos2d::CCArray::count(v9) )\n      {\n        v15 = cocos2d::CCDirector::sharedDirector(v14);\n        cocos2d::CCDirector::getWinSize(v15, &v25);\n        v16 = *(_QWORD *)(*(_QWORD *)v7 + 4296LL);\n        cocos2d::CCPoint::CCPoint(\n          (cocos2d::CCPoint *)v21,\n          v25 * 0.5,\n          (float)(*(float *)(a1 + 904) * 0.5) + (float)(v26 * 0.5));\n        cocos2d::CCNode::convertToNodeSpace(v16, &v24, v17);\n        cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v21, (const struct cocos2d::CCPoint *)&v24);\n        GridSnappedPos = EditorUI::getGridSnappedPos(a1, (__int64)v22, v18);\n        cocos2d::CCPoint::operator=(&v24, GridSnappedPos);\n        cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v22, (const struct cocos2d::CCPoint *)&v24);\n        EditorUI::repositionObjectsToCenter(a1, v9, v20, 0);\n      }\n    }\n    EditorUI::updateButtons(a1);\n    EditorUI::updateObjectInfoLabel(a1);\n  }\n}", "assembly": "; \n; EditorUI::doPasteObjects from 0x1401c5ea0 to 0x1401c60ff (607 bytes)\n; \n; 4 xrefs:\n; > EditorCommandsPopup::onCommand @ 0x14017dcb8\n; > EditorUI::handleEditorAction @ 0x1401c35a5\n; > EditorUI::onPaste @ 0x1401c5e8d\n; > <???> @ 0x14091a774\n; \n; This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:28:05 +0000\n; \nmov     [rsp+arg_0], rbx                                               ; +0x0, 0x1401c5ea0\npush    rbp                                                            ; +0x5, 0x1401c5ea5\npush    rsi                                                            ; +0x6, 0x1401c5ea6\npush    rdi                                                            ; +0x7, 0x1401c5ea7\nsub     rsp, 50h                                                       ; +0x8, 0x1401c5ea8\nmovzx   ebp, dl                                                        ; +0xc, 0x1401c5eac\nmov     rdi, rcx                                                       ; +0xf, 0x1401c5eaf\nmov     r8, cs:qword_14090BFD0                                         ; +0x12, 0x1401c5eb2\ntest    r8, r8                                                         ; +0x19, 0x1401c5eb9\njnz     short loc_1401C5EF3                                            ; +0x1c, 0x1401c5ebc\nmov     ecx, 6E8h; Size                                                ; +0x1e, 0x1401c5ebe\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x23, 0x1401c5ec3\nmov     [rsp+68h+arg_10], rax                                          ; +0x28, 0x1401c5ec8\nmov     rcx, rax                                                       ; +0x30, 0x1401c5ed0\ncall    GameManager__GameManager                                       ; +0x33, 0x1401c5ed3\nnop                                                                    ; +0x38, 0x1401c5ed8\nmov     cs:qword_14090BFD0, rax                                        ; +0x39, 0x1401c5ed9\nmov     rcx, [rax]                                                     ; +0x40, 0x1401c5ee0\nmov     rdx, [rcx+48h]                                                 ; +0x43, 0x1401c5ee3\nmov     rcx, rax                                                       ; +0x47, 0x1401c5ee7\ncall    rdx                                                            ; +0x4a, 0x1401c5eea\nmov     r8, cs:qword_14090BFD0                                         ; +0x4c, 0x1401c5eec\ncmp     qword ptr [r8+218h], 0                                         ; +0x53, 0x1401c5ef3\njz      loc_1401C60F2                                                  ; +0x5b, 0x1401c5efb\nmov     rdx, [rdi+5E8h]                                                ; +0x61, 0x1401c5f01\nmov     r9d, [rdx+3A50h]                                               ; +0x68, 0x1401c5f08\nsub     r9d, [rdx+3A54h]                                               ; +0x6f, 0x1401c5f0f\nadd     r9d, [r8+228h]                                                 ; +0x76, 0x1401c5f16\ncmp     r9d, 13880h                                                    ; +0x7d, 0x1401c5f1d\njle     short loc_1401C5F4A                                            ; +0x84, 0x1401c5f24\nmov     rax, [rdx+878h]                                                ; +0x86, 0x1401c5f26\ncmp     byte ptr [rax+511h], 0                                         ; +0x8d, 0x1401c5f2d\njnz     short loc_1401C5F4A                                            ; +0x94, 0x1401c5f34\nmov     rcx, rdi                                                       ; +0x96, 0x1401c5f36\nmov     rbx, [rsp+68h+arg_0]                                           ; +0x99, 0x1401c5f39\nadd     rsp, 50h                                                       ; +0x9e, 0x1401c5f3e\npop     rdi                                                            ; +0xa2, 0x1401c5f42\npop     rsi                                                            ; +0xa3, 0x1401c5f43\npop     rbp                                                            ; +0xa4, 0x1401c5f44\njmp     EditorUI__showMaxError                                         ; +0xa5, 0x1401c5f45\nlea     rsi, [rdi+5E8h]                                                ; +0xaa, 0x1401c5f4a\ncmp     r9d, 9C40h                                                     ; +0xb1, 0x1401c5f51\njle     short loc_1401C5F85                                            ; +0xb8, 0x1401c5f58\nmov     rax, [rdx+878h]                                                ; +0xba, 0x1401c5f5a\ncmp     byte ptr [rax+510h], 0                                         ; +0xc1, 0x1401c5f61\njnz     short loc_1401C5F7E                                            ; +0xc8, 0x1401c5f68\nmov     rcx, rdi                                                       ; +0xca, 0x1401c5f6a\nmov     rbx, [rsp+68h+arg_0]                                           ; +0xcd, 0x1401c5f6d\nadd     rsp, 50h                                                       ; +0xd2, 0x1401c5f72\npop     rdi                                                            ; +0xd6, 0x1401c5f76\npop     rsi                                                            ; +0xd7, 0x1401c5f77\npop     rbp                                                            ; +0xd8, 0x1401c5f78\njmp     EditorUI__showMaxBasicError                                    ; +0xd9, 0x1401c5f79\nlea     rsi, [rdi+5E8h]                                                ; +0xde, 0x1401c5f7e\nlea     rdx, [r8+208h]                                                 ; +0xe5, 0x1401c5f85\nlea     rcx, [rsp+68h+var_38]                                          ; +0xec, 0x1401c5f8c\ncall    sub_14003F4F0                                                  ; +0xf1, 0x1401c5f91\nxor     r9d, r9d                                                       ; +0xf6, 0x1401c5f96\nmovzx   r8d, bpl                                                       ; +0xf9, 0x1401c5f99\nmov     rdx, rax                                                       ; +0xfd, 0x1401c5f9d\nmov     rcx, rdi                                                       ; +0x100, 0x1401c5fa0\ncall    EditorUI__pasteObjects                                         ; +0x103, 0x1401c5fa3\nmov     rbp, rax                                                       ; +0x108, 0x1401c5fa8\nmov     r8, [rdi+5E8h]                                                 ; +0x10b, 0x1401c5fab\nmov     eax, [r8+3C90h]                                                ; +0x112, 0x1401c5fb2\ntest    eax, eax                                                       ; +0x119, 0x1401c5fb9\njs      short loc_1401C5FF0                                            ; +0x11b, 0x1401c5fbb\nmov     ecx, [r8+3C50h]                                                ; +0x11d, 0x1401c5fbd\nsub     ecx, eax                                                       ; +0x124, 0x1401c5fc4\nxor     edx, edx                                                       ; +0x126, 0x1401c5fc6\ncmp     ecx, 1                                                         ; +0x128, 0x1401c5fc8\njle     short loc_1401C5FDE                                            ; +0x12b, 0x1401c5fcb\nnop     dword ptr [rax]                                                ; +0x12d, 0x1401c5fcd\ncmp     edx, 7                                                         ; +0x130, 0x1401c5fd0\njge     short loc_1401C5FDE                                            ; +0x133, 0x1401c5fd3\nshr     ecx, 1                                                         ; +0x135, 0x1401c5fd5\ninc     edx                                                            ; +0x137, 0x1401c5fd7\ncmp     ecx, 1                                                         ; +0x139, 0x1401c5fd9\nja      short loc_1401C5FD0                                            ; +0x13c, 0x1401c5fdc\nmovsxd  rax, edx                                                       ; +0x13e, 0x1401c5fde\ninc     dword ptr [r8+rax*4+3C70h]                                     ; +0x141, 0x1401c5fe1\nlea     rsi, [rdi+5E8h]                                                ; +0x149, 0x1401c5fe9\nmov     eax, [r8+3C50h]                                                ; +0x150, 0x1401c5ff0\nmov     [r8+3C90h], eax                                                ; +0x157, 0x1401c5ff7\ntest    rbp, rbp                                                       ; +0x15e, 0x1401c5ffe\njz      loc_1401C60E2                                                  ; +0x161, 0x1401c6001\nmov     rcx, rbp                                                       ; +0x167, 0x1401c6007\ncall    cs:?count@CCArray@cocos2d@@QEBAIXZ; cocos2d::CCArray::count(void) ; +0x16a, 0x1401c600a\ntest    eax, eax                                                       ; +0x170, 0x1401c6010\njz      loc_1401C60E2                                                  ; +0x172, 0x1401c6012\ncall    cs:?sharedDirector@CCDirector@cocos2d@@SAPEAV12@XZ; cocos2d::CCDirector::sharedDirector(void) ; +0x178, 0x1401c6018\nmov     rcx, rax                                                       ; +0x17e, 0x1401c601e\nlea     rdx, [rsp+68h+arg_18]                                          ; +0x181, 0x1401c6021\ncall    cs:?getWinSize@CCDirector@cocos2d@@QEAA?AVCCSize@2@XZ; cocos2d::CCDirector::getWinSize(void) ; +0x189, 0x1401c6029\nmov     rax, [rsi]                                                     ; +0x18f, 0x1401c602f\nmov     rbx, [rax+10C8h]                                               ; +0x192, 0x1401c6032\nmovss   xmm2, dword ptr [rdi+388h]                                     ; +0x199, 0x1401c6039\nmovss   xmm3, cs:dword_140834F20                                       ; +0x1a1, 0x1401c6041\nmulss   xmm2, xmm3                                                     ; +0x1a9, 0x1401c6049\nmovss   xmm0, [rsp+68h+arg_1C]                                         ; +0x1ad, 0x1401c604d\nmulss   xmm0, xmm3                                                     ; +0x1b6, 0x1401c6056\naddss   xmm2, xmm0                                                     ; +0x1ba, 0x1401c605a\nmovss   xmm1, [rsp+68h+arg_18]                                         ; +0x1be, 0x1401c605e\nmulss   xmm1, xmm3                                                     ; +0x1c7, 0x1401c6067\nlea     rcx, [rsp+68h+var_48]                                          ; +0x1cb, 0x1401c606b\ncall    cs:??0CCPoint@cocos2d@@QEAA@MM@Z; cocos2d::CCPoint::CCPoint(float,float) ; +0x1d0, 0x1401c6070\nmov     r8, rax                                                        ; +0x1d6, 0x1401c6076\nlea     rdx, [rsp+68h+arg_10]                                          ; +0x1d9, 0x1401c6079\nmov     rcx, rbx                                                       ; +0x1e1, 0x1401c6081\ncall    cs:?convertToNodeSpace@CCNode@cocos2d@@QEAA?AVCCPoint@2@AEBV32@@Z; cocos2d::CCNode::convertToNodeSpace(cocos2d::CCPoint const &) ; +0x1e4, 0x1401c6084\nlea     rdx, [rsp+68h+arg_10]                                          ; +0x1ea, 0x1401c608a\nlea     rcx, [rsp+68h+var_48]                                          ; +0x1f2, 0x1401c6092\ncall    cs:??0CCPoint@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const &) ; +0x1f7, 0x1401c6097\nmov     r8, rax                                                        ; +0x1fd, 0x1401c609d\nlea     rdx, [rsp+68h+var_40]                                          ; +0x200, 0x1401c60a0\nmov     rcx, rdi                                                       ; +0x205, 0x1401c60a5\ncall    EditorUI__getGridSnappedPos                                    ; +0x208, 0x1401c60a8\nmov     rdx, rax                                                       ; +0x20d, 0x1401c60ad\nlea     rcx, [rsp+68h+arg_10]                                          ; +0x210, 0x1401c60b0\ncall    cs:??4CCPoint@cocos2d@@QEAAAEAV01@AEBV01@@Z; cocos2d::CCPoint::operator=(cocos2d::CCPoint const &) ; +0x218, 0x1401c60b8\nlea     rdx, [rsp+68h+arg_10]                                          ; +0x21e, 0x1401c60be\nlea     rcx, [rsp+68h+var_40]                                          ; +0x226, 0x1401c60c6\ncall    cs:??0CCPoint@cocos2d@@QEAA@AEBV01@@Z; cocos2d::CCPoint::CCPoint(cocos2d::CCPoint const &) ; +0x22b, 0x1401c60cb\nmov     r8, rax                                                        ; +0x231, 0x1401c60d1\nxor     r9d, r9d                                                       ; +0x234, 0x1401c60d4\nmov     rdx, rbp                                                       ; +0x237, 0x1401c60d7\nmov     rcx, rdi                                                       ; +0x23a, 0x1401c60da\ncall    EditorUI__repositionObjectsToCenter                            ; +0x23d, 0x1401c60dd\nmov     rcx, rdi                                                       ; +0x242, 0x1401c60e2\ncall    EditorUI__updateButtons                                        ; +0x245, 0x1401c60e5\nmov     rcx, rdi                                                       ; +0x24a, 0x1401c60ea\ncall    EditorUI__updateObjectInfoLabel                                ; +0x24d, 0x1401c60ed\nmov     rbx, [rsp+68h+arg_0]                                           ; +0x252, 0x1401c60f2\nadd     rsp, 50h                                                       ; +0x257, 0x1401c60f7\npop     rdi                                                            ; +0x25b, 0x1401c60fb\npop     rsi                                                            ; +0x25c, 0x1401c60fc\npop     rbp                                                            ; +0x25d, 0x1401c60fd\nretn                                                                   ; +0x25e, 0x1401c60fe", "xrefs": ["EditorCommandsPopup::onCommand @ 0x14017dcb8", "EditorUI::handleEditorAction @ 0x1401c35a5", "EditorUI::onPaste @ 0x1401c5e8d", "<???> @ 0x14091a774"], "is_objc": false, "is_32_bit": false, "is_64_bit": true, "idp_name": "pc", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}