//
// GJBaseGameLayer::createMiddleground from 0x140311c70 to 0x140311deb (379 bytes)
//
// 7 xrefs:
// > GameManager::finishedLoadingMGAsync @ 0x14027e02a
// > GJBaseGameLayer::syncBGTextures @ 0x140344f95
// > LevelEditorLayer::init @ 0x1403eeaef
// > LevelSettingsLayer::selectArtClosed @ 0x14045b3a9
// > PlayLayer::setupHasCompleted @ 0x140504d74
// > ArtTriggerGameObject::triggerObject @ 0x1406630d7
// > ??> @ 0x14091e7f4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:30:16 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall GJBaseGameLayer::createMiddleground(__int64 a1, int a2)
{
__int64 v4; // rcx
cocos2d::CCLayer *v5; // rbx
v4 = *(_QWORD *)(a1 + 4352);
if ( v4 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 512LL))(v4);
*(_QWORD *)(a1 + 4352) = 0;
}
if ( a2 > 0 )
{
if ( a2 > 3 )
a2 = 3;
v5 = (cocos2d::CCLayer *)operator new(0x1E8u);
cocos2d::CCLayer::CCLayer(v5);
*(_QWORD *)v5 = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 40) = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 41) = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 42) = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 43) = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 44) = &GJMGLayer::`vftable';
*((_QWORD *)v5 + 51) = 0;
*((_QWORD *)v5 + 52) = 0;
*((_DWORD *)v5 + 106) = 0;
*((_QWORD *)v5 + 54) = 0;
*((_BYTE *)v5 + 440) = 0;
*((_DWORD *)v5 + 111) = 0;
*((_WORD *)v5 + 224) = 257;
*((_DWORD *)v5 + 113) = 0;
*((_WORD *)v5 + 228) = 0;
*((_BYTE *)v5 + 458) = 0;
*((_QWORD *)v5 + 58) = 0;
*((_QWORD *)v5 + 59) = 0;
*((_QWORD *)v5 + 60) = 0;
if ( (unsigned __int8)GJMGLayer::init(v5, (unsigned int)a2) )
{
cocos2d::CCObject::autorelease(v5);
}
else
{
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)v5 + 8LL))(v5, 1);
v5 = nullptr;
}
*(_QWORD *)(a1 + 4352) = v5;
(*(void (__fastcall **)(cocos2d::CCLayer *, _QWORD))(*(_QWORD *)v5 + 64LL))(v5, (unsigned int)a2);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 4272) + 456LL))(
*(_QWORD *)(a1 + 4272),
*(_QWORD *)(a1 + 4352),
4294967257LL);
}
}