//
// SetupSongTriggerPopup::init from 0x5251bc to 0x52581a (1630 bytes)
//
// 1 xrefs:
// > SetupSongTriggerPopup::create @ 0x5259d2
//
// 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 SetupSongTriggerPopup::init(SetupSongTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
float v5; // s17
SongSelectNode *v6; // r0
cocos2d::CCSprite *v7; // r8
CCMenuItemSpriteExtra *v8; // r8
cocos2d::CCSprite *v9; // r8
CCMenuItemSpriteExtra *v10; // r7
cocos2d::CCMenu *v11; // r11
MusicDownloadManager *v12; // r0
float v13; // r0
cocos2d::CCPoint v15; // [sp+0h] [bp-94h]
bool v16; // [sp+10h] [bp-84h]
_BOOL4 v17; // [sp+34h] [bp-60h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+38h] [bp-5Ch]
void (__fastcall *v19)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+38h] [bp-5Ch]
cocos2d::CCMenu *m_buttonMenu; // [sp+44h] [bp-50h]
cocos2d::CCSize v21; // [sp+4Ch] [bp-48h] BYREF
cocos2d::CCPoint v22; // [sp+54h] [bp-40h] BYREF
cocos2d::CCPoint v23; // [sp+5Ch] [bp-38h] BYREF
cocos2d::CCPoint v24; // [sp+64h] [bp-30h] BYREF
cocos2d::CCPoint v25; // [sp+6Ch] [bp-28h] BYREF
cocos2d::CCPoint v26; // [sp+74h] [bp-20h] BYREF
cocos2d::CCPoint v27; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCPoint v28; // [sp+84h] [bp-10h] BYREF
v17 = SetupTriggerPopup::init(a1, a2, a3, 440.0, 300.0, 1);
if ( v17 )
{
SetupTriggerPopup::preSetup(a1);
sub_776584((int)&v28, "Song Trigger");
SetupTriggerPopup::addTitle(a1, (std::string)&v28);
sub_774008(&v28);
sub_776584((int)&v27, "Help");
sub_776584(
(int)&v28,
"Lets you start a specified song.\n"
"A single track can be active in each Channel at a time.\n"
"Start, End, FadeIn, and FadeOut are in milliseconds.\n"
"Prep is used to ensure exact sync to a specified time as there may be some delay loading it normally. Use "
"this option on a trigger to prepare the song before you want it to start, and then use Load Prep when you "
"want it to start. Note that only one Prep can be active at a time per channel.");
SetupTriggerPopup::addHelpButton(a1, (std::string)&v27, (std::string)&v28, 1.0);
sub_774008(&v28);
sub_774008(&v27);
sub_776584((int)&v28, "OK");
SetupTriggerPopup::addCloseButton(a1, (std::string)&v28);
sub_774008(&v28);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v21, v4);
cocos2d::CCPoint::CCPoint(&v22, v21.width * 0.5, v21.height * 0.5);
sub_776584((int)&v26, "Prep");
cocos2d::CCPoint::CCPoint(&v27, (float)(a1->m_width * 0.5) - 130.0, (float)(a1->m_height * 0.5) - 20.0);
cocos2d::CCPoint::operator+(&v28, &v22, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 399, (int)&v26, (int)&v28, 0, 0, 0, 1.0);
sub_774008(&v26);
sub_776584((int)&v26, "Load\nPrep");
cocos2d::CCPoint::CCPoint(&v27, (float)(a1->m_width * 0.5) - 60.0, (float)(a1->m_height * 0.5) - 20.0);
cocos2d::CCPoint::operator+(&v28, &v22, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 400, (int)&v26, (int)&v28, 0, 0, 2, 1.0);
sub_774008(&v26);
v5 = COERCE_FLOAT(((int (__fastcall *)(SetupSongTriggerPopup *, int))a1->getValue)(a1, 392));
cocos2d::CCPoint::CCPoint(&v28, v21.width * 0.5, (float)(v21.height * 0.5) + 55.0);
LODWORD(v15.x) = &v28;
LODWORD(v15.y) = a1->m_mainLayer;
v6 = SongSelectNode::create(
(int)v5,
1,
nullptr,
Custom,
v15,
a1->m_buttonMenu,
(cocos2d::CCMenu *)((char *)&dword_0 + 1),
v16);
a1->m_selectNode = v6;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v6, 5);
a1->m_selectNode->m_songWidget->m_playbackDelegate = &a1->SongPlaybackDelegate;
SetupSongTriggerPopup::updateLength(a1);
SetupTriggerPopup::addObjectsToGroup(a1, a1->m_selectNode->m_selectSongObjects, 1);
SetupTriggerPopup::addObjectsToGroup(a1, a1->m_selectNode->m_changeSongObjects, 1);
cocos2d::CCPoint::CCPoint(&v23, v21.width * 0.5, (float)(v21.height * 0.5) + 10.0);
sub_776584((int)&v26, "Volume:");
cocos2d::CCPoint::CCPoint(&v27, -91.0, -39.0);
cocos2d::CCPoint::operator+(&v28, &v23, &v27);
SetupTriggerPopup::createValueControlAdvanced(
(int)a1,
406,
(int)&v26,
(int)&v28,
0.65,
0,
1,
6,
0,
nullptr,
2.0,
0,
0,
1,
2,
0);
sub_774008(&v26);
sub_776584((int)&v26, "Speed:");
cocos2d::CCPoint::CCPoint(&v27, 91.0, -39.0);
cocos2d::CCPoint::operator+(&v28, &v23, &v27);
SetupTriggerPopup::createValueControlAdvanced(
(int)a1,
404,
(int)&v26,
(int)&v28,
0.65,
0,
2,
6,
0,
(cocos2d::CCFloat *)0xC1400000,
12.0,
0,
0,
1,
2,
0);
sub_774008(&v26);
SetupTriggerPopup::toggleLimitValue(a1, 404, 1);
SetupTriggerPopup::toggleLimitValue(a1, 406, 1);
sub_776584((int)&v26, "Loop");
cocos2d::CCPoint::CCPoint(&v27, 38.0, -93.0);
cocos2d::CCPoint::operator+(&v28, &v23, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 413, (int)&v26, (int)&v28, 0, 0, 0, 1.0);
sub_774008(&v26);
sub_776584((int)&v26, "Dont\nReset");
cocos2d::CCPoint::CCPoint(&v27, 118.0, -93.0);
cocos2d::CCPoint::operator+(&v28, &v23, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 595, (int)&v26, (int)&v28, 0, 0, 0, 1.0);
sub_774008(&v26);
sub_776584((int)&v26, "Channel:");
cocos2d::CCPoint::CCPoint(&v27, -108.0, -93.0);
cocos2d::CCPoint::operator+(&v28, &v23, &v27);
SetupTriggerPopup::createValueControlAdvanced(
(int)a1,
432,
(int)&v26,
(int)&v28,
0.65,
1,
3,
10,
1,
nullptr,
4.0,
0,
2,
0,
2,
0);
sub_774008(&v26);
SetupTriggerPopup::toggleLimitValue(a1, 432, 1);
SetupAudioTriggerPopup::addTimeControls(a1, 1, -25.0);
v7 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v7->setScale)(v7, 1058642330);
LODWORD(v27.x) = SetupSongTriggerPopup::onSavePlaybackPos;
v27.y = 0.0;
v8 = CCMenuItemSpriteExtra::create(
v7,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupSongTriggerPopup::onSavePlaybackPos, (unsigned int)a1));
v8->setTag(v8, 0);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v8);
setPosition = v8->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v25, -185.0, -25.0);
cocos2d::CCPoint::operator+(&v26, &v22, &v25);
cocos2d::CCNode::convertToNodeSpace(&v28, m_buttonMenu, &v26);
setPosition(v8, &v28);
SetupTriggerPopup::addObjectToPage(a1, v8, 1);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v9->setScale)(v9, 1058642330);
LODWORD(v28.x) = SetupSongTriggerPopup::onSavePlaybackPos;
v28.y = 0.0;
v10 = CCMenuItemSpriteExtra::create(
v9,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupSongTriggerPopup::onSavePlaybackPos, (unsigned int)a1));
v10->setTag(v10, 1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
v11 = a1->m_buttonMenu;
v19 = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v24, -185.0, -64.0);
cocos2d::CCPoint::operator+(&v25, &v22, &v24);
cocos2d::CCNode::convertToNodeSpace(&v26, v11, &v25);
v19(v10, &v26);
SetupTriggerPopup::addObjectToPage(a1, v10, 1);
v12 = MusicDownloadManager::sharedState();
MusicDownloadManager::addMusicDownloadDelegate(v12, &a1->MusicDownloadDelegate);
SetupSongTriggerPopup::updateSongTimeSlider(a1);
SetupTriggerPopup::createPageButtons(a1, (float)(a1->m_width * 0.5) + 15.0, 1);
if ( a1->getValue(a1, 400) == 0.0 )
{
v13 = a1->getValue(a1, 427);
SetupTriggerPopup::goToPage(a1, (int)v13, 0);
}
else
{
SetupSongTriggerPopup::updateApplyPrepare(a1, 1);
}
SetupTriggerPopup::postSetup(a1);
}
return v17;
}