//
// EditorSoundConfigUploadPopup::init from 0xcd490c to 0xcd55c4 (3256 bytes)
//
// 2 xrefs:
// > EditorSoundConfigUploadPopup::create @ 0xcd5870
// > ??> @ 0x53200
//
// 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:30 +0000
//
__int64 __fastcall EditorSoundConfigUploadPopup::init(
EditorSoundConfigUploadPopup *this,
GJEditorSoundConfig *a2,
EditorSoundConfigInfoLayer *a3)
{
unsigned __int8 v6; // w0
unsigned int v7; // w22
cocos2d::CCDirector *v9; // x0
cocos2d::CCMenu *WinSize; // x0
float v11; // s10
float v12; // s8
float v13; // s9
float v14; // s11
__int64 v15; // x0
__int64 v16; // x0
__int64 v17; // x2
__int64 v18; // x0
__int64 v19; // x1
cocos2d::CCLabelBMFont *v20; // x2
cocos2d::CCLabelBMFont *v21; // x0
cocos2d::CCLabelBMFont *v22; // x25
void (__fastcall *v23)(cocos2d::CCLabelBMFont *, void **); // x21
const char *v24; // x2
cocos2d::CCLabelBMFont *v25; // x25
void (__fastcall *v26)(cocos2d::CCLabelBMFont *, void **); // x2
void (__fastcall *v27)(cocos2d::CCLabelBMFont *, void **); // x27
__int64 v28; // x25
void (__fastcall *v29)(__int64, void **); // x27
void (__fastcall *v30)(__int64, void **); // x27
__int64 *v31; // x0
__int64 v32; // x1
int v33; // w0
const char *v34; // x2
cocos2d::CCLabelBMFont *v35; // x27
int v36; // w21
char *v37; // x0
__int64 v38; // x2
cocos2d::CCLabelBMFont *v39; // x0
cocos2d::CCLabelBMFont *v40; // x25
void (__fastcall *v41)(cocos2d::CCLabelBMFont *, __int64 *); // x26
int v42; // w0
bool v43; // w1
_BOOL8 v44; // x0
cocos2d::CCArray *v45; // x25
unsigned __int8 v46; // w28
cocos2d::CCNode *v47; // x27
CCMenuItemToggler *ToggleButton; // x0
char v49; // w1
cocos2d::CCArray *v50; // x0
cocos2d::CCArray *v51; // x25
unsigned __int8 v52; // w27
cocos2d::CCNode *v53; // x26
CCMenuItemToggler *v54; // x0
char v55; // w1
GJAccountManager *updated; // x0
GJAccountManager *v57; // x0
const char *v58; // x6
__int64 v59; // x0
_DWORD *v60; // x2
int v61; // w1
int v62; // w0
int v63; // w0
int v64; // w24
__int64 v65; // x0
__int64 *v66; // x25
__int64 v67; // x1
float v68; // s11
void (__fastcall *v69)(__int64 *, __int64 *); // x27
cocos2d::CCNode *v70; // x28
cocos2d::CCString *v71; // x0
size_t v72; // x0
const char *v73; // x6
ButtonSprite *v74; // x0
__int64 v75; // x0
__int64 v76; // x23
cocos2d::CCNode *v77; // x27
void (__fastcall *v78)(__int64, __int64 *); // x25
const char *v79; // x6
__int64 v80; // x0
__int64 v81; // x23
cocos2d::CCNode *v82; // x26
void (__fastcall *v83)(__int64, __int64 *); // x25
const char *v84; // x1
char v85; // w0
__int64 v86; // x23
__int64 v87; // x23
cocos2d::CCNode *v88; // x25
void (__fastcall *v89)(__int64, __int64 *); // x26
float v90; // s11
void (__fastcall *v91)(__int64 *, __int64 *); // x26
cocos2d::CCNode *v92; // x27
const char *v93; // x6
__int64 v94; // x0
__int64 v95; // x23
cocos2d::CCNode *v96; // x26
void (__fastcall *v97)(__int64, __int64 *); // x25
unsigned __int64 v98; // x0
unsigned __int64 v99; // x0
char *CString; // [xsp+A8h] [xbp+98h]
__int64 v101; // [xsp+B0h] [xbp+A0h] BYREF
_BYTE v102[8]; // [xsp+B8h] [xbp+A8h] BYREF
__int64 v103; // [xsp+C0h] [xbp+B0h] BYREF
__int64 v104; // [xsp+C8h] [xbp+B8h] BYREF
__int64 v105; // [xsp+D0h] [xbp+C0h]
cocos2d::CCLabelBMFont *v106; // [xsp+D8h] [xbp+C8h]
__int64 v107; // [xsp+E0h] [xbp+D0h] BYREF
__int64 v108; // [xsp+E8h] [xbp+D8h]
cocos2d::CCLabelBMFont *v109; // [xsp+F0h] [xbp+E0h]
void *v110; // [xsp+F8h] [xbp+E8h] BYREF
char *v111; // [xsp+100h] [xbp+F0h]
__int64 v112; // [xsp+108h] [xbp+F8h]
__int64 v113[3]; // [xsp+110h] [xbp+100h] BYREF
__int64 v114[2]; // [xsp+128h] [xbp+118h] BYREF
void *v115; // [xsp+138h] [xbp+128h]
__int64 v116; // [xsp+140h] [xbp+130h] BYREF
__int64 v117; // [xsp+148h] [xbp+138h]
ButtonSprite *v118; // [xsp+150h] [xbp+140h]
if ( !a2 )
return 0;
v6 = SetupTriggerPopup::init(this, nullptr, nullptr, 340.0, 240.0, 1u, 0.0);
v7 = v6;
if ( !v6 )
return 0;
*((_QWORD *)this + 141) = a3;
*((_QWORD *)this + 133) = a2;
SetupTriggerPopup::preSetup(this);
*((_BYTE *)this + 596) = (unsigned __int8)&dword_0 + 1;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)((char *)&dword_0 + 1));
WinSize = (cocos2d::CCMenu *)cocos2d::CCDirector::getWinSize(&v101, v9);
v11 = *((float *)this + 184) * 0.5;
v12 = *(float *)&v101 * 0.5;
v13 = v11 + (float)(*((float *)&v101 + 1) * 0.5);
v14 = -(float)(v11 - (float)(*((float *)&v101 + 1) * 0.5));
v15 = cocos2d::CCMenu::create(WinSize);
*((_QWORD *)this + 69) = v15;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(*((_QWORD *)this + 73), v15, 10);
v116 = 0;
v117 = 0;
v118 = nullptr;
std::string::__init(&v116, "Upload Sound Pack", 0x11u);
SetupTriggerPopup::addTitle((__int64)this, (__int64)&v116);
if ( (v116 & 1) != 0 )
operator delete(v118);
v16 = *((_QWORD *)this + 133);
v104 = 0;
v17 = v16 + 376;
v105 = 0;
LOBYTE(v16) = *(_BYTE *)(v16 + 376);
v106 = nullptr;
if ( (v16 & 1) != 0 )
{
std::string::__init(&v104, *(void **)(v17 + 16), *(_QWORD *)(v17 + 8));
}
else
{
v18 = *(_QWORD *)v17;
v19 = *(_QWORD *)(v17 + 8);
v20 = *(cocos2d::CCLabelBMFont **)(v17 + 16);
v106 = v20;
v104 = v18;
v105 = v19;
}
if ( (v104 & 1) != 0 )
{
if ( v105 )
{
LABEL_11:
v21 = v106;
goto LABEL_12;
}
}
else if ( (int)(unsigned __int8)v104 >> 1 )
{
v21 = (cocos2d::CCLabelBMFont *)((char *)&v104 + 1);
goto LABEL_12;
}
std::string::assign(&v104, &byte_1191DE0);
if ( (v104 & 1) != 0 )
goto LABEL_11;
v21 = (cocos2d::CCLabelBMFont *)((char *)&v104 + 1);
LABEL_12:
v22 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v21, "goldFont.fnt", (const char *)v20);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.8);
cocos2d::CCLabelBMFont::limitLabelWidth(v22, *((float *)this + 183) - 60.0, 0.8, 0.3);
v23 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v22 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v110, v12, v13 - 48.0);
v23(v22, &v110);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v22);
v25 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(
(cocos2d::CCLabelBMFont *)"You cannot change the name once it is shared.",
"chatFont.fnt",
v24);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, float))(*(_QWORD *)v25 + 160LL))(v25, 0.5);
v26 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v25 + 1072LL);
LOWORD(v110) = -5121;
BYTE2(v110) = 120;
v26(v25, &v110);
cocos2d::CCLabelBMFont::limitLabelWidth(v25, *((float *)this + 183) - 50.0, 0.5, 0.25);
v27 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, void **))(*(_QWORD *)v25 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v110, v12, v13 - 70.0);
v27(v25, &v110);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v25);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v110, 0.0, 0.0, 40.0, 40.0);
v28 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", &v110);
v29 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v28 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v110, *((float *)this + 183) - 40.0, 52.0);
v29(v28, &v110);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v28 + 960LL))(v28, &unk_11A42E0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v28 + 912LL))(v28, 90);
v30 = *(void (__fastcall **)(__int64, void **))(*(_QWORD *)v28 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v110, v12, v13 - 108.0);
v30(v28, &v110);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v28);
GJEditorSoundConfig::getUnpackedSoundDesc(&v107, *((GJEditorSoundConfig **)this + 133));
v31 = (__int64 *)(unsigned __int8)v107;
v32 = (unsigned __int8)v107 >> 1;
if ( (v107 & 1) != 0 )
v32 = v108;
if ( !v32 )
v31 = std::string::assign(&v107, "(No description provided)");
v110 = nullptr;
v111 = nullptr;
v112 = 0;
v33 = EmoteSprite::maxEmotesComment((EmoteSprite *)v31);
EmoteSprite::parseTokens((char *)&v107, &v110, v33);
if ( v110 != v111 )
{
EmoteSprite::replaceTokens((__int64)&v107, (__int64 *)&v110, v113, 0.0);
if ( (v107 & 1) != 0 )
{
*(_BYTE *)v109 = 0;
v108 = 0;
if ( (v107 & 1) != 0 )
{
v35 = v109;
v36 = 1;
v37 = (char *)&v107 + 1;
goto LABEL_20;
}
v98 = (unsigned __int8)v107 >> 1;
if ( v98 > 0x16 )
{
v99 = (v98 + 16) & 0xFFFFFFFFFFFFFFF0LL;
if ( v99 != 23 )
{
v37 = (char *)operator new(v99);
v36 = v107 & 1;
if ( (v107 & 1) == 0 )
{
v35 = (cocos2d::CCLabelBMFont *)((char *)&v107 + 1);
v38 = (unsigned __int8)v107 >> 1;
goto LABEL_21;
}
v35 = v109;
LABEL_20:
v38 = v108;
LABEL_21:
v34 = (const char *)(v38 + 1);
if ( v34 )
memcpy(v37, v35, (size_t)v34);
if ( v36 )
operator delete(v35);
}
}
}
v107 = v113[0];
v108 = v113[1];
v109 = (cocos2d::CCLabelBMFont *)v113[2];
}
v39 = (cocos2d::CCLabelBMFont *)((char *)&v107 + 1);
if ( (v107 & 1) != 0 )
v39 = v109;
v40 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v39, "chatFont.fnt", v34);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, float))(*(_QWORD *)v40 + 160LL))(v40, 0.55);
cocos2d::CCLabelBMFont::limitLabelWidth(v40, *((float *)this + 183) - 56.0, 0.55, 0.2);
v41 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, __int64 *))(*(_QWORD *)v40 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v103, v12, v13 - 108.0);
v41(v40, &v103);
(*(void (__fastcall **)(_QWORD, cocos2d::CCLabelBMFont *))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v40);
EmoteSprite::attachToLabel((__int64)v40, *((_QWORD *)this + 73), (__int64 *)&v110, 0.0);
v42 = *(_DWORD *)(*((_QWORD *)this + 133) + 360LL);
v43 = (unsigned int)(v42 - 3) <= 1;
v44 = v42 == 3;
*((_BYTE *)this + 1104) = v43;
*((_BYTE *)this + 1105) = v44;
v45 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)v44);
v114[0] = 0;
v114[1] = 0;
v115 = nullptr;
std::string::__init(v114, "Unlisted", 8u);
v46 = *((_BYTE *)this + 1104);
v47 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v103, v12 - 120.0, v13 - 155.0);
ToggleButton = GameToolbox::createToggleButton(
(char *)v114,
(const char *)EditorSoundConfigUploadPopup::onToggleUnlisted,
0,
v46,
v47,
(const cocos2d::CCPoint *)&v103,
(__int64)this,
*((_QWORD *)this + 73),
v45);
v49 = v114[0];
*((_QWORD *)this + 134) = ToggleButton;
if ( (v49 & 1) != 0 )
operator delete(v115);
v50 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v45, 1u);
*((_QWORD *)this + 136) = v50;
v51 = (cocos2d::CCArray *)cocos2d::CCArray::create(v50);
v116 = 0;
v117 = 0;
v118 = nullptr;
std::string::__init(&v116, "Friends Only", 0xCu);
v52 = *((_BYTE *)this + 1105);
v53 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v103, v12 + 20.0, v13 - 155.0);
v54 = GameToolbox::createToggleButton(
(char *)&v116,
(const char *)EditorSoundConfigUploadPopup::onToggleFriendsOnly,
0,
v52,
v53,
(const cocos2d::CCPoint *)&v103,
(__int64)this,
*((_QWORD *)this + 73),
v51);
v55 = v116;
*((_QWORD *)this + 135) = v54;
if ( (v55 & 1) != 0 )
operator delete(v118);
*((_QWORD *)this + 137) = cocos2d::CCArray::objectAtIndex(v51, 1u);
updated = (GJAccountManager *)EditorSoundConfigUploadPopup::updateVisibilityState(this);
v57 = (GJAccountManager *)GJAccountManager::sharedState(updated);
if ( v57 )
{
v59 = GJAccountManager::sharedState(v57);
v60 = *((_DWORD **)this + 133);
v61 = *(_DWORD *)(v59 + 352);
v62 = *(_DWORD *)(v59 + 356);
if ( !v60[79] )
{
v63 = v61 - v62;
if ( v63 > 0 && (int)v60[84] > 0 && v60[85] == v63 )
{
v64 = 1;
goto LABEL_38;
}
}
}
else
{
v64 = 0;
if ( !*(_DWORD *)(*((_QWORD *)this + 133) + 316LL) )
goto LABEL_38;
}
v64 = 0;
LABEL_38:
v65 = ButtonSprite::create(
(ButtonSprite *)"Cancel",
(const char *)&word_3C,
0,
1,
0.7,
"bigFont.fnt",
"GJ_button_06.png",
v58,
30.0);
v66 = (__int64 *)CCMenuItemSpriteExtra::create(
v65,
0,
(__int64)this,
(__int64)EditorSoundConfigUploadPopup::onCancel,
0);
(*(void (__fastcall **)(_QWORD, __int64 *))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v66);
*((_QWORD *)this + 131) = v66;
v67 = *v66;
if ( v64 )
{
v68 = v14 + 25.0;
v69 = *(void (__fastcall **)(__int64 *, __int64 *))(v67 + 184);
v70 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v102, v12 - 110.0, v68);
cocos2d::CCNode::convertToNodeSpace(&v103, v70, (const cocos2d::CCPoint *)v102);
v69(v66, &v103);
v71 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Update #%d",
(const char *)*(unsigned int *)(*((_QWORD *)this + 133) + 336LL));
CString = (char *)cocos2d::CCString::getCString(v71);
v116 = 0;
v117 = 0;
v118 = nullptr;
v72 = strlen(CString);
std::string::__init(&v116, CString, v72);
v74 = (ButtonSprite *)((char *)&v116 + 1);
if ( (v116 & 1) != 0 )
v74 = v118;
v75 = ButtonSprite::create(
v74,
(const char *)&qword_58 + 2,
0,
1,
0.55,
"goldFont.fnt",
"GJ_button_01.png",
v73,
30.0);
v76 = CCMenuItemSpriteExtra::create(
v75,
0,
(__int64)this,
(__int64)EditorSoundConfigUploadPopup::onUploadAsUpdate,
0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v76);
v77 = *((cocos2d::CCNode **)this + 69);
v78 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v76 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v102, v12, v68);
cocos2d::CCNode::convertToNodeSpace(&v103, v77, (const cocos2d::CCPoint *)v102);
v78(v76, &v103);
*((_QWORD *)this + 130) = v76;
v80 = ButtonSprite::create(
(ButtonSprite *)"Upload as New",
(const char *)&qword_58 + 2,
0,
1,
0.55,
"bigFont.fnt",
"GJ_button_02.png",
v79,
30.0);
v81 = CCMenuItemSpriteExtra::create(v80, 0, (__int64)this, (__int64)EditorSoundConfigUploadPopup::onUpload, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v81);
v82 = *((cocos2d::CCNode **)this + 69);
v83 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v81 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v102, v12 + 110.0, v68);
cocos2d::CCNode::convertToNodeSpace(&v103, v82, (const cocos2d::CCPoint *)v102);
v83(v81, &v103);
v85 = v116;
*((_QWORD *)this + 129) = v81;
if ( (v85 & 1) != 0 )
operator delete(v118);
}
else
{
v90 = v14 + 25.0;
v91 = *(void (__fastcall **)(__int64 *, __int64 *))(v67 + 184);
v92 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v102, v12 - 60.0, v90);
cocos2d::CCNode::convertToNodeSpace(&v103, v92, (const cocos2d::CCPoint *)v102);
v91(v66, &v103);
v94 = ButtonSprite::create(
(ButtonSprite *)"Upload",
(const char *)&word_3C,
0,
1,
0.7,
"goldFont.fnt",
"GJ_button_01.png",
v93,
30.0);
v95 = CCMenuItemSpriteExtra::create(v94, 0, (__int64)this, (__int64)EditorSoundConfigUploadPopup::onUpload, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v95);
v96 = *((cocos2d::CCNode **)this + 69);
v97 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v95 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v102, v12 + 60.0, v90);
cocos2d::CCNode::convertToNodeSpace(&v103, v96, (const cocos2d::CCPoint *)v102);
v97(v95, &v103);
*((_QWORD *)this + 129) = v95;
}
v86 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v84);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v86 + 160LL))(v86, 0.7);
v87 = CCMenuItemSpriteExtra::create(v86, 0, (__int64)this, 1368, 1);
CCMenuItemSpriteExtra::setSizeMult(v87, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v87);
v88 = *((cocos2d::CCNode **)this + 69);
v89 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v87 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v102,
(float)(v12 - (float)(*((float *)this + 183) * 0.5)) + 10.0,
v13 - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v103, v88, (const cocos2d::CCPoint *)v102);
v89(v87, &v103);
*((_QWORD *)this + 139) = v87;
SetupTriggerPopup::postSetup(this);
if ( v110 )
{
if ( v110 != v111 )
v111 += -24
* ((0xAAAAAAAAAAAAAABLL * ((unsigned __int64)(v111 - 24 - (_BYTE *)v110) >> 3)) & 0x1FFFFFFFFFFFFFFFLL)
- 24;
operator delete(v110);
}
if ( (v107 & 1) != 0 )
operator delete(v109);
if ( (v104 & 1) != 0 )
operator delete(v106);
return v7;
}