//
// SetupTeleportPopup::init from 0x1405f6820 to 0x1405f7ac4 (4772 bytes)
//
// 2 xrefs:
// > SetupTeleportPopup::create @ 0x1405f67d2
// > ??> @ 0x14092f4ec
//
// 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:08 +0000
//
// Hidden C++ exception states: #wind=8
char __fastcall SetupTeleportPopup::init(_BYTE *a1, int a2, int a3, int a4, char a5)
{
char result; // al
_BYTE *v8; // r9
_BYTE *v9; // rcx
const char *v10; // rdx
__int64 v11; // r8
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rdx
void *v16; // rcx
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
int v25; // eax
int v26; // r9d
int v27; // edx
int v28; // eax
struct cocos2d::CCLabelBMFont *v29; // rbx
__int64 v30; // rcx
cocos2d::CCObject *v31; // rax
int i; // r14d
size_t v33; // rbx
__int16 v34; // ax
__int64 v35; // rax
__int64 v36; // rbx
__int64 v37; // rdi
float *v38; // rax
struct cocos2d::CCObject *ToggleButton; // rbx
__int64 v40; // rax
struct cocos2d::CCLabelBMFont *v41; // rbx
__int64 v42; // rax
__int64 v43; // rax
__int64 v44; // rax
__int64 v45; // rax
void **v46; // rdx
__int64 v47; // rax
__int64 v48; // rax
void **v49; // rdx
__int64 v50; // rax
void **v51; // rdx
__int64 v52; // rax
void **v53; // rdx
__int64 v54; // r8
__int64 v55; // r8
void **v56; // [rsp+88h] [rbp-80h] BYREF
void **v57; // [rsp+90h] [rbp-78h] BYREF
void **v58; // [rsp+98h] [rbp-70h] BYREF
_BYTE v59[8]; // [rsp+A0h] [rbp-68h] BYREF
void **v60; // [rsp+A8h] [rbp-60h] BYREF
float v61; // [rsp+B0h] [rbp-58h] BYREF
float v62; // [rsp+B4h] [rbp-54h]
_BYTE v63[8]; // [rsp+B8h] [rbp-50h] BYREF
_BYTE v64[8]; // [rsp+C0h] [rbp-48h] BYREF
_BYTE v65[8]; // [rsp+C8h] [rbp-40h] BYREF
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i si128; // [rsp+E0h] [rbp-28h]
void *Src[2]; // [rsp+F0h] [rbp-18h] BYREF
size_t Size; // [rsp+100h] [rbp-8h]
unsigned __int64 v70; // [rsp+108h] [rbp+0h]
int v71; // [rsp+118h] [rbp+10h] BYREF
void *v72[4]; // [rsp+120h] [rbp+18h] BYREF
_BYTE v73[8]; // [rsp+140h] [rbp+38h] BYREF
int v74; // [rsp+148h] [rbp+40h]
char v75; // [rsp+14Ch] [rbp+44h]
int v76; // [rsp+150h] [rbp+48h]
int v77; // [rsp+154h] [rbp+4Ch]
char v78; // [rsp+158h] [rbp+50h]
int v79; // [rsp+15Ch] [rbp+54h]
__int64 v80; // [rsp+160h] [rbp+58h]
__int64 v81; // [rsp+168h] [rbp+60h]
int v82; // [rsp+170h] [rbp+68h]
char v83; // [rsp+174h] [rbp+6Ch]
_BYTE v84[40]; // [rsp+180h] [rbp+78h] BYREF
_BYTE v85[32]; // [rsp+1A8h] [rbp+A0h] BYREF
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1133248512, 1, 0);
if ( !result )
return result;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
si128.m128i_i64[0] = 14;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Setup Teleport");
HIBYTE(Block[1]) = 0;
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);
v56 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
v8 = sub_14003D460(0x170u);
Block[0] = v8;
si128.m128i_i64[0] = 363;
si128.m128i_i64[1] = 367;
v9 = v8;
v10 = "Teleports to an object using Target GroupID.\n"
"Smooth Ease makes the camera move slower.\n"
"Static Force lets you specify an exit force.\n"
"Redirect Force exits based on input force.\n"
"Save Offset keeps the offset from entering when exiting.\n"
"Redirect Dash will rotate the dash to the exit rotation in platformer mode.";
v11 = 2;
do
{
*(_OWORD *)v9 = *(_OWORD *)v10;
*((_OWORD *)v9 + 1) = *((_OWORD *)v10 + 1);
*((_OWORD *)v9 + 2) = *((_OWORD *)v10 + 2);
*((_OWORD *)v9 + 3) = *((_OWORD *)v10 + 3);
*((_OWORD *)v9 + 4) = *((_OWORD *)v10 + 4);
*((_OWORD *)v9 + 5) = *((_OWORD *)v10 + 5);
*((_OWORD *)v9 + 6) = *((_OWORD *)v10 + 6);
v9 += 128;
*((_OWORD *)v9 - 1) = *((_OWORD *)v10 + 7);
v10 += 128;
--v11;
}
while ( v11 );
*(_OWORD *)v9 = *(_OWORD *)v10;
*((_OWORD *)v9 + 1) = *((_OWORD *)v10 + 1);
*((_OWORD *)v9 + 2) = *((_OWORD *)v10 + 2);
*((_OWORD *)v9 + 3) = *((_OWORD *)v10 + 3);
*((_OWORD *)v9 + 4) = *((_OWORD *)v10 + 4);
*((_OWORD *)v9 + 5) = *((_OWORD *)v10 + 5);
*((_QWORD *)v9 + 12) = *((_QWORD *)v10 + 12);
*((_WORD *)v9 + 52) = *((_WORD *)v10 + 52);
v9[106] = v10[106];
v8[363] = 0;
*(_OWORD *)Src = 0;
Size = 4;
v70 = 15;
strcpy((char *)Src, "Help");
SetupTriggerPopup::addHelpButton(a1, Src, Block);
v13 = cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13, &v61);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v61 * 0.5, (float)(v62 * 0.5) + 75.0);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836600);
strcpy((char *)Block, "Target GroupID:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v14);
v15 = (__int64)(a1 + 544);
if ( !a1 )
v15 = 0;
IDNameInput::create(
(__int64)a1,
v15,
1,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v56,
1060320051,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 130.0, 42.0);
cocos2d::CCPoint::operator+(v59, v63, v17);
v58 = Block;
si128.m128i_i64[0] = 11;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x450A68746F6F6D53LL;
Block[1] = (void *)6648673;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 0.0, 0.0);
cocos2d::CCPoint::operator+(v63, &v56, v18);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
55,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
si128.m128i_i64[0] = 11;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x66664F0A65766153LL;
Block[1] = (void *)7628147;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -24.0);
cocos2d::CCPoint::operator+(v63, &v56, v19);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
351,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
Block[1] = nullptr;
si128.m128i_i64[0] = 8;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x582065726F6E6749LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -48.0);
cocos2d::CCPoint::operator+(v63, &v56, v20);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
352,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
Block[1] = nullptr;
si128.m128i_i64[0] = 8;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x592065726F6E6749LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -72.0);
cocos2d::CCPoint::operator+(v63, &v56, v21);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
353,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
si128.m128i_i64[0] = 14;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Instant\nCamera");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -96.0);
cocos2d::CCPoint::operator+(v63, &v56, v22);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
464,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
si128.m128i_i64[0] = 11;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x6F72470A70616E53LL;
Block[1] = (void *)6581877;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -120.0);
cocos2d::CCPoint::operator+(v63, &v56, v23);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
510,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
v57 = Block;
si128.m128i_i64[0] = 13;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Redirect\nDash");
HIWORD(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, -144.0);
cocos2d::CCPoint::operator+(v63, &v56, v24);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
591,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1061662228);
if ( a4 != 3022 )
{
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v56,
(float)(v61 * 0.5) + 120.0,
(float)((float)(v62 * 0.5) - (float)(*((float *)a1 + 184) * 0.5)) + 24.0);
v57 = Block;
if ( a5 )
{
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 17;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "NO Multi\nActivate");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, (const struct cocos2d::CCPoint *)&v56);
v26 = v25;
v27 = 444;
}
else
{
si128.m128i_i64[0] = 14;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Multi\nActivate");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, (const struct cocos2d::CCPoint *)&v56);
v26 = v28;
v27 = 99;
}
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, v27, (unsigned int)Block, v26, 0, 0, 0, 1065353216);
}
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v65,
(float)(v61 * 0.5) - 140.0,
(float)((float)(*((float *)a1 + 184) * 0.5) + (float)(v62 * 0.5)) - 20.0);
v29 = cocos2d::CCLabelBMFont::create((const char *)&qword_1407F6B08, "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v29 + 160LL))(v29);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**((_QWORD **)a1 + 73) + 464LL))(
*((_QWORD *)a1 + 73),
v29);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, _BYTE *))(*(_QWORD *)v29 + 184LL))(v29, v65);
v31 = (cocos2d::CCObject *)cocos2d::CCArray::create(v30);
*((_QWORD *)a1 + 125) = v31;
cocos2d::CCObject::retain(v31);
for ( i = 1; i < 4; ++i )
{
*(_OWORD *)Src = 0;
v33 = 0;
Size = 0;
v70 = 15;
LOBYTE(Src[0]) = 0;
if ( i == 1 )
{
LODWORD(Src[0]) = *(_DWORD *)"Normal";
v34 = *(_WORD *)"al";
LABEL_23:
v33 = 6;
BYTE6(Src[0]) = 0;
WORD2(Src[0]) = v34;
goto LABEL_24;
}
if ( i != 2 )
{
if ( i != 3 )
goto LABEL_25;
LODWORD(Src[0]) = 1734831956;
v34 = 25964;
goto LABEL_23;
}
v33 = 7;
Src[0] = (void *)0x64657070696C46LL;
LABEL_24:
Size = v33;
LABEL_25:
v57 = Block;
si128.m128i_i64[0] = v33;
si128.m128i_i64[1] = 15;
*(_OWORD *)Block = *(_OWORD *)Src;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, -25.0, (float)(-25 * i));
cocos2d::CCPoint::operator+(v65, &v56, v35);
v36 = *((_QWORD *)a1 + 73);
v37 = *((_QWORD *)a1 + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, 6.0, 0.0);
ToggleButton = GameToolbox::createToggleButton(
(const char *)Block,
(__int64)SetupTeleportPopup::onTeleportGravity,
0,
v37,
(__int64)&v56,
(__int64)a1,
v36,
0.60000002,
0.34999999,
60.0,
v38,
(const char *)&qword_140704F78,
0,
0,
nullptr);
*((_BYTE *)ToggleButton + 393) = 1;
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)ToggleButton + 64LL))(
ToggleButton,
(unsigned int)i);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)a1 + 125), ToggleButton);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, -25.0, -60.0);
cocos2d::CCPoint::operator+(v59, v64, v40);
v41 = cocos2d::CCLabelBMFont::create("Rotate Force", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v41 + 160LL))(v41);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**((_QWORD **)a1 + 73) + 464LL))(
*((_QWORD *)a1 + 73),
v41);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, _BYTE *))(*(_QWORD *)v41 + 184LL))(v41, v64);
v60 = Block;
si128.m128i_i64[0] = 12;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Static\nForce");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, -80.0, -30.0);
cocos2d::CCPoint::operator+(v64, &v56, v42);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
345,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1065353216);
v60 = Block;
si128.m128i_i64[0] = 14;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Redirect\nForce");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 20.0, -30.0);
cocos2d::CCPoint::operator+(v64, &v56, v43);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
347,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
0,
1065353216);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v60, v61 * 0.5, (float)(v62 * 0.5) - 60.0);
cocos2d::CCPoint::operator=(v59, v44);
v60 = Src;
*(_OWORD *)Src = 0;
Size = 6;
v70 = 15;
strcpy((char *)Src, "Force:");
v57 = Src;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, -50.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v45);
sub_14009BE60((__int64)&v71);
v71 = 346;
v46 = Src;
if ( v70 > 0xF )
v46 = (void **)Src[0];
sub_1400405A0(v72, v46, Size);
cocos2d::CCPoint::operator=(v73, &v56);
v74 = 1058642330;
v75 = 0;
v76 = 1;
v77 = 6;
v78 = 0;
v79 = 0;
v80 = 1106247680;
v81 = 1;
v82 = 2;
v83 = 0;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v71);
sub_14003D310((__int64)v85);
sub_14003D310((__int64)v84);
sub_14003D310((__int64)v72);
sub_14003D310((__int64)Src);
v60 = Block;
si128.m128i_i64[0] = 8;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x6576697469646441LL;
Block[1] = nullptr;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 50.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v47);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
443,
(unsigned int)Block,
(unsigned int)&v56,
0,
0,
1,
1065353216);
v60 = Src;
*(_OWORD *)Src = 0;
Size = 4;
v70 = 15;
strcpy((char *)Src, "Min:");
v57 = Src;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, -120.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v48);
sub_14009BE60((__int64)&v71);
v71 = 348;
v49 = Src;
if ( v70 > 0xF )
v49 = (void **)Src[0];
sub_1400405A0(v72, v49, Size);
cocos2d::CCPoint::operator=(v73, &v56);
v74 = 1058642330;
v75 = 0;
v76 = 1;
v77 = 6;
v78 = 0;
v79 = 0;
v80 = 1092616192;
v81 = 2;
v82 = 2;
v83 = 0;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v71);
sub_14003D310((__int64)v85);
sub_14003D310((__int64)v84);
sub_14003D310((__int64)v72);
sub_14003D310((__int64)Src);
v60 = Src;
*(_OWORD *)Src = 0;
Size = 4;
v70 = 15;
strcpy((char *)Src, "Max:");
v57 = Src;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 0.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v50);
sub_14009BE60((__int64)&v71);
v71 = 349;
v51 = Src;
if ( v70 > 0xF )
v51 = (void **)Src[0];
sub_1400405A0(v72, v51, Size);
cocos2d::CCPoint::operator=(v73, &v56);
v74 = 1058642330;
v75 = 0;
v76 = 1;
v77 = 6;
v78 = 0;
v79 = 0;
v80 = 1106247680;
v81 = 2;
v82 = 2;
v83 = 0;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v71);
sub_14003D310((__int64)v85);
sub_14003D310((__int64)v84);
sub_14003D310((__int64)v72);
sub_14003D310((__int64)Src);
v60 = Src;
*(_OWORD *)Src = 0;
Size = 4;
v70 = 15;
strcpy((char *)Src, "Mod:");
v57 = Src;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, 120.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v56, v52);
sub_14009BE60((__int64)&v71);
v71 = 350;
v53 = Src;
if ( v70 > 0xF )
v53 = (void **)Src[0];
sub_1400405A0(v72, v53, Size);
cocos2d::CCPoint::operator=(v73, &v56);
v74 = 1058642330;
v75 = 0;
v76 = 1;
v77 = 6;
v78 = 0;
v79 = 0;
v80 = 0x40000000;
v81 = 2;
v82 = 2;
v83 = 0;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v71);
sub_14003D310((__int64)v85);
sub_14003D310((__int64)v84);
sub_14003D310((__int64)v72);
sub_14003D310((__int64)Src);
if ( a4 == 3022 )
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
if ( (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 345) == 0.0 )
v54 = 0;
else
LOBYTE(v54) = 1;
(*(void (__fastcall **)(_BYTE *, __int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1, v54);
if ( (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 347) == 0.0 )
v55 = 0;
else
LOBYTE(v55) = 1;
(*(void (__fastcall **)(_BYTE *, __int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 2, v55);
a1[744] = 0;
return 1;
}