//
// SetupEndPopup::init from 0x96e3e4 to 0x96eea4 (2752 bytes)
//
// 2 xrefs:
// > SetupEndPopup::create @ 0x96f078
// > ??> @ 0x932b8
//
// 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 SetupEndPopup::init(SetupEndPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool v5; // w24
SetupEndPopup_vtbl *v7; // x1
cocos2d::CCDirector *v8; // x0
cocos2d::CCLabelBMFont *v9; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
const char *v11; // x6
cocos2d::CCNode *v12; // x0
CCMenuItemSpriteExtra *v13; // x0
__int64 v14; // x28
void *v15; // x0
void *v16; // x0
cocos2d::CCMenu *m_buttonMenu; // x4
cocos2d::CCMenu *v18; // x1
float v19; // s0
float v20; // s1
cocos2d::CCLabelBMFont *v21; // x28
cocos2d::CCNode *v22; // x22
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
CCTextInputNode *v24; // x0
CCTextInputNode *m_groupIDInput; // x22
void *v26; // x0
cocos2d::CCMenu *v27; // x0
cocos2d::CCSprite *v28; // x25
CCMenuItemSpriteExtra *v29; // x25
cocos2d::CCSprite *v30; // x25
CCMenuItemSpriteExtra *v31; // x25
_BOOL4 m_reversed; // w26
void *v33; // x0
_BOOL4 m_lockY; // w26
void *v35; // x0
_BOOL4 m_multiActivate; // w26
void *v37; // x0
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x20
int v41; // w1
unsigned int *v42; // x1
int v43; // w3
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w3
cocos2d::CCSize *v50[2]; // [xsp+0h] [xbp+0h] BYREF
cocos2d::CCSize *v51; // [xsp+80h] [xbp+80h]
cocos2d::CCNode *v52; // [xsp+88h] [xbp+88h]
cocos2d::CCSize *v53; // [xsp+90h] [xbp+90h]
cocos2d::CCPoint *v54; // [xsp+98h] [xbp+98h]
__int64 v55; // [xsp+A8h] [xbp+A8h]
float v56; // [xsp+B0h] [xbp+B0h]
float v57; // [xsp+B4h] [xbp+B4h]
cocos2d::CCPoint v58; // [xsp+B8h] [xbp+B8h] BYREF
char v59; // [xsp+C0h] [xbp+C0h] BYREF
_BYTE v60[8]; // [xsp+C8h] [xbp+C8h] BYREF
char v61; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v62; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v63; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCRect v64; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCRect v65; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v66; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v67; // 0:x2.16
cocos2d::SEL_MenuHandler v68; // 0:x2.16
cocos2d::SEL_MenuHandler v69; // 0:x2.16
cocos2d::CCRect v70; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v5 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( v5 )
{
v7 = a1->SetupTriggerPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v54 = (cocos2d::CCPoint *)&v61;
v7->determineStartValues(a1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v9 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v9);
v9->setScale(v9, 0.7);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v65.origin, v56 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v57 * 0.5)) - 18.0);
setPosition(v9, &v65.origin);
v12 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v11,
30.0);
v67.adj = 1320;
v67.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v13 = CCMenuItemSpriteExtra::create(v12, nullptr, v67);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v13);
sub_D153B8((int)&v64, "Help");
sub_D153B8(
(unsigned int)v50 + 248,
"Sets a specific object given by Group ID to be the end of the level when the game type is Classic."
" This essentially spawns the endwall at a set location.\n"
"Use Reversed if gameplay is reverse at the end.\n"
"Lock Y locks the endwall to the ground instead of the group's Y position.");
v14 = InfoAlertButton::create(1.0);
v15 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v15);
}
v16 = (void *)(*(_QWORD *)&v64.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v64.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(*(_QWORD *)&v64.origin - 8LL);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(*(_QWORD *)&v64.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v64.origin - 8LL) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v16);
}
m_buttonMenu = a1->m_buttonMenu;
v51 = (cocos2d::CCSize *)&v59;
m_buttonMenu->addChild(m_buttonMenu, (cocos2d::CCNode *)v14);
v18 = a1->m_buttonMenu;
v19 = a1->m_width * 0.5;
v20 = a1->m_height * 0.5;
v53 = *(cocos2d::CCSize **)(*(_QWORD *)v14 + 184LL);
v52 = v18;
cocos2d::CCPoint::CCPoint(
&v64.origin,
18.0 - (float)(v19 - (float)(v56 * 0.5)),
(float)(v20 + (float)(v57 * 0.5)) - 18.0);
v66 = cocos2d::CCNode::convertToNodeSpace(v52, &v64.origin);
((void (__fastcall *)(__int64, cocos2d::CCRect *, float, float))v53)(v14, &v65, v66.x, v66.y);
cocos2d::CCPoint::CCPoint(&v58, v56 * 0.5, (float)(v57 * 0.5) + 30.0);
v21 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v21);
v21->setScale(v21, 0.7);
v53 = (cocos2d::CCSize *)v21->setPosition;
cocos2d::CCPoint::CCPoint(&v64.origin, 0.0, 34.0);
cocos2d::CCPoint::operator+(&v65, &v58, &v64);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v53)(v21, &v65);
cocos2d::CCRect::CCRect(&v64, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v65, &v64);
v22 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v65,
v70);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v22->__vftable[1].~CCNode_0)(v22, 100);
getTag = v22->__vftable[1].getTag;
LOWORD(v65.origin.x) = 0;
BYTE2(v65.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v22, &v65);
v53 = v51;
cocos2d::CCSize::CCSize(v51, 50.0, 30.0);
v22->setContentSize(v22, v53);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, -1);
v22->setPosition(v22, &v58);
v24 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi");
a1->m_groupIDInput = v24;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, 20);
a1->m_groupIDInput->setPosition(a1->m_groupIDInput, &v58);
CCTextInputNode::setMaxLabelScale(a1->m_groupIDInput, 0.6);
CCTextInputNode::setMaxLabelWidth(a1->m_groupIDInput, 200.0);
a1->m_groupIDInput->m_textField->setVisible(a1->m_groupIDInput->m_textField, 0);
m_groupIDInput = a1->m_groupIDInput;
m_groupIDInput->m_maxLabelLength = 6;
sub_D153B8((unsigned int)v50 + 248, "0123456789");
CCTextInputNode::setAllowedChars((__int64)m_groupIDInput, (__int64)&v65);
v26 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v26);
}
LOWORD(v55) = -21896;
BYTE2(v55) = -16;
CCTextInputNode::setLabelPlaceholderColor(a1->m_groupIDInput, (cocos2d::ccColor3B)v55);
CCTextInputNode::setLabelPlaceholderScale(a1->m_groupIDInput, 0.5);
a1->m_groupIDInput->m_delegate = &a1->TextInputDelegate;
v27 = a1->m_buttonMenu;
a1->m_groupIDInput->m_numberInput = 1;
cocos2d::CCNode::convertToNodeSpace(v27, &v58);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
v28->setScale(v28, 1.1);
v68.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v68.adj = (size_t)SetupEndPopup::onTargetIDArrow;
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, v68);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v29->setTag(v29, 1);
v53 = (cocos2d::CCSize *)v29->setPosition;
cocos2d::CCPoint::CCPoint(&v63, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v65, v60, &v63);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *))v53)(v29, &v65);
CCMenuItemSpriteExtra::setSizeMult(v29, 2.0);
v30 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
v30->setScale(v30, 1.1);
v69.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v69.adj = (size_t)SetupEndPopup::onTargetIDArrow;
v31 = CCMenuItemSpriteExtra::create(v30, nullptr, v69);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v31);
v31->setTag(v31, 2);
v53 = (cocos2d::CCSize *)v31->setPosition;
cocos2d::CCPoint::CCPoint(&v63, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v65, v60, &v63);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *))v53)(v31, &v65);
CCMenuItemSpriteExtra::setSizeMult(v31, 2.0);
SetupEndPopup::updateTextInputLabel(a1);
cocos2d::CCPoint::CCPoint(
v54,
20.0 - (float)((float)(a1->m_width * 0.5) - (float)(v56 * 0.5)),
60.0 - (float)((float)(a1->m_height * 0.5) - (float)(v57 * 0.5)));
if ( a2 && a2->getType(a2) == CustomRing )
{
if ( a2->getType(a2) == CustomRing )
{
sub_D153B8((int)&v65, "Multi\nActivate");
m_multiActivate = a1->m_multiActivate;
cocos2d::CCPoint::CCPoint(&v62, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v63, v54, &v62);
SetupTriggerPopup::createToggleButton(a1, &v65, SetupEndPopup::onMultiActivate, 0, m_multiActivate, &v63);
v37 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v37);
}
}
}
else
{
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
}
sub_D153B8((unsigned int)v50 + 248, "Reversed");
m_reversed = a1->m_reversed;
cocos2d::CCPoint::CCPoint(&v63, (float)(v56 * 0.5) + -50.0, (float)(v57 * 0.5) + -20.0);
SetupTriggerPopup::createToggleButton(a1, &v65, SetupEndPopup::onReversed, 0, m_reversed, &v63);
v33 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v33);
}
sub_D153B8((unsigned int)v50 + 248, "Lock Y");
m_lockY = a1->m_lockY;
cocos2d::CCPoint::CCPoint(&v63, (float)(v56 * 0.5) + 50.0, (float)(v57 * 0.5) + -20.0);
SetupTriggerPopup::createToggleButton(a1, &v65, SetupEndPopup::onLockY, 0, m_lockY, &v63);
v35 = (void *)(*(_QWORD *)&v65.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v65.origin - 24LL) == &qword_124B6B0 )
goto LABEL_11;
if ( &pthread_create )
{
v40 = (unsigned int *)(*(_QWORD *)&v65.origin - 8LL);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(*(_QWORD *)&v65.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v65.origin - 8LL) = v41 - 1;
}
if ( v41 > 0 )
{
LABEL_11:
a1->m_disableTextDelegate = 0;
}
else
{
operator delete(v35);
a1->m_disableTextDelegate = 0;
}
}
return v5;
}