//
// SetupSongTriggerPopup::init from 0x9a9fb0 to 0x9aabf0 (3136 bytes)
//
// 2 xrefs:
// > SetupSongTriggerPopup::create @ 0x9aadd8
// > ??> @ 0xa9710
//
// 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)
{
bool v4; // w26
void *v6; // x0
void *v7; // x0
void *v8; // x0
void *v9; // x0
cocos2d::CCDirector *v10; // x0
float v11; // s2
void *v12; // x0
float v13; // s2
void *v14; // x0
float v15; // s9
SongSelectNode *v16; // x0
cocos2d::CCLayer *m_mainLayer; // x3
float v18; // s3
float v19; // s4
void *v20; // x0
float v21; // s3
float v22; // s4
void *v23; // x0
float v24; // s2
void *v25; // x0
float v26; // s2
void *v27; // x0
float v28; // s3
float v29; // s4
void *v30; // x0
cocos2d::CCSprite *v31; // x23
CCMenuItemSpriteExtra *v32; // x23
CCMenuItemSpriteExtra_vtbl *v33; // x1
cocos2d::CCSprite *v34; // x23
CCMenuItemSpriteExtra *v35; // x23
cocos2d::CCMenu *v36; // x28
void (__fastcall *v37)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
MusicDownloadManager *v38; // x0
float v39; // s0
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x1
int v61; // w2
int v62; // [xsp+18h] [xbp-18h]
__int64 v63; // [xsp+18h] [xbp-18h]
__int64 v64; // [xsp+18h] [xbp-18h]
char v65; // [xsp+20h] [xbp-10h]
__int64 v66; // [xsp+20h] [xbp-10h]
__int64 v67; // [xsp+20h] [xbp-10h]
cocos2d::CCNode *v68[2]; // [xsp+30h] [xbp+0h] BYREF
cocos2d::CCNode *m_buttonMenu; // [xsp+A0h] [xbp+70h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A8h] [xbp+78h]
float v71; // [xsp+B8h] [xbp+88h]
float v72; // [xsp+BCh] [xbp+8Ch]
cocos2d::CCPoint v73; // [xsp+C0h] [xbp+90h] BYREF
cocos2d::CCPoint v74; // [xsp+C8h] [xbp+98h] BYREF
cocos2d::CCPoint v75; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v76; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v77; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v78; // 0:kr08_8.8
cocos2d::CCPoint v79; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v80; // 0:x2.16
cocos2d::SEL_MenuHandler v81; // 0:x2.16
cocos2d::CCPoint v82; // 0:s0.4,4:s1.4
cocos2d::CCPoint v83; // 0:s0.4,4:s1.4
cocos2d::CCPoint v84; // 0:s0.4,4:s1.4
cocos2d::CCPoint v85; // 0:s0.4,4:s1.4
cocos2d::CCPoint v86; // 0:s0.4,4:s1.4
cocos2d::CCPoint v87; // 0:s0.4,4:s1.4
cocos2d::CCPoint v88; // 0:s0.4,4:s1.4
cocos2d::CCPoint v89; // 0:s0.4,4:s1.4
v4 = SetupTriggerPopup::init(a1, a2, a3, 440.0, 300.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_D153B8((unsigned int)v68 + 176, "Song Trigger");
SetupTriggerPopup::addTitle(a1, (std::string)&v77);
v6 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v76, "Help");
sub_D153B8(
(unsigned int)v68 + 176,
"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)&v76, (std::string)&v77, 1.0);
v7 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v7);
}
v8 = (void *)(*(_QWORD *)&v76 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v76 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(*(_QWORD *)&v76 - 8LL);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(*(_QWORD *)&v76 - 8LL);
*(_DWORD *)(*(_QWORD *)&v76 - 8LL) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v8);
}
sub_D153B8((unsigned int)v68 + 176, "OK");
SetupTriggerPopup::addCloseButton(a1, (std::string)&v77);
v9 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v9);
}
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v10 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v10);
cocos2d::CCPoint::CCPoint(&v73, v71 * 0.5, v72 * 0.5);
sub_D153B8((unsigned int)v68 + 176, "Prep");
cocos2d::CCPoint::CCPoint(&v75, (float)(a1->m_width * 0.5) + -130.0, (float)(a1->m_height * 0.5) + -20.0);
cocos2d::CCPoint::operator+(&v76, &v73, &v75);
v82.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 399, (std::string)&v77, v82, (bool)&v76, 0, 0, v11);
v12 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v12);
}
sub_D153B8((unsigned int)v68 + 176, "Load\nPrep");
cocos2d::CCPoint::CCPoint(&v75, (float)(a1->m_width * 0.5) + -60.0, (float)(a1->m_height * 0.5) + -20.0);
cocos2d::CCPoint::operator+(&v76, &v73, &v75);
v83.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 400, (std::string)&v77, v83, (bool)&v76, 0, 0, v13);
v14 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v14);
}
v15 = a1->getValue(a1, 392);
cocos2d::CCPoint::CCPoint(&v77, v71 * 0.5, (float)(v72 * 0.5) + 55.0);
v16 = SongSelectNode::create(
(int)v15,
1,
nullptr,
Custom,
v84,
(cocos2d::CCNode *)&v77,
(cocos2d::CCMenu *)a1->m_mainLayer,
(bool)a1->m_buttonMenu);
m_mainLayer = a1->m_mainLayer;
a1->m_selectNode = v16;
m_mainLayer->addChild_0(m_mainLayer, v16, 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(&v74, v71 * 0.5, (float)(v72 * 0.5) + 10.0);
sub_D153B8((unsigned int)v68 + 176, "Volume:");
cocos2d::CCPoint::CCPoint(&v75, -91.0, -39.0);
cocos2d::CCPoint::operator+(&v76, &v74, &v75);
v85.y = 0.0;
v85.x = 0.65;
v62 = 2;
v65 = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
406,
(std::string)&v77,
v85,
2.0,
(bool)&v76,
(InputValueType)0,
1,
6,
v18,
v19,
0,
0,
GoldLabel,
1,
v62,
v65);
v20 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v20);
}
sub_D153B8((unsigned int)v68 + 176, "Speed:");
cocos2d::CCPoint::CCPoint(&v75, 91.0, -39.0);
cocos2d::CCPoint::operator+(&v76, &v74, &v75);
v86.x = 0.65;
LODWORD(v63) = 2;
LOBYTE(v66) = 0;
v86.y = -12.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
404,
(std::string)&v77,
v86,
12.0,
(bool)&v76,
(InputValueType)0,
2,
6,
v21,
v22,
0,
0,
GoldLabel,
1,
v63,
v66);
v23 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v23);
}
SetupTriggerPopup::toggleLimitValue(a1, 404, 1);
SetupTriggerPopup::toggleLimitValue(a1, 406, 1);
sub_D153B8((unsigned int)v68 + 176, "Loop");
cocos2d::CCPoint::CCPoint(&v75, 38.0, -93.0);
cocos2d::CCPoint::operator+(&v76, &v74, &v75);
v87.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 413, (std::string)&v77, v87, (bool)&v76, 0, 0, v24);
v25 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v25);
}
sub_D153B8((unsigned int)v68 + 176, "Dont\nReset");
cocos2d::CCPoint::CCPoint(&v75, 118.0, -93.0);
cocos2d::CCPoint::operator+(&v76, &v74, &v75);
v88.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 595, (std::string)&v77, v88, (bool)&v76, 0, 0, v26);
v27 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v27);
}
sub_D153B8((unsigned int)v68 + 176, "Channel:");
cocos2d::CCPoint::CCPoint(&v75, -108.0, -93.0);
cocos2d::CCPoint::operator+(&v76, &v74, &v75);
v89.x = 0.65;
v89.y = 0.0;
LODWORD(v64) = 2;
LOBYTE(v67) = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
432,
(std::string)&v77,
v89,
4.0,
(bool)&v76,
Float,
3,
10,
v28,
v29,
1,
0,
(GJInputStyle)2,
0,
v64,
v67);
v30 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v30);
}
SetupTriggerPopup::toggleLimitValue(a1, 432, 1);
SetupAudioTriggerPopup::addTimeControls(a1, 1, -25.0);
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
v31->setScale(v31, 0.6);
v80.adj = (size_t)SetupSongTriggerPopup::onSavePlaybackPos;
v80.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, v80);
v32->setTag(v32, 0);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v32);
v33 = v32->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_buttonMenu = a1->m_buttonMenu;
setPosition = v33->setPosition;
cocos2d::CCPoint::CCPoint(&v75, -185.0, -25.0);
cocos2d::CCPoint::operator+(&v76, &v73, &v75);
v78 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v76);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))setPosition)(
v32,
&v77,
v78.x,
v78.y);
SetupTriggerPopup::addObjectToPage(a1, v32, 1);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_pauseEditorBtn_001.png");
v34->setScale(v34, 0.6);
v81.adj = (size_t)SetupSongTriggerPopup::onSavePlaybackPos;
v81.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v35 = CCMenuItemSpriteExtra::create(v34, nullptr, v81);
v35->setTag(v35, 1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v35);
v36 = a1->m_buttonMenu;
v37 = v35->setPosition;
cocos2d::CCPoint::CCPoint(&v75, -185.0, -64.0);
cocos2d::CCPoint::operator+(&v76, &v73, &v75);
v79 = cocos2d::CCNode::convertToNodeSpace(v36, &v76);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v37)(v35, &v77, v79.x, v79.y);
SetupTriggerPopup::addObjectToPage(a1, v35, 1);
v38 = MusicDownloadManager::sharedState();
MusicDownloadManager::addMusicDownloadDelegate(v38, &a1->MusicDownloadDelegate);
SetupSongTriggerPopup::updateSongTimeSlider(a1);
SetupTriggerPopup::createPageButtons(a1, (float)(a1->m_width * 0.5) + 15.0, 1);
if ( a1->getValue(a1, 400) == 0.0 )
{
v39 = a1->getValue(a1, 427);
SetupTriggerPopup::goToPage(a1, (int)v39, 0);
}
else
{
SetupSongTriggerPopup::updateApplyPrepare(a1, 1);
}
SetupTriggerPopup::postSetup(a1);
}
return v4;
}