//
// GameManager::loadMiddleground from 0x1003834d0 to 0x1003835cd (253 bytes)
//
// 2 xrefs:
// > LevelSettingsLayer::selectArtClosed @ 0x10026f54a
// > GameManager::getMGTexture @ 0x100383b90
//
// 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; // eax
int v3; // r14d
cocos2d::CCString *v4; // rax
const char *CString; // r12
cocos2d::CCTextureCache *v6; // rax
cocos2d::CCTextureCache *v7; // r12
cocos2d::CCString *v8; // rax
const char *v9; // rax
cocos2d::CCTextureCache *v10; // r15
cocos2d::CCString *v11; // rax
const char *v12; // rax
cocos2d::CCTextureCache *v13; // r15
cocos2d::CCString *v14; // rax
const char *v15; // rax
char v16; // [rsp+0h] [rbp-20h]
char v17; // [rsp+0h] [rbp-20h]
char v18; // [rsp+0h] [rbp-20h]
char v19; // [rsp+0h] [rbp-20h]
v2 = 3;
if ( a2 < 3 )
v2 = a2;
v3 = 0;
if ( v2 > 0 )
v3 = v2;
if ( v3 != a1->m_loadedMG )
{
v4 = (cocos2d::CCString *)sub_1007AB580("fg_%02d_001.png", v16);
CString = cocos2d::CCString::getCString(v4);
v6 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v6, CString);
v7 = cocos2d::CCTextureCache::sharedTextureCache();
v8 = (cocos2d::CCString *)sub_1007AB580("fg_%02d_2_001.png", v17);
v9 = cocos2d::CCString::getCString(v8);
cocos2d::CCTextureCache::removeTextureForKey(v7, v9);
if ( a2 > 0 )
{
v10 = cocos2d::CCTextureCache::sharedTextureCache();
v11 = (cocos2d::CCString *)sub_1007AB580("fg_%02d_001.png", v18);
v12 = cocos2d::CCString::getCString(v11);
cocos2d::CCTextureCache::addImage(v10, v12, 0);
v13 = cocos2d::CCTextureCache::sharedTextureCache();
v14 = (cocos2d::CCString *)sub_1007AB580("fg_%02d_2_001.png", v19);
v15 = cocos2d::CCString::getCString(v14);
cocos2d::CCTextureCache::addImage(v13, v15, 0);
}
a1->m_loadedMG = v3;
}
}