//
// MultiTriggerPopup::init from 0xa46e58 to 0xa4726c (1044 bytes)
//
// 2 xrefs:
// > MultiTriggerPopup::create @ 0xa47404
// > ??> @ 0xc5fa0
//
// 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 MultiTriggerPopup::init(MultiTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool v4; // w23
void *v6; // x0
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x4
__int64 v10; // x5
const char *v11; // x6
void *v12; // x0
void *v13; // x0
void *v14; // x0
cocos2d::CCDirector *v15; // x0
void *v16; // x0
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
_QWORD v27[2]; // [xsp+0h] [xbp+0h] BYREF
float v28; // [xsp+68h] [xbp+68h]
float v29; // [xsp+6Ch] [xbp+6Ch]
cocos2d::CCPoint v30; // [xsp+70h] [xbp+70h] BYREF
__int64 v31; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v32; // [xsp+80h] [xbp+80h] BYREF
v4 = SetupTriggerPopup::init(a1, a2, a3, 200.0, 120.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_D153B8((unsigned int)v27 + 128, "Setup");
SetupTriggerPopup::addTitle((__int64)a1);
v6 = (void *)(*(_QWORD *)&v32 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v32 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(*(_QWORD *)&v32 - 8LL);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(*(_QWORD *)&v32 - 8LL);
*(_DWORD *)(*(_QWORD *)&v32 - 8LL) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v6);
}
sub_D153B8((unsigned int)v27 + 128, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (ButtonSprite **)&v32, v7, v8, v9, v10, v11);
v12 = (void *)(*(_QWORD *)&v32 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v32 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(*(_QWORD *)&v32 - 8LL);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(*(_QWORD *)&v32 - 8LL);
*(_DWORD *)(*(_QWORD *)&v32 - 8LL) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v31, "Help");
sub_D153B8((unsigned int)v27 + 128, "Allow Multi makes it so the object can be activated several times.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v13 = (void *)(*(_QWORD *)&v32 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v32 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(*(_QWORD *)&v32 - 8LL);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(*(_QWORD *)&v32 - 8LL);
*(_DWORD *)(*(_QWORD *)&v32 - 8LL) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v13);
}
v14 = (void *)(v31 - 24);
if ( (__int64 *)(v31 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v31 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v31 - 8);
*(_DWORD *)(v31 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v14);
}
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
cocos2d::CCPoint::CCPoint(&v30, (float)(v28 * 0.5) + -30.0, (float)(v29 * 0.5) + 10.0);
sub_D153B8((int)&v31, "Allow Multi");
cocos2d::CCPoint::CCPoint(&v32, &v30);
SetupTriggerPopup::createToggleValueControl(a1, 87, 1.0, (__int64)&v31, &v32, 0, 0, 0);
v16 = (void *)(v31 - 24);
if ( (__int64 *)(v31 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v31 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v31 - 8);
*(_DWORD *)(v31 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v16);
}
SetupTriggerPopup::postSetup(a1);
}
return v4;
}