//
// AudioAssetsPopup::init from 0xc8e1f0 to 0xc8e824 (1588 bytes)
//
// 2 xrefs:
// > AudioAssetsPopup::create @ 0xc8ea70
// > ??> @ 0x81568
//
// 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:46 +0000
//
__int64 __fastcall AudioAssetsPopup::init(
__int64 a1,
unsigned int a2,
unsigned int a3,
unsigned __int8 *a4,
unsigned __int8 *a5)
{
cocos2d::CCDirector *v8; // x0
char v9; // w26
unsigned int v10; // w22
cocos2d::CCDirector *v12; // x0
float v13; // s10
float v14; // s9
float v15; // s11
const char *v16; // x1
__int64 v17; // x27
__int64 v18; // x27
__int64 v19; // x27
CustomSongWidget *SongObject; // x0
char v21; // w5
__int64 v22; // x0
__int64 v23; // x26
void (__fastcall *v24)(__int64, __int64 *); // x27
char v25; // w0
__int64 v26; // x24
MusicDownloadManager *v27; // x0
__int64 v28; // x1
char v29; // w0
__int64 v30; // x0
__int64 v31; // x1
MusicDownloadManager *v32; // x0
__int64 v33; // x1
__int64 v34; // x1
CustomSongWidget *v35; // x24
MusicDownloadManager *v36; // x26
char v37; // w0
MusicDownloadManager *v38; // x0
__int64 v39; // x1
char v40; // w0
__int64 v41; // x0
__int64 v42; // x1
MusicDownloadManager *v43; // x0
int v44; // w26
__int64 v45; // x0
MusicDownloadManager *v46; // x0
cocos2d::CCArray **v47; // x0
MusicDownloadDelegate *v48; // x0
MusicDownloadManager *v49; // x19
char v50; // w0
MusicDownloadManager *v51; // x0
__int64 v52; // x1
char v53; // w0
__int64 v54; // x0
__int64 v55; // x1
bool v56; // [xsp+18h] [xbp-8h]
cocos2d::CCNode *v57; // [xsp+A0h] [xbp+80h]
cocos2d::CCNode *v58; // [xsp+A0h] [xbp+80h]
void (__fastcall *v59)(__int64, __int64 *); // [xsp+A8h] [xbp+88h]
void (__fastcall *v60)(__int64, __int64 *); // [xsp+A8h] [xbp+88h]
__int64 v63; // [xsp+C0h] [xbp+A0h] BYREF
_BYTE v64[8]; // [xsp+C8h] [xbp+A8h] BYREF
__int64 v65; // [xsp+D0h] [xbp+B0h] BYREF
MusicDownloadManager *v66; // [xsp+D8h] [xbp+B8h] BYREF
__int64 v67; // [xsp+E0h] [xbp+C0h]
void *v68; // [xsp+E8h] [xbp+C8h]
__int64 v69; // [xsp+F0h] [xbp+D0h] BYREF
__int64 v70; // [xsp+F8h] [xbp+D8h]
void *v71; // [xsp+100h] [xbp+E0h]
v8 = (cocos2d::CCDirector *)SetupTriggerPopup::init((SetupTriggerPopup *)a1, nullptr, nullptr, 340.0, 170.0, 2u, 0.0);
v9 = (char)v8;
v10 = (unsigned __int8)v8;
if ( (_BYTE)v8 )
{
v12 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(&v63, v12);
v69 = 0;
v13 = *((float *)&v63 + 1) * 0.5;
v70 = 0;
v14 = *(float *)&v63 * 0.5;
v71 = nullptr;
v15 = (float)(*((float *)&v63 + 1) * 0.5) + 85.0;
std::string::__init(&v69, "Level Audio", 0xBu);
SetupTriggerPopup::addTitle(a1, (__int64)&v69);
if ( (v69 & 1) != 0 )
operator delete(v71);
v17 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v16);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v17 + 160LL))(v17, 0.8);
v18 = CCMenuItemSpriteExtra::create(v17, 0, a1, 1368, 1);
CCMenuItemSpriteExtra::setSizeMult(v18, 1.5);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v18);
v59 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v18 + 184LL);
v57 = *(cocos2d::CCNode **)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, (float)(v14 - 170.0) + 8.0, v15 - 12.0);
cocos2d::CCNode::convertToNodeSpace(&v65, v57, (const cocos2d::CCPoint *)v64);
v59(v18, &v65);
v66 = nullptr;
v67 = 0;
v68 = nullptr;
std::string::__init((__int64 *)&v66, "Level Audio", 0xBu);
v69 = 0;
v70 = 0;
v71 = nullptr;
std::string::__init(
&v69,
"Downloads all songs and SFX used in this level.\n"
"Size is total audio vs the upload limit. Red means the level cannot be uploaded.",
0x98u);
v19 = InfoAlertButton::create((char *)&v66, (char *)&v69, 0.9);
if ( (v69 & 1) != 0 )
operator delete(v71);
if ( ((unsigned __int8)v66 & 1) != 0 )
operator delete(v68);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v19);
v60 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v19 + 184LL);
v58 = *(cocos2d::CCNode **)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, (float)(v14 + 170.0) - 16.0, v15 - 16.0);
cocos2d::CCNode::convertToNodeSpace(&v65, v58, (const cocos2d::CCPoint *)v64);
v60(v19, &v65);
if ( a2 )
{
SongObject = (CustomSongWidget *)SongInfoObject::create((SongInfoObject *)a2);
v21 = 0;
}
else
{
SongObject = (CustomSongWidget *)LevelTools::getSongObject((LevelTools *)a3);
v21 = v9;
}
v22 = CustomSongWidget::create(SongObject, nullptr, nullptr, 0, 1, v21, 0, 0, 0, 0, 1, v56);
*(_QWORD *)(a1 + 1024) = v22;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v22, 2);
v23 = *(_QWORD *)(a1 + 1024);
v24 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v23 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v14, v13 - 6.0);
v24(v23, &v65);
CustomSongWidget::getSongInfoIfUnloaded(*(CustomSongWidget **)(a1 + 1024));
v66 = nullptr;
v25 = *a4;
v67 = 0;
v68 = nullptr;
v26 = *(_QWORD *)(a1 + 1024);
if ( (v25 & 1) != 0 )
{
std::string::__init((__int64 *)&v66, *((void **)a4 + 2), *((_QWORD *)a4 + 1));
}
else
{
v27 = *(MusicDownloadManager **)a4;
v28 = *((_QWORD *)a4 + 1);
v68 = *((void **)a4 + 2);
v66 = v27;
v67 = v28;
}
v29 = *a5;
v69 = 0;
v70 = 0;
v71 = nullptr;
if ( (v29 & 1) != 0 )
{
std::string::__init(&v69, *((void **)a5 + 2), *((_QWORD *)a5 + 1));
}
else
{
v30 = *(_QWORD *)a5;
v31 = *((_QWORD *)a5 + 1);
v71 = *((void **)a5 + 2);
v69 = v30;
v70 = v31;
}
CustomSongWidget::updateWithMultiAssets(v26, (__int64)&v66, (__int64)&v69, 0);
if ( (v69 & 1) != 0 )
operator delete(v71);
if ( ((unsigned __int8)v66 & 1) != 0 )
operator delete(v68);
v32 = (MusicDownloadManager *)*a4;
v33 = (unsigned __int8)v32 >> 1;
if ( ((unsigned __int8)v32 & 1) != 0 )
v33 = *((_QWORD *)a4 + 1);
if ( v33 )
goto LABEL_25;
v32 = (MusicDownloadManager *)*a5;
v34 = (unsigned __int8)v32 >> 1;
if ( ((unsigned __int8)v32 & 1) != 0 )
v34 = *((_QWORD *)a5 + 1);
if ( v34 )
{
LABEL_25:
v35 = *(CustomSongWidget **)(a1 + 1024);
v36 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v32);
v37 = *a4;
v66 = nullptr;
v67 = 0;
v68 = nullptr;
if ( (v37 & 1) != 0 )
{
std::string::__init((__int64 *)&v66, *((void **)a4 + 2), *((_QWORD *)a4 + 1));
}
else
{
v38 = *(MusicDownloadManager **)a4;
v39 = *((_QWORD *)a4 + 1);
v68 = *((void **)a4 + 2);
v66 = v38;
v67 = v39;
}
v40 = *a5;
v69 = 0;
v70 = 0;
v71 = nullptr;
if ( (v40 & 1) != 0 )
{
std::string::__init(&v69, *((void **)a5 + 2), *((_QWORD *)a5 + 1));
}
else
{
v41 = *(_QWORD *)a5;
v42 = *((_QWORD *)a5 + 1);
v71 = *((void **)a5 + 2);
v69 = v41;
v70 = v42;
}
v43 = (MusicDownloadManager *)MusicDownloadManager::sumLocalAudioSizeBytes(
v36,
(unsigned __int8 *)&v66,
(unsigned __int8 *)&v69);
v44 = (int)v43;
v45 = MusicDownloadManager::sharedState(v43);
CustomSongWidget::setMultiAssetFilesize(v35, v44, *(_DWORD *)(v45 + 396));
if ( (v69 & 1) != 0 )
operator delete(v71);
v46 = (MusicDownloadManager *)(unsigned __int8)v66;
if ( ((unsigned __int8)v66 & 1) != 0 )
operator delete(v68);
v47 = (cocos2d::CCArray **)MusicDownloadManager::sharedState(v46);
v48 = MusicDownloadManager::addMusicDownloadDelegate(v47, (MusicDownloadDelegate *)(a1 + 1016));
v49 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v48);
v50 = *a4;
v66 = nullptr;
v67 = 0;
v68 = nullptr;
if ( (v50 & 1) != 0 )
{
std::string::__init((__int64 *)&v66, *((void **)a4 + 2), *((_QWORD *)a4 + 1));
}
else
{
v51 = *(MusicDownloadManager **)a4;
v52 = *((_QWORD *)a4 + 1);
v68 = *((void **)a4 + 2);
v66 = v51;
v67 = v52;
}
v53 = *a5;
v69 = 0;
v70 = 0;
v71 = nullptr;
if ( (v53 & 1) != 0 )
{
std::string::__init(&v69, *((void **)a5 + 2), *((_QWORD *)a5 + 1));
}
else
{
v54 = *(_QWORD *)a5;
v55 = *((_QWORD *)a5 + 1);
v71 = *((void **)a5 + 2);
v69 = v54;
v70 = v55;
}
MusicDownloadManager::getAudioFilesize(v49, (__int64)&v66, (__int64)&v69);
if ( (v69 & 1) != 0 )
operator delete(v71);
if ( ((unsigned __int8)v66 & 1) != 0 )
operator delete(v68);
}
}
return v10;
}