//
// SetupSFXEditPopup::init from 0xa419a8 to 0xa4288c (3812 bytes)
//
// 2 xrefs:
// > SetupSFXEditPopup::create @ 0xa42a64
// > ??> @ 0x427c8
//
// 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 SetupSFXEditPopup::init(SetupSFXEditPopup *a1, SFXTriggerGameObject *a2, cocos2d::CCArray *a3, bool a4)
{
_BOOL4 v4; // w28
bool v6; // w26
char *v8; // x1
void *v9; // x0
__int64 v10; // x2
__int64 v11; // x3
__int64 v12; // x4
__int64 v13; // x5
const char *v14; // x6
void *v15; // x0
void *v16; // x0
void *v17; // x0
cocos2d::CCDirector *v18; // x0
float v19; // s3
float v20; // s4
void *v21; // x0
float v22; // s3
float v23; // s4
void *v24; // x0
float v25; // s3
float v26; // s4
void *v27; // x0
float v28; // s3
float v29; // s4
void *v30; // x0
float v31; // s3
float v32; // s4
void *v33; // x0
float v34; // s3
float v35; // s4
void *v36; // x0
void *v37; // x0
void *v38; // x0
void *v39; // x0
void *v40; // x0
char *v41; // x21
unsigned int *v42; // x19
int v43; // w0
float v44; // s3
float v45; // s4
void *v46; // x0
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x1
int v58; // w2
unsigned int *v59; // x1
int v60; // w2
unsigned int *v61; // x1
int v62; // w2
unsigned int *v63; // x1
int v64; // w2
unsigned int *v65; // x1
int v66; // w2
unsigned int *v67; // x1
int v68; // w2
unsigned int *v69; // x1
int v70; // w2
unsigned int *v71; // x1
int v72; // w2
unsigned int *v73; // x1
int v74; // w2
unsigned int *v75; // x1
int v76; // w2
__int64 v77; // [xsp+30h] [xbp+0h] BYREF
char *v78; // [xsp+D0h] [xbp+A0h] BYREF
__int64 v79; // [xsp+D8h] [xbp+A8h] BYREF
__int64 v80; // [xsp+E0h] [xbp+B0h] BYREF
float v81; // [xsp+E8h] [xbp+B8h]
float v82; // [xsp+ECh] [xbp+BCh]
cocos2d::CCPoint v83; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::CCPoint v84; // [xsp+F8h] [xbp+C8h] BYREF
__int64 v85; // [xsp+100h] [xbp+D0h] BYREF
__int64 v86; // [xsp+108h] [xbp+D8h] BYREF
__int64 v87; // [xsp+110h] [xbp+E0h] BYREF
__int64 v88; // [xsp+118h] [xbp+E8h] BYREF
__int64 v89; // [xsp+120h] [xbp+F0h] BYREF
__int64 v90; // [xsp+128h] [xbp+F8h] BYREF
__int64 v91; // [xsp+130h] [xbp+100h] BYREF
__int64 v92; // [xsp+138h] [xbp+108h] BYREF
cocos2d::CCPoint v93; // [xsp+140h] [xbp+110h] BYREF
cocos2d::CCPoint v94; // [xsp+148h] [xbp+118h] BYREF
cocos2d::CCPoint v95; // [xsp+150h] [xbp+120h] BYREF
cocos2d::CCPoint v96; // 0:s0.4,4:s1.4
cocos2d::CCPoint v97; // 0:s0.4,4:s1.4
cocos2d::CCPoint v98; // 0:s0.4,4:s1.4
cocos2d::CCPoint v99; // 0:s0.4,4:s1.4
cocos2d::CCPoint v100; // 0:s0.4,4:s1.4
cocos2d::CCPoint v101; // 0:s0.4,4:s1.4
cocos2d::CCPoint v102; // 0:s0.4,4:s1.4
v4 = a4;
v6 = SetupTriggerPopup::init(a1, a2, a3, 380.0, 280.0, 1);
if ( v6 )
{
SetupTriggerPopup::preSetup(a1);
if ( v4 )
v8 = "Edit Song Trigger";
else
v8 = "Edit SFX Trigger";
sub_D153B8((int)&v95, v8);
SetupTriggerPopup::addTitle((__int64)a1);
v9 = (void *)(*(_QWORD *)&v95 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v95 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v61 = (unsigned int *)(*(_QWORD *)&v95 - 8LL);
do
v62 = __ldaxr(v61);
while ( __stlxr(v62 - 1, v61) );
}
else
{
v62 = *(_DWORD *)(*(_QWORD *)&v95 - 8LL);
*(_DWORD *)(*(_QWORD *)&v95 - 8LL) = v62 - 1;
}
if ( v62 <= 0 )
operator delete(v9);
}
sub_D153B8((unsigned int)&v77 + 288, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (ButtonSprite **)&v95, v10, v11, v12, v13, v14);
v15 = (void *)(*(_QWORD *)&v95 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v95 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(*(_QWORD *)&v95 - 8LL);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *(_DWORD *)(*(_QWORD *)&v95 - 8LL);
*(_DWORD *)(*(_QWORD *)&v95 - 8LL) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v15);
}
v78 = &byte_124B6C8;
if ( v4 )
sub_D1798C(
&v78,
"Lets you edit the properties of a song in a specified Channel.\n"
"Page 2 lets you change the volume depending on proximity.\n"
"Group ID 1 is the target that volume is calculated around. Use the arrow buttons to define which directi"
"on it works in.\n"
"By default, the player changes the volume depending on how close they are to this group. You can also use Gr"
"oup ID 2 on an object to make this object control volume.",
438);
else
sub_D1798C(
&v78,
"Lets you edit the properties of a sound effect. Use Group ID, SFXGroup, or Unique ID"
" to refer to the correct one.\n"
"Page 2 lets you change the volume depending on proximity.\n"
"Group ID 1 is the target that volume is calculated around. Use the arrow buttons to define which directi"
"on it works in.\n"
"By default, the player changes the volume depending on how close they are to this group. You can also use Gr"
"oup ID 2 on an object to make this object control volume.",
505);
sub_D153B8((int)&v79, "Help");
sub_D153B8((int)&v80, v78);
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v16 = (void *)(v80 - 24);
if ( (__int64 *)(v80 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(v80 - 8);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(v80 - 8);
*(_DWORD *)(v80 - 8) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v16);
}
v17 = (void *)(v79 - 24);
if ( (__int64 *)(v79 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v79 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(v79 - 8);
*(_DWORD *)(v79 - 8) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v17);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
a1->m_disableSliderDelegate = (unsigned __int8)&dword_0 + 1;
v18 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v18);
cocos2d::CCPoint::CCPoint(&v83, v81 * 0.5, v82 * 0.5);
cocos2d::CCPoint::CCPoint(&v84, v81 * 0.5, (float)(v82 * 0.5) + 35.0);
if ( v4 )
{
sub_D153B8((int)&v88, "Channel:");
cocos2d::CCPoint::CCPoint(&v94, 0.0, 80.0);
cocos2d::CCPoint::operator+(&v95, &v83, &v94);
v102.y = 0.0;
v102.x = 0.65;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1B0u,
v102,
4.0,
v44,
v45,
(std::string)&v88,
&v95,
Float,
Uint,
10,
1u,
0,
0,
0,
2,
0);
v46 = (void *)(v88 - 24);
if ( (__int64 *)(v88 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v73 = (unsigned int *)(v88 - 8);
do
v74 = __ldaxr(v73);
while ( __stlxr(v74 - 1, v73) );
}
else
{
v74 = *(_DWORD *)(v88 - 8);
*(_DWORD *)(v88 - 8) = v74 - 1;
}
if ( v74 <= 0 )
operator delete(v46);
}
SetupTriggerPopup::toggleLimitValue(a1, 432, 1);
}
else
{
sub_D153B8((int)&v85, "Group ID:");
cocos2d::CCPoint::CCPoint(&v94, -110.0, 80.0);
cocos2d::CCPoint::operator+(&v95, &v83, &v94);
v96.x = 0.65;
v96.y = -100.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1C9u,
v96,
100.0,
v19,
v20,
(std::string)&v85,
&v95,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v21 = (void *)(v85 - 24);
if ( (__int64 *)(v85 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v75 = (unsigned int *)(v85 - 8);
do
v76 = __ldaxr(v75);
while ( __stlxr(v76 - 1, v75) );
}
else
{
v76 = *(_DWORD *)(v85 - 8);
*(_DWORD *)(v85 - 8) = v76 - 1;
}
if ( v76 <= 0 )
operator delete(v21);
}
sub_D153B8((int)&v86, "SFXGroup:");
cocos2d::CCPoint::CCPoint(&v94, 0.0, 80.0);
cocos2d::CCPoint::operator+(&v95, &v83, &v94);
v97.x = 0.65;
v97.y = -100.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1C7u,
v97,
100.0,
v22,
v23,
(std::string)&v86,
&v95,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v24 = (void *)(v86 - 24);
if ( (__int64 *)(v86 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(v86 - 8);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *(_DWORD *)(v86 - 8);
*(_DWORD *)(v86 - 8) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v24);
}
sub_D153B8((int)&v87, "Unique ID:");
cocos2d::CCPoint::CCPoint(&v94, 110.0, 80.0);
cocos2d::CCPoint::operator+(&v95, &v83, &v94);
v98.x = 0.65;
v98.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1A0u,
v98,
100.0,
v25,
v26,
(std::string)&v87,
&v95,
Float,
Uint,
10,
1u,
0,
0,
0,
0,
0);
v27 = (void *)(v87 - 24);
if ( (__int64 *)(v87 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v71 = (unsigned int *)(v87 - 8);
do
v72 = __ldaxr(v71);
while ( __stlxr(v72 - 1, v71) );
}
else
{
v72 = *(_DWORD *)(v87 - 8);
*(_DWORD *)(v87 - 8) = v72 - 1;
}
if ( v72 <= 0 )
operator delete(v27);
}
}
sub_D153B8((int)&v89, "Duration:");
cocos2d::CCPoint::CCPoint(&v94, -84.5, -0.0);
cocos2d::CCPoint::operator+(&v95, &v84, &v94);
v99.x = 0.65;
v99.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0xAu,
v99,
2.0,
v28,
v29,
(std::string)&v89,
&v95,
(InputValueType)0,
Float,
6,
0,
0,
0,
1,
2,
0);
v30 = (void *)(v89 - 24);
if ( (__int64 *)(v89 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)(v89 - 8);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *(_DWORD *)(v89 - 8);
*(_DWORD *)(v89 - 8) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v30);
}
sub_D153B8((int)&v90, "Speed:");
cocos2d::CCPoint::CCPoint(&v94, -84.5, -35.75);
cocos2d::CCPoint::operator+(&v95, &v84, &v94);
v100.x = 0.65;
v100.y = -12.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x194u,
v100,
12.0,
v31,
v32,
(std::string)&v90,
&v95,
(InputValueType)0,
Int,
6,
0,
0,
0,
1,
2,
0);
v33 = (void *)(v90 - 24);
if ( (__int64 *)(v90 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v65 = (unsigned int *)(v90 - 8);
do
v66 = __ldaxr(v65);
while ( __stlxr(v66 - 1, v65) );
}
else
{
v66 = *(_DWORD *)(v90 - 8);
*(_DWORD *)(v90 - 8) = v66 - 1;
}
if ( v66 <= 0 )
operator delete(v33);
}
sub_D153B8((int)&v91, "Volume:");
cocos2d::CCPoint::CCPoint(&v94, -84.5, -71.5);
cocos2d::CCPoint::operator+(&v95, &v84, &v94);
v101.x = 0.65;
v101.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x196u,
v101,
2.0,
v34,
v35,
(std::string)&v91,
&v95,
(InputValueType)0,
Float,
6,
0,
0,
0,
1,
2,
0);
v36 = (void *)(v91 - 24);
if ( (__int64 *)(v91 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(v91 - 8);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(v91 - 8);
*(_DWORD *)(v91 - 8) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v36);
}
sub_D153B8((int)&v92, "Stop");
cocos2d::CCPoint::CCPoint(&v94, 34.5, -0.0);
cocos2d::CCPoint::operator+(&v95, &v84, &v94);
SetupTriggerPopup::createToggleValueControl(a1, 417, 1.0, (__int64)&v92, &v95, 0, 0, 0);
v37 = (void *)(v92 - 24);
if ( (__int64 *)(v92 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v67 = (unsigned int *)(v92 - 8);
do
v68 = __ldaxr(v67);
while ( __stlxr(v68 - 1, v67) );
}
else
{
v68 = *(_DWORD *)(v92 - 8);
*(_DWORD *)(v92 - 8) = v68 - 1;
}
if ( v68 <= 0 )
operator delete(v37);
}
sub_D153B8((int)&v93, "Stop\nLoop");
cocos2d::CCPoint::CCPoint(&v94, 114.5, -0.0);
cocos2d::CCPoint::operator+(&v95, &v84, &v94);
SetupTriggerPopup::createToggleValueControl(a1, 414, 1.0, (__int64)&v93, &v95, 0, 0, 0);
v38 = (void *)(*(_QWORD *)&v93 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v93 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(*(_QWORD *)&v93 - 8LL);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(*(_QWORD *)&v93 - 8LL);
*(_DWORD *)(*(_QWORD *)&v93 - 8LL) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v38);
}
sub_D153B8((int)&v94, "Change Speed");
cocos2d::CCPoint::CCPoint(&v93, 34.5, -35.75);
cocos2d::CCPoint::operator+(&v95, &v84, &v93);
SetupTriggerPopup::createToggleValueControl(a1, 419, 1.0, (__int64)&v94, &v95, 0, 0, 0);
v39 = (void *)(*(_QWORD *)&v94 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v94 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v63 = (unsigned int *)(*(_QWORD *)&v94 - 8LL);
do
v64 = __ldaxr(v63);
while ( __stlxr(v64 - 1, v63) );
}
else
{
v64 = *(_DWORD *)(*(_QWORD *)&v94 - 8LL);
*(_DWORD *)(*(_QWORD *)&v94 - 8LL) = v64 - 1;
}
if ( v64 <= 0 )
operator delete(v39);
}
sub_D153B8((int)&v95, "Change Volume");
cocos2d::CCPoint::CCPoint(&v93, 34.5, -71.5);
cocos2d::CCPoint::operator+(&v94, &v84, &v93);
SetupTriggerPopup::createToggleValueControl(a1, 418, 1.0, (__int64)&v95, &v94, 0, 0, 0);
v40 = (void *)(*(_QWORD *)&v95 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v95 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(*(_QWORD *)&v95 - 8LL);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(*(_QWORD *)&v95 - 8LL);
*(_DWORD *)(*(_QWORD *)&v95 - 8LL) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v40);
}
SetupTriggerPopup::toggleLimitValue(a1, 404, 1);
SetupTriggerPopup::toggleLimitValue(a1, 406, 1);
SetupAudioTriggerPopup::addProxVolControls(a1, 1);
SetupTriggerPopup::createPageButtons(a1, (float)(a1->m_width * 0.5) + 15.0, 1);
SetupTriggerPopup::goToPage(a1, 0, 0);
SetupTriggerPopup::postSetup(a1);
v41 = v78 - 24;
if ( v78 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v78 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v78 - 2);
*((_DWORD *)v78 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v41);
}
}
return v6;
}