//
// CustomSongLayer::init from 0x980684 to 0x981274 (3056 bytes)
//
// 2 xrefs:
// > CustomSongLayer::create @ 0x98140c
// > ??> @ 0xb3c50
//
// 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 12:57:51 +0000
//
__int64 __fastcall CustomSongLayer::init(SongInfoObject **this, CustomSongDelegate *a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w23
SongInfoObject *v7; // x2
cocos2d::CCDirector *v8; // x0
cocos2d::CCDirector *v9; // x0
cocos2d::CCLayer *WinSize; // x0
__int64 v11; // x0
__int64 v12; // x24
void (__fastcall *v13)(__int64, __int64 *); // x25
void (__fastcall *v14)(__int64, __int64 *); // x25
__int64 v15; // x24
void (__fastcall *v16)(__int64, __int64 *); // x25
const char *v17; // x1
__int64 v18; // x0
cocos2d::CCMenu *v19; // x24
__int64 v20; // x24
void (__fastcall *v21)(__int64, __int64 *); // x25
const char *v22; // x1
__int64 v23; // x0
__int64 v24; // x24
cocos2d::CCNode *v25; // x28
void (__fastcall *v26)(__int64, __int64 *); // x25
const char *v27; // x1
__int64 v28; // x25
__int64 v29; // x25
void (__fastcall *v30)(__int64, __int64 *); // x28
const char *v31; // x1
__int64 v32; // x25
__int64 v33; // x25
void (__fastcall *v34)(__int64, __int64 *); // x28
const char *v35; // x1
__int64 v36; // x25
__int64 v37; // x25
void (__fastcall *v38)(__int64, __int64 *); // x28
__int64 v39; // x0
const char *v40; // x1
__int64 v41; // x0
__int64 v42; // x25
cocos2d::CCNode *v43; // x28
void (__fastcall *v44)(__int64, __int64 *); // x24
__int64 v45; // x0
const char *v46; // x1
__int64 v47; // x24
__int64 v48; // x24
cocos2d::CCNode *v49; // x26
void (__fastcall *v50)(__int64, __int64 *); // x25
__int64 v51; // x26
__int64 v52; // x21
const char *v53; // x4
__int64 v54; // x0
__int64 v55; // x21
void (__fastcall *v56)(__int64, __int64 *); // x26
__int64 v57; // x21
void (__fastcall *v58)(__int64, __int64 *); // x26
__int64 v59; // x21
void (__fastcall *v60)(__int64, __int64 *); // x26
__int64 v61; // x2
__int64 v62; // x21
const char *v63; // x6
__int64 v64; // x0
__int64 v65; // x26
cocos2d::CCNode *v66; // x27
void (__fastcall *v67)(__int64, __int64 *); // x21
SongInfoObject *v68; // x0
CustomSongWidget *v69; // x8
__int64 v70; // x0
__int64 v71; // x21
void (__fastcall *v72)(__int64, __int64 *); // x24
bool v73; // [xsp+18h] [xbp-8h]
cocos2d::CCNode *v74; // [xsp+D8h] [xbp+B8h]
cocos2d::CCNode *v75; // [xsp+D8h] [xbp+B8h]
cocos2d::CCNode *v76; // [xsp+D8h] [xbp+B8h]
int v77; // [xsp+E0h] [xbp+C0h]
__int64 v78; // [xsp+E8h] [xbp+C8h] BYREF
_BYTE v79[8]; // [xsp+F0h] [xbp+D0h] BYREF
float v80[2]; // [xsp+F8h] [xbp+D8h] BYREF
float v81[2]; // [xsp+100h] [xbp+E0h] BYREF
_BYTE v82[8]; // [xsp+108h] [xbp+E8h] BYREF
_BYTE v83[8]; // [xsp+110h] [xbp+F0h] BYREF
__int64 v84; // [xsp+118h] [xbp+F8h] BYREF
_BYTE v85[16]; // [xsp+120h] [xbp+100h] BYREF
__int64 v86[2]; // [xsp+130h] [xbp+110h] BYREF
__int64 v87[2]; // [xsp+140h] [xbp+120h] BYREF
void *v88; // [xsp+150h] [xbp+130h]
FLAlertLayer::incrementForcePrio((cocos2d::CCObject *)this);
LODWORD(v86[0]) = -1778384896;
v4 = cocos2d::CCLayerColor::initWithColor(this, v86);
v5 = v4;
if ( v4 )
{
v7 = *this;
*(this + 85) = a2;
(*((void (__fastcall **)(SongInfoObject **, __int64))v7 + 125))(this, 1);
v8 = (cocos2d::CCDirector *)(*((__int64 (__fastcall **)(SongInfoObject **, __int64))*this + 134))(this, 1);
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize(&v78, v9);
v11 = cocos2d::CCLayer::create(WinSize);
*(this + 73) = (SongInfoObject *)v11;
(*((void (__fastcall **)(SongInfoObject **, __int64))*this + 57))(this, v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v86, 0.0, 0.0, 40.0, 40.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_button_05.png", v86);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 912LL))(v12, 0xFFFFFFFFLL);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v86, 440.0, 290.0);
v13(v12, v86);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v12,
0xFFFFFFFFLL);
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, *(float *)&v78 * 0.5, *((float *)&v78 + 1) * 0.5);
v14(v12, v86);
*((_DWORD *)this + 160) = -1;
v15 = cocos2d::CCLabelBMFont::create(
(cocos2d::CCLabelBMFont *)"Custom Song Selection",
"goldFont.fnt",
(const char *)0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v15 + 160LL))(v15, 1.0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v15);
v16 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
*(float *)&v78 * 0.5,
(float)((float)(*((float *)&v78 + 1) * 0.5) + 145.0) - 22.0);
v16(v15, v86);
v18 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v17);
v19 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v18, 0, (__int64)this, (__int64)CustomSongLayer::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v19, 1.6);
v20 = cocos2d::CCMenu::create(v19, nullptr);
*(this + 69) = (SongInfoObject *)v20;
v21 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
(float)((float)(*(float *)&v78 * 0.5) + -220.0) + 10.0,
(float)((float)(*((float *)&v78 + 1) * 0.5) + 145.0) - 10.0);
v21(v20, v86);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), *(this + 69), 10);
v23 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_savedSongsBtn_001.png", v22);
v24 = CCMenuItemSpriteExtra::create(v23, 0, (__int64)this, (__int64)CustomSongLayer::onSongBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v24, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v24);
v25 = *(this + 69);
v26 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)((float)(*(float *)&v78 * 0.5) + 220.0) - 24.0,
(float)((float)((float)(*((float *)&v78 + 1) * 0.5) + -145.0) + 24.0) + 2.0);
cocos2d::CCNode::convertToNodeSpace(v86, v25, (const cocos2d::CCPoint *)v85);
v26(v24, v86);
v28 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_ncsLibraryBtn_001.png", v27);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 1.2);
v29 = CCMenuItemSpriteExtra::create(v28, 0, (__int64)this, (__int64)CustomSongLayer::onNCSBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v29, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v29);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
v74 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)(*(float *)&v78 * 0.5) + 105.0,
(float)(*((float *)&v78 + 1) * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace(v86, v74, (const cocos2d::CCPoint *)v85);
v30(v29, v86);
v32 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_musicLibraryBtn_001.png", v31);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v32 + 160LL))(v32, 1.2);
v33 = CCMenuItemSpriteExtra::create(v32, 0, (__int64)this, (__int64)CustomSongLayer::onMusicBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v33, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v33);
v34 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v33 + 184LL);
v75 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v85, *(float *)&v78 * 0.5, (float)(*((float *)&v78 + 1) * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace(v86, v75, (const cocos2d::CCPoint *)v85);
v34(v33, v86);
v36 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_ngBtn_001.png", v35);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v36 + 160LL))(v36, 1.2);
v37 = CCMenuItemSpriteExtra::create(v36, 0, (__int64)this, (__int64)CustomSongLayer::onNewgroundsBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v37, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v37);
v76 = *(this + 69);
v38 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)(*(float *)&v78 * 0.5) + -105.0,
(float)(*((float *)&v78 + 1) * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace(v86, v76, (const cocos2d::CCPoint *)v85);
v38(v37, v86);
v39 = (__int64)*(this + 85);
if ( v39 )
{
if ( (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v39 + 24LL))(v39) )
{
v41 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_createLinesBtn_001.png", v40);
v42 = CCMenuItemSpriteExtra::create(v41, 0, (__int64)this, (__int64)CustomSongLayer::onCreateLines, 0);
CCMenuItemSpriteExtra::setSizeMult(v24, 1.2);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v42);
v43 = *(this + 69);
v44 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v42 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)((float)(*(float *)&v78 * 0.5) + -220.0) + 24.0,
(float)((float)((float)(*((float *)&v78 + 1) * 0.5) + -145.0) + 24.0) + 2.0);
cocos2d::CCNode::convertToNodeSpace(v86, v43, (const cocos2d::CCPoint *)v85);
v44(v42, v86);
}
v45 = (__int64)*(this + 85);
if ( v45 && (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v45 + 24LL))(v45) )
{
v47 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_optionsBtn02_001.png", v46);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v47 + 160LL))(v47, 0.8);
v48 = CCMenuItemSpriteExtra::create(v47, 0, (__int64)this, (__int64)CustomSongLayer::onOptions, 0);
CCMenuItemSpriteExtra::setSizeMult(v48, 2.0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v48);
v49 = *(this + 69);
v50 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v48 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v85,
(float)((float)(*(float *)&v78 * 0.5) + 220.0) - 27.0,
(float)((float)(*((float *)&v78 + 1) * 0.5) + 145.0) - 27.0);
cocos2d::CCNode::convertToNodeSpace(v86, v49, (const cocos2d::CCPoint *)v85);
v50(v48, v86);
}
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v85, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v79,
(float)(*(float *)&v78 * 0.5) + -42.0,
(float)(*((float *)&v78 + 1) * 0.5) + -20.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v86, (const cocos2d::CCRect *)v85);
v51 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v86);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v51 + 912LL))(v51, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v80, 210.0, 35.0);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v51 + 320LL))(v51, v80);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v51,
0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v51 + 184LL))(v51, v79);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v86, (const cocos2d::CCRect *)v85);
v52 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v86);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v52 + 912LL))(v52, 40);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v81, 7.0, 6.0);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v82, v80[0] - v81[0], v80[1] - v81[1]);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v52 + 320LL))(v52, v82);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v52, 0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v52 + 184LL))(v52, v79);
v54 = CCTextInputNode::create(
(CCTextInputNode *)"Enter song ID",
210.0,
50.0,
"Thonburi",
(const char *)&off_18,
"bigFont.fnt",
v53);
*(this + 86) = (SongInfoObject *)v54;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v54, 20);
*((_QWORD *)*(this + 86) + 73) = this + 68;
v55 = (__int64)*(this + 86);
v56 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v55 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v84, -95.0, 0.0);
cocos2d::CCPoint::operator+(v86, v79);
v56(v55, v86);
v57 = *((_QWORD *)*(this + 86) + 72);
v58 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v57 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, 0.0, 0.5);
v58(v57, v86);
v59 = *((_QWORD *)*(this + 86) + 75);
v60 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v59 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, 0.0, 0.5);
v60(v59, v86);
CCTextInputNode::setMaxLabelScale(*(this + 86), 0.7);
CCTextInputNode::setMaxLabelWidth(*(this + 86), 210.0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)*(this + 86) + 72) + 344LL))(
*((_QWORD *)*(this + 86) + 72),
0);
v87[0] = 0;
v61 = (__int64)*(this + 86);
v87[1] = 0;
*(_DWORD *)(v61 + 592) = 15;
v88 = nullptr;
v62 = (__int64)*(this + 86);
std::string::__init(v87, "0123456789-", 0xBu);
CCTextInputNode::setAllowedChars(v62, (__int64)v87);
if ( (v87[0] & 1) != 0 )
operator delete(v88);
LOWORD(v77) = -21896;
BYTE2(v77) = -16;
CCTextInputNode::setLabelPlaceholderColor((__int64)*(this + 86), v77);
CCTextInputNode::setLabelPlaceholderScale(*(this + 86), 0.5);
CCTextInputNode::forceOffset((__int64)*(this + 86));
v64 = ButtonSprite::create(
(ButtonSprite *)"Search",
(const char *)&dword_30 + 2,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_04.png",
v63,
35.0);
v65 = CCMenuItemSpriteExtra::create(v64, 0, (__int64)this, (__int64)CustomSongLayer::onSearch, 0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v65);
v66 = *(this + 69);
v67 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v65 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v83, 155.0, 0.0);
cocos2d::CCPoint::operator+(&v84, v79);
cocos2d::CCNode::convertToNodeSpace(v86, v66, (const cocos2d::CCPoint *)&v84);
v67(v65, v86);
v68 = (SongInfoObject *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 85) + 8LL))(*(this + 85));
v69 = nullptr;
if ( (_DWORD)v68 )
v69 = (CustomSongWidget *)SongInfoObject::create(v68);
v70 = CustomSongWidget::create(
v69,
*(this + 85),
(CustomSongDelegate *)((char *)&dword_0 + 1),
(char)&dword_0 + 1,
(char)&dword_0 + 1,
0,
0,
0,
0,
0,
0,
v73);
*(this + 87) = (SongInfoObject *)v70;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v70, 2);
v71 = (__int64)*(this + 87);
v72 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v71 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v86,
*(float *)&v78 * 0.5,
(float)((float)(*((float *)&v78 + 1) * 0.5) + -145.0) + 50.0);
v72(v71, v86);
CustomSongWidget::getSongInfoIfUnloaded(*(this + 87));
}
return v5;
}