//
// GameManager::loadMiddlegroundAsync from 0x5ec044 to 0x5ec128 (228 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x858170
// > ??> @ 0x92e08
//
// 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 GameManager::loadMiddlegroundAsync(GameManager *a1, int a2)
{
unsigned int v2; // w19
cocos2d::CCTextureCache *v4; // x21
cocos2d::CCString *v5; // x0
const char *CString; // x0
cocos2d::CCTextureCache *v7; // x21
cocos2d::CCString *v8; // x0
const char *v9; // x0
cocos2d::SEL_MenuHandler v10; // 0:x3.16
cocos2d::SEL_MenuHandler v11; // 0:x3.16
if ( a2 <= 0 )
{
v2 = 1;
}
else if ( a2 > 3 )
{
v2 = 3;
}
else
{
v2 = a2;
}
if ( !a1->m_loadingG1 && v2 != a1->m_loadedMG )
{
a1->m_finishedLoadingMG1 = 0;
a1->m_finishedLoadingMG2 = 0;
a1->m_loadingG1 = (unsigned __int8)&dword_0 + 1;
v4 = cocos2d::CCTextureCache::sharedTextureCache();
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_001.png",
(const char *)v2);
CString = cocos2d::CCString::getCString(v5);
v10.adj = 0;
v10.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync1;
cocos2d::CCTextureCache::addImageAsync(v4, CString, a1, v10, v2, kCCTexture2DPixelFormat_RGBA8888);
v7 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)v2);
v9 = cocos2d::CCString::getCString(v8);
v11.adj = 0;
v11.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync2;
cocos2d::CCTextureCache::addImageAsync(v7, v9, a1, v11, v2, kCCTexture2DPixelFormat_RGBA8888);
}
}