//
// SetupSequenceTriggerPopup::init from 0x1004d8900 to 0x1004d9653 (3411 bytes)
//
// 1 xrefs:
// > SetupSequenceTriggerPopup::create @ 0x1004d88b9
//
// 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 12:31:14 +0000
//
__int64 __fastcall SetupSequenceTriggerPopup::init(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rbx
char *v6; // rax
void *v7; // rax
__int64 v8; // r14
__int64 v9; // rbx
__int64 v11; // rbx
int i; // r13d
__int64 (__fastcall *v13)(); // r12
std::string::pointer data; // rdi
char *v15; // rbx
__int64 v16; // xmm0_8
std::string::value_type *v17; // r8
char *v18; // rax
_DWORD *v19; // r12
void *v20; // rbx
int v21; // ebx
int v22; // ebx
char v23; // [rsp+40h] [rbp-1A0h] BYREF
char v24[15]; // [rsp+41h] [rbp-19Fh] BYREF
void *v25; // [rsp+50h] [rbp-190h]
_QWORD v26[2]; // [rsp+58h] [rbp-188h] BYREF
void *__p; // [rsp+68h] [rbp-178h]
__int128 v28; // [rsp+70h] [rbp-170h] BYREF
void *v29; // [rsp+80h] [rbp-160h] BYREF
__int128 v30; // [rsp+88h] [rbp-158h] BYREF
void *v31; // [rsp+98h] [rbp-148h]
__int128 v32; // [rsp+A0h] [rbp-140h] BYREF
void *v33; // [rsp+B0h] [rbp-130h]
std::string v34; // [rsp+B8h] [rbp-128h] BYREF
std::string v35; // [rsp+D0h] [rbp-110h] BYREF
std::string v36; // [rsp+E8h] [rbp-F8h] BYREF
__int128 v37; // [rsp+100h] [rbp-E0h] BYREF
void *v38; // [rsp+110h] [rbp-D0h]
__int128 v39; // [rsp+118h] [rbp-C8h] BYREF
void *v40; // [rsp+128h] [rbp-B8h]
__int128 v41; // [rsp+130h] [rbp-B0h] BYREF
void *v42; // [rsp+140h] [rbp-A0h]
unsigned __int64 v43; // [rsp+148h] [rbp-98h] BYREF
unsigned __int64 v44; // [rsp+150h] [rbp-90h] BYREF
float v45; // [rsp+158h] [rbp-88h]
float v46; // [rsp+15Ch] [rbp-84h]
void **v47; // [rsp+160h] [rbp-80h]
std::string v48; // [rsp+168h] [rbp-78h] BYREF
std::string v49; // [rsp+180h] [rbp-60h] BYREF
unsigned __int64 v50; // [rsp+19Ch] [rbp-44h] BYREF
__int64 v51; // [rsp+1A4h] [rbp-3Ch] BYREF
unsigned __int8 v52; // [rsp+1AFh] [rbp-31h]
unsigned __int64 v53[6]; // [rsp+1B0h] [rbp-30h] BYREF
result = SetupTriggerPopup::init(a1, a2, 0, 1, 420.0, 300.0, 0.0);
if ( !(_BYTE)result )
return result;
v52 = result;
SetupTriggerPopup::preSetup((_BYTE *)a1);
v3 = sub_1007FE900(a1);
*(_QWORD *)(a1 + 1032) = v3;
cocos2d::CCObject::retain(v3);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v51, v4);
v5 = cocos2d::CCLabelBMFont::create_3("Sequence Trigger", "goldFont.fnt");
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v5);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v5 + 160LL))(v5, 0.69999999);
sub_100278250(
(float *)&v49,
*(float *)&v51 * 0.5,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(*((float *)&v51 + 1) * 0.5)) + -18.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v5 + 184LL))(v5, &v49);
v6 = ButtonSprite::create_1(
(__int64)"OK",
0x28u,
0,
1u,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0.80000001,
30.0);
v7 = CCMenuItemSpriteExtra::create((__int64)v6, 0, a1, 1369, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v7);
v23 = 8;
strcpy(v24, "Help");
__p = operator new(0x1E8u);
v26[0] = 489;
v26[1] = 485;
strcpy(
(char *)__p,
"Activates a sequence of triggers. Every time it is called, the sequence is advanced one step.\n"
"GroupID is called the amount of times given by Count.\n"
"MinInt is the minimum interval between each step.\n"
"Mode Stop stops the sequence at the end.\n"
"Mode Loop restarts the sequence after ending.\n"
"Mode Last calls last group after the end.\n"
"Reset Full and Reset Step go back in the sequence if activation does not happen in a set time.");
v8 = InfoAlertButton::create(&v23, v26, 1.0);
if ( (v26[0] & 1) != 0 )
operator delete(__p);
if ( (v23 & 1) != 0 )
operator delete(v25);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v8);
v9 = *(_QWORD *)(a1 + 552);
sub_100278250(
(float *)&v48,
(float)((float)(*(float *)&v51 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 18.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(*((float *)&v51 + 1) * 0.5)) + -18.0);
cocos2d::CCNode::convertToNodeSpace((double *)&v49, v9, (unsigned int *)&v48);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v8 + 184LL))(v8, &v49);
sub_100278250((float *)&v43, (float)(*(float *)&v51 * 0.5) + -65.0, (float)(*((float *)&v51 + 1) * 0.5) + 82.0);
v49.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)16;
strcpy(v49.__r_.__value_.__s.__data_, "GroupID:");
sub_100278250((float *)&v44, -60.0, 0.0);
sub_100278350((double *)&v48, &v43, &v44);
IDNameInput::create(a1, a1 + 544, 1, -1, (unsigned int)&v49, (unsigned int)&v48, 6, 0, 0, 0);
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v49.__r_.__value_.__l.__data_);
v34.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)12;
strcpy(v34.__r_.__value_.__s.__data_, "Count:");
sub_100278250((float *)&v48, 60.0, 0.0);
sub_100278350((double *)&v49, &v43, (unsigned __int64 *)&v48);
SetupTriggerPopup::createValueControlAdvanced(
a1,
-2,
&v34,
(__int64)&v49,
1,
2u,
0.69999999,
0.0,
100.0,
6u,
1,
0,
0,
0,
2u,
0);
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v34.__r_.__value_.__l.__data_);
v47 = &v29;
v11 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)&v48, 138.0, 0.0);
sub_100278350((double *)&v49, &v43, (unsigned __int64 *)&v48);
cocos2d::CCNode::convertToNodeSpace((double *)&v44, v11, (unsigned int *)&v49);
for ( i = 0; i != 4; ++i )
{
strcpy((char *)&v49, "(edit_addCBtn_001.png");
strcpy((char *)&v48, " GJ_button_01.png");
v13 = SetupSequenceTriggerPopup::onAddChance;
if ( i )
{
if ( i == 1 )
{
std::string::assign(&v49, "edit_delCBtn_001.png");
std::string::assign(&v48, "GJ_button_06.png");
v13 = SetupSequenceTriggerPopup::onDeleteSelected;
}
else
{
std::string::assign(&v49, "edit_upBtn_001.png");
std::string::assign(&v48, "GJ_button_05.png");
v13 = SetupSequenceTriggerPopup::onChangeOrder;
}
}
data = v49.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
data = v49.__r_.__value_.__l.__data_;
v15 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)data, 7.753082858051579e228);
v16 = 3266576384LL;
if ( i != 2 )
{
if ( i != 3 )
goto LABEL_22;
v16 = 1119092736;
}
(*(void (__fastcall **)(char *, double))(*(_QWORD *)v15 + 360LL))(v15, *(double *)&v16);
LABEL_22:
v17 = v48.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
LODWORD(v17) = v48.__r_.__value_.__r.__words[2];
v18 = ButtonSprite::create((int)v15, 32, 0, 1u, (int)v17, 1, 32.0, 1.0, 0.0);
v19 = CCMenuItemSpriteExtra::create((__int64)v18, 0, a1, (__int64)v13, 0);
(*(void (__fastcall **)(_DWORD *, float))(*(_QWORD *)v19 + 160LL))(v19, 0.60000002);
v19[101] = 1058642330;
(*(void (__fastcall **)(_QWORD, _DWORD *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v19);
sub_100278250((float *)&v50, (float)i * 32.0, 0.0);
sub_100278350((double *)v53, &v44, &v50);
(*(void (__fastcall **)(_DWORD *, unsigned __int64 *))(*(_QWORD *)v19 + 184LL))(v19, v53);
(*(void (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)v19 + 72LL))(v19, (unsigned int)i);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v48.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) == 0 )
continue;
}
else if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) == 0 )
{
continue;
}
operator delete(v49.__r_.__value_.__l.__data_);
}
sub_100278270((__int64)&v49, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v20 = cocos2d::extension::CCScale9Sprite::create_2((__int64)"square02_001.png", (unsigned __int64 *)&v49);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v20 + 912LL))(v20, 50);
sub_100278260((float *)&v49, 370.0, 90.0);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v20 + 320LL))(v20, &v49);
(*(void (__fastcall **)(_QWORD, void *, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v20,
0xFFFFFFFFLL);
sub_100278250((float *)&v49, *(float *)&v51 * 0.5, (float)(*((float *)&v51 + 1) * 0.5) + 14.0);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v20 + 184LL))(v20, &v49);
sub_100278250((float *)&v49, *(float *)&v51 * 0.5, (float)(*((float *)&v51 + 1) * 0.5) + -50.0);
v35.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)14;
strcpy(v35.__r_.__value_.__s.__data_, "MinInt:");
sub_100278250((float *)v53, -91.0, -0.0);
sub_100278350((double *)&v48, (unsigned __int64 *)&v49, v53);
SetupTriggerPopup::createValueControlAdvanced(
a1,
437,
&v35,
(__int64)&v48,
0,
1u,
0.64999998,
0.0,
1.0,
6u,
0,
0,
0,
1u,
2u,
0);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v35.__r_.__value_.__l.__data_);
v36.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)12;
strcpy(v36.__r_.__value_.__s.__data_, "Reset:");
sub_100278250((float *)v53, 91.0, -0.0);
sub_100278350((double *)&v48, (unsigned __int64 *)&v49, v53);
SetupTriggerPopup::createValueControlAdvanced(
a1,
438,
&v36,
(__int64)&v48,
0,
1u,
0.64999998,
0.0,
1.0,
6u,
0,
0,
0,
1u,
2u,
0);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v36.__r_.__value_.__l.__data_);
sub_100278250((float *)v53, -25.0, -34.0);
sub_100278350((double *)&v48, (unsigned __int64 *)&v49, v53);
v45 = (*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1464LL))(a1, 436);
v46 = (*(float (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1464LL))(a1, 439);
LOBYTE(v28) = 18;
strcpy((char *)&v28 + 1, "Mode\nStop");
sub_100278250((float *)&v50, -158.0, 0.0);
sub_100278350((double *)v53, (unsigned __int64 *)&v48, &v50);
v21 = (int)v45;
SetupTriggerPopup::createCustomToggleValueControl((_QWORD *)a1, 0, (int)v45 == 0, 1, &v28, (__int64)v53, 0, 0, 0);
if ( (v28 & 1) != 0 )
operator delete(v29);
LOBYTE(v30) = 18;
strcpy((char *)&v30 + 1, "Mode\nLoop");
sub_100278250((float *)&v50, -79.0, 0.0);
sub_100278350((double *)v53, (unsigned __int64 *)&v48, &v50);
SetupTriggerPopup::createCustomToggleValueControl((_QWORD *)a1, 1u, v21 == 1, 1, &v30, (__int64)v53, 0, 0, 0);
if ( (v30 & 1) != 0 )
operator delete(v31);
LOBYTE(v32) = 18;
strcpy((char *)&v32 + 1, "Mode\nLast");
sub_100278250((float *)&v50, 0.0, 0.0);
sub_100278350((double *)v53, (unsigned __int64 *)&v48, &v50);
SetupTriggerPopup::createCustomToggleValueControl((_QWORD *)a1, 2u, v21 == 2, 1, &v32, (__int64)v53, 0, 0, 0);
if ( (v32 & 1) != 0 )
operator delete(v33);
LOBYTE(v37) = 20;
strcpy((char *)&v37 + 1, "Reset\nFull");
sub_100278250((float *)&v50, 79.0, 0.0);
sub_100278350((double *)v53, (unsigned __int64 *)&v48, &v50);
v22 = (int)v46;
SetupTriggerPopup::createCustomToggleValueControl((_QWORD *)a1, 0x64u, (int)v46 != 1, 1, &v37, (__int64)v53, 0, 0, 0);
if ( (v37 & 1) != 0 )
operator delete(v38);
LOBYTE(v39) = 20;
strcpy((char *)&v39 + 1, "Reset\nStep");
sub_100278250((float *)&v50, 158.0, 0.0);
sub_100278350((double *)v53, (unsigned __int64 *)&v48, &v50);
SetupTriggerPopup::createCustomToggleValueControl((_QWORD *)a1, 0x65u, v22 == 1, 1, &v39, (__int64)v53, 0, 0, 0);
if ( (v39 & 1) != 0 )
operator delete(v40);
LOBYTE(v41) = 24;
strcpy((char *)&v41 + 1, "Unique\nRemap");
sub_100278250(
(float *)v53,
(float)(*(float *)&v51 * 0.5) + 55.0,
(float)((float)(*((float *)&v51 + 1) * 0.5) - (float)(0.5 * *(float *)(a1 + 736))) + 20.0);
SetupTriggerPopup::createToggleValueControl(a1, 505, &v41, (__int64)v53, 0, 0, 1.0, 0);
if ( (v41 & 1) != 0 )
operator delete(v42);
sub_10021B1F0((float *)a1, 505);
SetupSequenceTriggerPopup::updateGroupIDButtons(a1);
SetupTriggerPopup::postSetup((_BYTE *)a1);
SetupTriggerPopup::updateValue((_QWORD *)a1, 0xFFFFFFFE, 1.0);
return v52;
}