//
// GJMGLayer::updateGroundWidth from 0x1005ec5f0 to 0x1005ec6ca (218 bytes)
//
// 1 xrefs:
// > GJMGLayer::scaleGround @ 0x1005ec5ca
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GJMGLayer::updateGroundWidth(GJMGLayer *a1, bool a2)
{
GJMGLayer *v2; // rbx
cocos2d::CCDirector *v3; // rsi
__int64 v4; // rax
GJMGLayer_vtbl *v5; // rcx
float (__cdecl **p_getScaleX)(cocos2d::CCNode *__hidden); // rcx
float v7; // xmm0_4
__m128 v8; // xmm1
int v9; // r14d
float v10; // [rsp+8h] [rbp-18h] BYREF
double v11; // 0:xmm0_8.8
v2 = a1;
if ( ((__int64 (__fastcall *)(GJMGLayer *, bool))a1->getParent)(a1, a2) )
{
v3 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v11 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v10);
v4 = ((__int64 (__fastcall *)(GJMGLayer *, cocos2d::CCDirector *, double))a1->getParent)(a1, v3, v11);
v5 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v4 )
{
p_getScaleX = &v5->getScaleX;
}
else
{
a1 = (GJMGLayer *)((__int64 (__fastcall *)(GJMGLayer *))v5->getParent)(a1);
p_getScaleX = &a1->getScale;
}
((void (__fastcall *)(GJMGLayer *))*p_getScaleX)(a1);
v7 = ((float (__fastcall *)(GJMGLayer *))v2->getScaleX)(v2);
v8 = (__m128)LODWORD(v10);
v8.f32[0] = (float)(v10 / v7) + 10.0;
LODWORD(v2->m_groundWidth) = v8.i32[0];
v8.f32[0] = v8.f32[0] / v2->m_textureWidth;
v9 = (int)(float)(_mm_round_ss((__m128)0LL, v8, 10).f32[0] + 1.0) + v2->m_cameraRotated;
GJMGLayer::loadGroundSprites(v2, v9, 1);
GJMGLayer::loadGroundSprites(v2, v9, 0);
}
}