//
// SongOptionsLayer::init from 0x981574 to 0x981f2c (2488 bytes)
//
// 2 xrefs:
// > SongOptionsLayer::create @ 0x9820a0
// > ??> @ 0x9b9e0
//
// 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 SongOptionsLayer::init(CCTextInputNode **this, CustomSongDelegate *a2)
{
cocos2d::CCDirector *v4; // x0
unsigned int v5; // w25
cocos2d::CCDirector *v7; // x0
__int64 v8; // x21
void (__fastcall *v9)(__int64, __int64 *); // x27
void (__fastcall *v10)(__int64, __int64 *); // x27
const char *v11; // x2
__int64 v12; // x21
void (__fastcall *v13)(__int64, __int64 *); // x27
cocos2d::CCMenu *v14; // x0
__int64 v15; // x0
__int64 v16; // x28
__int64 v17; // x26
const char *v18; // x1
__int64 v19; // x0
__int64 v20; // x28
const char *v21; // x1
__int64 v22; // x0
__int64 v23; // x28
const char *v24; // x2
__int64 v25; // x28
__int64 v26; // x21
const char *v27; // x4
__int64 v28; // x0
__int64 v29; // x21
const char *v30; // x1
_QWORD *v31; // x21
__int64 v32; // x0
const char *v33; // x1
cocos2d::CCString *v34; // x0
const char *CString; // x0
size_t v36; // x0
__int64 v37; // x0
__int64 v38; // x0
__int64 v39; // x21
cocos2d::CCNode *v40; // x23
void (__fastcall *v41)(__int64, __int64 *); // x19
cocos2d::CCSize *v42; // [xsp+C8h] [xbp+98h]
cocos2d::CCNode *v43; // [xsp+D0h] [xbp+A0h]
cocos2d::CCNode *v44; // [xsp+D0h] [xbp+A0h]
cocos2d::CCNode *v45; // [xsp+D0h] [xbp+A0h]
cocos2d::CCNode *v46; // [xsp+D0h] [xbp+A0h]
cocos2d::CCNode *v47; // [xsp+D0h] [xbp+A0h]
unsigned __int8 v48; // [xsp+D8h] [xbp+A8h]
unsigned __int8 v49; // [xsp+D8h] [xbp+A8h]
unsigned __int8 v50; // [xsp+D8h] [xbp+A8h]
void (__fastcall *v51)(__int64, __int64 *); // [xsp+D8h] [xbp+A8h]
void (__fastcall *v52)(__int64, __int64 *); // [xsp+D8h] [xbp+A8h]
void (__fastcall *v53)(__int64, __int64 *); // [xsp+D8h] [xbp+A8h]
char *v54; // [xsp+D8h] [xbp+A8h]
int v55; // [xsp+E8h] [xbp+B8h]
__int64 v56; // [xsp+F0h] [xbp+C0h] BYREF
_BYTE v57[4]; // [xsp+F8h] [xbp+C8h] BYREF
float v58; // [xsp+FCh] [xbp+CCh]
_BYTE v59[8]; // [xsp+100h] [xbp+D0h] BYREF
_BYTE v60[4]; // [xsp+108h] [xbp+D8h] BYREF
float v61; // [xsp+10Ch] [xbp+DCh]
_BYTE v62[8]; // [xsp+110h] [xbp+E0h] BYREF
_BYTE v63[8]; // [xsp+118h] [xbp+E8h] BYREF
float v64[4]; // [xsp+120h] [xbp+F0h] BYREF
__int64 v65[2]; // [xsp+130h] [xbp+100h] BYREF
__int64 v66; // [xsp+140h] [xbp+110h] BYREF
__int64 v67; // [xsp+148h] [xbp+118h]
void *v68; // [xsp+150h] [xbp+120h]
v4 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init((FLAlertLayer *)this, 75);
v5 = (unsigned __int8)v4;
if ( (_BYTE)v4 )
{
*(this + 83) = a2;
v7 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(&v56, v7);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v65);
v9 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v8 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v65, 360.0, 220.0);
v9(v8, v65);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v8, 0xFFFFFFFFLL);
v10 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v8 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, *(float *)&v56 * 0.5, *((float *)&v56 + 1) * 0.5);
v10(v8, v65);
v12 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Settings", "bigFont.fnt", v11);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v65,
*(float *)&v56 * 0.5,
(float)((float)(*((float *)&v56 + 1) * 0.5) + 110.0) - 20.0);
v13(v12, v65);
v14 = (cocos2d::CCMenu *)(*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(
*(this + 73),
v12);
v15 = cocos2d::CCMenu::create(v14);
*(this + 69) = (CCTextInputNode *)v15;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v15, 10);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v57,
(float)(*(float *)&v56 * 0.5) + -140.0,
(float)(*((float *)&v56 + 1) * 0.5) + -40.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, (float)(*(float *)&v56 * 0.5) + 30.0, v58);
v66 = 0;
v67 = 0;
v68 = nullptr;
std::string::__init(&v66, "Fade in", 7u);
v48 = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 83) + 24LL))(*(this + 83)) + 348);
v43 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (const cocos2d::CCPoint *)v57);
v42 = *(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v66,
(const char *)SongOptionsLayer::onFadeIn,
0,
v48,
v43,
(const cocos2d::CCPoint *)v65,
(__int64)this,
(__int64)v42,
0.8,
0.6,
150.0,
v64,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v66 & 1) != 0 )
operator delete(v68);
v66 = 0;
v67 = 0;
v68 = nullptr;
std::string::__init(&v66, "Fade out", 8u);
v49 = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 83) + 24LL))(*(this + 83)) + 349);
v44 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, 0.0, 0.0);
cocos2d::CCPoint::operator+(v64, v59);
v16 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v66,
(const char *)SongOptionsLayer::onFadeOut,
0,
v49,
v44,
(const cocos2d::CCPoint *)v64,
(__int64)this,
v16,
0.8,
0.6,
150.0,
(float *)v65,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v66 & 1) != 0 )
operator delete(v68);
v66 = 0;
v67 = 0;
v68 = nullptr;
std::string::__init(&v66, "Dont Reset", 0xAu);
v50 = *(_BYTE *)((*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 83) + 24LL))(*(this + 83)) + 350);
v45 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, 0.0, -40.0);
cocos2d::CCPoint::operator+(v64, v57);
v17 = (__int64)*(this + 73);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, 8.0, 0.0);
GameToolbox::createToggleButton(
(__int64)&v66,
(const char *)SongOptionsLayer::onSongPersistent,
0,
v50,
v45,
(const cocos2d::CCPoint *)v64,
(__int64)this,
v17,
0.8,
0.6,
150.0,
(float *)v65,
"bigFont.fnt",
0,
0,
nullptr);
if ( (v66 & 1) != 0 )
operator delete(v68);
v19 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v18);
v20 = CCMenuItemSpriteExtra::create(v19, 0, (__int64)this, (__int64)SongOptionsLayer::onClose, 0);
CCMenuItemSpriteExtra::setSizeMult(v20, 1.5);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v20);
v51 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
v46 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v64,
(float)((float)(*(float *)&v56 * 0.5) + -180.0) + 5.0,
(float)((float)(*((float *)&v56 + 1) * 0.5) + 110.0) - 5.0);
cocos2d::CCNode::convertToNodeSpace(v65, v46, (const cocos2d::CCPoint *)v64);
v51(v20, v65);
v22 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_infoIcon_001.png", v21);
v23 = CCMenuItemSpriteExtra::create(v22, 0, (__int64)this, (__int64)SongOptionsLayer::onInfo, 0);
CCMenuItemSpriteExtra::setSizeMult(v23, 2.0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v23);
v52 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v23 + 184LL);
v47 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v64,
(float)((float)(*(float *)&v56 * 0.5) + 180.0) - 17.0,
(float)((float)(*((float *)&v56 + 1) * 0.5) + 110.0) - 17.0);
cocos2d::CCNode::convertToNodeSpace(v65, v47, (const cocos2d::CCPoint *)v64);
v52(v23, v65);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, *(float *)&v56 * 0.5, (float)(*((float *)&v56 + 1) * 0.5) + 25.0);
v25 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Start Offset", "bigFont.fnt", v24);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v25 + 160LL))(v25, 0.4);
v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v25 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, 0.0, 25.0);
cocos2d::CCPoint::operator+(v65, v60);
v53(v25, v65);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(*(this + 73), v25);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v64, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v65, (const cocos2d::CCRect *)v64);
v26 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v65);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v26 + 912LL))(v26, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v62, 100.0, 30.0);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v26 + 320LL))(v26, v62);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v26,
0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v26 + 184LL))(v26, v60);
v28 = CCTextInputNode::create(
(CCTextInputNode *)"Seconds",
100.0,
50.0,
"Thonburi",
(const char *)&off_18,
"bigFont.fnt",
v27);
*(this + 84) = (CCTextInputNode *)v28;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v28, 20);
(*(void (__fastcall **)(_QWORD, _BYTE *))(*(_QWORD *)*(this + 84) + 184LL))(*(this + 84), v60);
CCTextInputNode::setMaxLabelScale(*(this + 84), 0.7);
CCTextInputNode::setMaxLabelWidth(*(this + 84), 200.0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)*(this + 84) + 72) + 344LL))(
*((_QWORD *)*(this + 84) + 72),
0);
*((_DWORD *)*(this + 84) + 148) = 5;
v66 = 0;
v29 = (__int64)*(this + 84);
v67 = 0;
v68 = nullptr;
std::string::__init(&v66, "0123456789.", 0xBu);
CCTextInputNode::setAllowedChars(v29, (__int64)&v66);
if ( (v66 & 1) != 0 )
operator delete(v68);
LOWORD(v55) = -21896;
BYTE2(v55) = -16;
CCTextInputNode::setLabelPlaceholderColor((__int64)*(this + 84), v55);
CCTextInputNode::setLabelPlaceholderScale(*(this + 84), 0.5);
if ( *(float *)((*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 83) + 24LL))(*(this + 83)) + 344) > 0.0 )
{
v31 = *(this + 84);
v32 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)*(this + 83) + 24LL))(*(this + 83));
v34 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%0.1f",
v33,
*(float *)(v32 + 344));
CString = (const char *)cocos2d::CCString::getCString(v34);
v66 = 0;
v54 = (char *)CString;
v67 = 0;
v68 = nullptr;
v36 = strlen(CString);
std::string::__init(&v66, v54, v36);
CCTextInputNode::setString(v31, (char *)&v66);
if ( (v66 & 1) != 0 )
operator delete(v68);
}
v37 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_playMusicBtn_001.png", v30);
v38 = CCMenuItemSpriteExtra::create(v37, 0, (__int64)this, (__int64)SongOptionsLayer::onPlayback, 0);
*(this + 85) = (CCTextInputNode *)v38;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v38);
v39 = (__int64)*(this + 85);
v40 = *(this + 69);
v41 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, (float)(*(float *)&v56 * 0.5) + 100.0, v61);
cocos2d::CCNode::convertToNodeSpace(v65, v40, (const cocos2d::CCPoint *)v63);
v41(v39, v65);
}
return v5;
}