//
// SongUsagePopup::buildUsageGrid from 0x760060 to 0x7602b6 (598 bytes)
//
// 1 xrefs:
// > SongUsagePopup::songUsageFinished @ 0x760d12
//
// 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:59:03 +0000
//
int __fastcall SongUsagePopup::buildUsageGrid(int a1, int *a2)
{
int v4; // r6
int v5; // r4
int v6; // r7
int v7; // r5
int v8; // r3
int v9; // r11
int v10; // r0
float v11; // s17
float v12; // s16
cocos2d::CCSprite *v13; // r8
const char *v14; // r2
cocos2d::CCLabelBMFont *v15; // r0
int v16; // r11
float v17; // s17
float v18; // s15
float v19; // s16
int (__fastcall *v20)(int, _BYTE *); // r6
int v22; // [sp+8h] [bp-24h]
void (__fastcall *v23)(int, _BYTE *); // [sp+8h] [bp-24h]
void (__fastcall *v24)(cocos2d::CCSprite *, _BYTE *); // [sp+Ch] [bp-20h]
_BYTE v25[8]; // [sp+10h] [bp-1Ch] BYREF
char v26; // [sp+18h] [bp-14h] BYREF
char v27; // [sp+19h] [bp-13h] BYREF
cocos2d::CCLabelBMFont *v28; // [sp+20h] [bp-Ch]
v4 = 0;
v5 = -1431655765 * ((a2[1] - *a2) >> 2);
v6 = (v5 + 6) / 7;
v7 = cocos2d::CCNode::create((cocos2d::CCNode *)v6);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v7, 2);
while ( v4 < v5 )
{
v8 = -7 * (v4 / 7) + v5;
if ( v8 >= 7 )
v8 = 7;
v22 = *a2;
v9 = *a2 + 12 * v4;
v10 = *(_DWORD *)(v9 + 4);
if ( !v10 )
v10 = -1;
v11 = (float)((float)(v4 % 7) - (float)((float)(v8 - 1) * 0.5)) * 50.0;
v12 = (float)(v4 / -7) * 72.0;
v13 = GJDifficultySprite::create((const char *)v10, nullptr);
GJDifficultySprite::updateFeatureState(v13, *(_DWORD *)(v22 + 12 * v4));
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v13 + 80))(v13, 1063675494);
(*(void (__fastcall **)(int, cocos2d::CCSprite *, int))(*(_DWORD *)v7 + 232))(v7, v13, 2);
v24 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v13 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v25, v11, v12);
v24(v13, v25);
GameToolbox::pointsToString((GameToolbox *)&v26, *(_DWORD *)(v9 + 8));
if ( (v26 & 1) != 0 )
v15 = v28;
else
v15 = (cocos2d::CCLabelBMFont *)&v27;
v16 = cocos2d::CCLabelBMFont::create(v15, "bigFont.fnt", v14);
std::string::~string((int)&v26);
++v4;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v16 + 80))(v16, 1051931443);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)v7 + 232))(v7, v16, 2);
v23 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v16 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v25, v11, v12 - 30.0);
v23(v16, v25);
}
if ( v5 >= 7 )
v5 = 7;
v17 = (float)((float)(v6 - 1) * 72.0) + 66.0;
v18 = 340.0 / (float)((float)v5 * 50.0);
v19 = (float)(*(float *)(a1 + 552) - 108.0) / v17;
if ( v18 >= 1.0 )
v18 = 1.0;
if ( v18 <= v19 )
v19 = v18;
(*(void (__fastcall **)(int, float))(*(_DWORD *)v7 + 80))(v7, COERCE_FLOAT(LODWORD(v19)));
v20 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)v7 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v25,
*(float *)(a1 + 556),
*(float *)(a1 + 560) + (float)(v19 * (float)((float)(v17 * 0.5) - 26.0)));
return v20(v7, v25);
}