//
// SetupBGSpeedTrigger::init from 0xa21538 to 0xa21be0 (1704 bytes)
//
// 2 xrefs:
// > SetupBGSpeedTrigger::create @ 0xa21d88
// > ??> @ 0x4d9b8
//
// 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 SetupBGSpeedTrigger::init(SetupBGSpeedTrigger *a1, EffectGameObject *a2, cocos2d::CCArray *a3, int a4)
{
bool v6; // w22
cocos2d::CCDirector *v8; // x0
char *v9; // x1
void *v10; // x0
__int64 v11; // x2
__int64 v12; // x3
__int64 v13; // x4
__int64 v14; // x5
const char *v15; // x6
char *v16; // x0
void *v17; // x0
void *v18; // x0
float v19; // s3
float v20; // s4
void *v21; // x0
float v22; // s3
float v23; // s4
void *v24; // x0
char *v25; // x0
void *v26; // x0
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
float v43; // [xsp+B0h] [xbp+80h]
float v44; // [xsp+B4h] [xbp+84h]
__int64 v45; // [xsp+B8h] [xbp+88h] BYREF
__int64 v46; // [xsp+C0h] [xbp+90h] BYREF
char *v47; // [xsp+C8h] [xbp+98h] BYREF
__int64 v48; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v49; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v50; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v51; // [xsp+E8h] [xbp+B8h] BYREF
cocos2d::CCPoint v52; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::CCPoint v53; // 0:s0.4,4:s1.4
cocos2d::CCPoint v54; // 0:s0.4,4:s1.4
v6 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( v6 )
{
SetupTriggerPopup::preSetup(a1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
if ( a4 == 3612 )
v9 = "Change MG Speed";
else
v9 = "Change BG Speed";
sub_D153B8((int)&v45, v9);
sub_D18D28(&v46);
SetupTriggerPopup::addTitle((__int64)a1);
v10 = (void *)(v46 - 24);
if ( (__int64 *)(v46 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v46 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(v46 - 8);
*(_DWORD *)(v46 - 8) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v10);
}
sub_D153B8((int)&v47, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (ButtonSprite **)&v47, v11, v12, v13, v14, v15);
v16 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v47 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v47 - 2);
*((_DWORD *)v47 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v16);
}
v47 = &byte_124B6C8;
if ( a4 == 3612 )
sub_D1798C(
&v47,
"Lets you change the speed of the middle ground during gameplay movement. Default X: 0.3, Y: 0.5",
103);
else
sub_D1798C(
&v47,
"Lets you change the speed of the background during gameplay movement. Default X: 0.1, Y: 0.1",
100);
sub_D153B8((int)&v48, "Help");
sub_D153B8((int)&v50, v47);
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v17 = (void *)(*(_QWORD *)&v50 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v50 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(*(_QWORD *)&v50 - 8LL);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(*(_QWORD *)&v50 - 8LL);
*(_DWORD *)(*(_QWORD *)&v50 - 8LL) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v17);
}
v18 = (void *)(v48 - 24);
if ( (__int64 *)(v48 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v48 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(v48 - 8);
*(_DWORD *)(v48 - 8) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v18);
}
cocos2d::CCPoint::CCPoint(&v49, v43 * 0.5, v44 * 0.5);
sub_D153B8((int)&v51, "Mod X:");
cocos2d::CCPoint::CCPoint(&v50, 0.0, 60.0);
cocos2d::CCPoint::operator+(&v52, &v49, &v50);
v53.y = 0.0;
v53.x = 0.8;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x8Fu,
v53,
1.0,
v19,
v20,
(std::string)&v51,
&v52,
(InputValueType)0,
Float,
10,
0,
0,
0,
0,
2,
0);
v21 = (void *)(*(_QWORD *)&v51 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v51 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(*(_QWORD *)&v51 - 8LL);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(*(_QWORD *)&v51 - 8LL);
*(_DWORD *)(*(_QWORD *)&v51 - 8LL) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v21);
}
sub_D153B8((int)&v52, "Mod Y:");
cocos2d::CCPoint::CCPoint(&v50, 0.0, -10.0);
cocos2d::CCPoint::operator+(&v51, &v49, &v50);
v54.x = 0.8;
v54.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x90u,
v54,
1.0,
v22,
v23,
(std::string)&v52,
&v51,
(InputValueType)0,
Float,
10,
0,
0,
0,
0,
2,
0);
v24 = (void *)(*(_QWORD *)&v52 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v52 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(*(_QWORD *)&v52 - 8LL);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(*(_QWORD *)&v52 - 8LL);
*(_DWORD *)(*(_QWORD *)&v52 - 8LL) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v24);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
SetupTriggerPopup::postSetup(a1);
v25 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v47 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v47 - 2);
*((_DWORD *)v47 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v25);
}
v26 = (void *)(v45 - 24);
if ( (__int64 *)(v45 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v45 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v45 - 8);
*(_DWORD *)(v45 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v26);
}
}
return v6;
}