//
// GameManager::loadGround from 0x41498c to 0x414a36 (170 bytes)
//
// 2 xrefs:
// > GameManager::getGTexture @ 0x414c18
// > LevelSettingsLayer::selectArtClosed @ 0x6a8c40
//
// 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
//
_DWORD *__fastcall GameManager::loadGround(_DWORD *this, const char *a2)
{
int *v2; // r5
const char *v3; // r4
const char *v4; // r1
cocos2d::CCString *v5; // r0
cocos2d::CCTextureCache *CString; // r6
cocos2d::CCTextureCache *v7; // r0
_BOOL4 HasSecondaryColor; // r0
cocos2d::CCTextureCache *v9; // r6
cocos2d::CCString *v10; // r0
const char *v11; // r0
cocos2d::CCString *v12; // r0
cocos2d::CCTextureCache *v13; // r6
cocos2d::CCTextureCache *v14; // r0
cocos2d::CCTextureCache *v15; // r6
cocos2d::CCString *v16; // r0
const char *v17; // r0
v2 = this;
if ( (int)a2 <= 0 )
{
v3 = (_BYTE *)(&dword_0 + 1);
}
else
{
if ( (int)a2 >= 22 )
a2 = (char *)&dword_14 + 2;
v3 = a2;
}
v4 = (const char *)*(this + 193);
if ( v3 != v4 )
{
if ( v4 )
{
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_001.png",
v4);
CString = (cocos2d::CCTextureCache *)cocos2d::CCString::getCString(v5);
v7 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(CString);
cocos2d::CCTextureCache::removeTextureForKey(v7, (const char *)CString);
HasSecondaryColor = GameManager::groundHasSecondaryColor((GameManager *)v2, v2[193]);
if ( HasSecondaryColor )
{
v9 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)HasSecondaryColor);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
(const char *)v2[193]);
v11 = (const char *)cocos2d::CCString::getCString(v10);
cocos2d::CCTextureCache::removeTextureForKey(v9, v11);
}
}
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"groundSquare_%02d_001.png", v3);
v13 = (cocos2d::CCTextureCache *)cocos2d::CCString::getCString(v12);
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v13);
cocos2d::CCTextureCache::addImage(v14, (const char *)v13, 0);
this = (_DWORD *)GameManager::groundHasSecondaryColor((GameManager *)v2, (int)v3);
if ( this )
{
v15 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache((cocos2d::CCTextureCache *)this);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"groundSquare_%02d_2_001.png",
v3);
v17 = (const char *)cocos2d::CCString::getCString(v16);
this = (_DWORD *)cocos2d::CCTextureCache::addImage(v15, v17, 0);
}
v2[193] = (int)v3;
}
return this;
}