//
// GameManager::loadMiddlegroundAsync from 0x414838 to 0x4148c2 (138 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::swapMiddleground @ 0x58c84c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:47:39 +0000
//
int __fastcall GameManager::loadMiddlegroundAsync(int this, const char *a2)
{
int v2; // r5
const char *v3; // r4
int v4; // r6
int v5; // r7
cocos2d::CCString *v6; // r0
char *CString; // r0
cocos2d::CCTextureCache *v8; // r0
int v9; // r7
cocos2d::CCString *v10; // r0
char *v11; // r0
v2 = this;
if ( (int)a2 <= 0 )
{
v3 = (_BYTE *)(&dword_0 + 1);
}
else
{
if ( (int)a2 >= 3 )
a2 = (_BYTE *)(&dword_0 + 3);
v3 = a2;
}
v4 = *(unsigned __int8 *)(this + 790);
if ( !*(_BYTE *)(this + 790) && v3 != *(const char **)(this + 776) )
{
*(_BYTE *)(this + 793) = v4;
*(_BYTE *)(this + 790) = 1;
*(_BYTE *)(this + 794) = v4;
v5 = cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)this);
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_001.png", v3);
CString = (char *)cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::addImageAsync(
v5,
CString,
v2,
(int)GameManager::finishedLoadingMGAsync1,
v4,
(int)v3,
v4);
v9 = cocos2d::CCTextureCache::sharedTextureCache(v8);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"fg_%02d_2_001.png", v3);
v11 = (char *)cocos2d::CCString::getCString(v10);
return cocos2d::CCTextureCache::addImageAsync(
v9,
v11,
v2,
(int)GameManager::finishedLoadingMGAsync2,
v4,
(int)v3,
v4);
}
return this;
}