//
// SongUsagePopup::init from 0x7602fc to 0x76059e (674 bytes)
//
// 1 xrefs:
// > SongUsagePopup::create @ 0x76073e
//
// 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::init(int a1, int a2, unsigned __int8 *a3, int a4)
{
int v8; // r8
int v9; // r3
int v10; // r3
cocos2d::CCDirector *v11; // r0
cocos2d::CCLayer *v12; // r0
int v13; // r0
int v14; // r3
int v15; // r10
int v16; // r3
cocos2d::CCLabelBMFont *v17; // r0
cocos2d::CCLabelBMFont *v18; // r0
const char *v19; // r2
cocos2d::CCLabelBMFont *v20; // r0
cocos2d::CCLabelBMFont *v21; // r0
cocos2d::CCMenu *v22; // r0
int v23; // r0
const char *v24; // r1
int v25; // r7
int v26; // r7
int v27; // r9
LoadingCircle *v28; // r0
cocos2d::CCLayerColor *v29; // r0
int v30; // r3
GameLevelManager *v31; // r0
GameLevelManager *v32; // r0
GameLevelManager *v33; // r0
float v35[2]; // [sp+Ch] [bp-40h] BYREF
_BYTE v36[8]; // [sp+14h] [bp-38h] BYREF
int v37[3]; // [sp+1Ch] [bp-30h] BYREF
int v38[3]; // [sp+28h] [bp-24h] BYREF
_DWORD v39[4]; // [sp+34h] [bp-18h] BYREF
v39[0] = -1778384896;
v8 = cocos2d::CCLayerColor::initWithColor(a1, v39);
if ( v8 )
{
v9 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 524) = a2;
(*(void (__fastcall **)(int, int))(v9 + 584))(a1, 150);
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)a1);
v10 = *(_DWORD *)a1;
*(_BYTE *)(a1 + 468) = 1;
(*(void (__fastcall **)(int, int))(v10 + 500))(a1, 1);
v11 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 536))(a1, 1);
cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v35);
v12 = (cocos2d::CCLayer *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v36, v35[0] * 0.5, v35[1] * 0.5);
v13 = cocos2d::CCLayer::create(v12);
v14 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 460) = v13;
(*(void (__fastcall **)(int, int))(v14 + 228))(a1, v13);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, 0.0, 0.0, 80.0, 80.0);
v15 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v39);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v15 + 92))(v15, v36);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v15, -2);
*(_DWORD *)(a1 + 532) = v15;
v16 = *a3;
if ( (v16 & 1) != 0 )
v17 = *((cocos2d::CCLabelBMFont **)a3 + 2);
else
v17 = (cocos2d::CCLabelBMFont *)(a3 + 1);
v18 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v17, "bigFont.fnt", (const char *)(v16 << 31));
*(_DWORD *)(a1 + 536) = v18;
cocos2d::CCLabelBMFont::limitLabelWidth(v18, 310.0, 0.7, 0.0);
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
*(_DWORD *)(a1 + 536));
if ( (*(_BYTE *)a4 & 1) != 0 )
v20 = *(cocos2d::CCLabelBMFont **)(a4 + 8);
else
v20 = (cocos2d::CCLabelBMFont *)(a4 + 1);
v21 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v20, "goldFont.fnt", v19);
*(_DWORD *)(a1 + 540) = v21;
cocos2d::CCLabelBMFont::limitLabelWidth(v21, 310.0, 0.6, 0.3);
v22 = (cocos2d::CCMenu *)(*(int (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
*(_DWORD *)(a1 + 540));
v23 = cocos2d::CCMenu::create(v22);
*(_DWORD *)(a1 + 444) = v23;
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v23, 10);
(*(void (__fastcall **)(_DWORD, void *))(**(_DWORD **)(a1 + 444) + 92))(*(_DWORD *)(a1 + 444), &unk_D2DF30);
*(_DWORD *)(a1 + 500) = -1;
v25 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v24);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v25 + 80))(v25, 1061997773);
v39[0] = SongUsagePopup::onClose;
v39[1] = 0;
v26 = CCMenuItemSpriteExtra::create(v25, 0, a1, (int)SongUsagePopup::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult(v26, 1.5);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v26);
*(_DWORD *)(a1 + 544) = v26;
memset(v37, 0, sizeof(v37));
std::string::__init(v37, "Song Usage", 0xAu);
memset(v38, 0, sizeof(v38));
std::string::__init(
v38,
"Blue arrow = Levels uploaded with this song.\n"
"Star = Rated levels using this song.\n"
"Green arrow = Total downloads for rated levels.\n"
"Rated levels are grouped by difficulty and rating.\n"
"Only a level's main song is counted.",
0x101u);
v27 = InfoAlertButton::create((char *)v37, (int)v38, 1061997773);
std::string::~string((int)v38);
std::string::~string((int)v37);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v27);
*(_DWORD *)(a1 + 548) = v27;
v28 = (LoadingCircle *)SongUsagePopup::layoutPopup((SongUsagePopup *)a1, 160.0);
v29 = LoadingCircle::create(v28);
v30 = *(_DWORD *)(a1 + 460);
*(_DWORD *)(a1 + 528) = v29;
*((_DWORD *)v29 + 111) = v30;
*(_BYTE *)(*(_DWORD *)(a1 + 528) + 448) = 0;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 528));
LoadingCircle::show(*(cocos2d::CCNode ***)(a1 + 528));
v31 = (GameLevelManager *)(*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(*(_DWORD *)(a1 + 528) + 440) + 92))(
*(_DWORD *)(*(_DWORD *)(a1 + 528) + 440),
a1 + 556);
v32 = (GameLevelManager *)GameLevelManager::sharedState(v31);
*((_DWORD *)v32 + 236) = a1 + 520;
v33 = (GameLevelManager *)GameLevelManager::sharedState(v32);
GameLevelManager::getSongUsage(v33, *(const char **)(a1 + 524));
}
return v8;
}