//
// GameManager::loadMiddlegroundAsync from 0x100318710 to 0x100318804 (244 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x1001de294
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GameManager::loadMiddlegroundAsync(GameManager *a1, int a2)
{
int v2; // w8
int v3; // w20
cocos2d::CCTextureCache *v5; // x21
cocos2d::CCString *v6; // x0
const char *CString; // x0
cocos2d::CCTextureCache *v8; // x21
cocos2d::CCString *v9; // x0
const char *v10; // x1
cocos2d::SEL_MenuHandler v11; // 0:x3.16
cocos2d::SEL_MenuHandler v12; // 0:x3.16
if ( a2 >= 3 )
v2 = 3;
else
v2 = a2;
if ( v2 <= 1 )
v3 = 1;
else
v3 = v2;
if ( !a1->m_loadingG1 && v3 != a1->m_loadedMG )
{
a1->m_loadingG1 = 1;
*(_WORD *)&a1->m_finishedLoadingMG1 = 0;
v5 = cocos2d::CCTextureCache::sharedTextureCache();
v6 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_001.png", v3);
CString = cocos2d::CCString::getCString(v6);
v11.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync1;
v11.adj = 0;
cocos2d::CCTextureCache::addImageAsync(v5, CString, a1, v11, v3, kCCTexture2DPixelFormat_RGBA8888);
v8 = cocos2d::CCTextureCache::sharedTextureCache();
v9 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_2_001.png", v3);
v10 = cocos2d::CCString::getCString(v9);
v12.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync2;
v12.adj = 0;
cocos2d::CCTextureCache::addImageAsync(v8, v10, a1, v12, v3, kCCTexture2DPixelFormat_RGBA8888);
}
}