//
// SongOptionsLayer::init from 0x1401656a0 to 0x1401660c3 (2595 bytes)
//
// 2 xrefs:
// > CustomSongLayer::onOptions @ 0x1401649f6
// > ??> @ 0x140917f00
//
// 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:27 +0000
//
// Hidden C++ exception states: #wind=3
bool __fastcall SongOptionsLayer::init(__int64 a1, __int64 a2)
{
bool result; // al
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
__int64 *v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
size_t v11; // r15
__int64 v12; // rbx
__int64 v13; // rax
struct cocos2d::CCLabelBMFont *v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rax
unsigned __int8 v18; // r14
__int64 v19; // rdi
__int64 v20; // rsi
float *v21; // rax
float *v22; // rbx
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rbx
__int64 v26; // rdi
float *v27; // rax
__int64 v28; // rax
__int64 v29; // rbx
__int64 v30; // rdi
float *v31; // rax
int v32; // eax
cocos2d::CCObject *v33; // rsi
__int64 v34; // rdi
__int64 v35; // rbx
__int64 v36; // rax
__int64 v37; // rax
int v38; // eax
cocos2d::CCObject *v39; // rsi
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
__int64 v43; // rax
struct cocos2d::CCLabelBMFont *v44; // rbx
__int64 v45; // rax
__int64 v46; // rax
_QWORD *v47; // rbx
__int64 v48; // rdx
void (__fastcall *v49)(_QWORD *, __int64); // r8
__int64 v50; // rdx
__int64 v51; // rcx
char *v52; // rax
__int64 v53; // rcx
__int64 v54; // rcx
__int64 v55; // rcx
__int64 v56; // rcx
__int64 v57; // rax
cocos2d::CCString *v58; // rax
const char *CString; // rax
int v60; // eax
cocos2d::CCObject *v61; // rax
__int64 *v62; // rsi
__int64 v63; // rdi
__int64 v64; // rbx
__int64 v65; // rax
__int64 v66; // rax
__int64 *v67; // [rsp+80h] [rbp-80h] BYREF
__int64 v68; // [rsp+88h] [rbp-78h] BYREF
__int64 v69; // [rsp+90h] [rbp-70h]
__int64 v70; // [rsp+98h] [rbp-68h]
__int64 v71; // [rsp+A0h] [rbp-60h]
__int128 *v72; // [rsp+A8h] [rbp-58h] BYREF
__int128 v73; // [rsp+B0h] [rbp-50h] BYREF
__int64 v74; // [rsp+C0h] [rbp-40h]
__int64 v75; // [rsp+C8h] [rbp-38h]
_BYTE v76[4]; // [rsp+D0h] [rbp-30h] BYREF
float v77; // [rsp+D4h] [rbp-2Ch]
_BYTE v78[8]; // [rsp+D8h] [rbp-28h] BYREF
_BYTE v79[8]; // [rsp+E0h] [rbp-20h] BYREF
_BYTE v80[8]; // [rsp+E8h] [rbp-18h] BYREF
_BYTE v81[112]; // [rsp+F0h] [rbp-10h] BYREF
float v82; // [rsp+1B0h] [rbp+B0h] BYREF
float v83; // [rsp+1B4h] [rbp+B4h]
char v84; // [rsp+1B8h] [rbp+B8h] BYREF
float v85; // [rsp+1BCh] [rbp+BCh]
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
*(_QWORD *)(a1 + 664) = a2;
v6 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6, &v82);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v68, 0.0, 0.0, 80.0, 80.0);
v8 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v7);
v9 = *v8;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v67, 360.0, 220.0);
(*(void (__fastcall **)(__int64 *, __int64))(v9 + 312))(v8, v10);
v11 = -1;
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v8,
0xFFFFFFFFLL);
v12 = *v8;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v67, v82 * 0.5, v83 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v12 + 184))(v8, v13);
v14 = cocos2d::CCLabelBMFont::create("Settings", (const char *)&qword_140704F78);
v15 = *(_QWORD *)v14;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v67, v82 * 0.5, (float)((float)(v83 * 0.5) + 110.0) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v15 + 184))(v14, v16);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v14);
v17 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v17;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v17, 10);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, (float)(v82 * 0.5) - 140.0, (float)(v83 * 0.5) - 40.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v79, (float)(v82 * 0.5) + 30.0, v77);
v67 = &v68;
v69 = 0;
v70 = 7;
v71 = 15;
v68 = 0x6E692065646146LL;
v18 = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 664) + 24LL))(*(_QWORD *)(a1 + 664)) + 348);
v19 = *(_QWORD *)(a1 + 584);
v20 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 8.0, 0.0);
v22 = v21;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, (const struct cocos2d::CCPoint *)v76);
GameToolbox::createToggleButton(
(const char *)&v68,
(__int64)SongOptionsLayer::onFadeIn,
v18,
v20,
v23,
a1,
v19,
0.80000001,
0.60000002,
150.0,
v22,
(const char *)&qword_140704F78,
0,
0,
nullptr);
v72 = &v73;
v74 = 8;
v75 = 15;
v73 = 0x74756F2065646146uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 0.0, 0.0);
cocos2d::CCPoint::operator+(v79, &v67, v24);
LOBYTE(v20) = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 664) + 24LL))(*(_QWORD *)(a1 + 664))
+ 349);
v25 = *(_QWORD *)(a1 + 584);
v26 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 8.0, 0.0);
GameToolbox::createToggleButton(
(const char *)&v73,
(__int64)SongOptionsLayer::onFadeOut,
v20,
v26,
(__int64)&v67,
a1,
v25,
0.80000001,
0.60000002,
150.0,
v27,
(const char *)&qword_140704F78,
0,
0,
nullptr);
v68 = (__int64)&v73;
*((_QWORD *)&v73 + 1) = 29797;
v74 = 10;
v75 = 15;
*(_QWORD *)&v73 = 0x73655220746E6F44LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, 0.0, -40.0);
cocos2d::CCPoint::operator+(v76, &v67, v28);
LOBYTE(v20) = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 664) + 24LL))(*(_QWORD *)(a1 + 664))
+ 350);
v29 = *(_QWORD *)(a1 + 584);
v30 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v78, 8.0, 0.0);
GameToolbox::createToggleButton(
(const char *)&v73,
(__int64)SongOptionsLayer::onSongPersistent,
v20,
v30,
(__int64)&v67,
a1,
v29,
0.80000001,
0.60000002,
150.0,
v31,
(const char *)&qword_140704F78,
0,
0,
nullptr);
v32 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v33 = CCMenuItemSpriteExtra::create(v32, 0, a1, (__int64)SongOptionsLayer::onClose);
*((_DWORD *)v33 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v33);
v34 = *(_QWORD *)v33;
v35 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v68,
(float)((float)(v82 * 0.5) - 180.0) + 5.0,
(float)((float)(v83 * 0.5) + 110.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v35, &v72, v36);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v34 + 184))(v33, v37);
v38 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
v39 = CCMenuItemSpriteExtra::create(v38, 0, a1, (__int64)SongOptionsLayer::onInfo);
*((_DWORD *)v39 + 93) = 0x40000000;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v39);
v40 = *(_QWORD *)v39;
v41 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v68,
(float)((float)(v82 * 0.5) + 180.0) - 17.0,
(float)((float)(v83 * 0.5) + 110.0) - 17.0);
cocos2d::CCNode::convertToNodeSpace(v41, &v72, v42);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v40 + 184))(v39, v43);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v84, v82 * 0.5, (float)(v83 * 0.5) + 25.0);
v44 = cocos2d::CCLabelBMFont::create("Start Offset", (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v44 + 160LL))(v44);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, 0.0, 25.0);
cocos2d::CCPoint::operator+(&v84, &v67, v45);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64 **))(*(_QWORD *)v44 + 184LL))(v44, &v67);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v44);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v81, 0.0, 0.0, 40.0, 40.0);
v46 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v68, (const struct cocos2d::CCRect *)v81);
v47 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02_small.png", v46);
v48 = v47[40];
v49 = *(void (__fastcall **)(_QWORD *, __int64))(v48 + 40);
LOBYTE(v48) = 100;
v49(v47 + 40, v48);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v80, 100.0, 30.0);
(*(void (__fastcall **)(_QWORD *, _BYTE *))(*v47 + 312LL))(v47, v80);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v47,
0xFFFFFFFFLL);
(*(void (__fastcall **)(_QWORD *, char *))(*v47 + 184LL))(v47, &v84);
v52 = CCTextInputNode::create(v51, v50, (__int64)"Seconds");
*(_QWORD *)(a1 + 672) = v52;
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v52, 20);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 672) + 184LL))(*(_QWORD *)(a1 + 672), &v84);
v53 = *(_QWORD *)(a1 + 672);
*(_DWORD *)(v53 + 564) = 1060320051;
CCTextInputNode::refreshLabel(v53);
v54 = *(_QWORD *)(a1 + 672);
*(_DWORD *)(v54 + 560) = 1128792064;
CCTextInputNode::refreshLabel(v54);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 672) + 592LL) + 336LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 672) + 592LL),
0);
*(_DWORD *)(*(_QWORD *)(a1 + 672) + 608LL) = 5;
v70 = 11;
v71 = 15;
v68 = 0x3736353433323130LL;
v69 = 3029304;
CCTextInputNode::setAllowedChars(*(_QWORD *)(a1 + 672), (void **)&v68);
v55 = *(_QWORD *)(a1 + 672);
*(_WORD *)(v55 + 572) = -21896;
*(_BYTE *)(v55 + 574) = -16;
CCTextInputNode::refreshLabel(v55);
v56 = *(_QWORD *)(a1 + 672);
*(_DWORD *)(v56 + 568) = 1056964608;
CCTextInputNode::refreshLabel(v56);
if ( *(float *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 664) + 24LL))(*(_QWORD *)(a1 + 664)) + 344) > 0.0 )
{
v57 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 664) + 24LL))(*(_QWORD *)(a1 + 664));
v58 = cocos2d::CCString::createWithFormat("%0.1f", *(float *)(v57 + 344));
CString = cocos2d::CCString::getCString(v58);
v73 = 0;
v74 = 0;
v75 = 0;
do
++v11;
while ( CString[v11] );
sub_14003D230(&v73, CString, v11);
CCTextInputNode::setString(*(_QWORD **)(a1 + 672), &v73);
}
v60 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_playMusicBtn_001.png");
v61 = CCMenuItemSpriteExtra::create(v60, 0, a1, (__int64)SongOptionsLayer::onPlayback);
*(_QWORD *)(a1 + 680) = v61;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v61);
v62 = *(__int64 **)(a1 + 680);
v63 = *v62;
v64 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v68, (float)(v82 * 0.5) + 100.0, v85);
cocos2d::CCNode::convertToNodeSpace(v64, &v72, v65);
(*(void (__fastcall **)(__int64 *, __int64))(v63 + 184))(v62, v66);
return 1;
}
return result;
}