//
// GameManager::loadMiddleground from 0x3227f8 to 0x322888 (144 bytes)
//
// 2 xrefs:
// > GameManager::getMGTexture @ 0x322c40
// > LevelSettingsLayer::selectArtClosed @ 0x56fa30
//
// 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::loadMiddleground(GameManager *a1, int a2)
{
const char *v2; // r4
const char *m_loadedMG; // r1
cocos2d::CCString *v5; // r0
const char *CString; // r6
cocos2d::CCTextureCache *v7; // r0
cocos2d::CCTextureCache *v8; // r8
cocos2d::CCString *v9; // r0
const char *v10; // r0
cocos2d::CCTextureCache *v11; // r8
cocos2d::CCString *v12; // r0
const char *v13; // r0
cocos2d::CCTextureCache *v14; // r7
cocos2d::CCString *v15; // r0
const char *v16; // r0
v2 = (const char *)__usat(2u, a2);
m_loadedMG = (const char *)a1->m_loadedMG;
if ( v2 != m_loadedMG )
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", m_loadedMG);
CString = cocos2d::CCString::getCString(v5);
v7 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v7, CString);
v8 = cocos2d::CCTextureCache::sharedTextureCache();
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)a1->m_loadedMG);
v10 = cocos2d::CCString::getCString(v9);
cocos2d::CCTextureCache::removeTextureForKey(v8, v10);
if ( (int)v2 > 0 )
{
v11 = cocos2d::CCTextureCache::sharedTextureCache();
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", v2);
v13 = cocos2d::CCString::getCString(v12);
cocos2d::CCTextureCache::addImage(v11, v13, 0);
v14 = cocos2d::CCTextureCache::sharedTextureCache();
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_2_001.png", v2);
v16 = cocos2d::CCString::getCString(v15);
cocos2d::CCTextureCache::addImage(v14, v16, 0);
}
a1->m_loadedMG = (int)v2;
}
}