//
// GameManager::loadGround from 0x14027e0c0 to 0x14027e1df (287 bytes)
//
// 5 xrefs:
// > GJGroundLayer::init @ 0x140386e37
// > LevelSettingsLayer::selectArtClosed @ 0x14045b240
// > ??> @ 0x1408ade68
// > ??> @ 0x1408ade78
// > ??> @ 0x14091cf4c
//
// 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::loadGround(__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
int v9; // edx
cocos2d::CCString *v10; // rax
const char *v11; // rbx
cocos2d::CCTextureCache *v12; // rax
cocos2d::CCString *v13; // rax
const char *v14; // rbx
cocos2d::CCTextureCache *v15; // rax
cocos2d::CCString *v16; // rax
const char *v17; // rbx
cocos2d::CCTextureCache *v18; // rax
result = 22;
v3 = 1;
if ( a2 < 22 )
result = (unsigned int)a2;
v5 = *(_DWORD *)(a1 + 1016);
if ( (int)result > 1 )
v3 = result;
if ( v3 != v5 )
{
if ( v5 )
{
v6 = cocos2d::CCString::createWithFormat("groundSquare_%02d_001.png", v5);
CString = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v8, CString);
v9 = *(_DWORD *)(a1 + 1016);
if ( v9 == 8 || (unsigned int)(v9 - 9) <= 2 )
{
v10 = cocos2d::CCString::createWithFormat("groundSquare_%02d_2_001.png", v9);
v11 = cocos2d::CCString::getCString(v10);
v12 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v12, v11);
}
}
v13 = cocos2d::CCString::createWithFormat("groundSquare_%02d_001.png", v3);
v14 = cocos2d::CCString::getCString(v13);
v15 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v15, v14, 0);
result = (unsigned int)(v3 - 8);
if ( (unsigned int)result <= 3 )
{
v16 = cocos2d::CCString::createWithFormat("groundSquare_%02d_2_001.png", v3);
v17 = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
result = (__int64)cocos2d::CCTextureCache::addImage(v18, v17, 0);
}
*(_DWORD *)(a1 + 1016) = v3;
}
return result;
}