{"type": "func", "start": 8745620, "end": 8745748, "name": "GJBaseGameLayer::createMiddleground", "pseudocode": "// \n// GJBaseGameLayer::createMiddleground from 0x857294 to 0x857314 (128 bytes)\n// \n// 7 xrefs:\n// > PlayLayer::setupHasCompleted @ 0x5dc428\n// > LevelEditorLayer::init @ 0x67ca18\n// > GJBaseGameLayer::asyncMGLoaded @ 0x8580f8\n// > GJBaseGameLayer::swapMiddleground @ 0x858184\n// > GJBaseGameLayer::syncBGTextures @ 0x866a70\n// > LevelSettingsLayer::selectArtClosed @ 0xa34710\n// > <???> @ 0x9bbc8\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// local variable allocation has failed, the output may be wrong!\nvoid GJBaseGameLayer::createMiddleground(GJBaseGameLayer *a1, int a2)\n{\n  __int64 v3; // x1\n  GJMGLayer *v4; // x0\n  GJMGLayer_vtbl *v5; // x2\n  int v6; // [xsp+28h] [xbp+28h]\n  __int64 v7; // [xsp+28h] [xbp+28h]\n\n  if ( a1->m_middleground )\n  {\n    v6 = a2;\n    GJBaseGameLayer::removeMiddleground(a1);\n    a2 = v6;\n  }\n  if ( a2 > 0 )\n  {\n    if ( a2 > 3 )\n      *(_QWORD *)&a2 = 3;\n    else\n      v3 = (unsigned int)a2;\n    v7 = *(_QWORD *)&a2;\n    v4 = GJMGLayer::create(a2);\n    v5 = v4->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;\n    a1->m_middleground = v4;\n    v5->setTag(v4, v7);\n    a1->m_objectParent->addChild_0(a1->m_objectParent, a1->m_middleground, -39);\n  }\n}", "assembly": "; \n; GJBaseGameLayer::createMiddleground from 0x857294 to 0x857314 (128 bytes)\n; \n; 7 xrefs:\n; > PlayLayer::setupHasCompleted @ 0x5dc428\n; > LevelEditorLayer::init @ 0x67ca18\n; > GJBaseGameLayer::asyncMGLoaded @ 0x8580f8\n; > GJBaseGameLayer::swapMiddleground @ 0x858184\n; > GJBaseGameLayer::syncBGTextures @ 0x866a70\n; > LevelSettingsLayer::selectArtClosed @ 0xa34710\n; > <???> @ 0x9bbc8\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\nSTP             X29, X30, [SP,#var_30]!                                ; +0x0, 0x857294\nMOV             X29, SP                                                ; +0x4, 0x857298\nLDR             X2, [X0,#0x1068]                                       ; +0x8, 0x85729c\nSTR             X19, [SP,#0x30+var_20]                                 ; +0xc, 0x8572a0\nMOV             X19, X0                                                ; +0x10, 0x8572a4\nCBZ             X2, loc_8572B8                                         ; +0x14, 0x8572a8\nSTR             X1, [X29,#0x30+var_8]                                  ; +0x18, 0x8572ac\nBL              _ZN15GJBaseGameLayer18removeMiddlegroundEv; GJBaseGameLayer::removeMiddleground(void) ; +0x1c, 0x8572b0\nLDR             X1, [X29,#0x30+var_8]                                  ; +0x20, 0x8572b4\nCMP             W1, WZR                                                ; +0x24, 0x8572b8\nB.LE            loc_857308                                             ; +0x28, 0x8572bc\nCMP             W1, #3                                                 ; +0x2c, 0x8572c0\nMOV             W0, #3                                                 ; +0x30, 0x8572c4\nCSEL            W1, W1, W0, LE; int                                    ; +0x34, 0x8572c8\nSTR             X1, [X29,#0x30+var_8]                                  ; +0x38, 0x8572cc\nMOV             W0, W1; this                                           ; +0x3c, 0x8572d0\nBL              _ZN9GJMGLayer6createEi; GJMGLayer::create(int)         ; +0x40, 0x8572d4\nLDR             X2, [X0]                                               ; +0x44, 0x8572d8\nSTR             X0, [X19,#0x1068]                                      ; +0x48, 0x8572dc\nLDR             X1, [X29,#0x30+var_8]                                  ; +0x4c, 0x8572e0\nLDR             X2, [X2,#0x48]                                         ; +0x50, 0x8572e4\nBLR             X2                                                     ; +0x54, 0x8572e8\nLDR             X3, [X19,#0x1018]                                      ; +0x58, 0x8572ec\nMOV             W2, #0xFFFFFFD9                                        ; +0x5c, 0x8572f0\nLDR             X1, [X19,#0x1068]                                      ; +0x60, 0x8572f4\nMOV             X0, X3                                                 ; +0x64, 0x8572f8\nLDR             X3, [X3]                                               ; +0x68, 0x8572fc\nLDR             X3, [X3,#0x1C0]                                        ; +0x6c, 0x857300\nBLR             X3                                                     ; +0x70, 0x857304\nLDR             X19, [SP,#0x30+var_20]                                 ; +0x74, 0x857308\nLDP             X29, X30, [SP+0x30+var_30],#0x30                       ; +0x78, 0x85730c\nRET                                                                    ; +0x7c, 0x857310", "xrefs": ["PlayLayer::setupHasCompleted @ 0x5dc428", "LevelEditorLayer::init @ 0x67ca18", "GJBaseGameLayer::asyncMGLoaded @ 0x8580f8", "GJBaseGameLayer::swapMiddleground @ 0x858184", "GJBaseGameLayer::syncBGTextures @ 0x866a70", "LevelSettingsLayer::selectArtClosed @ 0xa34710", "<???> @ 0x9bbc8"], "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"}