{"type": "func", "start": 5370854112, "end": 5370854491, "name": "GJBaseGameLayer::createMiddleground", "pseudocode": "// \n// GJBaseGameLayer::createMiddleground from 0x14020bae0 to 0x14020bc5b (379 bytes)\n// \n// 7 xrefs:\n// > GameManager::finishedLoadingMGAsync @ 0x140182bba\n// > GJBaseGameLayer::syncBGTextures @ 0x14023b02f\n// > LevelEditorLayer::init @ 0x1402d2bb4\n// > LevelSettingsLayer::selectArtClosed @ 0x140322160\n// > PlayLayer::setupHasCompleted @ 0x1403a6a72\n// > ArtTriggerGameObject::triggerObject @ 0x1404c24a3\n// > <???> @ 0x1406ccd14\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=1\nvoid GJBaseGameLayer::createMiddleground(GJBaseGameLayer *a1, int a2)\n{\n  GJMGLayer *m_middleground; // rcx\n  GJMGLayer *v5; // rbx\n\n  m_middleground = a1->m_middleground;\n  if ( m_middleground )\n  {\n    m_middleground->removeFromParent(m_middleground);\n    a1->m_middleground = nullptr;\n  }\n  if ( a2 > 0 )\n  {\n    if ( a2 > 3 )\n      a2 = 3;\n    v5 = (GJMGLayer *)operator new(0x1E8u);\n    cocos2d::CCLayer::CCLayer(v5);\n    v5->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (GJMGLayer_vtbl *)&GJMGLayer::`vftable';\n    v5->cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&GJMGLayer::`vftable';\n    v5->cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&GJMGLayer::`vftable';\n    v5->cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&GJMGLayer::`vftable';\n    v5->cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&GJMGLayer::`vftable';\n    v5->cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&GJMGLayer::`vftable';\n    v5->m_ground1Sprite = nullptr;\n    v5->m_ground2Sprite = nullptr;\n    v5->m_textureWidth = 0.0;\n    v5->m_unk1b0 = nullptr;\n    v5->m_showGround = 0;\n    v5->m_groundWidth = 0.0;\n    *(_WORD *)&v5->m_showGround1 = 257;\n    v5->m_unk1c4 = 0.0;\n    *(_WORD *)&v5->m_cameraRotated = 0;\n    v5->m_blendMG2 = 0;\n    v5->m_mg1BatchNode = nullptr;\n    v5->m_mg2BatchNode = nullptr;\n    *(_QWORD *)&v5->m_groundScale = 0;\n    if ( GJMGLayer::init(v5, a2) )\n    {\n      cocos2d::CCObject::autorelease(v5);\n    }\n    else\n    {\n      ((void (__fastcall *)(GJMGLayer *, __int64))v5->~GJMGLayer)(v5, 1);\n      v5 = nullptr;\n    }\n    a1->m_middleground = v5;\n    v5->setTag(v5, a2);\n    a1->m_objectParent->addChild_0(a1->m_objectParent, a1->m_middleground, -39);\n  }\n}", "assembly": "; \n; GJBaseGameLayer::createMiddleground from 0x14020bae0 to 0x14020bc5b (379 bytes)\n; \n; 7 xrefs:\n; > GameManager::finishedLoadingMGAsync @ 0x140182bba\n; > GJBaseGameLayer::syncBGTextures @ 0x14023b02f\n; > LevelEditorLayer::init @ 0x1402d2bb4\n; > LevelSettingsLayer::selectArtClosed @ 0x140322160\n; > PlayLayer::setupHasCompleted @ 0x1403a6a72\n; > ArtTriggerGameObject::triggerObject @ 0x1404c24a3\n; > <???> @ 0x1406ccd14\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, 0x14020bae0\nmov     [rsp+arg_10], rbp                                              ; +0x5, 0x14020bae5\nmov     [rsp+arg_18], rsi                                              ; +0xa, 0x14020baea\npush    rdi                                                            ; +0xf, 0x14020baef\nsub     rsp, 20h                                                       ; +0x10, 0x14020baf0\nmov     esi, edx                                                       ; +0x14, 0x14020baf4\nmov     rdi, rcx                                                       ; +0x16, 0x14020baf6\nmov     rcx, [rcx+1020h]                                               ; +0x19, 0x14020baf9\nxor     ebp, ebp                                                       ; +0x20, 0x14020bb00\ntest    rcx, rcx                                                       ; +0x22, 0x14020bb02\njz      short loc_14020BB17                                            ; +0x25, 0x14020bb05\nmov     rax, [rcx]                                                     ; +0x27, 0x14020bb07\ncall    qword ptr [rax+1F0h]                                           ; +0x2a, 0x14020bb0a\nmov     [rdi+1020h], rbp                                               ; +0x30, 0x14020bb10\ntest    esi, esi                                                       ; +0x37, 0x14020bb17\njle     loc_14020BC46                                                  ; +0x39, 0x14020bb19\nmov     eax, 3                                                         ; +0x3f, 0x14020bb1f\ncmp     esi, eax                                                       ; +0x44, 0x14020bb24\ncmovg   esi, eax                                                       ; +0x46, 0x14020bb26\nmov     ecx, 1E8h; Size                                                ; +0x49, 0x14020bb29\ncall    ??2@YAPEAX_K@Z; operator new(unsigned __int64)                 ; +0x4e, 0x14020bb2e\nmov     rbx, rax                                                       ; +0x53, 0x14020bb33\nmov     [rsp+28h+arg_0], rax                                           ; +0x56, 0x14020bb36\nmov     rcx, rax                                                       ; +0x5b, 0x14020bb3b\ncall    cs:??0CCLayer@cocos2d@@QEAA@XZ; cocos2d::CCLayer::CCLayer(void) ; +0x5e, 0x14020bb3e\nlea     rax, ??_7GJMGLayer@@6B@; const GJMGLayer::`vftable'            ; +0x64, 0x14020bb44\nmov     [rbx], rax                                                     ; +0x6b, 0x14020bb4b\nlea     rax, ??_7GJMGLayer@@6B@_0; const GJMGLayer::`vftable'          ; +0x6e, 0x14020bb4e\nmov     [rbx+140h], rax                                                ; +0x75, 0x14020bb55\nlea     rax, ??_7GJMGLayer@@6B@_1; const GJMGLayer::`vftable'          ; +0x7c, 0x14020bb5c\nmov     [rbx+148h], rax                                                ; +0x83, 0x14020bb63\nlea     rax, ??_7GJMGLayer@@6B@_2; const GJMGLayer::`vftable'          ; +0x8a, 0x14020bb6a\nmov     [rbx+150h], rax                                                ; +0x91, 0x14020bb71\nlea     rax, ??_7GJMGLayer@@6B@_3; const GJMGLayer::`vftable'          ; +0x98, 0x14020bb78\nmov     [rbx+158h], rax                                                ; +0x9f, 0x14020bb7f\nlea     rax, ??_7GJMGLayer@@6B@_4; const GJMGLayer::`vftable'          ; +0xa6, 0x14020bb86\nmov     [rbx+160h], rax                                                ; +0xad, 0x14020bb8d\nmov     [rbx+198h], rbp                                                ; +0xb4, 0x14020bb94\nmov     [rbx+1A0h], rbp                                                ; +0xbb, 0x14020bb9b\nmov     [rbx+1A8h], ebp                                                ; +0xc2, 0x14020bba2\nmov     [rbx+1B0h], rbp                                                ; +0xc8, 0x14020bba8\nmov     byte ptr [rbx+1B8h], 0                                         ; +0xcf, 0x14020bbaf\nmov     [rbx+1BCh], ebp                                                ; +0xd6, 0x14020bbb6\nmov     word ptr [rbx+1C0h], 101h                                      ; +0xdc, 0x14020bbbc\nmov     [rbx+1C4h], ebp                                                ; +0xe5, 0x14020bbc5\nmov     word ptr [rbx+1C8h], 0                                         ; +0xeb, 0x14020bbcb\nmov     byte ptr [rbx+1CAh], 0                                         ; +0xf4, 0x14020bbd4\nmov     [rbx+1D0h], rbp                                                ; +0xfb, 0x14020bbdb\nmov     [rbx+1D8h], rbp                                                ; +0x102, 0x14020bbe2\nmov     [rbx+1E0h], rbp                                                ; +0x109, 0x14020bbe9\nmov     edx, esi                                                       ; +0x110, 0x14020bbf0\nmov     rcx, rbx                                                       ; +0x112, 0x14020bbf2\ncall    GJMGLayer__init                                                ; +0x115, 0x14020bbf5\nmov     rcx, rbx                                                       ; +0x11a, 0x14020bbfa\ntest    al, al                                                         ; +0x11d, 0x14020bbfd\njz      short loc_14020BC09                                            ; +0x11f, 0x14020bbff\ncall    cs:?autorelease@CCObject@cocos2d@@QEAAPEAV12@XZ; cocos2d::CCObject::autorelease(void) ; +0x121, 0x14020bc01\njmp     short loc_14020BC17                                            ; +0x127, 0x14020bc07\nmov     rax, [rbx]                                                     ; +0x129, 0x14020bc09\nmov     edx, 1                                                         ; +0x12c, 0x14020bc0c\ncall    qword ptr [rax+8]                                              ; +0x131, 0x14020bc11\nmov     rbx, rbp                                                       ; +0x134, 0x14020bc14\nmov     [rdi+1020h], rbx                                               ; +0x137, 0x14020bc17\nmov     rax, [rbx]                                                     ; +0x13e, 0x14020bc1e\nmov     edx, esi                                                       ; +0x141, 0x14020bc21\nmov     rcx, rbx                                                       ; +0x143, 0x14020bc23\ncall    qword ptr [rax+40h]                                            ; +0x146, 0x14020bc26\nmov     rcx, [rdi+0FD0h]                                               ; +0x149, 0x14020bc29\nmov     rax, [rcx]                                                     ; +0x150, 0x14020bc30\nmov     r8d, 0FFFFFFD9h                                                ; +0x153, 0x14020bc33\nmov     rdx, [rdi+1020h]                                               ; +0x159, 0x14020bc39\ncall    qword ptr [rax+1B8h]                                           ; +0x160, 0x14020bc40\nmov     rbx, [rsp+28h+arg_8]                                           ; +0x166, 0x14020bc46\nmov     rbp, [rsp+28h+arg_10]                                          ; +0x16b, 0x14020bc4b\nmov     rsi, [rsp+28h+arg_18]                                          ; +0x170, 0x14020bc50\nadd     rsp, 20h                                                       ; +0x175, 0x14020bc55\npop     rdi                                                            ; +0x179, 0x14020bc59\nretn                                                                   ; +0x17a, 0x14020bc5a", "xrefs": ["GameManager::finishedLoadingMGAsync @ 0x140182bba", "GJBaseGameLayer::syncBGTextures @ 0x14023b02f", "LevelEditorLayer::init @ 0x1402d2bb4", "LevelSettingsLayer::selectArtClosed @ 0x140322160", "PlayLayer::setupHasCompleted @ 0x1403a6a72", "ArtTriggerGameObject::triggerObject @ 0x1404c24a3", "<???> @ 0x1406ccd14"], "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"}