//
// GameManager::loadGround from 0x716c60 to 0x716d7c (284 bytes)
//
// 3 xrefs:
// > GameManager::getGTexture @ 0x717068
// > LevelSettingsLayer::selectArtClosed @ 0xb61b68
// > ??> @ 0xec638
//
// 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::loadGround(__int64 this, int a2)
{
unsigned int v2; // w19
const char *v3; // x1
int *v4; // x20
cocos2d::CCString *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCTextureCache *v7; // x21
cocos2d::CCString *v8; // x0
const char *v9; // x0
cocos2d::CCString *v10; // x0
cocos2d::CCTextureCache *v11; // x0
_BOOL8 HasSecondaryColor; // x0
cocos2d::CCTextureCache *v13; // x22
cocos2d::CCString *v14; // x0
const char *v15; // x0
char *v16; // [xsp+38h] [xbp+38h]
char *CString; // [xsp+38h] [xbp+38h]
if ( a2 <= 0 )
{
v2 = 1;
}
else if ( a2 > 22 )
{
v2 = 22;
}
else
{
v2 = a2;
}
v3 = (const char *)*(unsigned int *)(this + 984);
if ( v2 != (_DWORD)v3 )
{
v4 = (int *)this;
if ( (_DWORD)v3 )
{
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
v3);
CString = (char *)cocos2d::CCString::getCString(v10);
v11 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)CString);
cocos2d::CCTextureCache::removeTextureForKey(v11, CString);
HasSecondaryColor = GameManager::groundHasSecondaryColor((GameManager *)v4, v4[246]);
if ( HasSecondaryColor )
{
v13 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)HasSecondaryColor);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)(unsigned int)v4[246]);
v15 = (const char *)cocos2d::CCString::getCString(v14);
cocos2d::CCTextureCache::removeTextureForKey(v13, v15);
}
}
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
(const char *)v2);
v16 = (char *)cocos2d::CCString::getCString(v5);
v6 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)v16);
cocos2d::CCTextureCache::addImage(v6, v16, 0);
this = GameManager::groundHasSecondaryColor((GameManager *)v4, v2);
if ( (_BYTE)this )
{
v7 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)this);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)v2);
v9 = (const char *)cocos2d::CCString::getCString(v8);
this = cocos2d::CCTextureCache::addImage(v7, v9, 0);
}
v4[246] = v2;
}
return this;
}