//
// GJGroundLayer::updateGroundWidth from 0x1006be700 to 0x1006be874 (372 bytes)
//
// 1 xrefs:
// > GJGroundLayer::scaleGround @ 0x1006be657
//
// This function is hookable on this platform (idp: pc, 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:35:31 +0000
//
__int64 __fastcall GJGroundLayer::updateGroundWidth(__int64 a1, char a2)
{
__int64 v3; // rbx
__int64 result; // rax
__int64 v5; // rsi
__int64 v6; // rax
float (__fastcall **v7)(__int64); // rax
float v8; // xmm0_4
__m128 v9; // xmm1
int v10; // r15d
float *v11; // rdi
double v12; // xmm0_8
float v13; // xmm0_4
__int64 v14; // rbx
__int64 v15; // rax
float v16[2]; // [rsp+4h] [rbp-2Ch] BYREF
__int64 v17; // [rsp+Ch] [rbp-24h] BYREF
float v18; // [rsp+14h] [rbp-1Ch]
v3 = a1;
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1 + 512LL))(a1);
if ( result )
{
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v17, v5);
v6 = *(_QWORD *)a1;
if ( a2 )
{
v7 = (float (__fastcall **)(__int64))(v6 + 136);
}
else
{
a1 = (*(__int64 (__fastcall **)(__int64))(v6 + 512))(a1);
v7 = (float (__fastcall **)(__int64))(*(_QWORD *)a1 + 168LL);
}
v8 = (*v7)(a1);
v9 = (__m128)(unsigned int)v17;
v18 = v8;
v9.f32[0] = (float)(*(float *)&v17 / v8) + 10.0;
*(_DWORD *)(v3 + 452) = v9.i32[0];
v9.f32[0] = v9.f32[0] / *(float *)(v3 + 424);
v10 = (int)(float)(_mm_round_ss((__m128)0LL, v9, 10).f32[0] + 1.0) + *(unsigned __int8 *)(v3 + 464);
GJGroundLayer::loadGroundSprites(v3, v10, 1u);
GJGroundLayer::loadGroundSprites(v3, v10, 0);
if ( *(int *)(v3 + 448) < 2 )
{
v9.i64[0] = LODWORD(v18);
if ( !a2 )
{
LABEL_10:
v13 = *(float *)(v3 + 452);
v14 = *(_QWORD *)(v3 + 432);
v18 = (float)(v13 * 0.5) + -5.0;
v15 = (*(__int64 (__fastcall **)(__int64, float, double))(*(_QWORD *)v14 + 192LL))(v14, v18, *(double *)v9.i64);
sub_100278250(v16, v18, *(float *)(v15 + 4));
return (*(__int64 (__fastcall **)(__int64, float *))(*(_QWORD *)v14 + 184LL))(v14, v16);
}
v11 = *(float **)(v3 + 432);
HIDWORD(v12) = 0;
*(float *)&v12 = 1.0 / v18;
}
else
{
v11 = *(float **)(v3 + 432);
*(_QWORD *)&v12 = (unsigned int)v17;
*(float *)&v12 = (float)((float)(*(float *)&v17 + 10.0) / v18) / v11[108];
}
(*(void (__fastcall **)(float *, double))(*(_QWORD *)v11 + 128LL))(v11, v12);
goto LABEL_10;
}
return result;
}