//
// SetupInstantCountPopup::init from 0x956000 to 0x956eb8 (3768 bytes)
//
// 2 xrefs:
// > SetupInstantCountPopup::create @ 0x9570a4
// > ??> @ 0x42c48
//
// 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 SetupInstantCountPopup::init(SetupInstantCountPopup *a1, CountTriggerGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x21
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const char *v8; // x6
cocos2d::CCNode *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
cocos2d::CCNode *v11; // x21
void *v12; // x0
void *v13; // x0
int v14; // w24
cocos2d::CCMenu *m_buttonMenu; // x25
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
float v17; // s0
float v18; // s1
int v19; // w25
void (*v20)(SetupInstantCountPopup *, cocos2d::CCObject *); // x27
cocos2d::CCLabelBMFont *v21; // x21
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCNode *v23; // x21
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
CCTextInputNode *v25; // x21
void *v26; // x0
CCTextInputNode_vtbl *v27; // x1
cocos2d::CCSprite *v28; // x23
CCMenuItemSpriteExtra *v29; // x25
cocos2d::CCSprite *v30; // x25
CCMenuItemSpriteExtra *v31; // x25
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
void *v33; // x0
_BOOL4 m_activateGroup; // w24
void *v35; // x0
_BOOL4 v36; // w24
CCMenuItemToggler *m_equalsToggler; // x0
void *v38; // x2
_BOOL4 v39; // w24
CCMenuItemToggler *m_largerToggler; // x0
void *v41; // x2
_BOOL4 v42; // w24
CCMenuItemToggler *m_smallerToggler; // x0
void *v44; // x21
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w0
unsigned int *v53; // x25
int v54; // w0
unsigned int *v55; // x1
int v56; // w0
unsigned int *v57; // x1
int v58; // w2
unsigned int *v59; // x1
int v60; // w2
unsigned int *v61; // x1
int v62; // w2
float v63; // s0
float v64; // s1
float v65; // s0
float v66; // s1
bool v67; // [xsp+AFh] [xbp+AFh]
void (__fastcall *v68)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B0h] [xbp+B0h]
cocos2d::ccColor3B v69; // [xsp+D8h] [xbp+D8h]
float v70; // [xsp+E0h] [xbp+E0h]
float v71; // [xsp+E4h] [xbp+E4h]
cocos2d::CCPoint v72; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v73; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCPoint v74; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCSize v75; // [xsp+100h] [xbp+100h] BYREF
cocos2d::CCPoint v76; // [xsp+108h] [xbp+108h] BYREF
cocos2d::CCPoint v77; // [xsp+110h] [xbp+110h] BYREF
cocos2d::CCRect v78; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCRect v79; // [xsp+128h] [xbp+128h] BYREF
cocos2d::CCPoint v80; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v81; // 0:x2.16
cocos2d::SEL_MenuHandler v82; // 0:x2.16
cocos2d::SEL_MenuHandler v83; // 0:x2.16
cocos2d::CCRect v84; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v67 = SetupTriggerPopup::init(a1, a2, a3, 320.0, 280.0, 1);
if ( !v67 )
return v67;
a1->determineStartValues(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v6);
v6->setScale(v6, 0.7);
setPosition = v6->setPosition;
cocos2d::CCPoint::CCPoint(&v79.origin, v70 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v71 * 0.5)) - 18.0);
setPosition(v6, &v79.origin);
v9 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v8,
30.0);
v81.adj = 1320;
v81.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, v81);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
sub_D153B8((int)&v78, "Help");
sub_D153B8(
(int)&v79,
"Disables objects using Target ID when an Item ID reaches a certain Target Count. The conditi"
"on is only checked once when the trigger is activated.\n"
"Equals, Larger, or Smaller specify which condition to use.\n"
"Activate Group makes the trigger enable and spawn the group instead.");
v11 = (cocos2d::CCNode *)InfoAlertButton::create(1.0);
v12 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v12);
}
v13 = (void *)(*(_QWORD *)&v78.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v78.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)(*(_QWORD *)&v78.origin - 8LL);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *(_DWORD *)(*(_QWORD *)&v78.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v78.origin - 8LL) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v13);
}
v14 = 0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v16 = v11->setPosition;
cocos2d::CCPoint::CCPoint(
&v78.origin,
18.0 - (float)((float)(a1->m_width * 0.5) - (float)(v70 * 0.5)),
(float)((float)(a1->m_height * 0.5) + (float)(v71 * 0.5)) - 18.0);
v80 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v78.origin);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v16)(v11, &v79, v80.x, v80.y);
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(&v72, v70 * 0.5, (float)(v71 * 0.5) + 25.0);
do
{
sub_D153B8((int)&v73, &byte_F288A0);
cocos2d::CCPoint::CCPoint(&v74);
if ( v14 )
{
if ( v14 == 1 )
{
sub_D1798C(&v73, "Target Count", 12);
cocos2d::CCPoint::CCPoint(&v78.origin, -70.0, -25.0);
cocos2d::CCPoint::operator+(&v79, &v72, &v78);
cocos2d::CCPoint::operator=(&v74, v63, v64);
v19 = 1;
v20 = SetupInstantCountPopup::onTargetCountArrow;
}
else
{
sub_D1798C(&v73, "Target ID", 9);
cocos2d::CCPoint::CCPoint(&v78.origin, 70.0, 40.0);
cocos2d::CCPoint::operator+(&v79, &v72, &v78);
cocos2d::CCPoint::operator=(&v74, v17, v18);
v19 = 0;
v20 = SetupInstantCountPopup::onTargetID2Arrow;
}
}
else
{
sub_D1798C(&v73, "Item ID", 7);
cocos2d::CCPoint::CCPoint(&v78.origin, -70.0, 40.0);
cocos2d::CCPoint::operator+(&v79, &v72, &v78);
cocos2d::CCPoint::operator=(&v74, v65, v66);
v19 = 0;
v20 = SetupInstantCountPopup::onTargetIDArrow;
}
v21 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v21);
v21->setScale(v21, 0.65);
v22 = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v78.origin, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v79, &v74, &v78);
v22(v21, &v79.origin);
cocos2d::CCRect::CCRect(&v78, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v79, &v78);
v23 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v79,
v84);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v23->__vftable[1].~CCNode_0)(v23, 100);
getTag = v23->__vftable[1].getTag;
LOWORD(v79.origin.x) = 0;
BYTE2(v79.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v23, &v79);
cocos2d::CCSize::CCSize(&v75, 50.0, 30.0);
v23->setContentSize(v23, &v75);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, -1);
v23->setPosition(v23, &v74);
v25 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, 20);
v25->setPosition(v25, &v74);
CCTextInputNode::setMaxLabelScale(v25, 0.6);
CCTextInputNode::setMaxLabelWidth(v25, 200.0);
v25->m_textField->setVisible(v25->m_textField, 0);
v25->m_maxLabelLength = 6;
if ( v19 )
{
sub_D153B8((int)&v77, "0123456789-");
CCTextInputNode::setAllowedChars((__int64)v25, (__int64)&v77);
v26 = (void *)(*(_QWORD *)&v77 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(*(_QWORD *)&v77 - 8LL);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(*(_QWORD *)&v77 - 8LL);
*(_DWORD *)(*(_QWORD *)&v77 - 8LL) = v50 - 1;
}
if ( v50 <= 0 )
goto LABEL_26;
}
}
else
{
sub_D153B8((int)&v79, "0123456789");
CCTextInputNode::setAllowedChars((__int64)v25, (__int64)&v79);
v26 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v46 - 1;
}
if ( v46 <= 0 )
LABEL_26:
operator delete(v26);
}
}
v69.r = 120;
*(_WORD *)&v69.g = -3926;
CCTextInputNode::setLabelPlaceholderColor(v25, v69);
CCTextInputNode::setLabelPlaceholderScale(v25, 0.5);
v27 = v25->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v25->m_delegate = &a1->TextInputDelegate;
v25->m_numberInput = 1;
v27->setTag(v25, v14);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v74);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
v28->setScale(v28, 1.1);
v82.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v82.adj = (size_t)v20;
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, v82);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v29->setTag(v29, 1);
v68 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v77, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v79, &v76, &v77);
v68(v29, &v79.origin);
CCMenuItemSpriteExtra::setSizeMult(v29, 2.0);
v30 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
v30->setScale(v30, 1.1);
v83.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v83.adj = (size_t)v20;
v31 = CCMenuItemSpriteExtra::create(v30, nullptr, v83);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v31);
v31->setTag(v31, 2);
v32 = v31->setPosition;
cocos2d::CCPoint::CCPoint(&v77, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v79, &v76, &v77);
v32(v31, &v79.origin);
CCMenuItemSpriteExtra::setSizeMult(v31, 2.0);
if ( v14 )
{
if ( v14 == 1 )
a1->m_targetCountInput = v25;
else
a1->m_targetIDInput = v25;
}
else
{
a1->m_itemIDInput = v25;
}
v33 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v73 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v33);
}
++v14;
}
while ( v14 != 3 );
SetupInstantCountPopup::updateItemIDInputLabel(a1);
SetupInstantCountPopup::updateTargetIDInputLabel(a1);
SetupInstantCountPopup::updateCountTextInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
sub_D153B8((int)&v79, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
cocos2d::CCPoint::CCPoint(&v77, 50.0, -20.0);
cocos2d::CCPoint::operator+(&v78, &v72, &v77);
SetupTriggerPopup::createToggleButton(a1, &v79, SetupInstantCountPopup::onEnableGroup, 0, m_activateGroup, &v78);
v35 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v61 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v62 = __ldaxr(v61);
while ( __stlxr(v62 - 1, v61) );
}
else
{
v62 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v62 - 1;
}
if ( v62 <= 0 )
operator delete(v35);
}
cocos2d::CCPoint::CCPoint(&v76, (float)(v70 * 0.5) + -28.0, (float)(v71 * 0.5) + -42.0);
sub_D153B8((int)&v79, "Equals");
v36 = a1->m_mode == 0;
cocos2d::CCPoint::CCPoint(&v77, -90.0, 0.0);
cocos2d::CCPoint::operator+(&v78, &v76, &v77);
m_equalsToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v79,
SetupInstantCountPopup::onCountType,
0,
v36,
&v78);
a1->m_equalsToggler = m_equalsToggler;
v38 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v38);
m_equalsToggler = a1->m_equalsToggler;
}
m_equalsToggler->setTag(m_equalsToggler, 0);
a1->m_equalsToggler->m_notClickable = 1;
sub_D153B8((int)&v79, "Larger");
v39 = a1->m_mode == 1;
cocos2d::CCPoint::CCPoint(&v77, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v78, &v76, &v77);
m_largerToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v79,
SetupInstantCountPopup::onCountType,
0,
v39,
&v78);
a1->m_largerToggler = m_largerToggler;
v41 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v41);
m_largerToggler = a1->m_largerToggler;
}
m_largerToggler->setTag(m_largerToggler, 1);
a1->m_largerToggler->m_notClickable = 1;
sub_D153B8((int)&v79, "Smaller");
v42 = a1->m_mode == 2;
cocos2d::CCPoint::CCPoint(&v77, 90.0, 0.0);
cocos2d::CCPoint::operator+(&v78, &v76, &v77);
m_smallerToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v79,
SetupInstantCountPopup::onCountType,
0,
v42,
&v78);
a1->m_smallerToggler = m_smallerToggler;
v44 = (void *)(*(_QWORD *)&v79.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v79.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(*(_QWORD *)&v79.origin - 8LL);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *(_DWORD *)(*(_QWORD *)&v79.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v79.origin - 8LL) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v44);
m_smallerToggler = a1->m_smallerToggler;
}
m_smallerToggler->setTag(m_smallerToggler, 2);
a1->m_smallerToggler->m_notClickable = 1;
a1->m_disableTextDelegate = 0;
return v67;
}