//
// SetupSFXEditPopup::init from 0x1004baf00 to 0x1004bba0c (2828 bytes)
//
// 1 xrefs:
// > SetupSFXEditPopup::create @ 0x1004baec3
//
// 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 SetupSFXEditPopup::init(SetupSFXEditPopup *a1, SFXTriggerGameObject *a2, cocos2d::CCArray *a3, bool a4)
{
_BOOL4 v4; // r12d
bool v5; // r15
const char *v6; // rsi
size_t v7; // rdx
const std::string::value_type *v8; // rsi
const char *data; // r12
size_t v10; // rax
size_t v11; // r13
char *v12; // rbx
size_t v13; // r15
bool v14; // bl
char v16; // [rsp+38h] [rbp-1D8h] BYREF
char __dst[15]; // [rsp+39h] [rbp-1D7h] BYREF
void *__p; // [rsp+48h] [rbp-1C8h]
char v19; // [rsp+50h] [rbp-1C0h] BYREF
char v20[15]; // [rsp+51h] [rbp-1BFh] BYREF
void *v21; // [rsp+60h] [rbp-1B0h]
char v22; // [rsp+68h] [rbp-1A8h] BYREF
char v23[15]; // [rsp+69h] [rbp-1A7h] BYREF
void *v24; // [rsp+78h] [rbp-198h]
char v25; // [rsp+80h] [rbp-190h] BYREF
_BYTE v26[23]; // [rsp+81h] [rbp-18Fh] BYREF
char v27; // [rsp+98h] [rbp-178h] BYREF
_BYTE v28[23]; // [rsp+99h] [rbp-177h] BYREF
char v29; // [rsp+B0h] [rbp-160h] BYREF
_BYTE v30[23]; // [rsp+B1h] [rbp-15Fh] BYREF
char v31; // [rsp+C8h] [rbp-148h] BYREF
_BYTE v32[23]; // [rsp+C9h] [rbp-147h] BYREF
__int128 v33; // [rsp+E0h] [rbp-130h] BYREF
void *v34; // [rsp+F0h] [rbp-120h]
__int128 v35; // [rsp+F8h] [rbp-118h] BYREF
void *v36; // [rsp+108h] [rbp-108h]
char v37; // [rsp+110h] [rbp-100h] BYREF
_BYTE v38[23]; // [rsp+111h] [rbp-FFh] BYREF
char v39; // [rsp+128h] [rbp-E8h] BYREF
char v40[15]; // [rsp+129h] [rbp-E7h] BYREF
void *v41; // [rsp+138h] [rbp-D8h]
char v42; // [rsp+140h] [rbp-D0h] BYREF
char v43[15]; // [rsp+141h] [rbp-CFh] BYREF
void *v44; // [rsp+150h] [rbp-C0h]
__int128 v45; // [rsp+158h] [rbp-B8h] BYREF
void *v46; // [rsp+168h] [rbp-A8h]
__int128 v47; // [rsp+170h] [rbp-A0h] BYREF
void *v48; // [rsp+180h] [rbp-90h]
__int128 v49; // [rsp+188h] [rbp-88h] BYREF
void *v50; // [rsp+198h] [rbp-78h]
std::string v51; // [rsp+1A0h] [rbp-70h] BYREF
_BOOL4 v52; // [rsp+1B8h] [rbp-58h]
float v53; // [rsp+1BCh] [rbp-54h] BYREF
float v54; // [rsp+1C0h] [rbp-50h]
unsigned __int64 v55; // [rsp+1C4h] [rbp-4Ch] BYREF
unsigned __int64 v56; // [rsp+1CCh] [rbp-44h] BYREF
bool v57; // [rsp+1D7h] [rbp-39h]
double v58; // [rsp+1D8h] [rbp-38h] BYREF
unsigned __int64 v59[6]; // [rsp+1E0h] [rbp-30h] BYREF
v4 = a4;
v5 = SetupTriggerPopup::init(a1, a2, a3, 380.0, 280.0, 1);
if ( !v5 )
return v5;
SetupTriggerPopup::preSetup(a1);
v6 = "Edit SFX Trigger";
if ( v4 )
v6 = "Edit Song Trigger";
v7 = v4 + 16LL;
v16 = 2 * v7;
memcpy(__dst, v6, v7);
__dst[v4 + 16] = 0;
SetupTriggerPopup::addTitle((__int64)a1, (__int64)&v16);
if ( (v16 & 1) != 0 )
operator delete(__p);
v19 = 4;
strcpy(v20, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (__int64)&v19);
if ( (v19 & 1) != 0 )
operator delete(v21);
memset(&v51, 0, sizeof(v51));
v8 = "Lets you edit the properties of a sound effect. Use Group ID, SFXGroup, or Unique ID<"
"/c> 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 directio"
"n it works in.\n"
"By default, the player changes the volume depending on how close they are to this group. You can also use Gro"
"up ID 2 on an object to make this object control volume.";
if ( v4 )
v8 = "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 direct"
"ion it works in.\n"
"By default, the player changes the volume depending on how close they are to this group. You can also use G"
"roup ID 2 on an object to make this object control volume.";
std::string::assign(&v51, v8);
v22 = 8;
strcpy(v23, "Help");
v52 = v4;
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
data = v51.__r_.__value_.__l.__data_;
else
data = v51.__r_.__value_.__s.__data_;
v10 = strlen(data);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v11 = v10;
if ( v10 >= 0x17 )
{
v57 = v5;
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
v50 = v12;
*(_QWORD *)&v49 = v13 | 1;
*((_QWORD *)&v49 + 1) = v11;
v5 = v57;
}
else
{
LOBYTE(v49) = 2 * v10;
v12 = (char *)&v49 + 1;
if ( !v10 )
goto LABEL_21;
}
memmove(v12, data, v11);
LABEL_21:
v12[v11] = 0;
SetupTriggerPopup::addHelpButton((__int64)a1, (__int64)&v22, &v49, (__m128)0x3F800000u);
v14 = v52;
if ( (v49 & 1) != 0 )
operator delete(v50);
if ( (v22 & 1) != 0 )
operator delete(v24);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
a1->m_disableSliderDelegate = 1;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v53);
sub_10028CBE0((float *)&v55, v53 * 0.5, v54 * 0.5);
sub_10028CBE0((float *)&v56, v53 * 0.5, (float)(0.5 * v54) + 35.0);
if ( v14 )
{
v29 = 16;
strcpy(v30, "Channel:");
sub_10028CBE0((float *)v59, 0.0, 80.0);
sub_10028CCE0(&v58, &v55, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
432,
(__int64)&v29,
(float *)&v58,
1,
Uint,
0.64999998,
0.0,
4.0,
10,
1,
0,
0,
0,
2,
0);
if ( (v29 & 1) != 0 )
operator delete(*(void **)&v30[15]);
SetupTriggerPopup::toggleLimitValue(a1, 432, 1);
}
else
{
v25 = 18;
strcpy(v26, "Group ID:");
sub_10028CBE0((float *)v59, -110.0, 80.0);
sub_10028CCE0(&v58, &v55, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
457,
(__int64)&v25,
(float *)&v58,
1,
Int,
0.64999998,
-100.0,
100.0,
10,
1,
0,
0,
0,
0,
0);
if ( (v25 & 1) != 0 )
operator delete(*(void **)&v26[15]);
v27 = 18;
strcpy(v28, "SFXGroup:");
sub_10028CBE0((float *)v59, 0.0, 80.0);
sub_10028CCE0(&v58, &v55, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
455,
(__int64)&v27,
(float *)&v58,
1,
Int,
0.64999998,
-100.0,
100.0,
10,
1,
0,
0,
0,
0,
0);
if ( (v27 & 1) != 0 )
operator delete(*(void **)&v28[15]);
v37 = 20;
strcpy(v38, "Unique ID:");
sub_10028CBE0((float *)v59, 110.0, 80.0);
sub_10028CCE0(&v58, &v55, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
416,
(__int64)&v37,
(float *)&v58,
1,
Uint,
0.64999998,
0.0,
100.0,
10,
1,
0,
0,
0,
0,
0);
if ( (v37 & 1) != 0 )
operator delete(*(void **)&v38[15]);
}
v31 = 18;
strcpy(v32, "Duration:");
sub_10028CBE0((float *)v59, -84.5, -0.0);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
10,
(__int64)&v31,
(float *)&v58,
0,
Float,
0.64999998,
0.0,
2.0,
6,
0,
0,
0,
1,
2,
0);
if ( (v31 & 1) != 0 )
operator delete(*(void **)&v32[15]);
v39 = 12;
strcpy(v40, "Speed:");
sub_10028CBE0((float *)v59, -84.5, -35.75);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
404,
(__int64)&v39,
(float *)&v58,
0,
Int,
0.64999998,
-12.0,
12.0,
6,
0,
0,
0,
1,
2,
0);
if ( (v39 & 1) != 0 )
operator delete(v41);
v42 = 14;
strcpy(v43, "Volume:");
sub_10028CBE0((float *)v59, -84.5, -71.5);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)a1,
406,
(__int64)&v42,
(float *)&v58,
0,
Float,
0.64999998,
0.0,
2.0,
6,
0,
0,
0,
1,
2,
0);
if ( (v42 & 1) != 0 )
operator delete(v44);
LOBYTE(v33) = 8;
strcpy((char *)&v33 + 1, "Stop");
sub_10028CBE0((float *)v59, 34.5, -0.0);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createToggleValueControl((int)a1, 417, &v33, 1.0, (__int64)&v58, 0, 0, 0);
if ( (v33 & 1) != 0 )
operator delete(v34);
LOBYTE(v35) = 18;
strcpy((char *)&v35 + 1, "Stop\nLoop");
sub_10028CBE0((float *)v59, 114.5, -0.0);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createToggleValueControl((int)a1, 414, &v35, 1.0, (__int64)&v58, 0, 0, 0);
if ( (v35 & 1) != 0 )
operator delete(v36);
LOBYTE(v45) = 24;
strcpy((char *)&v45 + 1, "Change Speed");
sub_10028CBE0((float *)v59, 34.5, -35.75);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createToggleValueControl((int)a1, 419, &v45, 1.0, (__int64)&v58, 0, 0, 0);
if ( (v45 & 1) != 0 )
operator delete(v46);
LOBYTE(v47) = 26;
strcpy((char *)&v47 + 1, "Change Volume");
sub_10028CBE0((float *)v59, 34.5, -71.5);
sub_10028CCE0(&v58, &v56, v59);
SetupTriggerPopup::createToggleValueControl((int)a1, 418, &v47, 1.0, (__int64)&v58, 0, 0, 0);
if ( (v47 & 1) != 0 )
operator delete(v48);
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);
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v51.__r_.__value_.__l.__data_);
return v5;
}