//
// SetupAdvFollowEditPhysicsPopup::init from 0x14059e890 to 0x14059f6ed (3677 bytes)
//
// 3 xrefs:
// > SetupAdvFollowEditPhysicsPopup::create @ 0x14059e84e
// > ??> @ 0x14092d368
// > ??> @ 0x14092d374
//
// 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:36 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupAdvFollowEditPhysicsPopup::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; // rax
__int64 v13; // rax
int v14; // esi
__int64 v15; // rdi
__int64 v16; // rax
void *v17; // rcx
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax
void *v27; // rcx
__int64 v28; // rax
__int64 v29; // rax
__int64 v30; // rax
void *v31; // rcx
__int64 v32; // rax
__int64 v33; // rax
void **v34; // [rsp+80h] [rbp-80h] BYREF
void **v35; // [rsp+88h] [rbp-78h] BYREF
_BYTE v36[8]; // [rsp+90h] [rbp-70h] BYREF
void **v37; // [rsp+98h] [rbp-68h] BYREF
_BYTE v38[8]; // [rsp+A0h] [rbp-60h] BYREF
float v39[2]; // [rsp+A8h] [rbp-58h] BYREF
_BYTE v40[8]; // [rsp+B0h] [rbp-50h] BYREF
void *Block[2]; // [rsp+B8h] [rbp-48h] BYREF
__m128i si128; // [rsp+C8h] [rbp-38h]
void *v43[2]; // [rsp+D8h] [rbp-28h] BYREF
__m128i v44; // [rsp+E8h] [rbp-18h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1134231552, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 21;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Edit AdvFollow Object");
SetupTriggerPopup::addTitle(a1, Block);
v34 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
v6 = sub_14003D460(0x150u);
Block[0] = v6;
si128.m128i_i64[0] = 331;
si128.m128i_i64[1] = 335;
v7 = v6;
v8 = "Lets you change the attributes of an active Advanced Follow trigger.\n"
"Target GID is the objects that follow.\n"
"X and Y Only limit change to one axis.\n"
"Mod X and Y modify movement on their axis.\n"
"Speed modifies the speed.\n"
"Dir modifies the direction.\n"
"View the editor guide for more details.";
v9 = 2;
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);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_QWORD *)v7 + 8) = *((_QWORD *)v8 + 8);
*((_WORD *)v7 + 36) = *((_WORD *)v8 + 36);
v7[74] = v8[74];
v6[331] = 0;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 4;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "Help");
SetupTriggerPopup::addHelpButton(a1, v43, Block);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v39);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, v39[0] * 0.5, (float)(v39[1] * 0.5) + 110.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v34, 0.0, -30.0);
cocos2d::CCPoint::operator+(v40, v38, v12);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v34, -50.0, 0.0);
cocos2d::CCPoint::operator+(v40, v36, v13);
v14 = 1;
if ( (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 535) != 0.0 )
v14 = 6;
HIWORD(Block[1]) = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365C0);
qmemcpy(Block, "Target GID", 10);
*(_DWORD *)((char *)&Block[1] + 2) = (unsigned __int8)aTargetGid[10];
v15 = (__int64)(a1 + 544);
if ( !a1 )
v15 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -88.0, 0.0);
cocos2d::CCPoint::operator+(v38, &v34, v16);
IDNameInput::create(
(__int64)a1,
v15,
v14,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v34,
1061997773,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v17 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
v37 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "X\nOnly");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, 15.0, 0.0);
cocos2d::CCPoint::operator+(v38, &v34, v18);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
306,
(unsigned int)Block,
(unsigned int)&v34,
0,
0,
0,
1065353216);
v35 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Y\nOnly");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 100.0, 0.0);
cocos2d::CCPoint::operator+(v38, &v34, v19);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
307,
(unsigned int)Block,
(unsigned int)&v34,
0,
0,
0,
1065353216);
v35 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Mod X:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -72.0, -70.200005);
cocos2d::CCPoint::operator+(v36, &v34, v20);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
566,
(unsigned int)Block,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
-1082130432,
1065353216,
1,
0,
1,
2,
0);
v35 = v43;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 2;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "+-");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 72.0, -70.200005);
cocos2d::CCPoint::operator+(v36, &v34, v21);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
567,
(unsigned int)v43,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
-1082130432,
1065353216,
1,
0,
1,
2,
0);
v35 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Mod Y:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -72.0, -98.600006);
cocos2d::CCPoint::operator+(v36, &v34, v22);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
568,
(unsigned int)Block,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
-1082130432,
1065353216,
1,
0,
1,
2,
0);
v35 = v43;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 2;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "+-");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 72.0, -98.600006);
cocos2d::CCPoint::operator+(v36, &v34, v23);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
569,
(unsigned int)v43,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
-1082130432,
1065353216,
1,
0,
1,
2,
0);
v35 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Speed:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -72.0, -127.00001);
cocos2d::CCPoint::operator+(v36, &v34, v24);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
300,
(unsigned int)Block,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
0,
1065353216,
1,
0,
1,
2,
0);
v35 = v43;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 2;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "+-");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 72.0, -127.00001);
cocos2d::CCPoint::operator+(v36, &v34, v25);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
301,
(unsigned int)v43,
(unsigned int)&v34,
1058642330,
0,
1,
6,
0,
0,
1065353216,
1,
0,
1,
2,
0);
*(_OWORD *)v43 = 0;
v44 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(v43[0]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, 222.0, -127.00001);
cocos2d::CCPoint::operator+(v36, &v34, v26);
IDNameInput::create(
(__int64)a1,
v15,
1,
560,
(__int64)v43,
(const struct cocos2d::CCPoint *)&v34,
1058642330,
6,
0,
1,
1);
if ( v44.m128i_i64[1] > 0xFuLL )
{
v27 = v43[0];
if ( (unsigned __int64)(v44.m128i_i64[1] + 1) >= 0x1000 )
{
v27 = *((void **)v43[0] - 1);
if ( (unsigned __int64)((char *)v43[0] - (char *)v27 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v27);
}
v35 = v43;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 4;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "Dir:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -72.0, -155.40001);
cocos2d::CCPoint::operator+(v36, &v34, v28);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
563,
(unsigned int)v43,
(unsigned int)&v34,
1058642330,
0,
2,
6,
0,
-1020002304,
1127481344,
1,
0,
1,
2,
0);
v35 = v43;
*(_OWORD *)v43 = 0;
v44.m128i_i64[0] = 2;
v44.m128i_i64[1] = 15;
strcpy((char *)v43, "+-");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 72.0, -155.40001);
cocos2d::CCPoint::operator+(v36, &v34, v29);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
564,
(unsigned int)v43,
(unsigned int)&v34,
1058642330,
0,
2,
6,
0,
0,
1135869952,
1,
0,
1,
2,
0);
*(_OWORD *)v43 = 0;
v44 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(v43[0]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v35, 222.0, -155.40001);
cocos2d::CCPoint::operator+(v36, &v34, v30);
IDNameInput::create(
(__int64)a1,
v15,
1,
565,
(__int64)v43,
(const struct cocos2d::CCPoint *)&v34,
1058642330,
6,
0,
1,
1);
if ( v44.m128i_i64[1] > 0xFuLL )
{
v31 = v43[0];
if ( (unsigned __int64)(v44.m128i_i64[1] + 1) >= 0x1000 )
{
v31 = *((void **)v43[0] - 1);
if ( (unsigned __int64)((char *)v43[0] - (char *)v31 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v31);
}
v35 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x20u);
si128.m128i_i64[0] = 17;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Target\nControl ID");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, -90.0, -183.80002);
cocos2d::CCPoint::operator+(v36, &v34, v32);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
535,
(unsigned int)Block,
(unsigned int)&v34,
0,
2,
0,
1065353216);
v35 = Block;
si128.m128i_i64[0] = 12;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Redirect\nDir");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v37, 60.0, -183.80002);
cocos2d::CCPoint::operator+(v36, &v34, v33);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
570,
(unsigned int)Block,
(unsigned int)&v34,
0,
2,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}