//
// SetupEventLinkPopup::init from 0xa44178 to 0xa4486c (1780 bytes)
//
// 2 xrefs:
// > SetupEventLinkPopup::create @ 0xa44a20
// > ??> @ 0x935d0
//
// 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 SetupEventLinkPopup::init(SetupEventLinkPopup *a1, EventLinkTrigger *a2, cocos2d::CCArray *a3)
{
bool v4; // w25
char *v6; // x0
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x4
__int64 v10; // x5
const char *v11; // x6
char *v12; // x0
char *v13; // x0
void *v14; // x0
cocos2d::CCDirector *v15; // x0
float v16; // s3
float v17; // s4
char *v18; // x0
float v19; // s3
float v20; // s4
char *v21; // x0
float v22; // s3
float v23; // s4
char *v24; // x0
cocos2d::CCSprite *v25; // x24
CCMenuItemSpriteExtra *v26; // x24
cocos2d::CCMenu *m_buttonMenu; // x28
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
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
_QWORD v43[2]; // [xsp+30h] [xbp+0h] BYREF
float v44; // [xsp+C0h] [xbp+90h]
float v45; // [xsp+C4h] [xbp+94h]
cocos2d::CCPoint v46; // [xsp+C8h] [xbp+98h] BYREF
cocos2d::CCPoint v47; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v48; // [xsp+D8h] [xbp+A8h] BYREF
char *v49; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v50; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v51; // 0:x2.16
cocos2d::CCPoint v52; // 0:s0.4,4:s1.4
cocos2d::CCPoint v53; // 0:s0.4,4:s1.4
cocos2d::CCPoint v54; // 0:s0.4,4:s1.4
v4 = SetupTriggerPopup::init(a1, a2, a3, 380.0, 280.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_D153B8((unsigned int)v43 + 176, "Event Link");
SetupTriggerPopup::addTitle((__int64)a1);
v6 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v49 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v6);
}
sub_D153B8((unsigned int)v43 + 176, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (ButtonSprite **)&v49, v7, v8, v9, v10, v11);
v12 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v49 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v48, "Help");
sub_D153B8(
(int)&v49,
"Activates Group ID upon a specified player action. Select one or multiple from the top right menu.\n"
"Extra ID makes the action only apply if the player interacts with a corresponding object, for example if M"
"aterial ID matches.\n"
"Extra ID2: 0 = All, 1 = P1, 2 = P2");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v13 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v49 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v13);
}
v14 = (void *)(*(_QWORD *)&v48 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v48 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(*(_QWORD *)&v48 - 8LL);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(*(_QWORD *)&v48 - 8LL);
*(_DWORD *)(*(_QWORD *)&v48 - 8LL) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v14);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
cocos2d::CCPoint::CCPoint(&v46, v44 * 0.5, v45 * 0.5);
sub_D153B8((int)&v49, "Group ID:");
cocos2d::CCPoint::CCPoint(&v47, -80.0, 40.0);
cocos2d::CCPoint::operator+(&v48, &v46, &v47);
v52.y = 0.0;
v52.x = 0.8;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x33u,
v52,
9999.0,
v16,
v17,
(std::string)&v49,
&v48,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v18 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v49 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v18);
}
sub_D153B8((int)&v49, "Extra ID:");
cocos2d::CCPoint::CCPoint(&v47, 80.0, 40.0);
cocos2d::CCPoint::operator+(&v48, &v46, &v47);
v53.x = 0.8;
v53.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1BFu,
v53,
9999.0,
v19,
v20,
(std::string)&v49,
&v48,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v21 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v49 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v21);
}
sub_D153B8((int)&v49, "Extra ID2:");
cocos2d::CCPoint::CCPoint(&v47, 80.0, -40.0);
cocos2d::CCPoint::operator+(&v48, &v46, &v47);
v54.x = 0.8;
v54.y = 0.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x20Du,
v54,
9999.0,
v22,
v23,
(std::string)&v49,
&v48,
Float,
Int,
10,
1u,
0,
0,
0,
0,
0);
v24 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v49 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v24);
}
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
v25->setScale(v25, 0.55);
v51.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v51.adj = (size_t)SetupEventLinkPopup::onSelectEvent;
v26 = CCMenuItemSpriteExtra::create(v25, nullptr, v51);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v26);
m_buttonMenu = a1->m_buttonMenu;
setPosition = v26->setPosition;
cocos2d::CCPoint::CCPoint(&v47, (float)(a1->m_width * 0.5) + -22.0, (float)(a1->m_height * 0.5) + -22.0);
cocos2d::CCPoint::operator+(&v48, &v46, &v47);
v50 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v48);
((void (__fastcall *)(CCMenuItemSpriteExtra *, char **, float, float))setPosition)(v26, &v49, v50.x, v50.y);
SetupTriggerPopup::postSetup(a1);
}
return v4;
}