//
// SetupPersistentItemTriggerPopup::init from 0xa4ec5c to 0xa4f3e8 (1932 bytes)
//
// 2 xrefs:
// > SetupPersistentItemTriggerPopup::create @ 0xa4f598
// > ??> @ 0x5ffd0
//
// 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 SetupPersistentItemTriggerPopup::init(
SetupPersistentItemTriggerPopup *a1,
ItemTriggerGameObject *a2,
cocos2d::CCArray *a3)
{
bool v4; // w26
cocos2d::CCPoint *p_m_textOffset; // x0
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x4
__int64 v10; // x5
const char *v11; // x6
cocos2d::CCPoint *v12; // x0
cocos2d::CCPoint *v13; // x0
void *v14; // x0
cocos2d::CCDirector *v15; // x0
float v16; // s3
float v17; // s4
cocos2d::CCPoint *v18; // x0
cocos2d::CCPoint *v19; // x0
cocos2d::CCPoint *v20; // x0
cocos2d::CCPoint *v21; // x0
cocos2d::CCPoint *v22; // x19
unsigned int *p_m_caption; // x1
int m_data; // w2
unsigned int *v25; // x1
int v26; // w2
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; // x22
int v40; // w0
_QWORD v41[2]; // [xsp+30h] [xbp+0h] BYREF
float v42; // [xsp+A8h] [xbp+78h]
float v43; // [xsp+ACh] [xbp+7Ch]
cocos2d::CCPoint v44; // [xsp+B0h] [xbp+80h] BYREF
cocos2d::CCPoint v45; // [xsp+B8h] [xbp+88h] BYREF
cocos2d::CCPoint v46; // [xsp+C0h] [xbp+90h] BYREF
cocos2d::CCPoint v47; // [xsp+C8h] [xbp+98h] BYREF
ButtonSprite *v48; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v49; // 0:s0.4,4:s1.4
v4 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 230.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_D153B8((unsigned int)v41 + 160, "Persistent Item Setup");
SetupTriggerPopup::addTitle((__int64)a1);
p_m_textOffset = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_caption = (unsigned int *)&v48[-1].m_caption;
do
m_data = __ldaxr(p_m_caption);
while ( __stlxr(m_data - 1, p_m_caption) );
}
else
{
m_data = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(p_m_textOffset);
}
sub_D153B8((unsigned int)v41 + 160, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, &v48, v7, v8, v9, v10, v11);
v12 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)&v48[-1].m_caption;
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v47, "Help");
sub_D153B8(
(unsigned int)v41 + 160,
"Lets you set ItemID to be Persistent. This means it does not reset upon player death, but only on "
"level exit.\n"
"TargetAll targets all persistent Item IDs.\n"
"Reset resets the target item(s) to 0.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v13 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)&v48[-1].m_caption;
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v13);
}
v14 = (void *)(*(_QWORD *)&v47 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v47 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(*(_QWORD *)&v47 - 8LL);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(*(_QWORD *)&v47 - 8LL);
*(_DWORD *)(*(_QWORD *)&v47 - 8LL) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v14);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
cocos2d::CCPoint::CCPoint(&v44, v42 * 0.5, v43 * 0.5);
sub_D153B8((unsigned int)v41 + 160, "Item ID");
cocos2d::CCPoint::CCPoint(&v46, -40.0, 40.0);
cocos2d::CCPoint::operator+(&v47, &v44, &v46);
v49.y = 0.0;
v49.x = 0.8;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x50u,
v49,
9999.0,
v16,
v17,
(std::string)&v48,
&v47,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v18 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)&v48[-1].m_caption;
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v18);
}
sub_D153B8((unsigned int)v41 + 160, "Timer");
cocos2d::CCPoint::CCPoint(&v46, 80.0, 40.0);
cocos2d::CCPoint::operator+(&v47, &v44, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 494, 1.0, (__int64)&v48, &v47, 1, 0, 0);
v19 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)&v48[-1].m_caption;
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v19);
}
cocos2d::CCPoint::CCPoint(&v45, v42 * 0.5, (float)(v43 * 0.5) + -23.0);
sub_D153B8((unsigned int)v41 + 160, "Persistent");
cocos2d::CCPoint::CCPoint(&v46, -80.0, 0.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 491, 1.0, (__int64)&v48, &v47, 1, 0, 0);
v20 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)&v48[-1].m_caption;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v20);
}
sub_D153B8((unsigned int)v41 + 160, "TargetAll");
cocos2d::CCPoint::CCPoint(&v46, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 492, 1.0, (__int64)&v48, &v47, 1, 0, 0);
v21 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)&v48[-1].m_caption;
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v21);
}
sub_D153B8((unsigned int)v41 + 160, "Reset");
cocos2d::CCPoint::CCPoint(&v46, 80.0, 0.0);
cocos2d::CCPoint::operator+(&v47, &v45, &v46);
SetupTriggerPopup::createToggleValueControl(a1, 493, 1.0, (__int64)&v48, &v47, 1, 0, 0);
v22 = &v48[-1].m_textOffset;
if ( &v48[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)&v48[-1].m_caption;
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = (int)v48[-1].m_caption.m_data.m_data;
LODWORD(v48[-1].m_caption.m_data.m_data) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v22);
}
SetupTriggerPopup::postSetup(a1);
}
return v4;
}