//
// UIObjectSettingsPopup::init from 0x1405ffd20 to 0x1406008eb (3019 bytes)
//
// 3 xrefs:
// > UIObjectSettingsPopup::create @ 0x1405ffcde
// > ??> @ 0x14092f858
// > ??> @ 0x14092f864
//
// 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 UIObjectSettingsPopup::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
unsigned int v17; // edi
int v18; // esi
__int64 v19; // rax
int v20; // r8d
__int64 v21; // rax
int v22; // r9d
__int64 v23; // rax
int v24; // r8d
int v25; // r9d
__int64 v26; // rax
int v27; // r8d
int v28; // r9d
__int64 v29; // rax
int v30; // r8d
int v31; // r9d
__int64 v32; // rax
__int64 v33; // rax
int v34; // r8d
bool v35; // di
__int64 v36; // rax
int v37; // r9d
__int64 v38; // rax
int v39; // r8d
int v40; // r9d
__int64 v41; // rax
int v42; // r8d
int v43; // r9d
__int64 v44; // rax
int v45; // r8d
int v46; // r9d
__int64 v47; // rax
int Reserved; // [rsp+28h] [rbp-E0h]
int Reserveda; // [rsp+28h] [rbp-E0h]
void **v50; // [rsp+68h] [rbp-A0h] BYREF
__int64 v51; // [rsp+70h] [rbp-98h] BYREF
void **v52; // [rsp+78h] [rbp-90h] BYREF
void **v53; // [rsp+80h] [rbp-88h] BYREF
__int128 v54; // [rsp+88h] [rbp-80h] BYREF
__int64 v55; // [rsp+98h] [rbp-70h]
__int64 v56; // [rsp+A0h] [rbp-68h]
float v57; // [rsp+A8h] [rbp-60h] BYREF
float v58; // [rsp+ACh] [rbp-5Ch]
_BYTE v59[8]; // [rsp+B0h] [rbp-58h] BYREF
void *Block[2]; // [rsp+B8h] [rbp-50h] BYREF
__m128i si128; // [rsp+C8h] [rbp-40h]
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] = 18;
si128.m128i_i64[1] = 31;
strcpy((char *)Block[0], "UI Object Settings");
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);
v50 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
v6 = sub_14003D460(0x170u);
Block[0] = v6;
si128.m128i_i64[0] = 355;
si128.m128i_i64[1] = 367;
v7 = v6;
v8 = "Group ID specify the objects to use for the UI. This is permanent from the start and cannot be edited.\n"
"UI Target is a single object used as a reference for the camera center. Camera Guide is a recommended t"
"ool.\n"
"XRef and YRef are reference points for aligning the object.\n"
"Relative makes UI positions scale with aspect ratio.";
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);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_OWORD *)v7 + 5) = *((_OWORD *)v8 + 5);
*((_WORD *)v7 + 48) = *((_WORD *)v8 + 48);
v7[98] = v8[98];
v6[355] = 0;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Help");
SetupTriggerPopup::addHelpButton(a1, &v54, Block);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v57);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v57 * 0.5, v58 * 0.5);
Block[1] = (void *)58;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
Block[0] = (void *)0x44492070756F7247LL;
v12 = (__int64)(a1 + 544);
if ( !a1 )
v12 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -80.0, 60.0);
cocos2d::CCPoint::operator+(v59, &v50, v13);
IDNameInput::create(
(__int64)a1,
v12,
1,
51,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v50,
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);
}
Block[1] = (void *)14964;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
Block[0] = (void *)0x6567726154204955LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 80.0, 60.0);
cocos2d::CCPoint::operator+(v59, &v50, v15);
IDNameInput::create(
(__int64)a1,
v12,
1,
71,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v50,
1061997773,
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 *)&v51, (float)(v57 * 0.5) - 25.0, (float)(v58 * 0.5) - 10.0);
v17 = (int)(*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 385);
v18 = (int)(*(float (__fastcall **)(_BYTE *, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 386);
v52 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 5;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "XRef:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -125.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v19);
SetupTriggerPopup::addInfoLabel((_DWORD)a1, (unsigned int)Block, v20, (unsigned int)&v50, Reserved, 0);
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Auto");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -75.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v21);
SetupTriggerPopup::createCustomToggleValueControl(
(_DWORD)a1,
1,
v17 < 2,
v22,
(__int64)&v54,
(__int64)&v50,
1,
0,
0);
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Center");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -25.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v23);
LOBYTE(v24) = v17 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 2, v24, v25, (__int64)Block, (__int64)&v50, 1, 0, 0);
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Left");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 25.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v26);
LOBYTE(v27) = v17 == 3;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 3, v27, v28, (__int64)&v54, (__int64)&v50, 1, 0, 0);
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 5;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Right");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 75.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v29);
LOBYTE(v30) = v17 == 4;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 4, v30, v31, (__int64)Block, (__int64)&v50, 1, 0, 0);
v53 = (void **)&v54;
v55 = 8;
v56 = 15;
v54 = 0x65766974616C6552uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 150.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v32);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
387,
(unsigned int)&v54,
(unsigned int)&v50,
1,
0,
0,
1065353216);
*((float *)&v51 + 1) = *((float *)&v51 + 1) + -60.0;
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 5;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "YRef:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -125.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v33);
SetupTriggerPopup::addInfoLabel((_DWORD)a1, (unsigned int)Block, v34, (unsigned int)&v50, Reserveda, 0);
v53 = (void **)&v54;
v35 = v18 == 5 || !v18;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Auto");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -75.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v36);
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 5, v35, v37, (__int64)&v54, (__int64)&v50, 1, 0, 0);
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Center");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, -25.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v38);
LOBYTE(v39) = v18 == 6;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 6, v39, v40, (__int64)Block, (__int64)&v50, 1, 0, 0);
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 6;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Bottom");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 25.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v41);
LOBYTE(v42) = v18 == 7;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 7, v42, v43, (__int64)Block, (__int64)&v50, 1, 0, 0);
v53 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 3;
si128.m128i_i64[1] = 15;
LOWORD(Block[0]) = *(_WORD *)"Top";
WORD1(Block[0]) = (unsigned __int8)aTop_0[2];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 75.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v44);
LOBYTE(v45) = v18 == 8;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 8, v45, v46, (__int64)Block, (__int64)&v50, 1, 0, 0);
v53 = (void **)&v54;
v55 = 8;
v56 = 15;
v54 = 0x65766974616C6552uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, 150.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v50, v47);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
388,
(unsigned int)&v54,
(unsigned int)&v50,
1,
0,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}