//
// SetupSongTriggerPopup::init from 0x1002d3180 to 0x1002d3bca (2634 bytes)
//
// 1 xrefs:
// > SetupSongTriggerPopup::create @ 0x1002d3132
//
// 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 SetupSongTriggerPopup::init(SetupSongTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
int v4; // r14d
cocos2d::CCPoint v5; // xmm0_8
SongSelectNode *v6; // rax
CustomSongWidget *m_songWidget; // r14
cocos2d::CCSprite *v8; // r12
CCMenuItemSpriteExtra *v9; // r13
cocos2d::CCMenu *m_buttonMenu; // r14
cocos2d::CCSprite *v11; // r14
CCMenuItemSpriteExtra *v12; // r14
cocos2d::CCMenu *v13; // r15
MusicDownloadManager *v14; // rax
float v15; // xmm0_4
unsigned __int64 v16; // [rsp+38h] [rbp-168h] BYREF
char v17; // [rsp+40h] [rbp-160h] BYREF
char v18[15]; // [rsp+41h] [rbp-15Fh] BYREF
void *v19; // [rsp+50h] [rbp-150h]
__int128 v20; // [rsp+58h] [rbp-148h] BYREF
void *v21; // [rsp+68h] [rbp-138h]
char v22; // [rsp+70h] [rbp-130h] BYREF
char v23[15]; // [rsp+71h] [rbp-12Fh] BYREF
void *v24; // [rsp+80h] [rbp-120h]
__int128 v25; // [rsp+88h] [rbp-118h] BYREF
void *v26; // [rsp+98h] [rbp-108h]
__int128 v27; // [rsp+A0h] [rbp-100h] BYREF
void *v28; // [rsp+B0h] [rbp-F0h]
__int128 v29; // [rsp+B8h] [rbp-E8h] BYREF
void *v30; // [rsp+C8h] [rbp-D8h]
char v31; // [rsp+D0h] [rbp-D0h] BYREF
_BYTE v32[23]; // [rsp+D1h] [rbp-CFh] BYREF
char v33; // [rsp+E8h] [rbp-B8h] BYREF
_BYTE v34[23]; // [rsp+E9h] [rbp-B7h] BYREF
char v35; // [rsp+100h] [rbp-A0h] BYREF
char v36[15]; // [rsp+101h] [rbp-9Fh] BYREF
void *v37; // [rsp+110h] [rbp-90h]
char v38; // [rsp+118h] [rbp-88h] BYREF
char v39[15]; // [rsp+119h] [rbp-87h] BYREF
void *v40; // [rsp+128h] [rbp-78h]
__int128 v41; // [rsp+130h] [rbp-70h] BYREF
void *v42; // [rsp+140h] [rbp-60h]
unsigned __int64 v43; // [rsp+14Ch] [rbp-54h] BYREF
float v44; // [rsp+154h] [rbp-4Ch] BYREF
float v45; // [rsp+158h] [rbp-48h]
unsigned __int64 v46; // [rsp+15Ch] [rbp-44h] BYREF
unsigned __int64 v47; // [rsp+164h] [rbp-3Ch] BYREF
bool v48; // [rsp+16Fh] [rbp-31h]
unsigned __int64 v49[6]; // [rsp+170h] [rbp-30h] BYREF
double v50; // 0:xmm0_8.8
double v51; // 0:xmm0_8.8
result = SetupTriggerPopup::init(a1, a2, a3, 440.0, 300.0, 1);
if ( result )
{
v48 = result;
SetupTriggerPopup::preSetup(a1);
v33 = 24;
strcpy(v34, "Song Trigger");
SetupTriggerPopup::addTitle((__int64)a1, (__int64)&v33);
if ( (v33 & 1) != 0 )
operator delete(*(void **)&v34[15]);
v17 = 8;
strcpy(v18, "Help");
v21 = operator new(0x1E0u);
*(_QWORD *)&v20 = 481;
*((_QWORD *)&v20 + 1) = 472;
strcpy(
(char *)v21,
"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((__int64)a1, (__int64)&v17, &v20, (__m128)0x3F800000u);
if ( (v20 & 1) != 0 )
operator delete(v21);
if ( (v17 & 1) != 0 )
operator delete(v19);
v22 = 4;
strcpy(v23, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (__int64)&v22);
if ( (v22 & 1) != 0 )
operator delete(v24);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v44);
sub_10028CBE0((float *)&v43, v44 * 0.5, v45 * 0.5);
LOBYTE(v25) = 8;
strcpy((char *)&v25 + 1, "Prep");
sub_10028CBE0((float *)v49, (float)(a1->m_width * 0.5) + -130.0, (float)(a1->m_height * 0.5) + -20.0);
sub_10028CCE0((double *)&v46, &v43, v49);
SetupTriggerPopup::createToggleValueControl((int)a1, 399, &v25, 1.0, (__int64)&v46, 0, 0, 0);
if ( (v25 & 1) != 0 )
operator delete(v26);
LOBYTE(v27) = 18;
strcpy((char *)&v27 + 1, "Load\nPrep");
sub_10028CBE0((float *)v49, (float)(a1->m_width * 0.5) + -60.0, (float)(a1->m_height * 0.5) + -20.0);
sub_10028CCE0((double *)&v46, &v43, v49);
SetupTriggerPopup::createToggleValueControl((int)a1, 400, &v27, 1.0, (__int64)&v46, 0, 0, 2);
if ( (v27 & 1) != 0 )
operator delete(v28);
v4 = (int)((float (__fastcall *)(SetupSongTriggerPopup *, __int64))a1->getValue)(a1, 392);
v5 = (cocos2d::CCPoint)LODWORD(v44);
v5.x = v44 * 0.5;
sub_10028CBE0((float *)&v46, v44 * 0.5, (float)(v45 * 0.5) + 55.0);
v6 = SongSelectNode::create(
v4,
1,
nullptr,
Custom,
v5,
(cocos2d::CCNode *)&v46,
(cocos2d::CCMenu *)a1->m_mainLayer,
(bool)a1->m_buttonMenu);
a1->m_selectNode = v6;
((void (__fastcall *)(cocos2d::CCLayer *, SongSelectNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v6,
5);
m_songWidget = a1->m_selectNode->m_songWidget;
m_songWidget->m_playbackDelegate = &a1->SongPlaybackDelegate;
FMODAudioEngine::sharedEngine();
v5.x = ((float (__fastcall *)(SetupSongTriggerPopup *, __int64))a1->getValue)(a1, 404);
v5.x = FMODAudioEngine::pitchForIdx((int)v5.x);
CustomSongWidget::updateLengthMod(m_songWidget, v5.x);
SetupTriggerPopup::addObjectsToGroup(a1, a1->m_selectNode->m_selectSongObjects, 1);
SetupTriggerPopup::addObjectsToGroup(a1, a1->m_selectNode->m_changeSongObjects, 1);
sub_10028CBE0((float *)&v46, v44 * 0.5, (float)(0.5 * v45) + 10.0);
v35 = 14;
strcpy(v36, "Volume:");
sub_10028CBE0((float *)&v47, -91.0, -39.0);
sub_10028CCE0((double *)v49, &v46, &v47);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
406,
(__int64)&v35,
(float *)v49,
0,
Float,
0.64999998,
0.0,
2.0,
6,
0,
0,
0,
1,
2,
0);
if ( (v35 & 1) != 0 )
operator delete(v37);
v38 = 12;
strcpy(v39, "Speed:");
sub_10028CBE0((float *)&v47, 91.0, -39.0);
sub_10028CCE0((double *)v49, &v46, &v47);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
404,
(__int64)&v38,
(float *)v49,
0,
Int,
0.64999998,
-12.0,
12.0,
6,
0,
0,
0,
1,
2,
0);
if ( (v38 & 1) != 0 )
operator delete(v40);
SetupTriggerPopup::toggleLimitValue(a1, 404, 1);
SetupTriggerPopup::toggleLimitValue(a1, 406, 1);
LOBYTE(v29) = 8;
strcpy((char *)&v29 + 1, "Loop");
sub_10028CBE0((float *)&v47, 38.0, -93.0);
sub_10028CCE0((double *)v49, &v46, &v47);
SetupTriggerPopup::createToggleValueControl((int)a1, 413, &v29, 1.0, (__int64)v49, 0, 0, 0);
if ( (v29 & 1) != 0 )
operator delete(v30);
LOBYTE(v41) = 20;
strcpy((char *)&v41 + 1, "Dont\nReset");
sub_10028CBE0((float *)&v47, 118.0, -93.0);
sub_10028CCE0((double *)v49, &v46, &v47);
SetupTriggerPopup::createToggleValueControl((int)a1, 595, &v41, 1.0, (__int64)v49, 0, 0, 0);
if ( (v41 & 1) != 0 )
operator delete(v42);
v31 = 16;
strcpy(v32, "Channel:");
sub_10028CBE0((float *)&v47, -108.0, -93.0);
sub_10028CCE0((double *)v49, &v46, &v47);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
432,
(__int64)&v31,
(float *)v49,
1,
Uint,
0.64999998,
0.0,
4.0,
10,
1,
0,
2,
0,
2,
0);
if ( (v31 & 1) != 0 )
operator delete(*(void **)&v32[15]);
SetupTriggerPopup::toggleLimitValue(a1, 432, 1);
SetupAudioTriggerPopup::addTimeControls(a1, 1, -25.0);
v8 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v8->setScale)(v8, 0.60000002);
v9 = CCMenuItemSpriteExtra::create(
v8,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SetupSongTriggerPopup::onSavePlaybackPos);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v9->setTag)(v9, 0);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0((float *)&v16, -185.0, -25.0);
sub_10028CCE0((double *)&v47, &v43, &v16);
*(cocos2d::CCPoint *)&v50 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v49,
(const cocos2d::CCPoint *)m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))v9->setPosition)(v9, v49, v50);
SetupTriggerPopup::addObjectToPage(a1, v9, 1);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v11->setScale)(v11, 0.60000002);
v12 = CCMenuItemSpriteExtra::create(
v11,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SetupSongTriggerPopup::onSavePlaybackPos);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v12->setTag)(v12, 1);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v12);
v13 = a1->m_buttonMenu;
sub_10028CBE0((float *)&v16, -185.0, -64.0);
sub_10028CCE0((double *)&v47, &v43, &v16);
*(cocos2d::CCPoint *)&v51 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)v49,
(const cocos2d::CCPoint *)v13);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))v12->setPosition)(v12, v49, v51);
SetupTriggerPopup::addObjectToPage(a1, v12, 1);
v14 = MusicDownloadManager::sharedState();
MusicDownloadManager::addMusicDownloadDelegate(v14, &a1->MusicDownloadDelegate);
SetupSongTriggerPopup::updateSongTimeSlider(a1);
SetupTriggerPopup::createPageButtons(a1, (float)(a1->m_width * 0.5) + 15.0, 1);
if ( ((float (__fastcall *)(SetupSongTriggerPopup *, __int64))a1->getValue)(a1, 400) == 0.0 )
{
v15 = ((float (__fastcall *)(SetupSongTriggerPopup *, __int64))a1->getValue)(a1, 427);
SetupTriggerPopup::goToPage(a1, (int)v15, 0);
}
else
{
SetupTriggerPopup::hideAll(a1);
((void (__fastcall *)(SetupSongTriggerPopup *, __int64, __int64))a1->toggleGroup)(a1, 2, 1);
}
SetupTriggerPopup::postSetup(a1);
return v48;
}
return result;
}