//
// SetupRandTriggerPopup::init from 0x1405d4ed0 to 0x1405d59bf (2799 bytes)
//
// 2 xrefs:
// > SetupRandTriggerPopup::create @ 0x1405d4e8e
// > ??> @ 0x14092e9ac
//
// 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:57 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupRandTriggerPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
struct cocos2d::CCLabelBMFont *v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
cocos2d::CCObject *v11; // rbx
cocos2d::CCObject *v12; // rax
_BYTE *v13; // rax
_BYTE *v14; // rcx
const char *v15; // rdx
__int64 v16; // r8
char *v17; // rsi
__int64 v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
char *v23; // rdi
void *v24; // r8
__int64 v25; // rax
char *v26; // rbx
void *v27; // r8
__int64 v28; // rax
__int64 v29; // rax
struct cocos2d::CCLabelBMFont *v30; // rdi
__int64 v31; // rbx
__int64 v32; // rax
__int64 v33; // rax
_QWORD *v34; // rsi
__int64 v35; // rdx
void (__fastcall *v36)(_QWORD *, __int64); // r8
__int64 v37; // rax
__int64 v38; // rdx
__int64 v39; // rcx
const char *v40; // r8
char *v41; // rax
__int64 v42; // rdi
__int64 v43; // rbx
__int64 v44; // rax
__int64 v45; // rcx
__int64 v46; // rcx
__int64 v47; // rcx
__int64 v48; // rcx
__int64 v49; // r8
cocos2d::CCLayer *v50; // rax
__int64 v51; // rax
float v52; // xmm1_4
__int64 v53; // rax
__int64 v54; // rax
__int64 v55; // rbx
__int64 v56; // rax
void **v57; // [rsp+60h] [rbp-A0h] BYREF
float v58; // [rsp+68h] [rbp-98h] BYREF
float v59; // [rsp+6Ch] [rbp-94h]
__int16 v60; // [rsp+70h] [rbp-90h]
_BYTE v61[8]; // [rsp+78h] [rbp-88h] BYREF
_BYTE v62[8]; // [rsp+80h] [rbp-80h] BYREF
_BYTE v63[4]; // [rsp+88h] [rbp-78h] BYREF
float v64; // [rsp+8Ch] [rbp-74h]
_BYTE v65[8]; // [rsp+90h] [rbp-70h] BYREF
_BYTE v66[8]; // [rsp+98h] [rbp-68h] BYREF
_BYTE v67[8]; // [rsp+A0h] [rbp-60h] BYREF
_BYTE v68[16]; // [rsp+A8h] [rbp-58h] BYREF
_BYTE v69[16]; // [rsp+B8h] [rbp-48h] BYREF
void *v70[2]; // [rsp+C8h] [rbp-38h] BYREF
__int64 v71; // [rsp+D8h] [rbp-28h]
unsigned __int64 v72; // [rsp+E0h] [rbp-20h]
void *Block[2]; // [rsp+E8h] [rbp-18h] BYREF
__int64 v74; // [rsp+F8h] [rbp-8h]
unsigned __int64 v75; // [rsp+100h] [rbp+0h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1133248512, 1, 0);
if ( result )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v58);
v8 = cocos2d::CCLabelBMFont::create("Random Trigger", "goldFont.fnt");
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v8);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v8 + 160LL))(v8);
v9 = *(_QWORD *)v8;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v57,
v58 * 0.5,
(float)((float)(v59 * 0.5) + (float)(*(float *)(a1 + 736) * 0.5)) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v9 + 184))(v8, v10);
v57 = (void **)operator new(0x2C8u);
v11 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v11 )
{
if ( ButtonSprite::init_1(
(__int64)v11,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v11);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v11 + 8LL))(v11, 1);
LODWORD(v11) = 0;
}
}
v12 = CCMenuItemSpriteExtra::create((int)v11, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v12);
v57 = v70;
*(_OWORD *)v70 = 0;
v71 = 0;
v72 = 0;
v13 = sub_14003D460(0x110u);
v70[0] = v13;
v71 = 268;
v72 = 271;
v14 = v13;
v15 = "Triggers one of two groups randomly.\n"
"Chance is how likely it is that the first group is triggered.\n"
"For example, setting this to 80% means that there is 80% chance that Group ID 1 is triggered and 20% c"
"hance that Group ID 2 is triggered.";
v16 = 2;
do
{
*(_OWORD *)v14 = *(_OWORD *)v15;
*((_OWORD *)v14 + 1) = *((_OWORD *)v15 + 1);
*((_OWORD *)v14 + 2) = *((_OWORD *)v15 + 2);
*((_OWORD *)v14 + 3) = *((_OWORD *)v15 + 3);
*((_OWORD *)v14 + 4) = *((_OWORD *)v15 + 4);
*((_OWORD *)v14 + 5) = *((_OWORD *)v15 + 5);
*((_OWORD *)v14 + 6) = *((_OWORD *)v15 + 6);
v14 += 128;
*((_OWORD *)v14 - 1) = *((_OWORD *)v15 + 7);
v15 += 128;
--v16;
}
while ( v16 );
*(_QWORD *)v14 = *(_QWORD *)v15;
*((_DWORD *)v14 + 2) = *((_DWORD *)v15 + 2);
v13[268] = 0;
*(_OWORD *)Block = 0;
v74 = 4;
v75 = 15;
strcpy((char *)Block, "Help");
v17 = InfoAlertButton::create((__int64)Block, (__int64)v70);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v17);
v18 = *(_QWORD *)v17;
v19 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v57,
(float)((float)(v58 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 18.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v59 * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v19, v65, v20);
(*(void (__fastcall **)(char *, __int64))(v18 + 184))(v17, v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v66, v58 * 0.5, (float)(v59 * 0.5) + 50.0);
Block[1] = (void *)12576;
v74 = 10;
v75 = 15;
Block[0] = (void *)0x44492070756F7247LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, -90.0, 0.0);
cocos2d::CCPoint::operator+(v66, v65, v22);
v23 = IDNameInput::create(
a1,
a1 + 544,
1,
3,
(__int64)Block,
(const struct cocos2d::CCPoint *)v65,
1065353216,
6,
0,
0,
0);
if ( v75 > 0xF )
{
v24 = Block[0];
if ( v75 + 1 >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
v74 = 0;
v75 = 15;
LOBYTE(Block[0]) = 0;
v70[1] = (void *)12832;
v71 = 10;
v72 = 15;
v70[0] = (void *)0x44492070756F7247LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 90.0, 0.0);
cocos2d::CCPoint::operator+(v66, &v57, v25);
v26 = IDNameInput::create(
a1,
a1 + 544,
1,
5,
(__int64)v70,
(const struct cocos2d::CCPoint *)&v57,
1065353216,
6,
0,
0,
0);
if ( v72 > 0xF )
{
v27 = v70[0];
if ( v72 + 1 >= 0x1000 )
{
v27 = *((void **)v70[0] - 1);
if ( (unsigned __int64)((char *)v70[0] - (char *)v27 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v27);
}
v71 = 0;
v72 = 15;
LOBYTE(v70[0]) = 0;
if ( v23 )
v28 = *((_QWORD *)v23 + 48);
else
v28 = 0;
*(_QWORD *)(a1 + 1024) = v28;
if ( v26 )
v29 = *((_QWORD *)v26 + 48);
else
v29 = 0;
*(_QWORD *)(a1 + 1032) = v29;
SetupRandTriggerPopup::updateTextInputLabel(a1);
SetupRandTriggerPopup::updateTextInputLabel2(a1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v58 * 0.5, (float)(v59 * 0.5) - 10.0);
v30 = cocos2d::CCLabelBMFont::create("Chance %: ", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v30 + 160LL))(v30);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, _BYTE *))(*(_QWORD *)v30 + 184LL))(v30, v62);
v31 = *(_QWORD *)v30;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 1.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v31 + 288))(v30, v32);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v30);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v69, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v68, (const struct cocos2d::CCRect *)v69);
v34 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02_small.png", v33);
v35 = v34[40];
v36 = *(void (__fastcall **)(_QWORD *, __int64))(v35 + 40);
LOBYTE(v35) = 100;
v36(v34 + 40, v35);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v67, 70.0, 30.0);
(*(void (__fastcall **)(_QWORD *, _BYTE *))(*v34 + 312LL))(v34, v67);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v34,
0xFFFFFFFFLL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 45.0, 0.0);
cocos2d::CCPoint::operator+(v62, &v57, v37);
(*(void (__fastcall **)(_QWORD *, void ***))(*v34 + 184LL))(v34, &v57);
v40 = "Num";
if ( *(float *)(a1 + 1016) == -99999.0 )
v40 = "Mixed";
v41 = CCTextInputNode::create(v39, v38, (__int64)v40);
*(_QWORD *)(a1 + 1000) = v41;
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v41, 20);
v42 = **(_QWORD **)(a1 + 1000);
v43 = *(_QWORD *)(a1 + 1000);
v44 = (*(__int64 (__fastcall **)(_QWORD *))(*v34 + 200LL))(v34);
(*(void (__fastcall **)(__int64, __int64))(v42 + 184))(v43, v44);
v45 = *(_QWORD *)(a1 + 1000);
*(_DWORD *)(v45 + 564) = 1058642330;
CCTextInputNode::refreshLabel(v45);
v46 = *(_QWORD *)(a1 + 1000);
*(_DWORD *)(v46 + 560) = 1128792064;
CCTextInputNode::refreshLabel(v46);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 1000) + 592LL) + 336LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 1000) + 592LL),
0);
*(_DWORD *)(*(_QWORD *)(a1 + 1000) + 608LL) = 7;
v71 = 11;
v72 = 15;
v70[0] = (void *)0x3736353433323130LL;
v70[1] = (void *)3029304;
CCTextInputNode::setAllowedChars(*(_QWORD *)(a1 + 1000), v70);
v60 = -21896;
v47 = *(_QWORD *)(a1 + 1000);
*(_WORD *)(v47 + 572) = -21896;
*(_BYTE *)(v47 + 574) = -16;
CCTextInputNode::refreshLabel(v47);
v48 = *(_QWORD *)(a1 + 1000);
*(_DWORD *)(v48 + 568) = 1056964608;
CCTextInputNode::refreshLabel(v48);
*(_BYTE *)(*(_QWORD *)(a1 + 1000) + 424LL) = 1;
*(_QWORD *)(*(_QWORD *)(a1 + 1000) + 600LL) = a1 + 544;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1000) + 64LL))(*(_QWORD *)(a1 + 1000), 4);
v50 = Slider::create(
a1,
(__int64)SetupRandTriggerPopup::sliderChanged,
v49,
"slidergroove.png",
(__int64)"sliderthumb.png",
(__int64)"sliderthumbsel.png",
0.80000001);
*(_QWORD *)(a1 + 1008) = v50;
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v50 + 52) + 336LL))(*((_QWORD *)v50 + 52), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1008));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 0.0, -32.0);
cocos2d::CCPoint::operator+(v62, &v57, v51);
(*(void (__fastcall **)(_QWORD, void ***))(**(_QWORD **)(a1 + 1008) + 184LL))(*(_QWORD *)(a1 + 1008), &v57);
v52 = fminf(100.0, *(float *)(a1 + 1016) / 100.0);
if ( v52 < 0.0 )
v52 = 0.0;
Slider::setValue(*(_QWORD *)(a1 + 1008), v52);
SetupRandTriggerPopup::updateChanceLabel(a1);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v63,
(float)((float)(v58 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 20.0,
(float)((float)(v59 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 20.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, 0.0, 30.0);
cocos2d::CCPoint::operator+(v63, &v57, v53);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v68,
(float)((float)(*(float *)(a1 + 732) * 0.5) + (float)(v58 * 0.5)) - 80.0,
v64 + 30.0);
v55 = v54;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (const struct cocos2d::CCPoint *)v63);
SetupTriggerPopup::createMultiTriggerItems(a1, &v57, v56, v55);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}