//
// SetupAdvFollowRetargetPopup::init from 0x14059f930 to 0x1405a003b (1803 bytes)
//
// 3 xrefs:
// > SetupAdvFollowRetargetPopup::create @ 0x14059f8ee
// > ??> @ 0x14092d38c
// > ??> @ 0x14092d398
//
// 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:37 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupAdvFollowRetargetPopup::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
int v12; // esi
__m128i si128; // xmm7
__int64 v14; // rdi
__int64 v15; // rax
void *v16; // rcx
__int64 v17; // rax
void *v18; // rcx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
void **v23; // [rsp+68h] [rbp-A0h] BYREF
_QWORD v24[3]; // [rsp+70h] [rbp-98h] BYREF
__int64 v25; // [rsp+88h] [rbp-80h]
__int64 v26; // [rsp+90h] [rbp-78h]
_QWORD *v27; // [rsp+98h] [rbp-70h] BYREF
void **v28; // [rsp+A0h] [rbp-68h] BYREF
float v29[2]; // [rsp+A8h] [rbp-60h] BYREF
void *Block[2]; // [rsp+B0h] [rbp-58h] BYREF
__m128i v31; // [rsp+C0h] [rbp-48h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1131413504, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
*(_OWORD *)Block = 0;
v31.m128i_i64[0] = 2;
v31.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
*(_OWORD *)Block = 0;
v31 = 0u;
Block[0] = sub_14003D460(0x20u);
v31.m128i_i64[0] = 27;
v31.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Re-Target AdvFollow Trigger");
SetupTriggerPopup::addTitle(a1, Block);
v23 = Block;
*(_OWORD *)Block = 0;
v31 = 0u;
v6 = sub_14003D460(0x120u);
Block[0] = v6;
v31.m128i_i64[0] = 279;
v31.m128i_i64[1] = 287;
v7 = v6;
v8 = "Lets you change the target of an active Advanced Follow trigger.\n"
"Target GID is the objects that follow Follow GID.\n"
"You can also follow the player using P1 and P2 or the center of the screen using C.\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;
*((_DWORD *)v7 + 4) = *((_DWORD *)v8 + 4);
*((_WORD *)v7 + 10) = *((_WORD *)v8 + 10);
v7[22] = v8[22];
v6[279] = 0;
*(_OWORD *)&v24[1] = 0;
v25 = 4;
v26 = 15;
strcpy((char *)&v24[1], "Help");
SetupTriggerPopup::addHelpButton(a1, &v24[1], Block);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v29);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, v29[0] * 0.5, (float)(v29[1] * 0.5) + 30.0);
v12 = 1;
if ( (*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 535) != 0.0 )
v12 = 6;
HIWORD(Block[1]) = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365C0);
v31 = si128;
qmemcpy(Block, "Target GID", 10);
*(_DWORD *)((char *)&Block[1] + 2) = (unsigned __int8)aTargetGid[10];
v14 = (__int64)(a1 + 544);
if ( !a1 )
v14 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, -88.0, 0.0);
cocos2d::CCPoint::operator+(v24, &v23, v15);
IDNameInput::create(
(__int64)a1,
v14,
v12,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v23,
1061997773,
6,
0,
0,
0);
if ( v31.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(v31.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);
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365C0);
}
HIWORD(Block[1]) = 0;
v31 = si128;
qmemcpy(Block, "Follow GID", 10);
*(_DWORD *)((char *)&Block[1] + 2) = (unsigned __int8)aFollowGid[10];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, 88.0, 0.0);
cocos2d::CCPoint::operator+(v24, &v23, v17);
IDNameInput::create(
(__int64)a1,
v14,
1,
71,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v23,
1061997773,
6,
0,
0,
0);
if ( v31.m128i_i64[1] > 0xFuLL )
{
v18 = Block[0];
if ( (unsigned __int64)(v31.m128i_i64[1] + 1) >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
v27 = &v24[1];
*(_OWORD *)&v24[1] = 0;
v25 = 2;
v26 = 15;
strcpy((char *)&v24[1], "P1");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, 18.0, -56.0);
cocos2d::CCPoint::operator+(v24, &v23, v19);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
138,
(unsigned int)&v24[1],
(unsigned int)&v23,
0,
0,
0,
1065353216);
v28 = (void **)&v24[1];
*(_OWORD *)&v24[1] = 0;
v25 = 2;
v26 = 15;
strcpy((char *)&v24[1], "P2");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, 78.0, -56.0);
cocos2d::CCPoint::operator+(v24, &v23, v20);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
200,
(unsigned int)&v24[1],
(unsigned int)&v23,
0,
0,
0,
1065353216);
v28 = (void **)&v24[1];
*(_OWORD *)&v24[1] = 0;
v25 = 1;
v26 = 15;
strcpy((char *)&v24[1], "C");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, 138.0, -56.0);
cocos2d::CCPoint::operator+(v24, &v23, v21);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
201,
(unsigned int)&v24[1],
(unsigned int)&v23,
0,
0,
0,
1065353216);
v28 = Block;
*(_OWORD *)Block = 0;
v31 = 0u;
Block[0] = sub_14003D460(0x20u);
v31.m128i_i64[0] = 17;
v31.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Target\nControl ID");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v27, -120.0, -56.0);
cocos2d::CCPoint::operator+(v24, &v23, v22);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
535,
(unsigned int)Block,
(unsigned int)&v23,
0,
2,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}