//
// SoundPackDescPopup::init from 0x140199220 to 0x140199b62 (2370 bytes)
//
// 2 xrefs:
// > EditorSoundConfigInfoLayer::onDescription @ 0x140195dd8
// > ??> @ 0x14091964c
//
// This function is hookable on this platform (idp: pc, 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 11:27:46 +0000
//
// Hidden C++ exception states: #wind=3
char __fastcall SoundPackDescPopup::init(__int64 a1, _QWORD *a2, size_t *a3, __int64 a4)
{
char result; // al
void **v9; // rcx
void *v10; // rdx
__int64 v11; // rax
float v12; // xmm8_4
float v13; // xmm10_4
struct cocos2d::CCSprite *v14; // rax
int v15; // ebx
cocos2d::CCObject *v16; // rsi
__int64 v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rdi
__int64 v23; // rbx
__int64 v24; // rax
__int64 v25; // rbx
__int64 v26; // rax
__int64 v27; // rdx
__int64 v28; // rcx
char *v29; // rax
__int64 v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
__int64 v33; // rcx
__int64 v34; // rdx
__int64 v35; // rcx
__int64 v36; // r8
__int64 v37; // rcx
__int64 v38; // rdx
__int64 v39; // r8
__int64 v40; // rcx
float v41; // xmm6_4
const struct cocos2d::CCPoint *v42; // rax
char *v43; // rdi
__int64 v44; // rbx
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rax
size_t v48; // r8
cocos2d::CCObject *v49; // rbx
cocos2d::CCObject *v50; // rsi
__int64 v51; // rdi
float v52; // xmm10_4
__int64 v53; // rbx
__int64 v54; // rax
__int64 v55; // rax
struct cocos2d::CCLabelBMFont *v56; // r14
__int64 v57; // rbx
__int64 v58; // rax
__int64 v59; // rbx
float v60; // xmm11_4
__int64 v61; // rax
__int64 v62; // rax
__int64 *v63; // rdi
__int64 v64; // rbx
__int64 v65; // rax
cocos2d::CCObject *v66; // rax
__int64 v67; // rsi
float *v68; // rax
__int64 v69; // rbx
__int64 v70; // rdi
__int64 v71; // rax
__int64 v72; // rax
__int64 v73; // rdx
__int64 v74; // r8
__int64 v75; // rax
_QWORD *v76; // rbx
void *v77; // r8
cocos2d::CCObject *v78; // rsi
__int64 v79; // rdi
__int64 v80; // rbx
__int64 v81; // rax
__int64 v82; // rax
__int16 v83; // [rsp+58h] [rbp-B0h] BYREF
char v84; // [rsp+5Ah] [rbp-AEh]
_QWORD *v85; // [rsp+60h] [rbp-A8h] BYREF
_QWORD v86[3]; // [rsp+68h] [rbp-A0h] BYREF
__int64 v87; // [rsp+80h] [rbp-88h]
__int64 v88; // [rsp+88h] [rbp-80h]
void *Block[2]; // [rsp+90h] [rbp-78h] BYREF
__int64 v90; // [rsp+A0h] [rbp-68h]
unsigned __int64 v91; // [rsp+A8h] [rbp-60h]
result = SetupTriggerPopup::init(a1, 0, 0, a4, 1128136704, 1, 0);
if ( result )
{
*(_QWORD *)(a1 + 1008) = a4;
v9 = (void **)(a1 + 1032);
if ( (size_t *)(a1 + 1032) != a3 )
{
v10 = a3;
if ( a3[3] > 0xF )
v10 = (void *)*a3;
sub_1400405A0(v9, v10, a3[2]);
}
v11 = cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v11, v86);
v12 = *(float *)v86 * 0.5;
v13 = *((float *)v86 + 1) * 0.5;
HIWORD(Block[1]) = 0;
v90 = 11;
v91 = 15;
qmemcpy(Block, "Descriptio", 10);
*(_DWORD *)((char *)&Block[1] + 2) = (unsigned __int8)aDescription[10];
SetupTriggerPopup::addTitle(a1, Block);
v14 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v15 = (int)v14;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v14 + 160LL))(v14);
v16 = CCMenuItemSpriteExtra::create(v15, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v16 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v16);
v17 = *(_QWORD *)v16;
v18 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, (float)(v12 - 170.0) + 8.0, (float)(v13 + 95.0) - 12.0);
cocos2d::CCNode::convertToNodeSpace(v18, &v85, v19);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v17 + 184))(v16, v20);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Block, 0.0, 0.0, 40.0, 40.0);
v22 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v21);
v23 = *(_QWORD *)v22;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v85, 300.0, 92.0);
(*(void (__fastcall **)(__int64, __int64))(v23 + 312))(v22, v24);
v83 = 13405;
v84 = 31;
(**(void (__fastcall ***)(__int64, __int16 *))(v22 + 320))(v22 + 320, &v83);
v25 = *(_QWORD *)v22;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v12, v13 + 8.0);
(*(void (__fastcall **)(__int64, __int64))(v25 + 184))(v22, v26);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v22, 0);
*(_DWORD *)(a1 + 1024) = 1133248512;
v29 = CCTextInputNode::create(v28, v27, (__int64)"Describe this sound pack");
*(_QWORD *)(a1 + 1016) = v29;
v29[624] = 0;
v30 = **(_QWORD **)(a1 + 1016);
v31 = *(_QWORD *)(a1 + 1016);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v12, v13 + 8.0);
(*(void (__fastcall **)(__int64, __int64))(v30 + 184))(v31, v32);
v33 = *(_QWORD *)(a1 + 1016);
*(_BYTE *)(v33 + 641) = 1;
sub_1400405A0((void **)(v33 + 480), &byte_1406ED6E0, 0);
ensureEmotesAreLoaded(v35, v34, v36, COERCE_DOUBLE(1109393408));
v37 = (unsigned int)(17 * dword_1408FE3A4 + 140);
*(_DWORD *)(*(_QWORD *)(a1 + 1016) + 608LL) = v37;
ensureEmotesAreLoaded(v37, v38, v39, COERCE_DOUBLE(1109393408));
CCTextInputNode::setParseEmotes(*(_QWORD *)(a1 + 1016), dword_1408FE3A4);
*(_QWORD *)(*(_QWORD *)(a1 + 1016) + 600LL) = a1 + 544;
v83 = 27843;
v40 = *(_QWORD *)(a1 + 1016);
*(_WORD *)(v40 + 572) = 27843;
*(_BYTE *)(v40 + 574) = 65;
CCTextInputNode::refreshLabel(v40);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1016),
5);
v85 = &v86[1];
*(_OWORD *)&v86[1] = 0;
v87 = 0;
v88 = 15;
LOBYTE(v86[1]) = 0;
v41 = *(float *)(a1 + 1024);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, 0.0, 0.5);
v43 = TextArea::create((__int64)&v86[1], "chatFont.fnt", 1.0, v41, v42, 1101004800, 1, 0);
v43[601] = 1;
v44 = *(_QWORD *)v43;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, 0.0, 0.5);
(*(void (__fastcall **)(char *, __int64))(v44 + 288))(v43, v45);
CCTextInputNode::addTextArea(*(_QWORD *)(a1 + 1016), (__int64)v43);
v46 = *(_QWORD *)v43;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, (float)-*(float *)(a1 + 1024) * 0.5, 0.0);
(*(void (__fastcall **)(char *, __int64))(v46 + 184))(v43, v47);
if ( a2[2] )
{
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
*(_OWORD *)&v86[1] = 0;
v87 = 0;
v88 = 0;
v48 = -1;
do
++v48;
while ( *((_BYTE *)a2 + v48) );
sub_14003D230(&v86[1], a2, v48);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1016), &v86[1]);
}
v85 = operator new(0x2C8u);
v49 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v85);
if ( v49 )
{
if ( ButtonSprite::init_1(
(__int64)v49,
(__int64)"Save",
70,
0,
1058642330,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v49);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v49 + 8LL))(v49, 1);
LODWORD(v49) = 0;
}
}
v50 = CCMenuItemSpriteExtra::create((int)v49, 0, a1, (__int64)SoundPackDescPopup::onSave);
*((_DWORD *)v50 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v50);
v51 = *(_QWORD *)v50;
v52 = (float)(v13 - 95.0) + 24.0;
v53 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v12, v52);
cocos2d::CCNode::convertToNodeSpace(v53, Block, v54);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v51 + 184))(v50, v55);
v56 = cocos2d::CCLabelBMFont::create("Icon:", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v56 + 160LL))(v56);
v57 = *(_QWORD *)v56;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, 0.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v57 + 288))(v56, v58);
v59 = *(_QWORD *)v56;
v60 = (float)(v12 - 170.0) + 22.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v60, v52);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v59 + 184))(v56, v61);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v56,
1);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Block, 0.0, 0.0, 40.0, 40.0);
v63 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_button_04.png", v62);
v64 = *v63;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v85, 32.0, 32.0);
(*(void (__fastcall **)(__int64 *, __int64))(v64 + 312))(v63, v65);
*(_QWORD *)(a1 + 1064) = v63;
v66 = CCMenuItemSpriteExtra::create((int)v63, 0, a1, (__int64)SoundPackDescPopup::onPickIcon);
*(_QWORD *)(a1 + 1072) = v66;
*((_DWORD *)v66 + 93) = 1067030938;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
*(_QWORD *)(a1 + 1072));
v67 = **(_QWORD **)(a1 + 1072);
v68 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v56 + 320LL))(v56);
v69 = *(_QWORD *)(a1 + 552);
v70 = *(_QWORD *)(a1 + 1072);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, (float)((float)(*v68 * 0.5) + v60) + 24.0, v52);
cocos2d::CCNode::convertToNodeSpace(v69, Block, v71);
(*(void (__fastcall **)(__int64, __int64))(v67 + 184))(v70, v72);
SoundPackDescPopup::refreshIconSlot(a1);
*(_OWORD *)Block = 0;
v90 = 4;
v91 = 15;
strcpy((char *)Block, "easy");
v75 = EmoteSprite::defForName((__int64)Block, v73, v74, COERCE_DOUBLE(1109393408));
if ( v75 )
v76 = EmoteSprite::createWithDef(v75);
else
v76 = nullptr;
if ( v91 > 0xF )
{
v77 = Block[0];
if ( v91 + 1 >= 0x1000 )
{
v77 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v77 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v77);
}
EmoteSprite::fitToHeight(v76, 18.0, 0.0);
v78 = CCMenuItemSpriteExtra::create((int)v76, 0, a1, (__int64)SoundPackDescPopup::onEmotes);
*((_DWORD *)v78 + 93) = 1068708659;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v78);
v79 = *(_QWORD *)v78;
v80 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, (float)(v12 + 170.0) - 30.0, v52);
cocos2d::CCNode::convertToNodeSpace(v80, Block, v81);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v79 + 184))(v78, v82);
return 1;
}
return result;
}