//
// GameManager::loadMiddlegroundAsync from 0x322890 to 0x32291a (138 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x46dcb0
//
// 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)
{
const char *v3; // r4
cocos2d::CCTexture2DPixelFormat m_loadingG1; // r6
cocos2d::CCTextureCache *v5; // r7
cocos2d::CCString *v6; // r0
const char *CString; // r0
cocos2d::CCTextureCache *v8; // r7
cocos2d::CCString *v9; // r0
const char *v10; // r0
cocos2d::SEL_MenuHandler v11; // 0:r3.4,4:^0.4
cocos2d::SEL_MenuHandler v12; // 0:r3.4,4:^0.4
if ( a2 <= 0 )
{
v3 = (_BYTE *)(&dword_0 + 1);
}
else
{
if ( a2 >= 3 )
a2 = 3;
v3 = (const char *)a2;
}
m_loadingG1 = a1->m_loadingG1;
if ( !a1->m_loadingG1 && v3 != (const char *)a1->m_loadedMG )
{
a1->m_finishedLoadingMG1 = m_loadingG1;
a1->m_loadingG1 = 1;
a1->m_finishedLoadingMG2 = m_loadingG1;
v5 = cocos2d::CCTextureCache::sharedTextureCache();
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", v3);
CString = cocos2d::CCString::getCString(v6);
v11.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync1;
v11.adj = m_loadingG1;
cocos2d::CCTextureCache::addImageAsync(v5, CString, a1, v11, (int)v3, m_loadingG1);
v8 = cocos2d::CCTextureCache::sharedTextureCache();
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_2_001.png", v3);
v10 = cocos2d::CCString::getCString(v9);
v12.ptr = (void (__cdecl *)(cocos2d::CCObject *))GameManager::finishedLoadingMGAsync2;
v12.adj = m_loadingG1;
cocos2d::CCTextureCache::addImageAsync(v8, v10, a1, v12, (int)v3, m_loadingG1);
}
}