//
// EditorSoundsLayer::init from 0xcd6bb4 to 0xcd738c (2008 bytes)
//
// 2 xrefs:
// > EditorSoundsLayer::create @ 0xcd7624
// > ??> @ 0xc0b98
//
// 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:31 +0000
//
__int64 __fastcall EditorSoundsLayer::init(EditorSoundsLayer *this, EditorUI *a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w23
cocos2d::CCDirector *v7; // x0
cocos2d::CCDirector *v8; // x0
float v9; // s9
float v10; // s8
__int64 v11; // x21
void (__fastcall *v12)(__int64, __int64 *); // x25
ScrollableContentLayer *v13; // x21
cocos2d::CCMenu *v14; // x0
__int64 v15; // x0
float v16; // s9
__int64 v17; // x21
void (__fastcall *v18)(__int64, __int64 *); // x25
void (__fastcall *v19)(__int64, __int64 *); // x2
void (__fastcall *v20)(__int64, __int64 *); // x25
const char *v21; // x4
__int64 v22; // x0
__int64 v23; // x21
__int64 v24; // x25
void (__fastcall *v25)(__int64, __int64 *); // x27
const char *v26; // x1
__int64 v27; // x25
__int64 v28; // x0
__int64 v29; // x25
cocos2d::CCNode *v30; // x28
void (__fastcall *v31)(__int64, __int64 *); // x27
const char *v32; // x6
__int64 v33; // x25
__int64 v34; // x25
cocos2d::CCNode *v35; // x28
void (__fastcall *v36)(__int64, __int64 *); // x27
const char *v37; // x1
__int64 v38; // x25
__int64 v39; // x25
cocos2d::CCNode *v40; // x28
void (__fastcall *v41)(__int64, __int64 *); // x27
size_t v42; // x2
char *v43; // x1
_QWORD *v44; // x20
int v45; // w0
const char *v46; // x1
size_t v47; // x0
__int64 v48; // x1
__int64 v49; // x2
char *v50; // [xsp+98h] [xbp+98h]
_BYTE v51[8]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v52; // [xsp+A8h] [xbp+A8h]
__int64 v53; // [xsp+B0h] [xbp+B0h] BYREF
_BYTE v54[8]; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v55[2]; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v56; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v57; // [xsp+D8h] [xbp+D8h]
void *v58; // [xsp+E0h] [xbp+E0h]
v4 = SetupTriggerPopup::init(this, nullptr, nullptr, 400.0, 280.0, 7u, 0.0);
v5 = v4;
if ( !v4 )
return v5;
*((_QWORD *)this + 136) = a2;
SetupTriggerPopup::preSetup(this);
qmemcpy(v51, "PWi", 3);
SetupTriggerPopup::setCustomBGColor((__int64)this, (__int64)v51);
*((_BYTE *)this + 596) = 1;
TabbedPopupLayer::addCloseButton(this);
v7 = (cocos2d::CCDirector *)EditorSoundsLayer::setupTabs(this);
v8 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(&v53, v8);
v9 = (float)(*((float *)&v53 + 1) * 0.5) + -100.0;
v10 = *((float *)this + 183) - 30.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v55, v10, (float)((float)(*((float *)&v53 + 1) * 0.5) + 96.0) - v9);
v11 = ScrollableContentLayer::create((const cocos2d::CCSize *)v55);
*((_QWORD *)this + 144) = v11;
v12 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, -(float)((float)(v10 * 0.5) - (float)(*(float *)&v53 * 0.5)), v9);
v12(v11, v55);
v13 = *((ScrollableContentLayer **)this + 144);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, 2.0, 0.0);
ScrollableContentLayer::setThumbOffset(v13, (__int64)v55);
v14 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 144),
5);
v15 = cocos2d::CCMenu::create(v14);
*((_QWORD *)this + 145) = v15;
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v15 + 296LL))(v15, &unk_155F308);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 145) + 320LL))(*((_QWORD *)this + 145), &unk_155F310);
(*(void (__fastcall **)(_QWORD, void *))(**((_QWORD **)this + 145) + 184LL))(*((_QWORD *)this + 145), &unk_155F308);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(*((_QWORD *)this + 144) + 416LL) + 464LL))(
*(_QWORD *)(*((_QWORD *)this + 144) + 416LL),
*((_QWORD *)this + 145),
2);
v16 = (float)((float)(*((float *)this + 184) * 0.5) + (float)(*((float *)&v53 + 1) * 0.5)) - 60.0;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v55, 0.0, 0.0, 40.0, 40.0);
v17 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v55);
v18 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v55, v10, 30.0);
v18(v17, v55);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 912LL))(v17, 100);
v19 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 960LL);
LOWORD(v55[0]) = 0;
BYTE2(v55[0]) = 0;
v19(v17, v55);
v20 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, *(float *)&v53 * 0.5, v16);
v20(v17, v55);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 344LL))(v17, 0);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**((_QWORD **)this + 73) + 464LL))(*((_QWORD *)this + 73), v17, 0);
*((_QWORD *)this + 138) = v17;
v22 = CCTextInputNode::create(
(CCTextInputNode *)"Search...",
v10 - 20.0,
30.0,
"Thonburi",
(const char *)&dword_14,
"bigFont.fnt",
v21);
*((_QWORD *)this + 137) = v22;
LOWORD(v52) = -26986;
BYTE2(v52) = -106;
CCTextInputNode::setLabelPlaceholderColor(v22, v52);
CCTextInputNode::setLabelPlaceholderScale(*((CCTextInputNode **)this + 137), 0.4);
CCTextInputNode::setMaxLabelScale(*((CCTextInputNode **)this + 137), 0.4);
CCTextInputNode::setMaxLabelWidth(*((CCTextInputNode **)this + 137), v10 - 60.0);
*(_QWORD *)(*((_QWORD *)this + 137) + 584LL) = (char *)this + 544;
v56 = 0;
v23 = *((_QWORD *)this + 137);
v57 = 0;
v58 = nullptr;
std::string::__init(&v56, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 0x3Fu);
CCTextInputNode::setAllowedChars(v23, (__int64)&v56);
if ( (v56 & 1) != 0 )
operator delete(v58);
v24 = *((_QWORD *)this + 137);
v25 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, *(float *)&v53 * 0.5, v16);
v25(v24, v55);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 137) + 1000LL))(*((_QWORD *)this + 137), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 137) + 344LL))(*((_QWORD *)this + 137), 0);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 137),
1);
v27 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_longBtn07_001.png", v26);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 0.6);
v28 = CCMenuItemSpriteExtra::create(v27, 0, (__int64)this, (__int64)EditorSoundsLayer::onClearSearch, 0);
*((_QWORD *)this + 139) = v28;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v28);
v29 = *((_QWORD *)this + 139);
v30 = *((cocos2d::CCNode **)this + 69);
v31 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
(float)((float)(v10 * 0.5) + (float)(*(float *)&v53 * 0.5)) - 18.0,
v16);
cocos2d::CCNode::convertToNodeSpace(v55, v30, (const cocos2d::CCPoint *)v54);
v31(v29, v55);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 139) + 344LL))(*((_QWORD *)this + 139), 0);
v33 = ButtonSprite::create(
(ButtonSprite *)"Browse",
(const char *)&dword_30 + 2,
0,
1,
0.4,
"goldFont.fnt",
"GJ_button_05.png",
v32,
26.0);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(v33 + 624) + 160LL))(*(_QWORD *)(v33 + 624), 0.5);
v34 = CCMenuItemSpriteExtra::create(v33, 0, (__int64)this, (__int64)EditorSoundsLayer::onBrowse, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v34);
v35 = *((cocos2d::CCNode **)this + 69);
v36 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
(float)((float)(*((float *)this + 183) * 0.5) + (float)(*(float *)&v53 * 0.5)) - 42.0,
20.0 - (float)((float)(*((float *)this + 184) * 0.5) - (float)(*((float *)&v53 + 1) * 0.5)));
cocos2d::CCNode::convertToNodeSpace(v55, v35, (const cocos2d::CCPoint *)v54);
v36(v34, v55);
v38 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_optionsBtn02_001.png", v37);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v38 + 160LL))(v38, 0.7);
v39 = CCMenuItemSpriteExtra::create(v38, 0, (__int64)this, (__int64)EditorSoundsLayer::onSettings, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v39);
v40 = *((cocos2d::CCNode **)this + 69);
v41 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
(float)((float)(*((float *)this + 183) * 0.5) + (float)(*(float *)&v53 * 0.5)) - 20.0,
(float)((float)(*((float *)this + 184) * 0.5) + (float)(*((float *)&v53 + 1) * 0.5)) - 20.0);
cocos2d::CCNode::convertToNodeSpace(v55, v40, (const cocos2d::CCPoint *)v54);
v41(v39, v55);
SetupTriggerPopup::postSetup(this);
if ( (__int64 *)((char *)this + 1120) != &EditorSoundsLayer::s_lastSearchText )
{
if ( (EditorSoundsLayer::s_lastSearchText & 1) != 0 )
{
v43 = (char *)qword_155F348;
v42 = qword_155F340;
}
else
{
v42 = (unsigned __int8)EditorSoundsLayer::s_lastSearchText >> 1;
v43 = (char *)&EditorSoundsLayer::s_lastSearchText + 1;
}
std::string::assign((__int64 *)this + 140, v43, v42);
}
v44 = *((_QWORD **)this + 137);
if ( v44 )
{
v45 = *((unsigned __int8 *)this + 1120);
if ( (v45 & 1) != 0 )
{
if ( *((_QWORD *)this + 141) )
{
v46 = *((const char **)this + 142);
LABEL_13:
v50 = (char *)v46;
v56 = 0;
v57 = 0;
v58 = nullptr;
v47 = strlen(v46);
std::string::__init(&v56, v50, v47);
CCTextInputNode::setString(v44, (char *)&v56);
if ( (v56 & 1) != 0 )
operator delete(v58);
}
}
else if ( v45 >> 1 )
{
v46 = (char *)this + 1121;
goto LABEL_13;
}
}
if ( EditorSoundsLayer::s_lastActiveTab < 0 )
{
v48 = 0;
}
else if ( EditorSoundsLayer::s_lastActiveTab >= (int)(954437177
* ((__int64)(*((_QWORD *)this + 128) - *((_QWORD *)this + 127)) >> 3)) )
{
v48 = 0;
}
else
{
v48 = (unsigned int)EditorSoundsLayer::s_lastActiveTab;
}
v49 = *(_QWORD *)this;
*((_DWORD *)this + 266) = -1;
(*(void (__fastcall **)(EditorSoundsLayer *, __int64))(v49 + 1504))(this, v48);
return v5;
}