//
// SetupInstantCountPopup::init from 0x1405b78a0 to 0x1405b8591 (3313 bytes)
//
// 2 xrefs:
// > SetupInstantCountPopup::create @ 0x1405b785d
// > ??> @ 0x14092dd88
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:34:44 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupInstantCountPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
_BYTE *v6; // r9
_BYTE *v7; // rcx
const char *v8; // rdx
__int64 v9; // r8
__int64 v10; // rcx
__int64 v11; // rax
size_t v12; // r14
__int64 v13; // r15
__int64 v14; // rax
char *v15; // rdi
void *v16; // r8
__m128i v17; // xmm6
__int64 v18; // rax
char *v19; // rbx
void *v20; // r8
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
struct cocos2d::CCLabelBMFont *v24; // rbx
__int64 v25; // rax
__int64 v26; // rax
_QWORD *v27; // rdi
__int64 v28; // rdx
void (__fastcall *v29)(_QWORD *, __int64); // r8
__int64 v30; // rbx
__int64 v31; // rax
__int64 v32; // rdx
__int64 v33; // rcx
char *v34; // rax
__int64 v35; // rcx
__int64 v36; // rcx
__int64 v37; // rcx
__int64 v38; // rcx
struct cocos2d::CCSprite *v39; // rax
cocos2d::CCObject *v40; // rbx
__int64 v41; // rax
struct cocos2d::CCSprite *v42; // rax
cocos2d::CCObject *v43; // rbx
__int64 v44; // rax
cocos2d::CCString *v45; // rax
const char *CString; // rax
size_t v47; // r8
cocos2d::CCString *v48; // rax
const char *v49; // rax
__int64 v50; // rax
int v51; // ebx
__int64 v52; // rax
int v53; // r9d
__int64 v54; // rax
int v55; // ebx
__int64 v56; // rax
int v57; // r9d
__int64 v58; // rax
int v59; // ebx
__int64 v60; // rax
int v61; // r9d
__int64 v62; // rax
void **v63; // [rsp+60h] [rbp-A0h] BYREF
void **v64; // [rsp+68h] [rbp-98h] BYREF
__int16 v65; // [rsp+70h] [rbp-90h] BYREF
char v66; // [rsp+72h] [rbp-8Eh]
_BYTE v67[8]; // [rsp+78h] [rbp-88h] BYREF
_BYTE v68[8]; // [rsp+80h] [rbp-80h] BYREF
float v69; // [rsp+88h] [rbp-78h] BYREF
float v70; // [rsp+8Ch] [rbp-74h]
_BYTE v71[8]; // [rsp+90h] [rbp-70h] BYREF
_BYTE v72[8]; // [rsp+98h] [rbp-68h] BYREF
_BYTE v73[16]; // [rsp+A0h] [rbp-60h] BYREF
_BYTE v74[8]; // [rsp+B0h] [rbp-50h] BYREF
void *v75[2]; // [rsp+B8h] [rbp-48h] BYREF
__m128i v76; // [rsp+C8h] [rbp-38h]
void *Block[2]; // [rsp+D8h] [rbp-28h] BYREF
__m128i si128; // [rsp+E8h] [rbp-18h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1133248512, 1, 0);
if ( result )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
*(_OWORD *)v75 = 0;
v75[0] = sub_14003D460(0x20u);
v76.m128i_i64[0] = 21;
v76.m128i_i64[1] = 31;
strcpy((char *)v75[0], "Instant Count Trigger");
SetupTriggerPopup::addTitle(a1, v75);
*(_OWORD *)v75 = 0;
v76.m128i_i64[0] = 2;
v76.m128i_i64[1] = 15;
strcpy((char *)v75, "OK");
SetupTriggerPopup::addCloseButton(a1, v75);
v63 = v75;
*(_OWORD *)v75 = 0;
v76 = 0u;
v6 = sub_14003D460(0x140u);
v75[0] = v6;
v76.m128i_i64[0] = 314;
v76.m128i_i64[1] = 319;
v7 = v6;
v8 = "Disables objects using Target ID when an Item ID reaches a certain Target Count. The co"
"ndition 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.";
v9 = 2;
do
{
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_OWORD *)v7 + 5) = *((_OWORD *)v8 + 5);
*((_OWORD *)v7 + 6) = *((_OWORD *)v8 + 6);
v7 += 128;
*((_OWORD *)v7 - 1) = *((_OWORD *)v8 + 7);
v8 += 128;
--v9;
}
while ( v9 );
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_QWORD *)v7 + 6) = *((_QWORD *)v8 + 6);
*((_WORD *)v7 + 28) = *((_WORD *)v8 + 28);
v6[314] = 0;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 4;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Help");
SetupTriggerPopup::addHelpButton(a1, Block, v75);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v69);
v12 = -1;
*(_DWORD *)(a1 + 640) = -1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, v69 * 0.5, (float)(v70 * 0.5) + 25.0);
Block[1] = nullptr;
si128 = _mm_load_si128((const __m128i *)&xmmword_140836580);
Block[0] = (void *)0x4449206D657449LL;
v13 = a1 + 544;
if ( !a1 )
v13 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, -90.0, 40.0);
cocos2d::CCPoint::operator+(v68, v74, v14);
v15 = IDNameInput::create(
a1,
v13,
2,
0,
(__int64)Block,
(const struct cocos2d::CCPoint *)v74,
1065353216,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
v17 = _mm_load_si128((const __m128i *)&Size);
si128 = v17;
LOBYTE(Block[0]) = 0;
v75[1] = (void *)68;
v76 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v75[0] = (void *)0x4920746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, 90.0, 40.0);
cocos2d::CCPoint::operator+(v68, &v63, v18);
v19 = IDNameInput::create(
a1,
v13,
1,
2,
(__int64)v75,
(const struct cocos2d::CCPoint *)&v63,
1065353216,
6,
0,
0,
0);
if ( v76.m128i_i64[1] > 0xFuLL )
{
v20 = v75[0];
if ( (unsigned __int64)(v76.m128i_i64[1] + 1) >= 0x1000 )
{
v20 = *((void **)v75[0] - 1);
if ( (unsigned __int64)((char *)v75[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
v17 = _mm_load_si128((const __m128i *)&Size);
}
v76 = v17;
LOBYTE(v75[0]) = 0;
if ( v15 )
v21 = *((_QWORD *)v15 + 48);
else
v21 = 0;
*(_QWORD *)(a1 + 1000) = v21;
if ( v19 )
v22 = *((_QWORD *)v19 + 48);
else
v22 = 0;
*(_QWORD *)(a1 + 1008) = v22;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, -90.0, -25.0);
cocos2d::CCPoint::operator+(v68, v67, v23);
v24 = cocos2d::CCLabelBMFont::create((const char *)&qword_1407F0AF8, "goldFont.fnt");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v24);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v24 + 160LL))(v24);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, 0.0, 30.0);
cocos2d::CCPoint::operator+(v67, &v63, v25);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, void ***))(*(_QWORD *)v24 + 184LL))(v24, &v63);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v73, 0.0, 0.0, 40.0, 40.0);
v27 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v26);
v28 = v27[40];
v29 = *(void (__fastcall **)(_QWORD *, __int64))(v28 + 40);
LOBYTE(v28) = 100;
v29(v27 + 40, v28);
v65 = 0;
v66 = 0;
(*(void (__fastcall **)(_QWORD *, __int16 *))v27[40])(v27 + 40, &v65);
v30 = *v27;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v64, 50.0, 30.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v30 + 312))(v27, v31);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v27,
0xFFFFFFFFLL);
(*(void (__fastcall **)(_QWORD *, _BYTE *))(*v27 + 184LL))(v27, v67);
v34 = CCTextInputNode::create(v33, v32, (__int64)"Num");
*(_QWORD *)(a1 + 1016) = v34;
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v34, 20);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**(_QWORD **)(a1 + 1016) + 184LL))(*(_QWORD *)(a1 + 1016), v67);
v35 = *(_QWORD *)(a1 + 1016);
*(_DWORD *)(v35 + 564) = 1058642330;
CCTextInputNode::refreshLabel(v35);
v36 = *(_QWORD *)(a1 + 1016);
*(_DWORD *)(v36 + 560) = 1128792064;
CCTextInputNode::refreshLabel(v36);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 1016) + 592LL) + 336LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 1016) + 592LL),
0);
*(_DWORD *)(*(_QWORD *)(a1 + 1016) + 608LL) = 6;
v76.m128i_i64[0] = 11;
v76.m128i_i64[1] = 15;
v75[0] = (void *)0x3736353433323130LL;
v75[1] = (void *)2963768;
CCTextInputNode::setAllowedChars(*(_QWORD *)(a1 + 1016), v75);
v37 = *(_QWORD *)(a1 + 1016);
*(_WORD *)(v37 + 572) = -21896;
*(_BYTE *)(v37 + 574) = -16;
CCTextInputNode::refreshLabel(v37);
v38 = *(_QWORD *)(a1 + 1016);
*(_DWORD *)(v38 + 568) = 1056964608;
CCTextInputNode::refreshLabel(v38);
*(_QWORD *)(*(_QWORD *)(a1 + 1016) + 600LL) = v13;
*(_BYTE *)(*(_QWORD *)(a1 + 1016) + 424LL) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1016) + 64LL))(*(_QWORD *)(a1 + 1016), 1);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v72, v67);
v39 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
LODWORD(v30) = (_DWORD)v39;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v39 + 160LL))(v39);
v40 = CCMenuItemSpriteExtra::create(v30, 0, a1, (__int64)SetupInstantCountPopup::onTargetCountArrow);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v40);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v40 + 64LL))(v40, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, -50.0, 0.0);
cocos2d::CCPoint::operator+(v72, &v63, v41);
(*(void (__fastcall **)(cocos2d::CCObject *, void ***))(*(_QWORD *)v40 + 184LL))(v40, &v63);
*((_DWORD *)v40 + 93) = 0x40000000;
v42 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
LODWORD(v40) = (_DWORD)v42;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v42 + 160LL))(v42);
v43 = CCMenuItemSpriteExtra::create((int)v40, 0, a1, (__int64)SetupInstantCountPopup::onTargetCountArrow);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v43);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v43 + 64LL))(v43, 2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, 50.0, 0.0);
cocos2d::CCPoint::operator+(v72, &v63, v44);
(*(void (__fastcall **)(cocos2d::CCObject *, void ***))(*(_QWORD *)v43 + 184LL))(v43, &v63);
*((_DWORD *)v43 + 93) = 0x40000000;
*(_BYTE *)(a1 + 744) = 1;
v45 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, *(unsigned int *)(a1 + 1024));
CString = cocos2d::CCString::getCString(v45);
*(_OWORD *)v75 = 0;
v76 = 0u;
v47 = -1;
do
++v47;
while ( CString[v47] );
sub_14003D230(v75, CString, v47);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1000), v75);
*(_BYTE *)(a1 + 744) = 1;
v48 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, *(unsigned int *)(a1 + 1028));
v49 = cocos2d::CCString::getCString(v48);
*(_OWORD *)v75 = 0;
v76 = 0u;
do
++v12;
while ( v49[v12] );
sub_14003D230(v75, v49, v12);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1008), v75);
*(_BYTE *)(a1 + 744) = 0;
SetupInstantCountPopup::updateCountTextInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v64 = v75;
v76.m128i_i64[0] = 14;
v76.m128i_i64[1] = 15;
strcpy((char *)v75, "Activate\nGroup");
HIBYTE(v75[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 50.0, -20.0);
cocos2d::CCPoint::operator+(v68, &v63, v50);
SetupTriggerPopup::createToggleButton(
a1,
(unsigned int)v75,
(unsigned int)SetupInstantCountPopup::onEnableGroup,
*(unsigned __int8 *)(a1 + 1036),
(__int64)&v63);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, (float)(v69 * 0.5) - 28.0, (float)(v70 * 0.5) - 42.0);
v64 = v75;
v51 = *(_DWORD *)(a1 + 1040);
*(_OWORD *)v75 = 0;
v76.m128i_i64[0] = 6;
v76.m128i_i64[1] = 15;
strcpy((char *)v75, "Equals");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, -90.0, 0.0);
cocos2d::CCPoint::operator+(v71, &v63, v52);
LOBYTE(v53) = v51 == 0;
SetupTriggerPopup::createToggleButton(
a1,
(unsigned int)v75,
(unsigned int)SetupInstantCountPopup::onCountType,
v53,
(__int64)&v63);
*(_QWORD *)(a1 + 1048) = v54;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v54 + 64LL))(v54, 0);
*(_BYTE *)(*(_QWORD *)(a1 + 1048) + 393LL) = 1;
v64 = v75;
v55 = *(_DWORD *)(a1 + 1040);
*(_OWORD *)v75 = 0;
v76.m128i_i64[0] = 6;
v76.m128i_i64[1] = 15;
strcpy((char *)v75, "Larger");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 0.0, 0.0);
cocos2d::CCPoint::operator+(v71, &v63, v56);
LOBYTE(v57) = v55 == 1;
SetupTriggerPopup::createToggleButton(
a1,
(unsigned int)v75,
(unsigned int)SetupInstantCountPopup::onCountType,
v57,
(__int64)&v63);
*(_QWORD *)(a1 + 1056) = v58;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v58 + 64LL))(v58, 1);
*(_BYTE *)(*(_QWORD *)(a1 + 1056) + 393LL) = 1;
v64 = v75;
v59 = *(_DWORD *)(a1 + 1040);
v75[1] = nullptr;
v76.m128i_i64[0] = 7;
v76.m128i_i64[1] = 15;
v75[0] = (void *)0x72656C6C616D53LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, 90.0, 0.0);
cocos2d::CCPoint::operator+(v71, &v63, v60);
LOBYTE(v61) = v59 == 2;
SetupTriggerPopup::createToggleButton(
a1,
(unsigned int)v75,
(unsigned int)SetupInstantCountPopup::onCountType,
v61,
(__int64)&v63);
*(_QWORD *)(a1 + 1064) = v62;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v62 + 64LL))(v62, 2);
*(_BYTE *)(*(_QWORD *)(a1 + 1064) + 393LL) = 1;
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}