//
// SetupCollisionTriggerPopup::init from 0x1405afa20 to 0x1405b0256 (2102 bytes)
//
// 3 xrefs:
// > SetupCollisionTriggerPopup::create @ 0x1405af9de
// > ??> @ 0x14092da34
// > ??> @ 0x14092da40
//
// 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:42 +0000
//
// Hidden C++ exception states: #wind=3
char __fastcall SetupCollisionTriggerPopup::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
float v12; // xmm12_4
float v13; // xmm10_4
float v14; // xmm6_4
__m128i si128; // xmm9
__int64 v16; // rdi
const struct cocos2d::CCPoint *v17; // rax
void *v18; // rcx
const struct cocos2d::CCPoint *v19; // rax
void *v20; // rcx
const struct cocos2d::CCPoint *v21; // rax
void *v22; // rcx
int v23; // eax
int v24; // eax
int v25; // eax
int v26; // eax
int v27; // eax
void **v28; // [rsp+68h] [rbp-A0h] BYREF
_QWORD v29[3]; // [rsp+70h] [rbp-98h] BYREF
__int64 v30; // [rsp+88h] [rbp-80h]
__int64 v31; // [rsp+90h] [rbp-78h]
void **v32; // [rsp+98h] [rbp-70h] BYREF
void *Block[2]; // [rsp+A0h] [rbp-68h] BYREF
__m128i v34; // [rsp+B0h] [rbp-58h]
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);
v34.m128i_i64[0] = 17;
v34.m128i_i64[1] = 31;
strcpy((char *)Block[0], "Collision Trigger");
SetupTriggerPopup::addTitle(a1, Block);
*(_OWORD *)Block = 0;
v34.m128i_i64[0] = 2;
v34.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v28 = Block;
*(_OWORD *)Block = 0;
v34 = 0u;
v6 = sub_14003D460(0x1F0u);
Block[0] = v6;
v34.m128i_i64[0] = 495;
v34.m128i_i64[1] = 495;
v7 = v6;
v8 = "Disables Target ID when Collision Blocks using BlockA ID and BlockB ID collide. This condition "
"is checked constantly. Make sure that one of the blocks have Dynamic Block enabled.\n"
"Use Activate Group to activate and spawn instead.\n"
"P1 and P2 makes collision trigger upon the respective player touching BlockB ID.\n"
"PP triggers when both players collide.\n"
"Trigger On Exit makes it activate after collision between the blocks ends and not when it starts. ";
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);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_OWORD *)v7 + 5) = *((_OWORD *)v8 + 5);
*((_QWORD *)v7 + 12) = *((_QWORD *)v8 + 12);
*((_DWORD *)v7 + 26) = *((_DWORD *)v8 + 26);
*((_WORD *)v7 + 54) = *((_WORD *)v8 + 54);
v7[110] = v8[110];
v6[495] = 0;
*(_OWORD *)&v29[1] = 0;
v30 = 4;
v31 = 15;
strcpy((char *)&v29[1], "Help");
SetupTriggerPopup::addHelpButton(a1, &v29[1], Block);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v29);
v12 = (float)(*((float *)v29 + 1) * 0.5) + 70.0;
v13 = (float)(*((float *)v29 + 1) * 0.5) + 10.0;
v14 = (float)(*((float *)v29 + 1) * 0.5) - 55.0;
Block[1] = (void *)68;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v34 = si128;
Block[0] = (void *)0x4920416B636F6C42LL;
v16 = (__int64)(a1 + 544);
if ( !a1 )
v16 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) - 70.0, v13);
IDNameInput::create((__int64)a1, v16, 3, 80, (__int64)Block, v17, 1060320051, 6, 0, 0, 0);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v18 = Block[0];
if ( (unsigned __int64)(v34.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);
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
}
Block[1] = (void *)68;
v34 = si128;
Block[0] = (void *)0x4920426B636F6C42LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) + 70.0, v13);
IDNameInput::create((__int64)a1, v16, 3, 95, (__int64)Block, v19, 1060320051, 6, 0, 0, 0);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v20 = Block[0];
if ( (unsigned __int64)(v34.m128i_i64[1] + 1) >= 0x1000 )
{
v20 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
Block[1] = (void *)68;
v34 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
Block[0] = (void *)0x4920746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) - 70.0, v14);
IDNameInput::create((__int64)a1, v16, 1, 51, (__int64)Block, v21, 1060320051, 6, 0, 0, 0);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v22 = Block[0];
if ( (unsigned __int64)(v34.m128i_i64[1] + 1) >= 0x1000 )
{
v22 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
v28 = (void **)&v29[1];
*(_OWORD *)&v29[1] = 0;
v30 = 2;
v31 = 15;
strcpy((char *)&v29[1], "P1");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v32, (float)(*(float *)v29 * 0.5) - 70.0, v12);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 138, (unsigned int)&v29[1], v23, 0, 0, 0, 1065353216);
v32 = (void **)&v29[1];
*(_OWORD *)&v29[1] = 0;
v30 = 2;
v31 = 15;
strcpy((char *)&v29[1], "P2");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, *(float *)v29 * 0.5, v12);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 200, (unsigned int)&v29[1], v24, 0, 0, 0, 1065353216);
v32 = (void **)&v29[1];
*(_OWORD *)&v29[1] = 0;
v30 = 2;
v31 = 15;
strcpy((char *)&v29[1], "PP");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) + 70.0, v12);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 201, (unsigned int)&v29[1], v25, 0, 0, 0, 1065353216);
v32 = Block;
v34.m128i_i64[0] = 14;
v34.m128i_i64[1] = 15;
strcpy((char *)Block, "Activate\nGroup");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) + 70.0, v14 + 15.0);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 56, (unsigned int)Block, v26, 0, 0, 0, 1065353216);
v32 = Block;
v34.m128i_i64[0] = 15;
v34.m128i_i64[1] = 15;
strcpy((char *)Block, "Trigger\nOn Exit");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, (float)(*(float *)v29 * 0.5) + 70.0, v14 - 30.0);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 93, (unsigned int)Block, v27, 0, 0, 0, 1065353216);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}