//
// SongUsagePopup::buildUsageGrid from 0xc8c6b8 to 0xc8ca40 (904 bytes)
//
// 2 xrefs:
// > SongUsagePopup::songUsageFinished @ 0xc8dd8c
// > ??> @ 0x4b3a0
//
// This function is hookable on this platform (idp: arm, 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 13:05:45 +0000
//
__int64 __fastcall SongUsagePopup::buildUsageGrid(__int64 a1, __int64 *a2)
{
int v4; // w25
__int64 v5; // x20
__int64 v6; // x22
int v7; // w19
void (__fastcall *v8)(__int64, _BYTE *); // x26
__int64 v9; // x27
__int64 v10; // x26
unsigned int v11; // w0
int v12; // w2
int v13; // w2
float v14; // s9
float v15; // s8
_DWORD *v16; // x28
void (__fastcall *v17)(_DWORD *, _BYTE *); // x27
const char *v18; // x2
cocos2d::CCLabelBMFont *v19; // x0
__int64 v20; // x27
int v21; // w1
float v22; // s10
float v23; // s11
float v24; // s8
void (__fastcall *v25)(__int64, _BYTE *); // x19
unsigned __int64 v27; // [xsp+A8h] [xbp+A8h]
_BYTE v29[8]; // [xsp+C8h] [xbp+C8h] BYREF
unsigned __int64 v30[2]; // [xsp+D0h] [xbp+D0h] BYREF
void *v31; // [xsp+E0h] [xbp+E0h]
v27 = 0xAAAAAAAAAAAAAAABLL * ((a2[1] - *a2) >> 2);
v4 = -1431655765 * ((a2[1] - *a2) >> 2);
v5 = cocos2d::CCNode::create((cocos2d::CCNode *)(unsigned int)(((int)v27 + 6) / 7));
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v5, 2);
if ( (int)v27 > 0 )
{
v6 = 0;
v7 = 0;
do
{
v9 = *a2;
v10 = *a2 + v6;
v11 = *(_DWORD *)(v10 + 4);
v12 = -7 * (v7 / 7) + v4;
if ( v12 > 7 )
v12 = 7;
v13 = v12 - 1;
if ( !v11 )
v11 = -1;
v14 = (float)(v7 / -7) * 72.0;
v15 = (float)((float)(v7 % 7) - (float)((float)v13 * 0.5)) * 50.0;
v16 = (_DWORD *)GJDifficultySprite::create(v11, 0);
GJDifficultySprite::updateFeatureState(v16, *(_DWORD *)(v9 + v6));
(*(void (__fastcall **)(_DWORD *, float))(*(_QWORD *)v16 + 160LL))(v16, 0.9);
(*(void (__fastcall **)(__int64, _DWORD *, __int64))(*(_QWORD *)v5 + 464LL))(v5, v16, 2);
v17 = *(void (__fastcall **)(_DWORD *, _BYTE *))(*(_QWORD *)v16 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, v15, v14);
v17(v16, v29);
GameToolbox::pointsToString((GameToolbox *)*(unsigned int *)(v10 + 8), v30);
v19 = (cocos2d::CCLabelBMFont *)((char *)v30 + 1);
if ( (v30[0] & 1) != 0 )
v19 = (cocos2d::CCLabelBMFont *)v31;
v20 = cocos2d::CCLabelBMFont::create(v19, "bigFont.fnt", v18);
if ( (v30[0] & 1) != 0 )
operator delete(v31);
++v7;
v6 += 12;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v20 + 160LL))(v20, 0.35);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v5 + 464LL))(v5, v20, 2);
v8 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, v15, v14 - 30.0);
v8(v20, v29);
}
while ( v7 != (_DWORD)v27 );
}
if ( (int)v27 > 7 )
v21 = 7;
else
v21 = v27;
v22 = (float)((float)(((int)v27 + 6) / 7 - 1) * 72.0) + 66.0;
v23 = 340.0 / (float)((float)v21 * 50.0);
if ( v23 >= 1.0 )
v23 = 1.0;
v24 = (float)(*(float *)(a1 + 728) - 108.0) / v22;
if ( v23 <= v24 )
v24 = v23;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v5 + 160LL))(v5, v24);
v25 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v5 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v29,
*(float *)(a1 + 732),
*(float *)(a1 + 736) + (float)(v24 * (float)((float)(v22 * 0.5) + -26.0)));
v25(v5, v29);
return _stack_chk_guard;
}