//
// SetupPlatformerEndPopup::init from 0x1405b2cd0 to 0x1405b32f2 (1570 bytes)
//
// 3 xrefs:
// > SetupPlatformerEndPopup::create @ 0x1405b2c8e
// > ??> @ 0x14092dbf0
// > ??> @ 0x14092dbfc
//
// 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:43 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupPlatformerEndPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rbx
_BYTE *v7; // r8
_BYTE *v8; // rcx
const char *v9; // rdx
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rbx
__int64 v13; // rax
void *v14; // rcx
__int64 v15; // rax
void *v16; // rcx
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax
void **v20; // [rsp+68h] [rbp-59h] BYREF
_BYTE v21[8]; // [rsp+70h] [rbp-51h] BYREF
void **v22; // [rsp+78h] [rbp-49h] BYREF
float v23[2]; // [rsp+80h] [rbp-41h] BYREF
void **v24; // [rsp+88h] [rbp-39h] BYREF
void *v25[2]; // [rsp+90h] [rbp-31h] BYREF
__m128i v26; // [rsp+A0h] [rbp-21h]
void *Block[2]; // [rsp+B0h] [rbp-11h] BYREF
__m128i si128; // [rsp+C0h] [rbp-1h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1131413504, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
v25[1] = (void *)100;
v26.m128i_i64[0] = 9;
v26.m128i_i64[1] = 15;
v25[0] = (void *)0x6E45207075746553LL;
SetupTriggerPopup::addTitle(a1, v25);
*(_OWORD *)v25 = 0;
v6 = 2;
v26.m128i_i64[0] = 2;
v26.m128i_i64[1] = 15;
strcpy((char *)v25, "OK");
SetupTriggerPopup::addCloseButton(a1, v25);
v20 = v25;
*(_OWORD *)v25 = 0;
v26 = 0u;
v7 = sub_14003D460(0x170u);
v25[0] = v7;
v26.m128i_i64[0] = 367;
v26.m128i_i64[1] = 367;
v8 = v7;
v9 = "Sets a specific object given by TargetPos to be the end of the level. The player is pulled into"
" the end instantly.\n"
"SpawnID lets you spawn a group at the end.\n"
"Instant teleports the player to the end instantly instead of the default gradual pull.\n"
"No Effects disables visual end effects.\n"
"No SFX disables end sound effects.";
do
{
*(_OWORD *)v8 = *(_OWORD *)v9;
*((_OWORD *)v8 + 1) = *((_OWORD *)v9 + 1);
*((_OWORD *)v8 + 2) = *((_OWORD *)v9 + 2);
*((_OWORD *)v8 + 3) = *((_OWORD *)v9 + 3);
*((_OWORD *)v8 + 4) = *((_OWORD *)v9 + 4);
*((_OWORD *)v8 + 5) = *((_OWORD *)v9 + 5);
*((_OWORD *)v8 + 6) = *((_OWORD *)v9 + 6);
v8 += 128;
*((_OWORD *)v8 - 1) = *((_OWORD *)v9 + 7);
v9 += 128;
--v6;
}
while ( v6 );
*(_OWORD *)v8 = *(_OWORD *)v9;
*((_OWORD *)v8 + 1) = *((_OWORD *)v9 + 1);
*((_OWORD *)v8 + 2) = *((_OWORD *)v9 + 2);
*((_OWORD *)v8 + 3) = *((_OWORD *)v9 + 3);
*((_OWORD *)v8 + 4) = *((_OWORD *)v9 + 4);
*((_OWORD *)v8 + 5) = *((_OWORD *)v9 + 5);
*((_QWORD *)v8 + 12) = *((_QWORD *)v9 + 12);
*((_DWORD *)v8 + 26) = *((_DWORD *)v9 + 26);
*((_WORD *)v8 + 54) = *((_WORD *)v9 + 54);
v8[110] = v9[110];
v7[367] = 0;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 4;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Help");
SetupTriggerPopup::addHelpButton(a1, Block, v25);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v23);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v21, v23[0] * 0.5, v23[1] * 0.5);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836590);
Block[0] = (void *)0x3A44496E77617053LL;
Block[1] = nullptr;
v12 = (__int64)(a1 + 544);
if ( !a1 )
v12 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, -75.0, 50.0);
cocos2d::CCPoint::operator+(v21, &v20, v13);
IDNameInput::create(
(__int64)a1,
v12,
1,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v20,
1061997773,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
v25[1] = (void *)14963;
v26 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
v25[0] = (void *)0x6F50746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, 75.0, 50.0);
cocos2d::CCPoint::operator+(v21, &v20, v15);
IDNameInput::create(
(__int64)a1,
v12,
1,
71,
(__int64)v25,
(const struct cocos2d::CCPoint *)&v20,
1061997773,
6,
0,
0,
0);
if ( v26.m128i_i64[1] > 0xFuLL )
{
v16 = v25[0];
if ( (unsigned __int64)(v26.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)v25[0] - 1);
if ( (unsigned __int64)((char *)v25[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
v22 = v25;
v25[1] = (void *)29556;
v26.m128i_i64[0] = 10;
v26.m128i_i64[1] = 15;
v25[0] = (void *)0x6365666645206F4ELL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v24, -90.0, 0.0);
cocos2d::CCPoint::operator+(v21, &v20, v17);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
460,
(unsigned int)v25,
(unsigned int)&v20,
0,
0,
0,
1065353216);
v24 = v25;
*(_OWORD *)v25 = 0;
v26.m128i_i64[0] = 6;
v26.m128i_i64[1] = 15;
strcpy((char *)v25, "No SFX");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, -90.0, -30.0);
cocos2d::CCPoint::operator+(v21, &v20, v18);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
461,
(unsigned int)v25,
(unsigned int)&v20,
0,
0,
0,
1065353216);
v24 = v25;
v25[1] = nullptr;
v26.m128i_i64[0] = 7;
v26.m128i_i64[1] = 15;
v25[0] = (void *)0x746E6174736E49LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, 40.0, 0.0);
cocos2d::CCPoint::operator+(v21, &v20, v19);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
487,
(unsigned int)v25,
(unsigned int)&v20,
0,
0,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}