{"type": "func", "start": 5373266112, "end": 5373266359, "name": "SetupSmartBlockLayer::onCreateTemplate", "pseudocode": "// \n// SetupSmartBlockLayer::onCreateTemplate from 0x1404588c0 to 0x1404589b7 (247 bytes)\n// \n// 2 xrefs:\n// > SetupSmartBlockLayer::init @ 0x140456ed2\n// > <???> @ 0x1406daa60\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\n// Hidden C++ exception states: #wind=2\nvoid SetupSmartBlockLayer::onCreateTemplate(SetupSmartBlockLayer *a1, cocos2d::CCObject *a2)\n{\n  cocos2d::CCArray *v3; // rax\n  cocos2d::CCArray *v4; // rbx\n  SmartGameObject *m_gameObject; // rdx\n  struct cocos2d::CCArray *m_gameObjects; // rdx\n  __int64 v7; // rax\n  GJSmartTemplate *v8; // rsi\n  __int64 v9; // rcx\n  void *v10; // [rsp+30h] [rbp+8h]\n  void *v11; // [rsp+30h] [rbp+8h]\n\n  v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);\n  v4 = v3;\n  m_gameObject = a1->m_gameObject;\n  if ( m_gameObject )\n  {\n    cocos2d::CCArray::addObject(v3, m_gameObject);\n  }\n  else\n  {\n    m_gameObjects = a1->m_gameObjects;\n    if ( m_gameObjects )\n      cocos2d::CCArray::addObjectsFromArray(v3, m_gameObjects);\n  }\n  v7 = qword_1406C2EC0;\n  if ( !qword_1406C2EC0 )\n  {\n    v10 = operator new(0x3D0u);\n    qword_1406C2EC0 = sub_140141280((__int64)v10);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);\n    v7 = qword_1406C2EC0;\n  }\n  v8 = *(GJSmartTemplate **)(v7 + 960);\n  v9 = qword_1406C2ED8;\n  if ( !qword_1406C2ED8 )\n  {\n    v11 = operator new(0x668u);\n    qword_1406C2ED8 = sub_14017AB00((__int64)v11);\n    (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);\n    v9 = qword_1406C2ED8;\n  }\n  EditorUI::addObjectsToSmartTemplate(*(EditorUI **)(*(_QWORD *)(v9 + 528) + 14496LL), v8, v4);\n  SetupSmartBlockLayer::onClose(a1, nullptr);\n}", "assembly": "; \n; SetupSmartBlockLayer::onCreateTemplate from 0x1404588c0 to 0x1404589b7 (247 bytes)\n; \n; 2 xrefs:\n; > SetupSmartBlockLayer::init @ 0x140456ed2\n; > <???> @ 0x1406daa60\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\nmov     [rsp+arg_8], rbx                                               ; +0x0, 0x1404588c0\nmov     [rsp+arg_10], rsi                                              ; +0x5, 0x1404588c5\npush    rdi                                                            ; +0xa, 0x1404588ca\nsub     rsp, 20h                                                       ; +0xb, 0x1404588cb\nmov     rdi, rcx                                                       ; +0xf, 0x1404588cf\ncall    cs:?create@CCArray@cocos2d@@SAPEAV12@XZ; cocos2d::CCArray::create(void) ; +0x12, 0x1404588d2\nmov     rbx, rax                                                       ; +0x18, 0x1404588d8\nmov     rdx, [rdi+298h]                                                ; +0x1b, 0x1404588db\ntest    rdx, rdx                                                       ; +0x22, 0x1404588e2\njz      short loc_1404588F2                                            ; +0x25, 0x1404588e5\nmov     rcx, rax                                                       ; +0x27, 0x1404588e7\ncall    cs:?addObject@CCArray@cocos2d@@QEAAXPEAVCCObject@2@@Z; cocos2d::CCArray::addObject(cocos2d::CCObject *) ; +0x2a, 0x1404588ea\njmp     short loc_140458907                                            ; +0x30, 0x1404588f0\nmov     rdx, [rdi+2A0h]                                                ; +0x32, 0x1404588f2\ntest    rdx, rdx                                                       ; +0x39, 0x1404588f9\njz      short loc_140458907                                            ; +0x3c, 0x1404588fc\nmov     rcx, rbx                                                       ; +0x3e, 0x1404588fe\ncall    cs:?addObjectsFromArray@CCArray@cocos2d@@QEAAXPEAV12@@Z; cocos2d::CCArray::addObjectsFromArray(cocos2d::CCArray *) ; +0x41, 0x140458901\nmov     rax, cs:qword_1406C2EC0                                        ; +0x47, 0x140458907\ntest    rax, rax                                                       ; +0x4e, 0x14045890e\njnz     short loc_140458942                                            ; +0x51, 0x140458911\nmov     ecx, 3D0h; Size                                                ; +0x53, 0x140458913\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x58, 0x140458918\nmov     [rsp+28h+arg_0], rax                                           ; +0x5d, 0x14045891d\nmov     rcx, rax                                                       ; +0x62, 0x140458922\ncall    sub_140141280                                                  ; +0x65, 0x140458925\nnop                                                                    ; +0x6a, 0x14045892a\nmov     cs:qword_1406C2EC0, rax                                        ; +0x6b, 0x14045892b\nmov     rdx, [rax]                                                     ; +0x72, 0x140458932\nmov     rcx, rax                                                       ; +0x75, 0x140458935\ncall    qword ptr [rdx+48h]                                            ; +0x78, 0x140458938\nmov     rax, cs:qword_1406C2EC0                                        ; +0x7b, 0x14045893b\nmov     rsi, [rax+3C0h]                                                ; +0x82, 0x140458942\nmov     rcx, cs:qword_1406C2ED8                                        ; +0x89, 0x140458949\ntest    rcx, rcx                                                       ; +0x90, 0x140458950\njnz     short loc_140458985                                            ; +0x93, 0x140458953\nmov     ecx, 668h; Size                                                ; +0x95, 0x140458955\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x9a, 0x14045895a\nmov     [rsp+28h+arg_0], rax                                           ; +0x9f, 0x14045895f\nmov     rcx, rax                                                       ; +0xa4, 0x140458964\ncall    sub_14017AB00                                                  ; +0xa7, 0x140458967\nnop                                                                    ; +0xac, 0x14045896c\nmov     cs:qword_1406C2ED8, rax                                        ; +0xad, 0x14045896d\nmov     r8, [rax]                                                      ; +0xb4, 0x140458974\nmov     rcx, rax                                                       ; +0xb7, 0x140458977\ncall    qword ptr [r8+48h]                                             ; +0xba, 0x14045897a\nmov     rcx, cs:qword_1406C2ED8                                        ; +0xbe, 0x14045897e\nmov     rcx, [rcx+210h]                                                ; +0xc5, 0x140458985\nmov     r8, rbx                                                        ; +0xcc, 0x14045898c\nmov     rdx, rsi                                                       ; +0xcf, 0x14045898f\nmov     rcx, [rcx+38A0h]                                               ; +0xd2, 0x140458992\ncall    EditorUI__addObjectsToSmartTemplate                            ; +0xd9, 0x140458999\nxor     edx, edx                                                       ; +0xde, 0x14045899e\nmov     rcx, rdi                                                       ; +0xe0, 0x1404589a0\nmov     rbx, [rsp+28h+arg_8]                                           ; +0xe3, 0x1404589a3\nmov     rsi, [rsp+28h+arg_10]                                          ; +0xe8, 0x1404589a8\nadd     rsp, 20h                                                       ; +0xed, 0x1404589ad\npop     rdi                                                            ; +0xf1, 0x1404589b1\njmp     SetupSmartBlockLayer__onClose                                  ; +0xf2, 0x1404589b2", "xrefs": ["SetupSmartBlockLayer::init @ 0x140456ed2", "<???> @ 0x1406daa60"], "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"}