//
// CustomSongLayer::init from 0x57c320 to 0x57cc76 (2390 bytes)
//
// 1 xrefs:
// > CustomSongLayer::create @ 0x57cd10
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:50 +0000
//
int __fastcall CustomSongLayer::init(CustomSongLayer *this, CustomSongDelegate *a2)
{
int v4; // r3
cocos2d::CCDirector *v5; // r0
cocos2d::CCLayer *WinSize; // r0
int v7; // r0
int v8; // r3
int v9; // r7
void (__fastcall *v10)(int, _DWORD *); // r9
void (__fastcall *v11)(int, _DWORD *); // r9
const char *v12; // r2
int v13; // r7
void (__fastcall *v14)(int, _DWORD *); // r9
const char *v15; // r1
int v16; // r0
cocos2d::CCMenu *v17; // r7
int v18; // r0
float v19; // s14
float v20; // s13
int v21; // r7
void (__fastcall *v22)(int, _DWORD *); // r9
const char *v23; // r1
int v24; // r0
int v25; // r9
const cocos2d::CCPoint *v26; // r11
void (__fastcall *v27)(int, _DWORD *); // r10
const char *v28; // r1
int v29; // r10
int v30; // r10
void (__fastcall *v31)(int, _DWORD *); // r11
const char *v32; // r1
int v33; // r10
int v34; // r10
void (__fastcall *v35)(int, _DWORD *); // r11
const char *v36; // r1
int v37; // r10
int v38; // r10
void (__fastcall *v39)(int, _DWORD *); // r11
int v40; // r0
const char *v41; // r1
int v42; // r0
const char *v43; // r1
int v44; // r5
int v45; // r5
int *v46; // r0
int v47; // r7
void (__fastcall *v48)(int, _DWORD *); // r10
int v49; // r7
void (__fastcall *v50)(int, _DWORD *); // r10
int v51; // r7
void (__fastcall *v52)(int, _DWORD *); // r10
int v53; // r9
ButtonSprite *v54; // r0
int v55; // r8
const cocos2d::CCPoint *v56; // r11
SongInfoObject *v57; // r0
int v58; // r1
cocos2d::CCNode *v59; // r0
int v60; // r6
void (__fastcall *v61)(int, _BYTE *); // r7
int v63; // r0
int v64; // r5
const cocos2d::CCPoint *v65; // r10
void (__fastcall *v66)(int, _DWORD *); // r9
int v67; // r5
int v68; // r10
const cocos2d::CCPoint *v69; // r9
void (__fastcall *v70)(int, _DWORD *); // r6
char *v71; // [sp+8h] [bp-DCh]
float v72; // [sp+10h] [bp-D4h]
bool v73; // [sp+1Ch] [bp-C8h]
int v74; // [sp+20h] [bp-C4h]
cocos2d::CCPoint *v75; // [sp+28h] [bp-BCh]
cocos2d::CCPoint *v76; // [sp+28h] [bp-BCh]
cocos2d::CCPoint *v77; // [sp+28h] [bp-BCh]
cocos2d::CCPoint *v78; // [sp+28h] [bp-BCh]
int v79; // [sp+34h] [bp-B0h]
float v80; // [sp+38h] [bp-ACh] BYREF
float v81; // [sp+3Ch] [bp-A8h]
_BYTE v82[8]; // [sp+40h] [bp-A4h] BYREF
float v83[2]; // [sp+48h] [bp-9Ch] BYREF
float v84[2]; // [sp+50h] [bp-94h] BYREF
_BYTE v85[8]; // [sp+58h] [bp-8Ch] BYREF
_BYTE v86[8]; // [sp+60h] [bp-84h] BYREF
_BYTE v87[8]; // [sp+68h] [bp-7Ch] BYREF
_BYTE v88[8]; // [sp+70h] [bp-74h] BYREF
int (__fastcall *v89)(CustomSongLayer *, cocos2d::CCObject *); // [sp+78h] [bp-6Ch]
int v90; // [sp+7Ch] [bp-68h]
int (__fastcall *v91)(CustomSongLayer *, cocos2d::CCObject *); // [sp+80h] [bp-64h]
int v92; // [sp+84h] [bp-60h]
_DWORD (*v93)(CustomSongLayer *__hidden, cocos2d::CCObject *); // [sp+88h] [bp-5Ch]
int v94; // [sp+8Ch] [bp-58h]
int (__fastcall *v95)(CustomSongLayer *, cocos2d::CCObject *); // [sp+90h] [bp-54h]
int v96; // [sp+94h] [bp-50h]
int (__fastcall *v97)(CustomSongLayer *, cocos2d::CCObject *); // [sp+98h] [bp-4Ch]
int v98; // [sp+9Ch] [bp-48h]
int (__fastcall *v99)(CustomSongLayer *, cocos2d::CCObject *); // [sp+A0h] [bp-44h]
int v100; // [sp+A4h] [bp-40h]
_DWORD (*v101)(CustomSongLayer *__hidden, cocos2d::CCObject *); // [sp+A8h] [bp-3Ch]
int v102; // [sp+ACh] [bp-38h]
int v103[3]; // [sp+B0h] [bp-34h] BYREF
_BYTE v104[16]; // [sp+BCh] [bp-28h] BYREF
_DWORD v105[4]; // [sp+CCh] [bp-18h] BYREF
FLAlertLayer::incrementForcePrio(this);
v105[0] = -1778384896;
v74 = cocos2d::CCLayerColor::initWithColor(this, v105);
if ( v74 )
{
v4 = *(_DWORD *)this;
*((_DWORD *)this + 132) = a2;
(*(void (__fastcall **)(CustomSongLayer *, int))(v4 + 500))(this, 1);
v5 = (cocos2d::CCDirector *)(*(int (__fastcall **)(CustomSongLayer *, int))(*(_DWORD *)this + 536))(this, 1);
cocos2d::CCDirector::sharedDirector(v5);
WinSize = (cocos2d::CCLayer *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v80);
v7 = cocos2d::CCLayer::create(WinSize);
v8 = *(_DWORD *)this;
*((_DWORD *)this + 115) = v7;
(*(void (__fastcall **)(CustomSongLayer *, int))(v8 + 228))(this, v7);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v105, 0.0, 0.0, 40.0, 40.0);
v9 = cocos2d::extension::CCScale9Sprite::create("GJ_button_05.png", v105);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v9 + 456))(v9, 255);
v10 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v9 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v105, 440.0, 290.0);
v10(v9, v105);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v9, -1);
v11 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v9 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, v80 * 0.5, v81 * 0.5);
v11(v9, v105);
*((_DWORD *)this + 125) = -1;
v13 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Custom Song Selection", "goldFont.fnt", v12);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v13 + 80))(v13, 1065353216);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 115) + 228))(*((_DWORD *)this + 115), v13);
v14 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v13 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, v80 * 0.5, (float)((float)(v81 * 0.5) + 145.0) - 22.0);
v14(v13, v105);
v16 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v15);
v90 = 0;
v89 = CustomSongLayer::onClose;
v17 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v16, 0, (int)this, (int)CustomSongLayer::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v17, 1.6);
v18 = cocos2d::CCMenu::create(v17, nullptr);
v19 = v81;
v20 = (float)(v80 * 0.5) - 220.0;
*((_DWORD *)this + 111) = v18;
v21 = v18;
v22 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v18 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, v20 + 10.0, (float)((float)(v19 * 0.5) + 145.0) - 10.0);
v22(v21, v105);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
*((_DWORD *)this + 111),
10);
v24 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_savedSongsBtn_001.png", v23);
v92 = 0;
v91 = CustomSongLayer::onSongBrowser;
v25 = CCMenuItemSpriteExtra::create(v24, 0, (int)this, (int)CustomSongLayer::onSongBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v25, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v25);
v26 = *((const cocos2d::CCPoint **)this + 111);
v27 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v25 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v104,
(float)((float)(v80 * 0.5) + 220.0) - 24.0,
(float)((float)((float)(v81 * 0.5) - 145.0) + 24.0) + 2.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v26);
v27(v25, v105);
v29 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_ncsLibraryBtn_001.png", v28);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v29 + 80))(v29, 1067030938);
v94 = 0;
v93 = CustomSongLayer::onNCSBrowser;
v30 = CCMenuItemSpriteExtra::create(v29, 0, (int)this, (int)CustomSongLayer::onNCSBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v30, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v30);
v31 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v30 + 92);
v75 = *((cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v104, (float)(v80 * 0.5) + 105.0, (float)(v81 * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v75);
v31(v30, v105);
v33 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_musicLibraryBtn_001.png", v32);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v33 + 80))(v33, 1067030938);
v96 = 0;
v95 = CustomSongLayer::onMusicBrowser;
v34 = CCMenuItemSpriteExtra::create(v33, 0, (int)this, (int)CustomSongLayer::onMusicBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v34, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v34);
v35 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v34 + 92);
v76 = *((cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v104, v80 * 0.5, (float)(v81 * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v76);
v35(v34, v105);
v37 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_ngBtn_001.png", v36);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v37 + 80))(v37, 1067030938);
v98 = 0;
v97 = CustomSongLayer::onNewgroundsBrowser;
v38 = CCMenuItemSpriteExtra::create(v37, 0, (int)this, (int)CustomSongLayer::onNewgroundsBrowser, 0);
CCMenuItemSpriteExtra::setSizeMult(v38, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v38);
v39 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v38 + 92);
v77 = *((cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v104, (float)(v80 * 0.5) - 105.0, (float)(v81 * 0.5) + 55.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v77);
v39(v38, v105);
v40 = *((_DWORD *)this + 132);
if ( v40 && (*(int (__fastcall **)(int))(*(_DWORD *)v40 + 12))(v40) )
{
v63 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_createLinesBtn_001.png", v41);
v100 = 0;
v99 = CustomSongLayer::onCreateLines;
v64 = CCMenuItemSpriteExtra::create(v63, 0, (int)this, (int)CustomSongLayer::onCreateLines, 0);
CCMenuItemSpriteExtra::setSizeMult(v25, 1.2);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v64);
v65 = *((const cocos2d::CCPoint **)this + 111);
v66 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v64 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v104,
(float)((float)(v80 * 0.5) - 220.0) + 24.0,
(float)((float)((float)(v81 * 0.5) - 145.0) + 24.0) + 2.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v65);
v66(v64, v105);
}
v42 = *((_DWORD *)this + 132);
if ( v42 && (*(int (__fastcall **)(int))(*(_DWORD *)v42 + 12))(v42) )
{
v67 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_optionsBtn02_001.png", v43);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v67 + 80))(v67, 1061997773);
v102 = 0;
v101 = CustomSongLayer::onOptions;
v68 = CCMenuItemSpriteExtra::create(v67, 0, (int)this, (int)CustomSongLayer::onOptions, 0);
CCMenuItemSpriteExtra::setSizeMult(v68, 2.0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v68);
v69 = *((const cocos2d::CCPoint **)this + 111);
v70 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v68 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v104,
(float)((float)(v80 * 0.5) + 220.0) - 27.0,
(float)((float)(v81 * 0.5) + 145.0) - 27.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v105, v69);
v70(v68, v105);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v104, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (float)(v80 * 0.5) - 42.0, (float)(v81 * 0.5) - 20.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v105, (const cocos2d::CCRect *)v104);
v44 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v105);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v44 + 456))(v44, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v83, 210.0, 35.0);
(*(void (__fastcall **)(int, float *))(*(_DWORD *)v44 + 160))(v44, v83);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v44, -1);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v44 + 92))(v44, v82);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v105, (const cocos2d::CCRect *)v104);
v45 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v105);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v45 + 456))(v45, 40);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v84, 7.0, 6.0);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v85, v83[0] - v84[0], v83[1] - v84[1]);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v45 + 160))(v45, v85);
(*(void (__fastcall **)(_DWORD, int, _DWORD))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v45, 0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v45 + 92))(v45, v82);
v46 = CCTextInputNode::create(
(CCTextInputNode *)0x43520000,
50.0,
"Enter song ID",
"Thonburi",
(const char *)&dword_18,
"bigFont.fnt",
v71);
*((_DWORD *)this + 133) = v46;
(*(void (__fastcall **)(_DWORD, int *, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v46, 20);
*(_DWORD *)(*((_DWORD *)this + 133) + 420) = (char *)this + 440;
v47 = *((_DWORD *)this + 133);
v48 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v88, -95.0, 0.0);
cocos2d::CCPoint::operator+(v105, v82, v88);
v48(v47, v105);
v49 = *(_DWORD *)(*((_DWORD *)this + 133) + 416);
v50 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v49 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, 0.0, 0.5);
v50(v49, v105);
v51 = *(_DWORD *)(*((_DWORD *)this + 133) + 428);
v52 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v51 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v105, 0.0, 0.5);
v52(v51, v105);
CCTextInputNode::setMaxLabelScale(*((_DWORD *)this + 133), 0.7);
CCTextInputNode::setMaxLabelWidth(*((_DWORD *)this + 133), 210.0);
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 133) + 416) + 172))(
*(_DWORD *)(*((_DWORD *)this + 133) + 416),
0);
*(_DWORD *)(*((_DWORD *)this + 133) + 424) = 15;
v53 = *((_DWORD *)this + 133);
memset(v103, 0, sizeof(v103));
std::string::__init(v103, "0123456789-", 0xBu);
CCTextInputNode::setAllowedChars(v53, (unsigned __int8 *)v103);
std::string::~string((int)v103);
LOWORD(v79) = -21896;
BYTE2(v79) = -16;
CCTextInputNode::setLabelPlaceholderColor(*((_DWORD *)this + 133), v79);
CCTextInputNode::setLabelPlaceholderScale(*((_DWORD *)this + 133), 0.5);
CCTextInputNode::forceOffset(*((_DWORD *)this + 133));
v54 = ButtonSprite::create(
(ButtonSprite *)"Search",
(const char *)&word_32,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_04.png",
(const char *)0x420C0000,
v72);
v105[1] = 0;
v105[0] = CustomSongLayer::onSearch;
v55 = CCMenuItemSpriteExtra::create((int)v54, 0, (int)this, (int)CustomSongLayer::onSearch, 0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v55);
v56 = *((const cocos2d::CCPoint **)this + 111);
v78 = *(cocos2d::CCPoint **)(*(_DWORD *)v55 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v86, 155.0, 0.0);
cocos2d::CCPoint::operator+(v87, v82, v86);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v88, v56);
((void (__fastcall *)(int, _BYTE *))v78)(v55, v88);
v57 = (SongInfoObject *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 132) + 4))(*((_DWORD *)this + 132));
if ( v57 )
v57 = SongInfoObject::create(v57, v58);
v59 = CustomSongWidget::create(
v57,
*((SongInfoObject **)this + 132),
(CustomSongDelegate *)((char *)&dword_0 + 1),
(bool)&dword_0 + 1,
1,
0,
0,
0,
0,
0,
0,
v73);
*((_DWORD *)this + 134) = v59;
(*(void (__fastcall **)(_DWORD, cocos2d::CCNode *, int))(**((_DWORD **)this + 115) + 232))(
*((_DWORD *)this + 115),
v59,
2);
v60 = *((_DWORD *)this + 134);
v61 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v60 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v88, v80 * 0.5, (float)((float)(v81 * 0.5) - 145.0) + 50.0);
v61(v60, v88);
CustomSongWidget::getSongInfoIfUnloaded(*((_DWORD *)this + 134));
}
return v74;
}