//
// EditorSoundConfigUploadPopup::performUpload from 0xcd4190 to 0xcd4700 (1392 bytes)
//
// 3 xrefs:
// > EditorSoundConfigUploadPopup::onUpload @ 0xcd4708
// > EditorSoundConfigUploadPopup::onUploadAsUpdate @ 0xcd4714
// > ??> @ 0xfc868
//
// 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:06:29 +0000
//
__int64 __fastcall EditorSoundConfigUploadPopup::performUpload(EditorSoundConfigUploadPopup *this, unsigned int a2)
{
GJAccountManager *v4; // x0
__int64 v6; // x0
GJAccountManager *v7; // x0
__int64 v8; // x0
char v9; // w1
__int64 v10; // x4
__int64 v11; // x5
char v12; // w1
__int64 v13; // x2
__int64 v14; // x0
__int64 v15; // x1
int v16; // w0
__int64 v17; // x0
__int64 v18; // x0
__int64 v19; // x0
__int64 v20; // x2
__int64 v21; // x0
__int64 v22; // x1
__int64 v23; // x1
__int64 v24; // x0
signed int v25; // w25
signed int v26; // w26
int v27; // w1
__int64 v28; // x0
__int64 v29; // x0
__int64 v30; // x0
LoadingCircle *v31; // x0
__int64 v32; // x0
GameLevelManager *v33; // x0
GameLevelManager *v34; // x0
cocos2d::CCObject *v35; // x28
__int64 v36; // x0
__int64 v37; // x2
unsigned int v38; // w21
__int64 v39; // x0
__int64 v40; // x1
__int64 v41; // x1
__int64 v42; // x0
__int64 v43; // x0
GJAccountManager *v44; // x0
__int64 v45; // x0
__int64 v46; // [xsp+70h] [xbp+60h] BYREF
__int64 v47; // [xsp+78h] [xbp+68h]
void *v48; // [xsp+80h] [xbp+70h]
__int64 v49; // [xsp+88h] [xbp+78h] BYREF
__int64 v50; // [xsp+90h] [xbp+80h]
void *v51; // [xsp+98h] [xbp+88h]
__int64 v52[2]; // [xsp+A0h] [xbp+90h] BYREF
void *v53; // [xsp+B0h] [xbp+A0h]
__int64 v54; // [xsp+B8h] [xbp+A8h] BYREF
__int64 v55; // [xsp+C0h] [xbp+B0h]
void *v56; // [xsp+C8h] [xbp+B8h]
__int64 v57[2]; // [xsp+D0h] [xbp+C0h] BYREF
void *v58; // [xsp+E0h] [xbp+D0h]
__int64 v59[2]; // [xsp+E8h] [xbp+D8h] BYREF
void *v60; // [xsp+F8h] [xbp+E8h]
__int64 v61; // [xsp+100h] [xbp+F0h] BYREF
__int64 v62; // [xsp+108h] [xbp+F8h]
void *v63; // [xsp+110h] [xbp+100h]
v4 = (GJAccountManager *)*((unsigned __int8 *)this + 1056);
if ( !(_DWORD)v4 )
{
v6 = GJAccountManager::sharedState(v4);
v7 = (GJAccountManager *)(unsigned int)(*(_DWORD *)(v6 + 352) - *(_DWORD *)(v6 + 356));
if ( (int)v7 <= 0 )
{
v44 = (GJAccountManager *)GJAccountManager::sharedState(v7);
GJAccountManager::showAccountNeededAlert(v44, "upload sound packs");
}
else
{
v8 = *((_QWORD *)this + 133);
v46 = 0;
v47 = 0;
v9 = *(_BYTE *)(v8 + 376);
v48 = nullptr;
if ( (v9 & 1) != 0 )
{
std::string::__init(&v46, *(void **)(v8 + 392), *(_QWORD *)(v8 + 384));
v8 = *((_QWORD *)this + 133);
}
else
{
v10 = *(_QWORD *)(v8 + 376);
v11 = *(_QWORD *)(v8 + 384);
v48 = *(void **)(v8 + 392);
v46 = v10;
v47 = v11;
}
v12 = *(_BYTE *)(v8 + 400);
v49 = 0;
v13 = v8 + 400;
v50 = 0;
v51 = nullptr;
if ( (v12 & 1) != 0 )
{
std::string::__init(&v49, *(void **)(v8 + 416), *(_QWORD *)(v8 + 408));
}
else
{
v14 = *(_QWORD *)v13;
v15 = *(_QWORD *)(v13 + 8);
v51 = *(void **)(v13 + 16);
v49 = v14;
v50 = v15;
}
while ( 1 )
{
v16 = (unsigned __int8)v46;
if ( (v46 & 1) != 0 )
break;
LABEL_40:
LODWORD(v18) = v16 >> 1;
if ( !(_DWORD)v18 || (v41 = (int)v18 - 1LL, *((_BYTE *)&v46 + v41 + 1) != 32) )
{
v18 = (int)v18;
goto LABEL_12;
}
LOBYTE(v46) = 2 * (v18 - 1);
*((_BYTE *)&v46 + v41 + 1) = 0;
}
while ( v47 )
{
v17 = v47 - 1;
if ( *((_BYTE *)v48 + v47 - 1) != 32 )
break;
--v47;
*((_BYTE *)v48 + v17) = 0;
v16 = (unsigned __int8)v46;
if ( (v46 & 1) == 0 )
goto LABEL_40;
}
v18 = v47;
LABEL_12:
if ( v18 )
{
v19 = *((_QWORD *)this + 133);
v54 = 0;
v20 = v19 + 472;
v55 = 0;
LOBYTE(v19) = *(_BYTE *)(v19 + 472);
v56 = nullptr;
if ( (v19 & 1) != 0 )
{
std::string::__init(&v54, *(void **)(v20 + 16), *(_QWORD *)(v20 + 8));
}
else
{
v21 = *(_QWORD *)v20;
v22 = *(_QWORD *)(v20 + 8);
v56 = *(void **)(v20 + 16);
v54 = v21;
v55 = v22;
}
v23 = (unsigned __int8)v54 >> 1;
if ( (v54 & 1) != 0 )
v23 = v55;
if ( v23 )
{
v24 = *((_QWORD *)this + 133);
v25 = *(_DWORD *)(v24 + 356);
v26 = *(_DWORD *)(v24 + 352);
if ( v25 <= 0 || v26 <= 0 )
{
v59[0] = 0;
v59[1] = 0;
v60 = nullptr;
std::string::__init(v59, "This sound pack is empty. Add at least one sound before uploading.", 0x42u);
v45 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)v59, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 1312LL))(v45);
if ( (v59[0] & 1) != 0 )
operator delete(v60);
}
else
{
v27 = 0;
if ( *((_BYTE *)this + 1104) )
{
if ( *((_BYTE *)this + 1105) )
v27 = 3;
else
v27 = 4;
}
v28 = *((_QWORD *)this + 129);
*((_DWORD *)this + 277) = v27;
*((_DWORD *)this + 280) = a2;
*((_BYTE *)this + 1056) = 1;
if ( v28 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v28 + 344LL))(v28, 0);
v29 = *((_QWORD *)this + 130);
if ( v29 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v29 + 344LL))(v29, 0);
v30 = *((_QWORD *)this + 131);
if ( v30 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v30 + 344LL))(v30, 0);
v31 = *((LoadingCircle **)this + 139);
if ( v31 )
v31 = (LoadingCircle *)(*(__int64 (__fastcall **)(LoadingCircle *, _QWORD))(*(_QWORD *)v31 + 344LL))(
v31,
0);
v32 = LoadingCircle::create(v31);
*((_QWORD *)this + 128) = v32;
*(_QWORD *)(v32 + 552) = *((_QWORD *)this + 73);
v33 = (GameLevelManager *)LoadingCircle::show(*((cocos2d::CCNode ***)this + 128));
v34 = (GameLevelManager *)GameLevelManager::sharedState(v33);
*((_QWORD *)v34 + 165) = (char *)this + 1016;
v35 = (cocos2d::CCObject *)GameLevelManager::sharedState(v34);
v36 = *((_QWORD *)this + 133);
v61 = 0;
v37 = v36 + 424;
v62 = 0;
LOBYTE(v36) = *(_BYTE *)(v36 + 424);
v63 = nullptr;
v38 = *((_DWORD *)this + 277);
if ( (v36 & 1) != 0 )
{
std::string::__init(&v61, *(void **)(v37 + 16), *(_QWORD *)(v37 + 8));
}
else
{
v39 = *(_QWORD *)v37;
v40 = *(_QWORD *)(v37 + 8);
v63 = *(void **)(v37 + 16);
v61 = v39;
v62 = v40;
}
GameLevelManager::uploadEditorSoundConfig(
v35,
(char *)&v46,
(char *)&v49,
(__int64)&v54,
v26,
v25,
a2,
v38,
(__int64)&v61);
if ( (v61 & 1) != 0 )
operator delete(v63);
}
}
else
{
v57[0] = 0;
v57[1] = 0;
v58 = nullptr;
std::string::__init(v57, "This sound pack has no data.", 0x1Cu);
v43 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)v57, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v43 + 1312LL))(v43);
if ( (v57[0] & 1) != 0 )
operator delete(v58);
}
if ( (v54 & 1) != 0 )
operator delete(v56);
}
else
{
v52[0] = 0;
v52[1] = 0;
v53 = nullptr;
std::string::__init(v52, "This sound pack has no name. Set one before uploading.", 0x36u);
v42 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)v52, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v42 + 1312LL))(v42);
if ( (v52[0] & 1) != 0 )
operator delete(v53);
}
if ( (v49 & 1) != 0 )
operator delete(v51);
if ( (v46 & 1) != 0 )
operator delete(v48);
}
}
return _stack_chk_guard;
}