//
// SetupItemCompareTriggerPopup::init from 0x1406039a0 to 0x140604d47 (5031 bytes)
//
// 2 xrefs:
// > SetupItemCompareTriggerPopup::create @ 0x140603949
// > ??> @ 0x14092f924
//
// 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:35:12 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupItemCompareTriggerPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rax
__int64 v7; // rdi
__int64 v8; // rax
__int64 v9; // rbx
__int64 v10; // rax
_BYTE *v11; // r8
_OWORD *v12; // rcx
const char *v13; // rax
__int64 v14; // rdx
__int64 v15; // rcx
__int64 v16; // rax
int v17; // ebx
__int64 v18; // rax
int v19; // r8d
void *v20; // rcx
__int64 v21; // rax
int v22; // r8d
int v23; // r9d
__int64 v24; // rax
int v25; // r8d
int v26; // r9d
__int64 v27; // rax
int v28; // r8d
int v29; // r9d
__int64 v30; // rax
int v31; // r8d
int v32; // r9d
__int64 v33; // rax
int v34; // r8d
int v35; // r9d
int v36; // ebx
__int64 v37; // rax
int v38; // r8d
void *v39; // rcx
__int64 v40; // rax
int v41; // r8d
int v42; // r9d
__int64 v43; // rax
int v44; // r8d
int v45; // r9d
__int64 v46; // rax
int v47; // r8d
int v48; // r9d
__int64 v49; // rax
int v50; // r8d
int v51; // r9d
__int64 v52; // rax
int v53; // r8d
int v54; // r9d
__int64 v55; // rax
__int64 v56; // rax
__int64 v57; // rax
void *v58; // rcx
__int64 v59; // rax
void *v60; // rcx
__int64 v61; // rax
unsigned int v62; // r14d
float v63; // xmm6_4
unsigned int v64; // r12d
int v65; // edx
__int64 *v66; // rdi
__int64 v67; // rbx
__int64 v68; // rax
__int64 *v69; // rsi
__int64 v70; // rdi
__int64 v71; // rbx
__int64 v72; // rax
__int64 v73; // rax
__int64 v74; // rax
__int64 v75; // rbx
__int64 v76; // rax
float v77; // xmm0_4
__int64 v78; // rcx
__int64 v79; // rax
_QWORD *v80; // rdi
__int64 v81; // rdx
void (__fastcall *v82)(_QWORD *, __int64); // r8
__int64 v83; // rbx
__int64 v84; // rax
struct cocos2d::CCLabelBMFont *v85; // rax
__int64 v86; // rax
__int64 v87; // [rsp+80h] [rbp-88h]
__int64 v88; // [rsp+80h] [rbp-88h]
int v89; // [rsp+88h] [rbp-80h] BYREF
void **v90; // [rsp+90h] [rbp-78h] BYREF
_BYTE v91[8]; // [rsp+98h] [rbp-70h] BYREF
void **v92; // [rsp+A0h] [rbp-68h] BYREF
__int128 v93; // [rsp+A8h] [rbp-60h] BYREF
__int64 v94; // [rsp+B8h] [rbp-50h]
__int64 v95; // [rsp+C0h] [rbp-48h]
float v96; // [rsp+C8h] [rbp-40h] BYREF
float v97; // [rsp+CCh] [rbp-3Ch]
_BYTE v98[8]; // [rsp+D0h] [rbp-38h] BYREF
_BYTE v99[8]; // [rsp+D8h] [rbp-30h] BYREF
_BYTE v100[8]; // [rsp+E0h] [rbp-28h] BYREF
_BYTE v101[8]; // [rsp+E8h] [rbp-20h] BYREF
_BYTE v102[8]; // [rsp+F0h] [rbp-18h] BYREF
void *Block[2]; // [rsp+F8h] [rbp-10h] BYREF
__int64 v104; // [rsp+108h] [rbp+0h]
unsigned __int64 v105; // [rsp+110h] [rbp+8h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1134231552, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v104 = 12;
v105 = 15;
strcpy((char *)Block, "Item Compare");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
SetupTriggerPopup::addTitle(a1, Block);
v7 = v6;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, -85.0, 0.0);
v9 = v8;
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 200LL))(v7);
cocos2d::CCPoint::operator+(v10, &v89, v9);
(*(void (__fastcall **)(__int64, int *))(*(_QWORD *)v7 + 184LL))(v7, &v89);
*(_OWORD *)Block = 0;
v104 = 2;
v105 = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v90 = Block;
*(_OWORD *)Block = 0;
v104 = 0;
v105 = 0;
v11 = sub_14003D460(0x220u);
Block[0] = v11;
v104 = 532;
v105 = 543;
v12 = v11;
v13 = "Activates TrueID or FalseID based on comparison of ItemID1 and ItemID2.\n"
"Use Item, Timer, Points, Time, or Att to specify type.\n"
"Mod1 and Mod2 are modifiers for the two Item IDs.\n"
"The first operator button sets interaction between ItemID1 and Mod 1 and similar for the second.\n"
"The third sets how the two values are compared.\n"
"Button 4/5 can be used to force values positive or negative.\n"
"Tol allows the result to be off a certain amount.\n"
"Click NA to switch to different rounding functions.";
v14 = 4;
do
{
*v12 = *(_OWORD *)v13;
v12[1] = *((_OWORD *)v13 + 1);
v12[2] = *((_OWORD *)v13 + 2);
v12[3] = *((_OWORD *)v13 + 3);
v12[4] = *((_OWORD *)v13 + 4);
v12[5] = *((_OWORD *)v13 + 5);
v12[6] = *((_OWORD *)v13 + 6);
v12 += 8;
*(v12 - 1) = *((_OWORD *)v13 + 7);
v13 += 128;
--v14;
}
while ( v14 );
*v12 = *(_OWORD *)v13;
*((_DWORD *)v12 + 4) = *((_DWORD *)v13 + 4);
v11[532] = 0;
v93 = 0;
v94 = 4;
v95 = 15;
strcpy((char *)&v93, "Help");
SetupTriggerPopup::addHelpButton(a1, &v93, Block);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v16 = cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::getWinSize(v16, &v96);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v91, v96 * 0.5, (float)(v97 * 0.5) + 66.0);
v17 = (int)(*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 476);
Block[1] = nullptr;
v104 = 7;
v105 = 15;
Block[0] = (void *)0x3144496D657449LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, -105.0, 42.0);
cocos2d::CCPoint::operator+(v91, &v89, v18);
if ( v17 == 1 )
{
v19 = 2;
}
else if ( v17 == 2 )
{
v19 = 4;
}
else
{
v19 = 0;
}
IDNameInput::create(
a1,
a1 + 544,
v19,
80,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v89,
1061997773,
6,
0,
0,
1);
if ( v105 > 0xF )
{
v20 = Block[0];
if ( v105 + 1 >= 0x1000 )
{
v20 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
v89 = 80;
*(_BYTE *)sub_14016EE40((__int64 *)(a1 + 856), &v89) = 1;
v90 = (void **)&v93;
v93 = 0;
v94 = 4;
v95 = 15;
strcpy((char *)&v93, "Item");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, 20.0, 43.0);
cocos2d::CCPoint::operator+(v91, &v89, v21);
LOBYTE(v22) = v17 == 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 1, v22, v23, (__int64)&v93, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 5;
v105 = 15;
strcpy((char *)Block, "Timer");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 62.0, 43.0);
cocos2d::CCPoint::operator+(v91, &v89, v24);
LOBYTE(v25) = v17 == 2;
SetupTriggerPopup::createCustomToggleValueControl(a1, 2, v25, v26, (__int64)Block, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 6;
v105 = 15;
strcpy((char *)Block, "Points");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 104.0, 43.0);
cocos2d::CCPoint::operator+(v91, &v89, v27);
LOBYTE(v28) = v17 == 3;
SetupTriggerPopup::createCustomToggleValueControl(a1, 3, v28, v29, (__int64)Block, (__int64)&v89, 1, 0, 0);
v92 = (void **)&v93;
v93 = 0;
v94 = 4;
v95 = 15;
strcpy((char *)&v93, "Time");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 146.0, 43.0);
cocos2d::CCPoint::operator+(v91, &v89, v30);
LOBYTE(v31) = v17 == 4;
SetupTriggerPopup::createCustomToggleValueControl(a1, 4, v31, v32, (__int64)&v93, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 3;
v105 = 15;
LODWORD(Block[0]) = 7631937;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 188.0, 43.0);
cocos2d::CCPoint::operator+(v91, &v89, v33);
LOBYTE(v34) = v17 == 5;
SetupTriggerPopup::createCustomToggleValueControl(a1, 5, v34, v35, (__int64)Block, (__int64)&v89, 1, 0, 0);
v36 = (int)(*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 477);
Block[1] = nullptr;
v104 = 7;
v105 = 15;
Block[0] = (void *)0x3244496D657449LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, -105.0, 0.0);
cocos2d::CCPoint::operator+(v91, &v89, v37);
if ( v36 == 1 )
{
v38 = 2;
}
else if ( v36 == 2 )
{
v38 = 4;
}
else
{
v38 = 0;
}
IDNameInput::create(
a1,
a1 + 544,
v38,
95,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v89,
1061997773,
6,
0,
0,
1);
if ( v105 > 0xF )
{
v39 = Block[0];
if ( v105 + 1 >= 0x1000 )
{
v39 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v39 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v39);
}
v89 = 95;
*(_BYTE *)sub_14016EE40((__int64 *)(a1 + 856), &v89) = 1;
v92 = (void **)&v93;
v93 = 0;
v94 = 4;
v95 = 15;
strcpy((char *)&v93, "Item");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 20.0, -1.0);
cocos2d::CCPoint::operator+(v91, &v89, v40);
LOBYTE(v41) = v36 == 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 101, v41, v42, (__int64)&v93, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 5;
v105 = 15;
strcpy((char *)Block, "Timer");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 62.0, -1.0);
cocos2d::CCPoint::operator+(v91, &v89, v43);
LOBYTE(v44) = v36 == 2;
SetupTriggerPopup::createCustomToggleValueControl(a1, 102, v44, v45, (__int64)Block, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 6;
v105 = 15;
strcpy((char *)Block, "Points");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 104.0, -1.0);
cocos2d::CCPoint::operator+(v91, &v89, v46);
LOBYTE(v47) = v36 == 3;
SetupTriggerPopup::createCustomToggleValueControl(a1, 103, v47, v48, (__int64)Block, (__int64)&v89, 1, 0, 0);
v92 = (void **)&v93;
v93 = 0;
v94 = 4;
v95 = 15;
strcpy((char *)&v93, "Time");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 146.0, -1.0);
cocos2d::CCPoint::operator+(v91, &v89, v49);
LOBYTE(v50) = v36 == 4;
SetupTriggerPopup::createCustomToggleValueControl(a1, 104, v50, v51, (__int64)&v93, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 3;
v105 = 15;
LODWORD(Block[0]) = 7631937;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 188.0, -1.0);
cocos2d::CCPoint::operator+(v91, &v89, v52);
LOBYTE(v53) = v36 == 5;
SetupTriggerPopup::createCustomToggleValueControl(a1, 105, v53, v54, (__int64)Block, (__int64)&v89, 1, 0, 0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 5;
v105 = 15;
strcpy((char *)Block, "Mod1:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, -105.0, -42.0);
cocos2d::CCPoint::operator+(v91, &v89, v55);
SetupTriggerPopup::createValueControlAdvanced(
a1,
479,
(unsigned int)Block,
(unsigned int)&v89,
1061997773,
0,
1,
10,
0,
-1073741824,
0x40000000,
0,
0,
1,
3,
0);
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 5;
v105 = 15;
strcpy((char *)Block, "Mod2:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, 105.0, -42.0);
cocos2d::CCPoint::operator+(v91, &v89, v56);
LOBYTE(v87) = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
483,
(unsigned int)Block,
(unsigned int)&v89,
1061997773,
0,
1,
10,
0,
-1073741824,
0x40000000,
0,
0,
1,
3,
v87);
*(_OWORD *)Block = 0;
v104 = 6;
v105 = 15;
strcpy((char *)Block, "TrueID");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, -105.0, -84.0);
cocos2d::CCPoint::operator+(v91, &v89, v57);
IDNameInput::create(
a1,
a1 + 544,
1,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v89,
1061997773,
6,
0,
0,
1);
if ( v105 > 0xF )
{
v58 = Block[0];
if ( v105 + 1 >= 0x1000 )
{
v58 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v58 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v58);
}
Block[1] = nullptr;
v104 = 7;
v105 = 15;
Block[0] = (void *)0x444965736C6146LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v92, 105.0, -84.0);
cocos2d::CCPoint::operator+(v91, &v89, v59);
IDNameInput::create(
a1,
a1 + 544,
1,
71,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v89,
1061997773,
6,
0,
0,
1);
if ( v105 > 0xF )
{
v60 = Block[0];
if ( v105 + 1 >= 0x1000 )
{
v60 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v60 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v60);
}
v92 = Block;
*(_OWORD *)Block = 0;
v104 = 6;
v105 = 15;
strcpy((char *)Block, "Tol+-:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v90, -105.0, -126.0);
cocos2d::CCPoint::operator+(v91, &v89, v61);
LOBYTE(v88) = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
484,
(unsigned int)Block,
(unsigned int)&v89,
1061997773,
0,
1,
10,
0,
0,
1065353216,
0,
0,
1,
3,
v88);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, 2.0, 2.0);
v62 = 0;
while ( 1 )
{
v63 = 0.0;
v64 = 480;
switch ( v62 )
{
case 1u:
v64 = 481;
break;
case 2u:
v64 = 482;
break;
case 3u:
v64 = 578;
break;
case 4u:
v64 = 579;
break;
case 5u:
v64 = 485;
v63 = 15.0;
break;
case 6u:
v64 = 486;
v63 = 36.0;
break;
}
v65 = 50;
if ( v62 < 5 )
v65 = 15;
v66 = (__int64 *)ButtonSprite::create_1(
(int)"+",
v65,
15,
0.40000001,
1,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
(*(void (__fastcall **)(__int64 *))(*v66 + 160))(v66);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v66[79] + 160LL))(v66[79]);
v67 = v66[79];
v68 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 200LL))(v67);
cocos2d::CCPoint::operator+(v68, &v89, v100);
(*(void (__fastcall **)(__int64, int *))(*(_QWORD *)v67 + 184LL))(v67, &v89);
v92 = (void **)operator new(0x208u);
v69 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v92);
if ( !v69 )
goto LABEL_53;
if ( !CCMenuItemSpriteExtra::init(v69, v66, 0, a1, (__int64)SetupItemCompareTriggerPopup::onOpButton) )
break;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v69);
LABEL_54:
(*(void (__fastcall **)(__int64 *, _QWORD))(*v69 + 64))(v69, v64);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v69);
if ( v62 < 5 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, (float)((float)(int)v62 * 42.0) + 20.0, -125.0);
cocos2d::CCPoint::operator+(v91, &v90, v74);
v75 = *v69;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v99, &v90);
(*(void (__fastcall **)(__int64 *, __int64))(v75 + 184))(v69, v76);
}
else
{
v70 = *v69;
v71 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v101,
(float)((float)(int)(50 * (v62 % 5)) + (float)((float)(v96 * 0.5) + 75.0)) + v63,
(float)((float)(v97 * 0.5) - 60.0) - 35.0);
cocos2d::CCNode::convertToNodeSpace(v71, v102, v72);
(*(void (__fastcall **)(__int64 *, __int64))(v70 + 184))(v69, v73);
}
v77 = (*(float (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1168LL))(a1, v64);
SetupItemCompareTriggerPopup::updateOpButton(v78, v69, (unsigned int)(int)v77, v64);
if ( (int)++v62 >= 7 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v98, (float)(v96 * 0.5) - 80.0, (float)(v97 * 0.5) - 95.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Block, 0.0, 0.0, 80.0, 80.0);
v80 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v79);
v81 = v80[40];
v82 = *(void (__fastcall **)(_QWORD *, __int64))(v81 + 40);
LOBYTE(v81) = 50;
v82(v80 + 40, v81);
(*(void (__fastcall **)(_QWORD *, void *))v80[40])(v80 + 40, &unk_1407046A0);
v83 = *v80;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v99, 960.0, 88.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v83 + 312))(v80, v84);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v80,
1);
(*(void (__fastcall **)(_QWORD *, _BYTE *))(*v80 + 184LL))(v80, v98);
(*(void (__fastcall **)(_QWORD *))(*v80 + 160LL))(v80);
v85 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
*(_QWORD *)(a1 + 1000) = v85;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v85,
2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v99, 0.0, 1.0);
cocos2d::CCPoint::operator+(v98, &v90, v86);
(*(void (__fastcall **)(_QWORD, void ***))(**(_QWORD **)(a1 + 1000) + 184LL))(*(_QWORD *)(a1 + 1000), &v90);
SetupItemCompareTriggerPopup::updateFormulaLabel(a1);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
}
(*(void (__fastcall **)(__int64 *, __int64))(*v69 + 8))(v69, 1);
LABEL_53:
v69 = nullptr;
goto LABEL_54;
}
return result;
}