//
// GameManager::loadMiddlegroundAsync from 0x716a44 to 0x716b28 (228 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x99a6a4
// > ??> @ 0xc21d0
//
// 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
//
__int64 __fastcall GameManager::loadMiddlegroundAsync(__int64 this, int a2)
{
unsigned int v2; // w19
int v3; // w21
cocos2d::CCString *v4; // x0
char *CString; // x0
cocos2d::CCTextureCache *v6; // x0
int v7; // w21
cocos2d::CCString *v8; // x0
char *v9; // x0
if ( a2 <= 0 )
{
v2 = 1;
}
else if ( a2 > 3 )
{
v2 = 3;
}
else
{
v2 = a2;
}
if ( !*(_BYTE *)(this + 1002) && v2 != *(_DWORD *)(this + 988) )
{
*(_BYTE *)(this + 1005) = 0;
*(_BYTE *)(this + 1006) = 0;
*(_BYTE *)(this + 1002) = (unsigned __int8)&dword_0 + 1;
v3 = cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)((char *)&dword_0 + 1));
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_001.png",
(const char *)v2);
CString = (char *)cocos2d::CCString::getCString(v4);
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::addImageAsync(v3, CString);
v7 = cocos2d::CCTextureCache::sharedTextureCache(v6);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"fg_%02d_2_001.png",
(const char *)v2);
v9 = (char *)cocos2d::CCString::getCString(v8);
return cocos2d::CCTextureCache::addImageAsync(v7, v9);
}
return this;
}