//
// GameManager::loadBackground from 0x14027dd10 to 0x14027ddbb (171 bytes)
//
// 9 xrefs:
// > GauntletLayer::init @ 0x1402faf97
// > GJBaseGameLayer::createBackground @ 0x140311a95
// > LevelAreaLayer::init @ 0x1403dd8f7
// > LevelSettingsLayer::selectArtClosed @ 0x14045b119
// > LoadingLayer::init @ 0x14046924e
// > MenuGameLayer::init @ 0x14046fae7
// > ??> @ 0x1408addd8
// > ??> @ 0x1408adde8
// > ??> @ 0x14091cea4
//
// 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
//
__int64 __fastcall GameManager::loadBackground(__int64 a1, int a2)
{
__int64 result; // rax
int v3; // edi
int v5; // edx
cocos2d::CCString *v6; // rax
const char *CString; // rbx
cocos2d::CCTextureCache *v8; // rax
cocos2d::CCString *v9; // rax
const char *v10; // rbx
__int64 v11; // rcx
cocos2d::CCTextureCache *v12; // rax
result = 59;
v3 = 1;
if ( a2 < 59 )
result = (unsigned int)a2;
v5 = *(_DWORD *)(a1 + 1012);
if ( (int)result > 1 )
v3 = result;
if ( v3 != v5 )
{
if ( v5 )
{
v6 = cocos2d::CCString::createWithFormat("game_bg_%02d_001.png", v5);
CString = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
}
v9 = cocos2d::CCString::createWithFormat("game_bg_%02d_001.png", v3);
v10 = cocos2d::CCString::getCString(v9);
cocos2d::CCApplication::sharedApplication(v11);
v12 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
result = (__int64)cocos2d::CCTextureCache::addImage(v12, v10, 0);
*(_DWORD *)(a1 + 1012) = v3;
}
return result;
}