//
// GameManager::loadMiddleground from 0x5ebf4c to 0x5ec044 (248 bytes)
//
// 3 xrefs:
// > GameManager::getMGTexture @ 0x5ec61c
// > LevelSettingsLayer::selectArtClosed @ 0xa346ac
// > ??> @ 0xb9448
//
// 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)
{
int v2; // w19
const char *m_loadedMG; // x1
cocos2d::CCString *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCTextureCache *v7; // x23
cocos2d::CCString *v8; // x0
const char *v9; // x0
cocos2d::CCTextureCache *v10; // x23
cocos2d::CCString *v11; // x0
const char *v12; // x0
cocos2d::CCTextureCache *v13; // x21
cocos2d::CCString *v14; // x0
const char *v15; // x0
char *CString; // [xsp+48h] [xbp+48h]
if ( a2 > 3 )
v2 = 3;
else
v2 = a2;
m_loadedMG = (const char *)(unsigned int)a1->m_loadedMG;
if ( v2 < 0 )
v2 = 0;
if ( (_DWORD)m_loadedMG != v2 )
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", m_loadedMG);
CString = (char *)cocos2d::CCString::getCString(v5);
v6 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v6, CString);
v7 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)(unsigned int)a1->m_loadedMG);
v9 = cocos2d::CCString::getCString(v8);
cocos2d::CCTextureCache::removeTextureForKey(v7, v9);
if ( v2 > 0 )
{
v10 = cocos2d::CCTextureCache::sharedTextureCache();
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_001.png",
(const char *)(unsigned int)v2);
v12 = cocos2d::CCString::getCString(v11);
cocos2d::CCTextureCache::addImage(v10, v12, 0);
v13 = cocos2d::CCTextureCache::sharedTextureCache();
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)(unsigned int)v2);
v15 = cocos2d::CCString::getCString(v14);
cocos2d::CCTextureCache::addImage(v13, v15, 0);
}
a1->m_loadedMG = v2;
}
}