//
// GameManager::loadMiddlegroundAsync from 0x10036c9b0 to 0x10036ca8b (219 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x1000f0d91
//
// 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 12:29:00 +0000
//
__int64 __fastcall GameManager::loadMiddlegroundAsync(__int64 a1, int a2)
{
char v2; // al
__int64 result; // rax
unsigned int v4; // ebx
__int64 v5; // r15
__int64 v6; // rax
__int64 CString; // rax
__int64 v8; // r15
__int64 v9; // rax
__int64 v10; // rax
char v11; // [rsp+0h] [rbp-20h]
char v12; // [rsp+0h] [rbp-20h]
v11 = v2;
result = 3;
if ( a2 < 3 )
result = (unsigned int)a2;
v4 = 1;
if ( (int)result >= 2 )
v4 = result;
if ( !*(_BYTE *)(a1 + 1002) && v4 != *(_DWORD *)(a1 + 988) )
{
*(_BYTE *)(a1 + 1002) = 1;
*(_WORD *)(a1 + 1005) = 0;
v5 = cocos2d::CCTextureCache::sharedTextureCache(a1);
v6 = sub_10088E820("fg_%02d_001.png", v11);
CString = cocos2d::CCString::getCString(v6);
cocos2d::CCTextureCache::addImageAsync(v5, CString, a1, sub_10036CA90, 0, v4, 0);
v8 = cocos2d::CCTextureCache::sharedTextureCache(v5);
v9 = sub_10088E820("fg_%02d_2_001.png", v12);
v10 = cocos2d::CCString::getCString(v9);
return cocos2d::CCTextureCache::addImageAsync(v8, v10, a1, GameManager::finishedLoadingMGAsync2, 0, v4, 0);
}
return result;
}