//
// GameManager::loadMiddleground from 0x71694c to 0x716a44 (248 bytes)
//
// 3 xrefs:
// > GameManager::getMGTexture @ 0x71701c
// > LevelSettingsLayer::selectArtClosed @ 0xb61bf4
// > ??> @ 0xf1be8
//
// This function is hookable on this platform (idp: arm, 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 12:52:16 +0000
//
unsigned int *__fastcall GameManager::loadMiddleground(unsigned int *this, int a2)
{
int v2; // w19
const char *v3; // x1
unsigned int *v4; // x22
cocos2d::CCString *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCTextureCache *v7; // x0
cocos2d::CCTextureCache *v8; // x23
cocos2d::CCString *v9; // x0
const char *v10; // x0
cocos2d::CCTextureCache *v11; // x23
cocos2d::CCString *v12; // x0
const char *v13; // x0
cocos2d::CCTextureCache *v14; // x0
cocos2d::CCTextureCache *v15; // x21
cocos2d::CCString *v16; // x0
const char *v17; // x0
char *CString; // [xsp+48h] [xbp+48h]
if ( a2 > 3 )
v2 = 3;
else
v2 = a2;
v3 = (const char *)*(this + 247);
if ( v2 < 0 )
v2 = 0;
if ( (_DWORD)v3 != v2 )
{
v4 = this;
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", v3);
CString = (char *)cocos2d::CCString::getCString(v5);
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)CString);
v7 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::removeTextureForKey(v6, CString);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v7);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)v4[247]);
v10 = (const char *)cocos2d::CCString::getCString(v9);
this = (unsigned int *)cocos2d::CCTextureCache::removeTextureForKey(v8, v10);
if ( v2 > 0 )
{
v11 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)this);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_001.png",
(const char *)(unsigned int)v2);
v13 = (const char *)cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::addImage(v11, v13, 0);
v15 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v14);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)(unsigned int)v2);
v17 = (const char *)cocos2d::CCString::getCString(v16);
this = (unsigned int *)cocos2d::CCTextureCache::addImage(v15, v17, 0);
}
v4[247] = v2;
}
return this;
}