//
// SetupSongTriggerPopup::init from 0x1405f25c0 to 0x1405f3116 (2902 bytes)
//
// 2 xrefs:
// > SetupSongTriggerPopup::create @ 0x1405f2575
// > ??> @ 0x14092f354
//
// 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:35:06 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupSongTriggerPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
_QWORD *v6; // r8
_OWORD *v7; // rcx
const char *v8; // rax
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rsi
__int64 v15; // rdi
float v16; // xmm7_4
float v17; // xmm6_4
int v18; // ebx
const struct cocos2d::CCPoint *v19; // rax
cocos2d::CCNode *v20; // rax
struct cocos2d::CCArray *v21; // rbx
cocos2d::CCArray *GroupContainer; // rax
struct cocos2d::CCArray *v23; // rbx
cocos2d::CCArray *v24; // rax
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rax
__int64 v28; // rax
__int64 v29; // rax
__int64 v30; // rdx
struct cocos2d::CCSprite *v31; // rax
struct cocos2d::CCObject *v32; // rdi
__int64 v33; // rax
__int64 v34; // rbx
__int64 v35; // rax
cocos2d::CCArray *PageContainer; // rax
struct cocos2d::CCSprite *v37; // rax
struct cocos2d::CCObject *v38; // rdi
__int64 v39; // rax
__int64 v40; // rbx
__int64 v41; // rax
cocos2d::CCArray *v42; // rax
__int64 v43; // rcx
__int64 v44; // r8
float v45; // xmm0_4
__int64 v46; // r8
__int64 v47; // [rsp+80h] [rbp-88h]
__int64 v48; // [rsp+80h] [rbp-88h]
__int128 v49; // [rsp+88h] [rbp-80h] BYREF
__int64 v50; // [rsp+98h] [rbp-70h]
__int64 v51; // [rsp+A0h] [rbp-68h]
__int128 *v52; // [rsp+A8h] [rbp-60h] BYREF
__int128 *v53; // [rsp+B0h] [rbp-58h] BYREF
__int128 v54; // [rsp+B8h] [rbp-50h] BYREF
__int64 v55; // [rsp+C8h] [rbp-40h]
__int64 v56; // [rsp+D0h] [rbp-38h]
float v57; // [rsp+D8h] [rbp-30h] BYREF
float v58; // [rsp+DCh] [rbp-2Ch]
_BYTE v59[8]; // [rsp+E0h] [rbp-28h] BYREF
_BYTE v60[96]; // [rsp+E8h] [rbp-20h] BYREF
__int128 *v61; // [rsp+180h] [rbp+78h] BYREF
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1133903872, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
v50 = 12;
v51 = 15;
strcpy((char *)&v49, "Song Trigger");
BYTE13(v49) = 0;
HIWORD(v49) = 0;
SetupTriggerPopup::addTitle(a1, &v49);
v61 = &v49;
v49 = 0;
v50 = 0;
v51 = 0;
v6 = sub_14003D460(0x1E0u);
*(_QWORD *)&v49 = v6;
v50 = 472;
v51 = 479;
v7 = v6;
v8 = "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. U"
"se this option on a trigger to prepare the song before you want it to start, and then use Load Prep whe"
"n you want it to start. Note that only one Prep can be active at a time per channel.";
v9 = 3;
do
{
*v7 = *(_OWORD *)v8;
v7[1] = *((_OWORD *)v8 + 1);
v7[2] = *((_OWORD *)v8 + 2);
v7[3] = *((_OWORD *)v8 + 3);
v7[4] = *((_OWORD *)v8 + 4);
v7[5] = *((_OWORD *)v8 + 5);
v7[6] = *((_OWORD *)v8 + 6);
v7 += 8;
*(v7 - 1) = *((_OWORD *)v8 + 7);
v8 += 128;
--v9;
}
while ( v9 );
*v7 = *(_OWORD *)v8;
v7[1] = *((_OWORD *)v8 + 1);
v7[2] = *((_OWORD *)v8 + 2);
v7[3] = *((_OWORD *)v8 + 3);
v7[4] = *((_OWORD *)v8 + 4);
*((_QWORD *)v7 + 10) = *((_QWORD *)v8 + 10);
*((_BYTE *)v6 + 472) = 0;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Help");
SetupTriggerPopup::addHelpButton(a1, &v54, &v49);
v54 = 0;
v55 = 2;
v56 = 15;
strcpy((char *)&v54, "OK");
SetupTriggerPopup::addCloseButton(a1, &v54);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v57);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, v57 * 0.5, v58 * 0.5);
v52 = &v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Prep");
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v53,
(float)(*((float *)a1 + 183) * 0.5) - 130.0,
(float)(*((float *)a1 + 184) * 0.5) - 20.0);
cocos2d::CCPoint::operator+(v60, &v61, v12);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
399,
(unsigned int)&v54,
(unsigned int)&v61,
0,
0,
0,
1065353216);
v53 = &v49;
*((_QWORD *)&v49 + 1) = 112;
v50 = 9;
v51 = 15;
*(_QWORD *)&v49 = 0x6572500A64616F4CLL;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v52,
(float)(*((float *)a1 + 183) * 0.5) - 60.0,
(float)(*((float *)a1 + 184) * 0.5) - 20.0);
cocos2d::CCPoint::operator+(v60, &v61, v13);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
400,
(unsigned int)&v49,
(unsigned int)&v61,
0,
0,
2,
1065353216);
v14 = *((_QWORD *)a1 + 69);
v15 = *((_QWORD *)a1 + 73);
v16 = (float)(v58 * 0.5) + 55.0;
v17 = v57 * 0.5;
v18 = (int)(*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 392);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v61, v17, v16);
v20 = SongSelectNode::create(v18, 1u, 0, 1, v19, v15, v14, 1);
*((_QWORD *)a1 + 128) = v20;
(*(void (__fastcall **)(_QWORD, cocos2d::CCNode *, __int64))(**((_QWORD **)a1 + 73) + 456LL))(
*((_QWORD *)a1 + 73),
v20,
5);
*(_QWORD *)(*(_QWORD *)(*((_QWORD *)a1 + 128) + 416LL) + 520LL) = a1 + 1016;
SetupSongTriggerPopup::updateLength(a1);
v21 = *(struct cocos2d::CCArray **)(*((_QWORD *)a1 + 128) + 360LL);
GroupContainer = (cocos2d::CCArray *)SetupTriggerPopup::getGroupContainer(a1, 1);
cocos2d::CCArray::addObjectsFromArray(GroupContainer, v21);
v23 = *(struct cocos2d::CCArray **)(*((_QWORD *)a1 + 128) + 376LL);
v24 = (cocos2d::CCArray *)SetupTriggerPopup::getGroupContainer(a1, 1);
cocos2d::CCArray::addObjectsFromArray(v24, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v57 * 0.5, (float)(v58 * 0.5) + 10.0);
v53 = &v49;
v50 = 7;
v51 = 15;
v49 = 0x3A656D756C6F56uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -91.0, -39.0);
cocos2d::CCPoint::operator+(v59, &v61, v25);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
406,
(unsigned int)&v49,
(unsigned int)&v61,
1059481190,
0,
1,
6,
0,
0,
0x40000000,
0,
0,
1,
2,
0);
v53 = &v49;
v49 = 0;
v50 = 6;
v51 = 15;
strcpy((char *)&v49, "Speed:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 91.0, -39.0);
cocos2d::CCPoint::operator+(v59, &v61, v26);
LOBYTE(v47) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
404,
(unsigned int)&v49,
(unsigned int)&v61,
1059481190,
0,
2,
6,
0,
-1052770304,
1094713344,
0,
0,
1,
2,
v47);
LODWORD(v61) = 404;
*(_BYTE *)sub_14016EE40((__int64 *)a1 + 107, (int *)&v61) = 1;
LODWORD(v61) = 406;
*(_BYTE *)sub_14016EE40((__int64 *)a1 + 107, (int *)&v61) = 1;
v53 = &v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Loop");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 38.0, -93.0);
cocos2d::CCPoint::operator+(v59, &v61, v27);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
413,
(unsigned int)&v54,
(unsigned int)&v61,
0,
0,
0,
1065353216);
v53 = &v49;
*((_QWORD *)&v49 + 1) = 29797;
v50 = 10;
v51 = 15;
*(_QWORD *)&v49 = 0x7365520A746E6F44LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 118.0, -93.0);
cocos2d::CCPoint::operator+(v59, &v61, v28);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
595,
(unsigned int)&v49,
(unsigned int)&v61,
0,
0,
0,
1065353216);
v53 = &v54;
v55 = 8;
v56 = 15;
v54 = *(unsigned __int64 *)"Channel:";
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -108.0, -93.0);
cocos2d::CCPoint::operator+(v59, &v61, v29);
LOBYTE(v48) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
432,
(unsigned int)&v54,
(unsigned int)&v61,
1059481190,
1,
3,
10,
1,
0,
1082130432,
0,
2,
0,
2,
v48);
LODWORD(v61) = 432;
*(_BYTE *)sub_14016EE40((__int64 *)a1 + 107, (int *)&v61) = 1;
SetupAudioTriggerPopup::addTimeControls((__int64)a1, v30, -25.0);
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
LODWORD(v23) = (_DWORD)v31;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v31 + 160LL))(v31);
v32 = CCMenuItemSpriteExtra::create((int)v23, 0, (int)a1, (__int64)SetupSongTriggerPopup::onSavePlaybackPos);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v32 + 64LL))(v32, 0);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**((_QWORD **)a1 + 69) + 464LL))(
*((_QWORD *)a1 + 69),
v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -185.0, -25.0);
cocos2d::CCPoint::operator+(v60, &v61, v33);
v34 = *(_QWORD *)v32;
cocos2d::CCNode::convertToNodeSpace(*((_QWORD *)a1 + 69), &v52, &v61);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v34 + 184))(v32, v35);
PageContainer = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(PageContainer, v32);
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
LODWORD(v34) = (_DWORD)v37;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v37 + 160LL))(v37);
v38 = CCMenuItemSpriteExtra::create(v34, 0, (int)a1, (__int64)SetupSongTriggerPopup::onSavePlaybackPos);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v38 + 64LL))(v38, 1);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**((_QWORD **)a1 + 69) + 464LL))(
*((_QWORD *)a1 + 69),
v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -185.0, -64.0);
cocos2d::CCPoint::operator+(v60, &v61, v39);
v40 = *(_QWORD *)v38;
cocos2d::CCNode::convertToNodeSpace(*((_QWORD *)a1 + 69), &v52, &v61);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v40 + 184))(v38, v41);
v42 = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(v42, v38);
v43 = qword_14090C070;
if ( !qword_14090C070 )
{
v61 = (__int128 *)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v61);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v43 = qword_14090C070;
}
MusicDownloadManager::addMusicDownloadDelegate(v43, (__int64)(a1 + 1008));
SetupSongTriggerPopup::updateSongTimeSlider(a1);
SetupTriggerPopup::createPageButtons(a1);
if ( (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 400) == 0.0 )
{
v45 = (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 427);
SetupTriggerPopup::goToPage(a1, (unsigned int)(int)v45, 0);
}
else
{
LOBYTE(v44) = 1;
SetupTriggerPopup::goToPage(a1, 0, v44);
LOBYTE(v46) = 1;
(*(void (__fastcall **)(_BYTE *, __int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 2, v46);
}
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}