//
// SongUsagePopup::songUsageFinished from 0x760870 to 0x760d80 (1296 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'SongUsagePopup::songUsageFinished @ 0x760dc8
//
// 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::songUsageFinished(int result, int a2, int a3)
{
SongUsagePopup *v4; // r8
int v5; // r2
cocos2d::CCNode **v6; // r0
int v7; // r1
char *v8; // r2
size_t v9; // r0
size_t v10; // r9
int v11; // r0
int v12; // r1
char *v13; // r2
int v14; // r0
int v15; // r1
_BYTE *v16; // r2
char *v17; // r0
const char *v18; // r2
unsigned int v19; // r6
int v20; // r11
unsigned int v21; // r2
int v22; // r7
const char *v23; // r0
_BOOL4 v24; // r11
char *v25; // r3
int v26; // r1
int v27; // r2
float v28; // s16
int i; // r3
int *v30; // r1
int j; // r3
char *v32; // r1
int *v33; // r0
int v34; // r1
_BYTE *v35; // r2
int *v36; // r0
int v37; // r1
_BYTE *v38; // r2
int v39; // r3
int v40; // [sp+Ch] [bp-108h]
int v41; // [sp+18h] [bp-FCh] BYREF
int v42; // [sp+1Ch] [bp-F8h] BYREF
__int64 v43; // [sp+20h] [bp-F4h] BYREF
char v44[4]; // [sp+2Ch] [bp-E8h] BYREF
float v45; // [sp+30h] [bp-E4h]
int v46; // [sp+34h] [bp-E0h] BYREF
int v47; // [sp+38h] [bp-DCh]
char *s; // [sp+3Ch] [bp-D8h]
int v49; // [sp+40h] [bp-D4h] BYREF
int v50; // [sp+44h] [bp-D0h]
_BYTE *v51; // [sp+48h] [bp-CCh]
int v52; // [sp+4Ch] [bp-C8h] BYREF
int v53; // [sp+50h] [bp-C4h]
char *v54; // [sp+54h] [bp-C0h]
int v55; // [sp+58h] [bp-BCh] BYREF
int v56; // [sp+5Ch] [bp-B8h]
_BYTE *v57; // [sp+60h] [bp-B4h]
const char *v58; // [sp+64h] [bp-B0h] BYREF
char *v59; // [sp+68h] [bp-ACh]
char *v60; // [sp+6Ch] [bp-A8h]
int v61; // [sp+70h] [bp-A4h] BYREF
int v62; // [sp+74h] [bp-A0h] BYREF
int v63; // [sp+78h] [bp-9Ch] BYREF
int v64[3]; // [sp+7Ch] [bp-98h] BYREF
int v65; // [sp+88h] [bp-8Ch] BYREF
int v66; // [sp+8Ch] [bp-88h]
_BYTE *v67; // [sp+90h] [bp-84h]
int v68; // [sp+94h] [bp-80h] BYREF
int v69; // [sp+98h] [bp-7Ch]
_BYTE *v70; // [sp+9Ch] [bp-78h]
int v71; // [sp+A0h] [bp-74h] BYREF
int v72; // [sp+A4h] [bp-70h]
_BYTE *v73; // [sp+A8h] [bp-6Ch]
_DWORD v74[3]; // [sp+ACh] [bp-68h] BYREF
_DWORD v75[3]; // [sp+B8h] [bp-5Ch] BYREF
int v76[3]; // [sp+C4h] [bp-50h] BYREF
int v77[3]; // [sp+D0h] [bp-44h] BYREF
int v78[3]; // [sp+DCh] [bp-38h] BYREF
int v79; // [sp+E8h] [bp-2Ch] BYREF
int v80; // [sp+ECh] [bp-28h]
_BYTE *v81; // [sp+F0h] [bp-24h]
int v82; // [sp+F4h] [bp-20h] BYREF
int v83; // [sp+F8h] [bp-1Ch]
_BYTE *v84; // [sp+FCh] [bp-18h]
int v85; // [sp+100h] [bp-14h] BYREF
int v86; // [sp+104h] [bp-10h]
_BYTE *v87; // [sp+108h] [bp-Ch]
v4 = (SongUsagePopup *)result;
v5 = *(_DWORD *)(result + 524);
if ( a2 == v5 )
{
v6 = *(cocos2d::CCNode ***)(result + 528);
if ( v6 )
LoadingCircle::fadeAndRemove(v6, a2, v5);
v46 = 0;
v47 = 0;
s = nullptr;
if ( (*(_BYTE *)a3 & 1) != 0 )
{
std::string::__init(&v46, *(const void **)(a3 + 8), *(_DWORD *)(a3 + 4));
}
else
{
v7 = *(_DWORD *)(a3 + 4);
v8 = *(char **)(a3 + 8);
v46 = *(_DWORD *)a3;
v47 = v7;
s = v8;
}
v49 = 0;
v50 = 0;
v51 = nullptr;
std::string::__init(&v49, &unk_B6B226, 0);
v9 = std::string::find((unsigned __int8 *)a3, 35, 0);
v10 = v9;
if ( v9 != -1 )
{
std::string::basic_string(&v52, (unsigned __int8 *)a3, 0, v9);
if ( (v46 & 1) != 0 )
{
*s = 0;
v47 = 0;
}
else
{
LOWORD(v46) = 0;
}
std::string::reserve(&v46, 0);
v11 = v52;
v12 = v53;
v13 = v54;
v52 = 0;
v53 = 0;
v54 = nullptr;
v46 = v11;
v47 = v12;
s = v13;
std::string::~string((int)&v52);
std::string::basic_string(&v55, (unsigned __int8 *)a3, v10 + 1, 0xFFFFFFFF);
if ( (v49 & 1) != 0 )
{
*v51 = 0;
v50 = 0;
}
else
{
LOWORD(v49) = 0;
}
std::string::reserve(&v49, 0);
v14 = v55;
v15 = v56;
v16 = v57;
v55 = 0;
v56 = 0;
v57 = nullptr;
v49 = v14;
v50 = v15;
v51 = v16;
std::string::~string((int)&v55);
}
v41 = 0;
v42 = 0;
v43 = 0;
if ( (v46 & 1) != 0 )
v17 = s;
else
v17 = (char *)&v46 + 1;
if ( sscanf(v17, "%i,%i,%lld", &v41, &v42, &v43) == 3 )
{
cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)((char *)&dword_0 + 3));
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v44);
v19 = 0;
v58 = nullptr;
v59 = nullptr;
v60 = nullptr;
while ( 1 )
{
v20 = (unsigned __int8)v49;
v21 = (v49 & 1) != 0 ? v50 : (int)(unsigned __int8)v49 >> 1;
if ( v19 >= v21 )
break;
v40 = v49 & 1;
v22 = std::string::find((unsigned __int8 *)&v49, 124, v19);
if ( v22 == -1 )
{
if ( v40 )
v22 = v50;
else
v22 = v20 >> 1;
}
v61 = 0;
v62 = 0;
v63 = 0;
std::string::basic_string(v64, (unsigned __int8 *)&v49, v19, v22 - v19);
if ( (v64[0] & 1) != 0 )
v23 = (const char *)v64[2];
else
v23 = (char *)v64 + 1;
v24 = sscanf(v23, "%i:%i:%i", &v61, &v62, &v63) == 3 && v63 > 0;
std::string::~string((int)v64);
if ( v24 )
{
v25 = v59;
if ( v59 == v60 )
{
std::vector::__push_back_slow_path((void **)&v58, &v61);
}
else
{
if ( v59 )
{
v26 = v62;
v27 = v63;
*(_DWORD *)v59 = v61;
*((_DWORD *)v25 + 1) = v26;
*((_DWORD *)v25 + 2) = v27;
}
v59 += 12;
}
}
v19 = v22 + 1;
}
if ( v58 == v59 )
{
v28 = 160.0;
}
else
{
v28 = (float)((float)((-1431655765 * ((v59 - v58) >> 2) + 6) / 7 - 1) * 72.0) + 178.0;
if ( v28 >= 275.0 )
v28 = 275.0;
}
SongUsagePopup::layoutPopup(v4, v28);
for ( i = 0; i != 9; i += 3 )
{
v76[i] = 0;
v30 = &v76[i];
v30[1] = 0;
v30[2] = 0;
}
for ( j = 0; j != 36; j += 12 )
{
*(int *)((char *)&v79 + j) = 0;
v32 = (char *)&v79 + j;
*((_DWORD *)v32 + 1) = 0;
*((_DWORD *)v32 + 2) = 0;
}
std::string::assign(v76, "exportIcon_001.png");
if ( v41 <= 200000 )
{
GameToolbox::intToShortString((GameToolbox *)&v65, v41, 0);
}
else
{
GameToolbox::intToShortString((GameToolbox *)v74, 200000, 0);
v33 = std::string::append(v74, "+", 1u);
v34 = v33[1];
v35 = (_BYTE *)v33[2];
v65 = *v33;
v66 = v34;
v67 = v35;
*v33 = 0;
v33[1] = 0;
v33[2] = 0;
std::string::~string((int)v74);
}
if ( (v79 & 1) != 0 )
{
*v81 = 0;
v80 = 0;
}
else
{
LOWORD(v79) = 0;
}
std::string::reserve(&v79, 0);
v79 = v65;
v80 = v66;
v81 = v67;
v65 = 0;
v66 = 0;
v67 = nullptr;
std::string::~string((int)&v65);
if ( v42 <= 0 )
{
v39 = 1;
}
else
{
std::string::assign(v77, "GJ_starsIcon_001.png");
GameToolbox::pointsToString((GameToolbox *)&v68, v42);
if ( (v82 & 1) != 0 )
{
*v84 = 0;
v83 = 0;
}
else
{
LOWORD(v82) = 0;
}
std::string::reserve(&v82, 0);
v82 = v68;
v83 = v69;
v84 = v70;
v68 = 0;
v69 = 0;
v70 = nullptr;
std::string::~string((int)&v68);
std::string::assign(v78, "GJ_downloadsIcon_001.png");
if ( v43 < 0x80000000LL )
{
GameToolbox::intToShortString((GameToolbox *)&v71, v43, 0);
}
else
{
GameToolbox::intToShortString((GameToolbox *)v75, 0x7FFFFFFF, 0);
v36 = std::string::append(v75, "+", 1u);
v37 = v36[1];
v38 = (_BYTE *)v36[2];
v71 = *v36;
v72 = v37;
v73 = v38;
*v36 = 0;
v36[1] = 0;
v36[2] = 0;
std::string::~string((int)v75);
}
if ( (v85 & 1) != 0 )
{
*v87 = 0;
v86 = 0;
}
else
{
LOWORD(v85) = 0;
}
std::string::reserve(&v85, 0);
v85 = v71;
v86 = v72;
v87 = v73;
v71 = 0;
v72 = 0;
v73 = nullptr;
std::string::~string((int)&v71);
v39 = 3;
}
SongUsagePopup::buildStatRow(
v4,
(int)v76,
(int)&v79,
v39,
(float)((float)(v28 * 0.5) + (float)(v45 * 0.5)) - 72.0);
if ( v58 == v59 )
SongUsagePopup::showStatus(v4, (cocos2d::CCLabelBMFont *)"No rated levels", v58);
else
SongUsagePopup::buildUsageGrid((int)v4, (int *)&v58);
std::string::~string((int)&v85);
std::string::~string((int)&v82);
std::string::~string((int)&v79);
std::string::~string((int)v78);
std::string::~string((int)v77);
std::string::~string((int)v76);
std::__vector_base::~__vector_base((char **)&v58);
}
else
{
SongUsagePopup::showStatus(v4, (cocos2d::CCLabelBMFont *)"Failed to load info", v18);
}
std::string::~string((int)&v49);
return std::string::~string((int)&v46);
}
return result;
}