//
// GJGroundLayer::updateGroundWidth from 0x5462b8 to 0x5463d8 (288 bytes)
//
// 1 xrefs:
// > GJGroundLayer::scaleGround @ 0x546516
//
// 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::CCDirector *__fastcall GJGroundLayer::updateGroundWidth(GJGroundLayer *this, int a2)
{
cocos2d::CCDirector *result; // r0
int v5; // r3
float v6; // r0
int v7; // r0
float v8; // s14
float v9; // s15
unsigned int v10; // r5
int v11; // r0
void (*v12)(void); // r3
int v13; // r5
float v14; // s14
int (__fastcall *v15)(int, _BYTE *); // r7
int v16; // r0
float v17[2]; // [sp+4h] [bp-18h] BYREF
_BYTE v18[8]; // [sp+Ch] [bp-10h] BYREF
result = (cocos2d::CCDirector *)(*(int (__fastcall **)(GJGroundLayer *))(*(_DWORD *)this + 256))(this);
if ( result )
{
cocos2d::CCDirector::sharedDirector(result);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v17);
v5 = *(_DWORD *)this;
if ( a2 )
{
v6 = COERCE_FLOAT((*(int (__fastcall **)(GJGroundLayer *))(v5 + 68))(this));
}
else
{
v7 = (*(int (__fastcall **)(GJGroundLayer *))(v5 + 256))(this);
v6 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v7 + 84))(v7));
}
v8 = *((float *)this + 81);
v9 = (float)(v17[0] / v6) + 10.0;
*((float *)this + 86) = v9;
v10 = (int)(float)(ceilf(v9 / v8) + 1.0);
if ( *((_BYTE *)this + 356) )
++v10;
GJGroundLayer::loadGroundSprites(this, v10, 1);
GJGroundLayer::loadGroundSprites(this, v10, 0);
v11 = *((_DWORD *)this + 82);
if ( *((int *)this + 85) <= 1 )
{
if ( !a2 )
{
LABEL_12:
v13 = *((_DWORD *)this + 82);
v14 = *((float *)this + 86);
v15 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)v13 + 92);
v16 = (*(int (__fastcall **)(int))(*(_DWORD *)v13 + 96))(v13);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v18, (float)(v14 * 0.5) - 5.0, *(float *)(v16 + 4));
return (cocos2d::CCDirector *)v15(v13, v18);
}
v12 = *(void (**)(void))(*(_DWORD *)v11 + 64);
}
else
{
v12 = *(void (**)(void))(*(_DWORD *)v11 + 64);
}
v12();
goto LABEL_12;
}
return result;
}