//
// GameManager::loadBackground from 0x716814 to 0x7168b4 (160 bytes)
//
// 3 xrefs:
// > GameManager::getBGTexture @ 0x716fd0
// > LevelSettingsLayer::selectArtClosed @ 0xb61ab0
// > ??> @ 0x4ec70
//
// 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::loadBackground(__int64 this, int a2)
{
unsigned int v2; // w19
const char *v3; // x1
__int64 v4; // x20
cocos2d::CCString *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCTextureCache *v7; // x0
cocos2d::CCString *v8; // x0
cocos2d::CCTextureCache *v9; // x0
char *v10; // [xsp+38h] [xbp+38h]
char *CString; // [xsp+38h] [xbp+38h]
if ( a2 <= 0 )
{
v2 = 1;
}
else if ( a2 > 59 )
{
v2 = 59;
}
else
{
v2 = a2;
}
v3 = (const char *)*(unsigned int *)(this + 980);
if ( v2 != (_DWORD)v3 )
{
v4 = this;
if ( (_DWORD)v3 )
{
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"game_bg_%02d_001.png", v3);
CString = (char *)cocos2d::CCString::getCString(v8);
v9 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)CString);
cocos2d::CCTextureCache::removeTextureForKey(v9, CString);
}
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"game_bg_%02d_001.png",
(const char *)v2);
v10 = (char *)cocos2d::CCString::getCString(v5);
v6 = (cocos2d::CCTextureCache *)AppDelegate::get((AppDelegate *)v10);
v7 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v6);
this = cocos2d::CCTextureCache::addImage(v7, v10, 0);
*(_DWORD *)(v4 + 980) = v2;
}
return this;
}