//
// SetupEndPopup::init from 0x1405b2030 to 0x1405b27a1 (1905 bytes)
//
// 2 xrefs:
// > SetupEndPopup::create @ 0x1405b1fd8
// > ??> @ 0x14092db3c
//
// 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:42 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupEndPopup::init(__int64 a1, __int64 a2, int a3, int a4)
{
char result; // al
__int64 v7; // rcx
__int64 v8; // rax
struct cocos2d::CCLabelBMFont *v9; // rdi
__int64 v10; // rbx
__int64 v11; // rax
cocos2d::CCObject *v12; // rbx
cocos2d::CCObject *v13; // rax
_BYTE *v14; // rax
_BYTE *v15; // rcx
const char *v16; // rdx
__int64 v17; // r8
char *v18; // rsi
__int64 v19; // rdi
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
const struct cocos2d::CCPoint *v23; // rax
char *v24; // rbx
void *v25; // r8
__int64 v26; // rax
cocos2d::CCString *v27; // rax
const char *CString; // rax
size_t v29; // r8
__int64 v30; // rax
unsigned __int8 v31; // bl
__int64 v32; // rax
unsigned __int8 v33; // bl
__int64 v34; // rax
float v35; // [rsp+68h] [rbp-A0h] BYREF
float v36; // [rsp+6Ch] [rbp-9Ch]
void **v37; // [rsp+70h] [rbp-98h] BYREF
void **v38; // [rsp+78h] [rbp-90h] BYREF
__int128 v39; // [rsp+80h] [rbp-88h] BYREF
__int64 v40; // [rsp+90h] [rbp-78h]
__int64 v41; // [rsp+98h] [rbp-70h]
void **v42; // [rsp+A0h] [rbp-68h] BYREF
_BYTE v43[8]; // [rsp+A8h] [rbp-60h] BYREF
_BYTE v44[8]; // [rsp+B0h] [rbp-58h] BYREF
void *Block[2]; // [rsp+B8h] [rbp-50h] BYREF
__int64 v46; // [rsp+C8h] [rbp-40h]
unsigned __int64 v47; // [rsp+D0h] [rbp-38h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1131413504, 1, 0);
if ( result )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v35);
v9 = cocos2d::CCLabelBMFont::create("End Trigger", "goldFont.fnt");
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1 + 464LL))(a1, v9);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v9 + 160LL))(v9);
v10 = *(_QWORD *)v9;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v37,
v35 * 0.5,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v36 * 0.5)) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v10 + 184))(v9, v11);
v37 = (void **)operator new(0x2C8u);
v12 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v37);
if ( v12 )
{
if ( ButtonSprite::init_1(
(__int64)v12,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v12);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v12 + 8LL))(v12, 1);
LODWORD(v12) = 0;
}
}
v13 = CCMenuItemSpriteExtra::create((int)v12, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v13);
v37 = Block;
*(_OWORD *)Block = 0;
v46 = 0;
v47 = 0;
v14 = sub_14003D460(0x140u);
Block[0] = v14;
v46 = 307;
v47 = 319;
v15 = v14;
v16 = "Sets a specific object given by Group ID to be the end of the level when the game type is Clas"
"sic. This essentially spawns the endwall at a set location.\n"
"Use Reversed if gameplay is reverse at the end.\n"
"Lock Y locks the endwall to the ground instead of the group's Y position.";
v17 = 2;
do
{
*(_OWORD *)v15 = *(_OWORD *)v16;
*((_OWORD *)v15 + 1) = *((_OWORD *)v16 + 1);
*((_OWORD *)v15 + 2) = *((_OWORD *)v16 + 2);
*((_OWORD *)v15 + 3) = *((_OWORD *)v16 + 3);
*((_OWORD *)v15 + 4) = *((_OWORD *)v16 + 4);
*((_OWORD *)v15 + 5) = *((_OWORD *)v16 + 5);
*((_OWORD *)v15 + 6) = *((_OWORD *)v16 + 6);
v15 += 128;
*((_OWORD *)v15 - 1) = *((_OWORD *)v16 + 7);
v16 += 128;
--v17;
}
while ( v17 );
*(_OWORD *)v15 = *(_OWORD *)v16;
*((_OWORD *)v15 + 1) = *((_OWORD *)v16 + 1);
*((_OWORD *)v15 + 2) = *((_OWORD *)v16 + 2);
*((_WORD *)v15 + 24) = *((_WORD *)v16 + 24);
v15[50] = v16[50];
v14[307] = 0;
v39 = 0;
v40 = 4;
v41 = 15;
strcpy((char *)&v39, "Help");
v18 = InfoAlertButton::create((__int64)&v39, (__int64)Block);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v18);
v19 = *(_QWORD *)v18;
v20 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v37,
(float)((float)(v35 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 18.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v36 * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v20, &v38, v21);
(*(void (__fastcall **)(char *, __int64))(v19 + 184))(v18, v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, v35 * 0.5, (float)(v36 * 0.5) + 30.0);
Block[1] = nullptr;
v46 = 8;
v47 = 15;
Block[0] = (void *)0x44492070756F7247LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, (const struct cocos2d::CCPoint *)v43);
v24 = IDNameInput::create(a1, a1 + 544, 1, 51, (__int64)Block, v23, 1065353216, 6, 0, 0, 0);
if ( v47 > 0xF )
{
v25 = Block[0];
if ( v47 + 1 >= 0x1000 )
{
v25 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v25 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v25);
}
v46 = 0;
v47 = 15;
LOBYTE(Block[0]) = 0;
if ( v24 )
v26 = *((_QWORD *)v24 + 48);
else
v26 = 0;
*(_QWORD *)(a1 + 1000) = v26;
*(_BYTE *)(a1 + 744) = 1;
v27 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, *(unsigned int *)(a1 + 1012));
CString = cocos2d::CCString::getCString(v27);
v39 = 0;
v40 = 0;
v41 = 0;
v29 = -1;
do
++v29;
while ( CString[v29] );
sub_14003D230(&v39, CString, v29);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1000), &v39);
*(_BYTE *)(a1 + 744) = 0;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v44,
(float)((float)(v35 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 20.0,
(float)((float)(v36 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 60.0);
if ( a2 && (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1648LL))(a2) == 36 )
{
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 1648LL))(a2) == 36 )
{
v38 = Block;
v46 = 14;
v47 = 15;
strcpy((char *)Block, "Multi\nActivate");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, 0.0, -35.0);
cocos2d::CCPoint::operator+(v44, &v37, v30);
SetupTriggerPopup::createToggleButton(
a1,
(unsigned int)Block,
(unsigned int)SetupEndPopup::onMultiActivate,
*(unsigned __int8 *)(a1 + 1016),
(__int64)&v37);
}
}
else
{
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
}
v42 = (void **)&v39;
v40 = 8;
v41 = 15;
v39 = 0x6465737265766552uLL;
v31 = *(_BYTE *)(a1 + 1008);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, (float)(v35 * 0.5) - 50.0, (float)(v36 * 0.5) - 20.0);
SetupTriggerPopup::createToggleButton(a1, (unsigned int)&v39, (unsigned int)SetupEndPopup::onReversed, v31, v32);
v42 = Block;
*(_OWORD *)Block = 0;
v46 = 6;
v47 = 15;
strcpy((char *)Block, "Lock Y");
v33 = *(_BYTE *)(a1 + 1009);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v38, (float)(v35 * 0.5) + 50.0, (float)(v36 * 0.5) - 20.0);
SetupTriggerPopup::createToggleButton(a1, (unsigned int)Block, (unsigned int)SetupEndPopup::onLockY, v33, v34);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}