//
// SetupCheckpointPopup::init from 0x1405ff1a0 to 0x1405ff87c (1756 bytes)
//
// 2 xrefs:
// > EditorUI::editObjectSpecial @ 0x1401bd700
// > ??> @ 0x14092f834
//
// 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:10 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupCheckpointPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
_BYTE *v6; // r9
_BYTE *v7; // rcx
const char *v8; // rdx
__int64 v9; // r8
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rdi
__int64 v13; // rax
void *v14; // rcx
__int64 v15; // rax
void *v16; // rcx
__m128i v17; // xmm6
__int64 v18; // rax
void *v19; // rcx
__int64 v20; // rax
void *v21; // rcx
__int64 v22; // rax
void **v23; // [rsp+68h] [rbp-59h] BYREF
_BYTE v24[8]; // [rsp+70h] [rbp-51h] BYREF
void **v25; // [rsp+78h] [rbp-49h] BYREF
float v26[2]; // [rsp+80h] [rbp-41h] BYREF
_BYTE v27[8]; // [rsp+88h] [rbp-39h] BYREF
void *Block[2]; // [rsp+90h] [rbp-31h] BYREF
__m128i si128; // [rsp+A0h] [rbp-21h]
void *v30[2]; // [rsp+B0h] [rbp-11h] BYREF
__m128i v31; // [rsp+C0h] [rbp-1h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1133248512, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 16;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Setup Checkpoint");
SetupTriggerPopup::addTitle(a1, Block);
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v23 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
v6 = sub_14003D460(0x1C0u);
Block[0] = v6;
si128.m128i_i64[0] = 441;
si128.m128i_i64[1] = 447;
v7 = v6;
v8 = "Checkpoints used when the game type is Platformer.\n"
"PreSpawnID spawned before the checkpoint is saved.\n"
"SpawnID spawned after the checkpoint is saved.\n"
"RespawnID spawned after respawning at the checkpoint.\n"
"TargetPos lets you set a respawn location upon death after the checkpoint. Make sure this group contain"
"s one object.\n"
"Player Pos respawns where the player was when the checkpoint was touched.";
v9 = 3;
do
{
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_OWORD *)v7 + 5) = *((_OWORD *)v8 + 5);
*((_OWORD *)v7 + 6) = *((_OWORD *)v8 + 6);
v7 += 128;
*((_OWORD *)v7 - 1) = *((_OWORD *)v8 + 7);
v8 += 128;
--v9;
}
while ( v9 );
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_QWORD *)v7 + 6) = *((_QWORD *)v8 + 6);
v7[56] = v8[56];
v6[441] = 0;
*(_OWORD *)v30 = 0;
v31.m128i_i64[0] = 4;
v31.m128i_i64[1] = 15;
strcpy((char *)v30, "Help");
SetupTriggerPopup::addHelpButton(a1, v30, Block);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v26);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, v26[0] * 0.5, v26[1] * 0.5);
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365C0);
Block[0] = (void *)0x6E77617053657250LL;
Block[1] = (void *)3818569;
v12 = (__int64)(a1 + 544);
if ( !a1 )
v12 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, -80.0, 60.0);
cocos2d::CCPoint::operator+(v24, &v23, v13);
IDNameInput::create(
(__int64)a1,
v12,
1,
604,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v23,
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);
}
v30[1] = nullptr;
v31 = _mm_load_si128((const __m128i *)&xmmword_140836590);
v30[0] = (void *)0x3A44496E77617053LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, 80.0, 60.0);
cocos2d::CCPoint::operator+(v24, &v23, v15);
IDNameInput::create(
(__int64)a1,
v12,
1,
51,
(__int64)v30,
(const struct cocos2d::CCPoint *)&v23,
1061997773,
6,
0,
0,
0);
if ( v31.m128i_i64[1] > 0xFuLL )
{
v16 = v30[0];
if ( (unsigned __int64)(v31.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)v30[0] - 1);
if ( (unsigned __int64)((char *)v30[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
Block[1] = (void *)14916;
v17 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
si128 = v17;
Block[0] = (void *)0x496E776170736552LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, -80.0, -5.0);
cocos2d::CCPoint::operator+(v24, &v23, v18);
IDNameInput::create(
(__int64)a1,
v12,
1,
448,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v23,
1061997773,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v19 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
v17 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
}
Block[1] = (void *)14963;
si128 = v17;
Block[0] = (void *)0x6F50746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, 80.0, -5.0);
cocos2d::CCPoint::operator+(v24, &v23, v20);
IDNameInput::create(
(__int64)a1,
v12,
1,
71,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v23,
1061997773,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v21 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
v25 = Block;
Block[1] = (void *)29551;
si128.m128i_i64[0] = 10;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x5020726579616C50LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v27, 80.0, -60.0);
cocos2d::CCPoint::operator+(v24, &v23, v22);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
138,
(unsigned int)Block,
(unsigned int)&v23,
1,
0,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}