//
// SetupSpawnPopup::init from 0x1405f3eb0 to 0x1405f4cd1 (3617 bytes)
//
// 2 xrefs:
// > SetupSpawnPopup::create @ 0x1405f3e68
// > ??> @ 0x14092f3cc
//
// 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:07 +0000
//
// Hidden C++ exception states: #wind=9
char __fastcall SetupSpawnPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
_BYTE *v6; // r8
_OWORD *v7; // rcx
const char *v8; // rax
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rax
void *v13; // rcx
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rcx
cocos2d::CCObject *v20; // rax
__int64 v21; // rax
void *v22; // rcx
__int64 v23; // rax
void *v24; // rcx
struct cocos2d::CCSprite *v25; // rdi
cocos2d::CCObject *v26; // rbx
__int64 v27; // r9
struct cocos2d::CCObject *v28; // rdi
__int64 v29; // rax
__int64 v30; // rbx
__int64 v31; // rax
cocos2d::CCArray *PageContainer; // rax
struct cocos2d::CCSprite *v33; // rdi
cocos2d::CCObject *v34; // rbx
__int64 v35; // r9
struct cocos2d::CCObject *v36; // rdi
__int64 v37; // rax
__int64 v38; // rbx
__int64 v39; // rax
cocos2d::CCArray *v40; // rax
__int64 v41; // rax
cocos2d::CCObject *v42; // rbx
struct cocos2d::CCObject *v43; // rsi
__int64 v44; // rdi
__int64 v45; // rbx
__int64 v46; // rax
__int64 v47; // rax
cocos2d::CCArray *v48; // rax
__int64 v49; // rax
struct cocos2d::CCObject *v50; // rdi
__int64 v51; // rdx
void (__fastcall *v52)(char *, __int64); // r8
__int64 v53; // rbx
__int64 v54; // rax
cocos2d::CCArray *v55; // rax
__int64 v56; // [rsp+30h] [rbp-D0h]
__int64 v57; // [rsp+78h] [rbp-88h]
void **v58; // [rsp+80h] [rbp-80h] BYREF
void **v59; // [rsp+88h] [rbp-78h] BYREF
_BYTE v60[8]; // [rsp+90h] [rbp-70h] BYREF
float v61; // [rsp+98h] [rbp-68h] BYREF
float v62; // [rsp+9Ch] [rbp-64h]
_BYTE v63[8]; // [rsp+A0h] [rbp-60h] BYREF
void *Block[2]; // [rsp+A8h] [rbp-58h] BYREF
__int64 v65; // [rsp+B8h] [rbp-48h]
unsigned __int64 v66; // [rsp+C0h] [rbp-40h]
void *v67[2]; // [rsp+C8h] [rbp-38h] BYREF
__int64 v68; // [rsp+D8h] [rbp-28h]
unsigned __int64 v69; // [rsp+E0h] [rbp-20h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1133248512, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v68 = 11;
v69 = 15;
v67[0] = (void *)0x7247206E77617053LL;
v67[1] = (void *)7370095;
SetupTriggerPopup::addTitle(a1, v67);
*(_OWORD *)Block = 0;
v65 = 2;
v66 = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v58 = Block;
*(_OWORD *)Block = 0;
v65 = 0;
v66 = 0;
v6 = sub_14003D460(0x170u);
Block[0] = v6;
v65 = 360;
v66 = 367;
v7 = v6;
v8 = "Activates other triggers simultaneously regardless of X position. These triggers need to use Group ID a"
"nd have Spawn Trigger enabled.\n"
"Preview Disable disables activation while not playtesting in editor.\n"
"Spawn Ordered spawns the triggers in order from left to right.\n"
"Use remapping (page 2) to copy a Spawn setup to another group.";
v9 = 2;
do
{
*v7 = *(_OWORD *)v8;
v7[1] = *((_OWORD *)v8 + 1);
v7[2] = *((_OWORD *)v8 + 2);
v7[3] = *((_OWORD *)v8 + 3);
v7[4] = *((_OWORD *)v8 + 4);
v7[5] = *((_OWORD *)v8 + 5);
v7[6] = *((_OWORD *)v8 + 6);
v7 += 8;
*(v7 - 1) = *((_OWORD *)v8 + 7);
v8 += 128;
--v9;
}
while ( v9 );
*v7 = *(_OWORD *)v8;
v7[1] = *((_OWORD *)v8 + 1);
v7[2] = *((_OWORD *)v8 + 2);
v7[3] = *((_OWORD *)v8 + 3);
v7[4] = *((_OWORD *)v8 + 4);
v7[5] = *((_OWORD *)v8 + 5);
*((_QWORD *)v7 + 12) = *((_QWORD *)v8 + 12);
v6[360] = 0;
*(_OWORD *)v67 = 0;
v68 = 4;
v69 = 15;
strcpy((char *)v67, "Help");
SetupTriggerPopup::addHelpButton(a1, v67, Block);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v61);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v60, v61 * 0.5, v62 * 0.5);
Block[1] = nullptr;
v65 = 8;
v66 = 15;
Block[0] = (void *)0x44492070756F7247LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, -50.0, 50.0);
cocos2d::CCPoint::operator+(v60, &v58, v12);
IDNameInput::create(
a1,
a1 + 544,
1,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v58,
1063675494,
6,
0,
0,
0);
if ( v66 > 0xF )
{
v13 = Block[0];
if ( v66 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
v67[0] = Block;
*(_OWORD *)Block = 0;
v65 = 6;
v66 = 15;
strcpy((char *)Block, "Delay:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, -85.0, -35.0);
cocos2d::CCPoint::operator+(v60, &v58, v14);
SetupTriggerPopup::createValueControlAdvanced(
a1,
63,
(unsigned int)Block,
(unsigned int)&v58,
1060320051,
0,
1,
10,
0,
0,
1065353216,
0,
0,
1,
5,
0,
v58);
v59 = Block;
*(_OWORD *)Block = 0;
v65 = 2;
v66 = 15;
strcpy((char *)Block, "+-");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 80.0, -35.0);
cocos2d::CCPoint::operator+(v60, &v58, v15);
LOBYTE(v57) = 0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
556,
(unsigned int)Block,
(unsigned int)&v58,
1060320051,
0,
1,
10,
0,
0,
1065353216,
0,
0,
1,
5,
v57);
v59 = Block;
v65 = 15;
v66 = 15;
strcpy((char *)Block, "Preview\nDisable");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 50.0, 85.0);
cocos2d::CCPoint::operator+(v60, &v58, v16);
SetupTriggerPopup::createToggleValueControl(a1, 102, (unsigned int)Block, (unsigned int)&v58, 0, 0, 0, 1065353216);
v59 = Block;
v65 = 13;
v66 = 15;
strcpy((char *)Block, "Spawn\nOrdered");
HIWORD(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 50.0, 50.0);
cocos2d::CCPoint::operator+(v60, &v58, v17);
SetupTriggerPopup::createToggleValueControl(a1, 441, (unsigned int)Block, (unsigned int)&v58, 0, 0, 0, 1065353216);
v59 = Block;
v65 = 11;
v66 = 15;
Block[0] = (void *)0x65520A7465736552LL;
Block[1] = (void *)7364973;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 50.0, 15.0);
cocos2d::CCPoint::operator+(v60, &v58, v18);
SetupTriggerPopup::createToggleValueControl(a1, 581, (unsigned int)Block, (unsigned int)&v58, 0, 0, 0, 1065353216);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, v61 * 0.5, v62 * 0.5);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*(_QWORD *)(a1 + 1008) = v20;
cocos2d::CCObject::retain(v20);
v68 = 11;
v69 = 15;
v67[0] = (void *)0x6C616E696769724FLL;
v67[1] = (void *)3818569;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, -100.0, 65.0);
cocos2d::CCPoint::operator+(v63, &v58, v21);
IDNameInput::create(
a1,
a1 + 544,
1,
-1,
(__int64)v67,
(const struct cocos2d::CCPoint *)&v58,
1060320051,
6,
0,
1,
0);
if ( v69 > 0xF )
{
v22 = v67[0];
if ( v69 + 1 >= 0x1000 )
{
v22 = *((void **)v67[0] - 1);
if ( (unsigned __int64)((char *)v67[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
*(_OWORD *)Block = 0;
v65 = 6;
v66 = 15;
strcpy((char *)Block, "NewID:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, 20.0, 65.0);
cocos2d::CCPoint::operator+(v63, &v58, v23);
IDNameInput::create(
a1,
a1 + 544,
1,
-2,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v58,
1060320051,
6,
0,
1,
0);
if ( v66 > 0xF )
{
v24 = Block[0];
if ( v66 + 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);
}
v25 = cocos2d::CCSprite::createWithSpriteFrameName("edit_addCBtn_001.png");
v59 = (void **)operator new(0x2C8u);
v26 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v59);
if ( v26 )
{
if ( ButtonSprite::init((__int64 *)v26, (__int64)v25, 32, v27, 32.0, 1065353216, v56, "GJ_button_01.png", 1, 0) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v26 + 8LL))(v26, 1);
LODWORD(v26) = 0;
}
}
v28 = CCMenuItemSpriteExtra::create((int)v26, 0, a1, (__int64)SetupSpawnPopup::onAddRemap);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v28 + 160LL))(v28);
*((_DWORD *)v28 + 101) = 1058642330;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v28);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, 120.0, 65.0);
cocos2d::CCPoint::operator+(v63, &v58, v29);
v30 = *(_QWORD *)v28;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v67, &v58);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v30 + 184))(v28, v31);
PageContainer = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(PageContainer, v28);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("edit_delCBtn_001.png");
v59 = (void **)operator new(0x2C8u);
v34 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v59);
if ( v34 )
{
if ( ButtonSprite::init((__int64 *)v34, (__int64)v33, 32, v35, 32.0, 1065353216, v56, "GJ_button_06.png", 1, 0) )
{
cocos2d::CCObject::autorelease(v34);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v34 + 8LL))(v34, 1);
LODWORD(v34) = 0;
}
}
v36 = CCMenuItemSpriteExtra::create((int)v34, 0, a1, (__int64)SetupSpawnPopup::onDeleteRemap);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v36 + 160LL))(v36);
*((_DWORD *)v36 + 101) = 1058642330;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v36);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, 150.0, 65.0);
cocos2d::CCPoint::operator+(v63, &v58, v37);
v38 = *(_QWORD *)v36;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v67, &v58);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v38 + 184))(v36, v39);
v40 = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(v40, v36);
v41 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v59 = (void **)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v59);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v41 = qword_14090BFD0;
}
if ( *(_QWORD *)(*(_QWORD *)(v41 + 568) + 15616LL) )
{
v59 = (void **)operator new(0x2C8u);
v42 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v59);
if ( v42 )
{
if ( ButtonSprite::init_1(
(__int64)v42,
(__int64)"Paste",
30,
0,
1056964608,
1,
"goldFont.fnt",
(__int64)"GJ_button_04.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v42);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v42 + 8LL))(v42, 1);
v42 = nullptr;
}
}
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v42 + 160LL))(v42);
v43 = CCMenuItemSpriteExtra::create((int)v42, 0, a1, (__int64)SetupSpawnPopup::onPasteRemap);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v43);
v44 = *(_QWORD *)v43;
v45 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v59,
(float)((float)(*(float *)(a1 + 732) * 0.5) + (float)(v61 * 0.5)) - 25.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v62 * 0.5)) - 20.0);
cocos2d::CCNode::convertToNodeSpace(v45, v67, v46);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v44 + 184))(v43, v47);
v48 = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(v48, v43);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67, 0.0, 0.0, 80.0, 80.0);
v50 = (struct cocos2d::CCObject *)cocos2d::extension::CCScale9Sprite::create("square02_001.png", v49);
v51 = *((_QWORD *)v50 + 40);
v52 = *(void (__fastcall **)(char *, __int64))(v51 + 40);
LOBYTE(v51) = 50;
v52((char *)v50 + 320, v51);
v53 = *(_QWORD *)v50;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v59, 360.0, 90.0);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v53 + 312))(v50, v54);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v50,
0xFFFFFFFFLL);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v50 + 184LL))(v50, v63);
v55 = (cocos2d::CCArray *)SetupTriggerPopup::getPageContainer(a1, 1);
cocos2d::CCArray::addObject(v55, v50);
SetupSpawnPopup::updateRemapButtons(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
SetupTriggerPopup::createPageButtons(a1);
SetupTriggerPopup::goToPage(a1, 0, 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}