//
// CreateGuidelinesLayer::init from 0x10050b3b0 to 0x10050c1da (3626 bytes)
//
// 2 xrefs:
// > CreateGuidelinesLayer::create @ 0x10050b36b
// > FindBPMLayer::init @ 0x10050d6cc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall CreateGuidelinesLayer::init(CreateGuidelinesLayer *a1, CustomSongDelegate *a2, AudioGuidelinesType a3)
{
bool inited; // bl
cocos2d::CCDirector *v6; // rsi
cocos2d::CCArray *v7; // rax
cocos2d::CCArray *v8; // rdi
cocos2d::CCArray *v9; // rax
cocos2d::CCMenu *v10; // rax
cocos2d::extension::CCScale9Sprite *v11; // r12
const std::string::value_type *v12; // rsi
const char *data; // rdi
cocos2d::CCLabelBMFont *v14; // r12
cocos2d::CCLabelBMFont *v15; // r13
cocos2d::CCTintTo *v16; // r15
cocos2d::CCTintTo *v17; // rax
cocos2d::CCSequence *v18; // rax
cocos2d::CCRepeatForever *v19; // rax
char *v20; // r13
unsigned __int64 *v21; // r15
char *v22; // r13
unsigned __int64 *v23; // r15
ButtonSprite *v24; // rax
CCMenuItemSpriteExtra *v25; // r12
cocos2d::CCMenu *m_buttonMenu; // r13
cocos2d::CCLabelBMFont *v27; // r12
cocos2d::extension::CCScale9Sprite *v28; // r12
CCTextInputNode *v29; // rax
CCTextInputNode *m_offsetInput; // rdi
ButtonSprite *v31; // rax
CCMenuItemSpriteExtra *v32; // r12
cocos2d::CCMenu *v33; // r13
ButtonSprite *v34; // rax
CCMenuItemSpriteExtra *v35; // r12
cocos2d::CCMenu *v36; // r13
cocos2d::CCLabelBMFont *v37; // r12
cocos2d::CCSprite *v38; // r12
cocos2d::CCSprite *v39; // rax
CCMenuItemSpriteExtra *v40; // r12
cocos2d::CCMenu *v41; // r13
cocos2d::CCSprite *v42; // rax
CCMenuItemSpriteExtra *v43; // r15
cocos2d::CCMenu *v44; // r12
__int128 v46; // [rsp+0h] [rbp-120h] BYREF
void *__p; // [rsp+10h] [rbp-110h]
__int128 v48; // [rsp+20h] [rbp-100h] BYREF
void *v49; // [rsp+30h] [rbp-F0h]
std::string v50; // [rsp+40h] [rbp-E0h] BYREF
unsigned __int64 v51; // [rsp+58h] [rbp-C8h] BYREF
std::string v52; // [rsp+60h] [rbp-C0h] BYREF
std::string v53; // [rsp+80h] [rbp-A0h] BYREF
std::string v54; // [rsp+A0h] [rbp-80h] BYREF
__m128 v55; // [rsp+BCh] [rbp-64h] BYREF
AudioGuidelinesType v56; // [rsp+CCh] [rbp-54h]
float v57; // [rsp+D0h] [rbp-50h] BYREF
float v58; // [rsp+D8h] [rbp-48h] BYREF
unsigned __int64 v59[2]; // [rsp+E0h] [rbp-40h] BYREF
float v60; // [rsp+F0h] [rbp-30h] BYREF
float v61; // [rsp+F4h] [rbp-2Ch]
double v62; // 0:xmm0_8.8
double v63; // 0:xmm0_8.8
double v64; // 0:xmm0_8.8
double v65; // 0:xmm0_8.8
double v66; // 0:xmm0_8.8
double v67; // 0:xmm0_8.8
cocos2d::CCRect v68; // 0:xmm0_8.8,8:xmm1_8.8
cocos2d::CCRect v69; // 0:xmm0_8.8,8:xmm1_8.8
inited = FLAlertLayer::init_1(a1, 75);
if ( !inited )
return inited;
a1->m_delegate = a2;
v6 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v62 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v60);
v7 = (cocos2d::CCArray *)sub_10071F9E0(&v60, v6);
a1->m_nonRecordingObjects = v7;
v8 = v7;
cocos2d::CCObject::retain(v7);
v9 = (cocos2d::CCArray *)sub_10071F9E0(v8, v6);
a1->m_recordingObjects = v9;
cocos2d::CCObject::retain(v9);
v10 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v10;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64, double))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
10,
v62);
v68.origin = 0;
v68.size = 0;
sub_10028CC00((__int64)&v54, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v11 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v68);
sub_10028CBF0((float *)&v54, 440.0, 290.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v11->setContentSize)(v11, &v54);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v11,
0xFFFFFFFFLL);
sub_10028CBE0((float *)&v54, v60 * 0.5, v61 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v11->setPosition)(v11, &v54);
memset(&v54, 0, sizeof(v54));
memset(&v53, 0, sizeof(v53));
memset(&v52, 0, sizeof(v52));
v56 = a3;
if ( a3 == BPMFinder )
{
std::string::assign(&v54, "BPM Finder");
std::string::assign(&v53, "- Find the BPM of a song.\n- Tap to the beat.\n- Recording starts on first tap.");
v12 = "- Tap on the screen to the beat.\n- Tap on the stop button to finish.";
}
else
{
std::string::assign(&v54, "Guideline Creator");
std::string::assign(
&v53,
"- Create guidelines for custom songs.\n"
"- Each tap will be shown as a line in the editor.\n"
"- Multiple recordings will be merged into one.\n"
"- Use the clear button to reset the guidelines.");
v12 = "- Tap on the screen to create markers.\n- Tap on the stop button to finish.";
}
std::string::assign(&v52, v12);
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
data = v54.__r_.__value_.__l.__data_;
else
data = v54.__r_.__value_.__s.__data_;
v14 = cocos2d::CCLabelBMFont::create_3(data, "bigFont.fnt");
sub_10028CBE0((float *)v59, v60 * 0.5, (float)((float)(v61 * 0.5) + 145.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v14->setPosition)(v14, v59);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v14);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v14->setScale)(v14, 0.80000001);
sub_10071FCD0(a1->m_nonRecordingObjects, v14);
v15 = cocos2d::CCLabelBMFont::create_3("•Recording•", "bigFont.fnt");
sub_10028CBE0((float *)v59, v60 * 0.5, (float)((float)(0.5 * v61) + 145.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v15->setPosition)(v15, v59);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v15);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v15->setScale)(v15, 0.80000001);
sub_10071FCD0(a1->m_recordingObjects, v15);
BYTE2(v59[0]) = 0;
LOWORD(v59[0]) = -26881;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v15->setColor)(v15, v59);
v16 = cocos2d::CCTintTo::create(1.0, 0xFFu, 0x64u, 0);
v17 = cocos2d::CCTintTo::create(1.0, 0xFFu, 0x96u, 0);
v18 = sub_1003B5760(v16, v17, 0);
v19 = cocos2d::CCRepeatForever::create(v18);
cocos2d::CCNode::runAction(v15, v19);
if ( (*(_BYTE *)&v53.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v46, v53.__r_.__value_.__l.__data_, v53.__r_.__value_.__l.__size_, COERCE_DOUBLE(1065353216));
}
else
{
__p = v53.__r_.__value_.__l.__data_;
v46 = *(_OWORD *)&v53.__r_.__value_.__l.0;
}
sub_10028CBE0((float *)v59, 0.0, 1.0);
v20 = TextArea::create(&v46, (__int64)"goldFont.fnt", (double *)v59, 0, 1.0, 9999.0, 28.0);
if ( (v46 & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v20 + 160LL))(v20, 0.5);
sub_10028CBE0((float *)v59, 0.0, 1.0);
(*(void (__fastcall **)(char *, unsigned __int64 *))(*(_QWORD *)v20 + 280LL))(v20, v59);
((void (__fastcall *)(cocos2d::CCLayer *, char *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v20);
v21 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v14->getPosition)(v14);
sub_10028CBE0(v55.f32, -155.0, -20.0);
sub_10028CCE0((double *)v59, v21, (unsigned __int64 *)&v55);
(*(void (__fastcall **)(char *, unsigned __int64 *))(*(_QWORD *)v20 + 184LL))(v20, v59);
sub_10071FCD0(a1->m_nonRecordingObjects, v20);
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v48, v52.__r_.__value_.__l.__data_, v52.__r_.__value_.__l.__size_, COERCE_DOUBLE(3273326592LL));
}
else
{
v49 = v52.__r_.__value_.__l.__data_;
v48 = *(_OWORD *)&v52.__r_.__value_.__l.0;
}
sub_10028CBE0((float *)v59, 0.0, 1.0);
v22 = TextArea::create(&v48, (__int64)"goldFont.fnt", (double *)v59, 0, 1.0, 9999.0, 28.0);
if ( (v48 & 1) != 0 )
operator delete(v49);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.5);
sub_10028CBE0((float *)v59, 0.0, 1.0);
(*(void (__fastcall **)(char *, unsigned __int64 *))(*(_QWORD *)v22 + 280LL))(v22, v59);
((void (__fastcall *)(cocos2d::CCLayer *, char *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v22);
v23 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v14->getPosition)(v14);
sub_10028CBE0(v55.f32, -155.0, -20.0);
sub_10028CCE0((double *)v59, v23, (unsigned __int64 *)&v55);
(*(void (__fastcall **)(char *, unsigned __int64 *))(*(_QWORD *)v22 + 184LL))(v22, v59);
sub_10071FCD0(a1->m_recordingObjects, v22);
if ( v56 != BPMFinder )
{
v24 = sub_100092A60("Clear", 100, 0, 0, 0.60000002);
v25 = CCMenuItemSpriteExtra::create(
v24,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)CreateGuidelinesLayer::onClearGuidelines);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v25);
sub_10071FCD0(a1->m_nonRecordingObjects, v25);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0(v55.f32, (float)(v60 * 0.5) + -75.0, v61 * 0.5);
*(cocos2d::CCPoint *)&v63 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v59,
(const cocos2d::CCPoint *)m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))v25->setPosition)(v25, v59, v63);
}
sub_10028CBE0((float *)&v51, (float)(v60 * 0.5) + 75.0, 0.5 * v61);
v27 = cocos2d::CCLabelBMFont::create_3("Start Offset", "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v27->setScale)(v27, 0.40000001);
sub_10028CBE0(v55.f32, 0.0, 25.0);
sub_10028CCE0((double *)v59, &v51, (unsigned __int64 *)&v55);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, unsigned __int64 *))v27->setPosition)(v27, v59);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v27);
sub_10071FCD0(a1->m_nonRecordingObjects, v27);
v69.size = 0;
sub_10028CC00((__int64)v59, 0.0, 0.0, (__m128)0x42200000u, (__m128)0x42200000u);
*(double *)&v69.origin = sub_10028D180(&v55, v59);
v28 = cocos2d::extension::CCScale9Sprite::create_2("square02_small.png", v69);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v28->setOpacity)(v28, 100);
sub_10028CBF0(v55.f32, 100.0, 30.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __m128 *))v28->setContentSize)(v28, &v55);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v28,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned __int64 *))v28->setPosition)(v28, &v51);
sub_10071FCD0(a1->m_nonRecordingObjects, v28);
v29 = CCTextInputNode::create(100.0, 50.0, "Seconds", "Thonburi", 24, "bigFont.fnt");
a1->m_offsetInput = v29;
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v29,
20);
((void (__fastcall *)(CCTextInputNode *, unsigned __int64 *))a1->m_offsetInput->setPosition)(a1->m_offsetInput, &v51);
CCTextInputNode::setMaxLabelScale(a1->m_offsetInput, 0.69999999);
CCTextInputNode::setMaxLabelWidth(a1->m_offsetInput, 200.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))a1->m_offsetInput->m_textField->setVisible)(
a1->m_offsetInput->m_textField,
0);
m_offsetInput = a1->m_offsetInput;
m_offsetInput->m_maxLabelLength = 3;
v50.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)22;
strcpy(v50.__r_.__value_.__s.__data_, "0123456789.");
CCTextInputNode::setAllowedChars((std::string *)m_offsetInput, &v50);
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v50.__r_.__value_.__l.__data_);
CCTextInputNode::setLabelPlaceholderColor(a1->m_offsetInput, (cocos2d::ccColor3B)-1004936);
CCTextInputNode::setLabelPlaceholderScale(a1->m_offsetInput, 0.5);
sub_10071FCD0(a1->m_nonRecordingObjects, a1->m_offsetInput);
v31 = sub_100092BF0("Record", 120, 0, 1, "bigFont.fnt", "GJ_button_01.png", 0.80000001);
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, a1, (cocos2d::SEL_MenuHandler)0x541uLL);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v32);
sub_10071FCD0(a1->m_nonRecordingObjects, v32);
v33 = a1->m_buttonMenu;
sub_10028CBE0(&v57, v60 * 0.5, (float)((float)(v61 * 0.5) + -145.0) + 50.0);
*(cocos2d::CCPoint *)&v64 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v58,
(const cocos2d::CCPoint *)v33);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float *, double))v32->setPosition)(v32, &v58, v64);
v34 = sub_100092BF0("Stop", 100, 0, 0, "bigFont.fnt", "GJ_button_02.png", 0.60000002);
v35 = CCMenuItemSpriteExtra::create(
v34,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)CreateGuidelinesLayer::onStop);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v35);
sub_10071FCD0(a1->m_recordingObjects, v35);
v36 = a1->m_buttonMenu;
sub_10028CBE0(&v57, (float)((float)(v60 * 0.5) + 220.0) + -40.0, (float)((float)(v61 * 0.5) + 145.0) + -25.0);
*(cocos2d::CCPoint *)&v65 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v58,
(const cocos2d::CCPoint *)v36);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float *, double))v35->setPosition)(v35, &v58, v65);
v37 = cocos2d::CCLabelBMFont::create_3("", "bigFont.fnt");
a1->m_infoLabel = v37;
sub_10028CBE0(&v58, v60 * 0.5, (float)((float)(0.5 * v61) + -145.0) + 90.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float *))v37->setPosition)(v37, &v58);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
a1->m_infoLabel);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_infoLabel->setScale)(a1->m_infoLabel, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_infoLabel->setColor)(a1->m_infoLabel, &unk_10081E220);
sub_10071FCD0(a1->m_nonRecordingObjects, a1->m_infoLabel);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("d_ball_01_001.png");
a1->m_circleSprite = v38;
sub_10028CBE0(&v58, (float)((float)(v60 * 0.5) + -220.0) + 30.0, (float)((float)(v61 * 0.5) + 145.0) + -30.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v38->setPosition)(v38, &v58);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_circleSprite->setScale)(a1->m_circleSprite, 0.80000001);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
a1->m_circleSprite);
sub_10071FCD0(a1->m_recordingObjects, a1->m_circleSprite);
v39 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v40 = CCMenuItemSpriteExtra::create(v39, nullptr, a1, (cocos2d::SEL_MenuHandler)0x519uLL);
CCMenuItemSpriteExtra::setSizeMult(v40, 1.5);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v40);
sub_10071FCD0(a1->m_nonRecordingObjects, v40);
v41 = a1->m_buttonMenu;
sub_10028CBE0(&v57, (float)((float)(v60 * 0.5) + -220.0) + 10.0, (float)((float)(v61 * 0.5) + 145.0) + -10.0);
*(cocos2d::CCPoint *)&v66 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v58,
(const cocos2d::CCPoint *)v41);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float *, double))v40->setPosition)(v40, &v58, v66);
if ( v56 != BPMFinder )
{
v42 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
v43 = CCMenuItemSpriteExtra::create(v42, nullptr, a1, (cocos2d::SEL_MenuHandler)0x539uLL);
CCMenuItemSpriteExtra::setSizeMult(v43, 2.0);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v43);
v44 = a1->m_buttonMenu;
sub_10028CBE0(&v57, (float)((float)(v60 * 0.5) + 220.0) + -17.0, (float)((float)(0.5 * v61) + 145.0) + -17.0);
*(cocos2d::CCPoint *)&v67 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v58,
(const cocos2d::CCPoint *)v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float *, double))v43->setPosition)(v43, &v58, v67);
sub_10071FCD0(a1->m_nonRecordingObjects, v43);
}
CreateGuidelinesLayer::toggleItems(a1, 0);
if ( (*(_BYTE *)&v52.__r_.__value_.__s.0 & 1) == 0 )
{
if ( (*(_BYTE *)&v53.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_26;
LABEL_30:
operator delete(v53.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) == 0 )
return inited;
goto LABEL_27;
}
operator delete(v52.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v53.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_30;
LABEL_26:
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
LABEL_27:
operator delete(v54.__r_.__value_.__l.__data_);
return inited;
}