//
// GJMGLayer::loadGroundSprites from 0x546724 to 0x546848 (292 bytes)
//
// 4 xrefs:
// > GJMGLayer::init @ 0x546a7a
// > GJMGLayer::init @ 0x546b60
// > GJMGLayer::updateGroundWidth @ 0x546d66
// > GJMGLayer::updateGroundWidth @ 0x546d70
//
// 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:52:23 +0000
//
cocos2d::CCArray *__fastcall GJMGLayer::loadGroundSprites(cocos2d::CCArray *this, unsigned int a2, int a3)
{
int v4; // r4
cocos2d::CCArray *v5; // r5
cocos2d::CCArray *v6; // r0
int v7; // r7
__int64 v8; // r0
float *v9; // r5
float v10; // s14
void (__fastcall *v11)(float *, _BYTE *); // r11
void (__fastcall *v12)(float *, _BYTE *); // r11
int v13; // r6
int Object; // r0
_BYTE v15[8]; // [sp+4h] [bp-10h] BYREF
v4 = *((_DWORD *)this + 79);
if ( !a3 )
v4 = *((_DWORD *)this + 80);
if ( v4 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(this);
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v4 + 244))(v4) )
{
v6 = (cocos2d::CCArray *)(*(int (__fastcall **)(int))(*(_DWORD *)v4 + 244))(v4);
cocos2d::CCArray::addObjectsFromArray(v5, v6);
}
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v5);
if ( this != (cocos2d::CCArray *)a2 )
{
if ( cocos2d::CCArray::count(v5) >= a2 )
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v5);
v13 = (int)this - a2;
while ( v13 > 0 )
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v5);
if ( !this )
break;
--v13;
Object = cocos2d::CCArray::lastObject(v5);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)v4 + 276))(v4, Object, 1);
this = (cocos2d::CCArray *)cocos2d::CCArray::removeLastObject(v5, 1);
}
}
else
{
this = (cocos2d::CCArray *)cocos2d::CCArray::count(v5);
v7 = (int)this;
while ( v7 < (int)a2 )
{
v8 = ((__int64 (__fastcall *)(int))*(_DWORD *)(*(_DWORD *)v4 + 536))(v4);
v9 = (float *)cocos2d::CCSprite::createWithTexture(
(cocos2d::CCSprite *)v8,
(cocos2d::CCTexture2D *)HIDWORD(v8));
(*(void (__fastcall **)(int, float *))(*(_DWORD *)v4 + 228))(v4, v9);
v10 = (float)v7++;
v11 = *(void (__fastcall **)(float *, _BYTE *))(*(_DWORD *)v9 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v15, v10 * v9[86], 0.0);
v11(v9, v15);
v12 = *(void (__fastcall **)(float *, _BYTE *))(*(_DWORD *)v9 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v15, 0.0, 0.0);
v12(v9, v15);
this = (cocos2d::CCArray *)(*(int (__fastcall **)(float *, void *))(*(_DWORD *)v9 + 480))(v9, &unk_BECFD0);
}
}
}
}
return this;
}