//
// GameManager::loadMiddleground from 0x100318610 to 0x100318710 (256 bytes)
//
// 2 xrefs:
// > LevelSettingsLayer::selectArtClosed @ 0x10017c294
// > GameManager::getMGTexture @ 0x100318cfc
//
// 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::loadMiddleground(GameManager *a1, int a2)
{
int v2; // w8
int v3; // w22
cocos2d::CCString *v6; // x0
const char *CString; // x21
cocos2d::CCTextureCache *v8; // x0
cocos2d::CCTextureCache *v9; // x21
cocos2d::CCString *v10; // x0
const char *v11; // x0
cocos2d::CCTextureCache *v12; // x20
cocos2d::CCString *v13; // x0
const char *v14; // x0
cocos2d::CCTextureCache *v15; // x20
cocos2d::CCString *v16; // x0
const char *v17; // x0
if ( a2 >= 3 )
v2 = 3;
else
v2 = a2;
v3 = v2 & ~(v2 >> 31);
if ( v3 != a1->m_loadedMG )
{
v6 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_001.png", a1->m_loadedMG);
CString = cocos2d::CCString::getCString(v6);
v8 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
v9 = cocos2d::CCTextureCache::sharedTextureCache();
v10 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_2_001.png", a1->m_loadedMG);
v11 = cocos2d::CCString::getCString(v10);
cocos2d::CCTextureCache::removeTextureForKey(v9, v11);
if ( a2 >= 1 )
{
v12 = cocos2d::CCTextureCache::sharedTextureCache();
v13 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_001.png", v3);
v14 = cocos2d::CCString::getCString(v13);
cocos2d::CCTextureCache::addImage(v12, v14, 0);
v15 = cocos2d::CCTextureCache::sharedTextureCache();
v16 = (cocos2d::CCString *)sub_100268F4C("fg_%02d_2_001.png", v3);
v17 = cocos2d::CCString::getCString(v16);
cocos2d::CCTextureCache::addImage(v15, v17, 0);
}
a1->m_loadedMG = v3;
}
}