//
// GameManager::loadMiddleground from 0x14027de70 to 0x14027df77 (263 bytes)
//
// 5 xrefs:
// > GJMGLayer::init @ 0x140387c6e
// > LevelSettingsLayer::selectArtClosed @ 0x14045b344
// > ??> @ 0x1408ade20
// > ??> @ 0x1408ade30
// > ??> @ 0x14091ceec
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:28:58 +0000
//
void __fastcall GameManager::loadMiddleground(__int64 a1, int a2)
{
int v2; // eax
int v4; // edx
int v5; // edi
cocos2d::CCString *v6; // rax
const char *CString; // rbx
cocos2d::CCTextureCache *v8; // rax
cocos2d::CCString *v9; // rax
const char *v10; // rbx
cocos2d::CCTextureCache *v11; // rax
cocos2d::CCString *v12; // rax
const char *v13; // rbx
cocos2d::CCTextureCache *v14; // rax
cocos2d::CCString *v15; // rax
const char *v16; // rbx
cocos2d::CCTextureCache *v17; // rax
v2 = 3;
if ( a2 < 3 )
v2 = a2;
v4 = *(_DWORD *)(a1 + 1020);
v5 = 0;
if ( v2 > 0 )
v5 = v2;
if ( v5 != v4 )
{
v6 = cocos2d::CCString::createWithFormat("fg_%02d_001.png", v4);
CString = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
v9 = cocos2d::CCString::createWithFormat("fg_%02d_2_001.png", *(_DWORD *)(a1 + 1020));
v10 = cocos2d::CCString::getCString(v9);
v11 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v11, v10);
if ( v5 > 0 )
{
v12 = cocos2d::CCString::createWithFormat("fg_%02d_001.png", v5);
v13 = cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v14, v13, 0);
v15 = cocos2d::CCString::createWithFormat("fg_%02d_2_001.png", v5);
v16 = cocos2d::CCString::getCString(v15);
v17 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v17, v16, 0);
}
*(_DWORD *)(a1 + 1020) = v5;
}
}