//
// SetupInstantCollisionTriggerPopup::init from 0x1405b0580 to 0x1405b0d56 (2006 bytes)
//
// 2 xrefs:
// > SetupInstantCollisionTriggerPopup::create @ 0x1405b052d
// > ??> @ 0x14092da94
//
// 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=4
char __fastcall SetupInstantCollisionTriggerPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
_QWORD *v6; // r9
_QWORD *v7; // rcx
const char *v8; // rdx
__int64 v9; // r8
__int64 v10; // rcx
__int64 v11; // rax
float v12; // xmm7_4
float v13; // xmm11_4
float v14; // xmm9_4
__m128i si128; // xmm6
__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
const struct cocos2d::CCPoint *v23; // rax
void *v24; // rcx
float v25; // xmm7_4
int v26; // eax
int v27; // eax
int v28; // eax
void **v29; // [rsp+68h] [rbp-A0h] BYREF
float v30[2]; // [rsp+70h] [rbp-98h] BYREF
void **Block; // [rsp+78h] [rbp-90h] BYREF
void *Block_8[2]; // [rsp+80h] [rbp-88h] BYREF
__m128i v33; // [rsp+90h] [rbp-78h]
void *v34[2]; // [rsp+A0h] [rbp-68h] BYREF
__m128i v35; // [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_8 = 0;
Block_8[0] = sub_14003D460(0x20u);
v33.m128i_i64[0] = 17;
v33.m128i_i64[1] = 31;
strcpy((char *)Block_8[0], "Instant Collision");
SetupTriggerPopup::addTitle(a1, Block_8);
*(_OWORD *)Block_8 = 0;
v33.m128i_i64[0] = 2;
v33.m128i_i64[1] = 15;
strcpy((char *)Block_8, "OK");
SetupTriggerPopup::addCloseButton(a1, Block_8);
v29 = Block_8;
*(_OWORD *)Block_8 = 0;
v33 = 0u;
v6 = sub_14003D460(0x1D0u);
Block_8[0] = v6;
v33.m128i_i64[0] = 463;
v33.m128i_i64[1] = 463;
v7 = v6;
v8 = "Activates a group when Collision Blocks using BlockA ID and BlockB ID collide or do not collide. The co"
"ndition is only checked when it is hit and never again. Make sure that one of the blocks have Dynamic Block ena"
"bled.\n"
"True ID is activated if they collide. False ID is activated if they do not collide.\n"
"P1 and P2 makes collision trigger upon the respective player touching BlockB ID.\n"
"PP triggers when both players collide.";
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 += 16;
*((_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);
v7[8] = *((_QWORD *)v8 + 8);
*((_DWORD *)v7 + 18) = *((_DWORD *)v8 + 18);
*((_WORD *)v7 + 38) = *((_WORD *)v8 + 38);
*((_BYTE *)v7 + 78) = v8[78];
*((_BYTE *)v6 + 463) = 0;
*(_OWORD *)v34 = 0;
v35.m128i_i64[0] = 4;
v35.m128i_i64[1] = 15;
strcpy((char *)v34, "Help");
SetupTriggerPopup::addHelpButton(a1, v34, Block_8);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v30);
v12 = (float)(v30[1] * 0.5) + 70.0;
v13 = (float)(v30[0] * 0.5) - 70.0;
v14 = (float)(v30[0] * 0.5) + 70.0;
Block_8[1] = (void *)68;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v33 = si128;
Block_8[0] = (void *)0x4920416B636F6C42LL;
v16 = (__int64)(a1 + 544);
if ( !a1 )
v16 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v13, v12);
IDNameInput::create((__int64)a1, v16, 3, 80, (__int64)Block_8, v17, 1060320051, 6, 0, 0, 0);
if ( v33.m128i_i64[1] > 0xFuLL )
{
v18 = Block_8[0];
if ( (unsigned __int64)(v33.m128i_i64[1] + 1) >= 0x1000 )
{
v18 = *((void **)Block_8[0] - 1);
if ( (unsigned __int64)((char *)Block_8[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_8[1] = (void *)68;
v33 = si128;
Block_8[0] = (void *)0x4920426B636F6C42LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v14, v12);
IDNameInput::create((__int64)a1, v16, 3, 95, (__int64)Block_8, v19, 1060320051, 6, 0, 0, 0);
if ( v33.m128i_i64[1] > 0xFuLL )
{
v20 = Block_8[0];
if ( (unsigned __int64)(v33.m128i_i64[1] + 1) >= 0x1000 )
{
v20 = *((void **)Block_8[0] - 1);
if ( (unsigned __int64)((char *)Block_8[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
v33 = _mm_load_si128((const __m128i *)&xmmword_140836580);
*(_OWORD *)Block_8 = 0x44492065757254uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v13, v12 - 60.0);
IDNameInput::create((__int64)a1, v16, 1, 51, (__int64)Block_8, v21, 1060320051, 6, 0, 0, 0);
if ( v33.m128i_i64[1] > 0xFuLL )
{
v22 = Block_8[0];
if ( (unsigned __int64)(v33.m128i_i64[1] + 1) >= 0x1000 )
{
v22 = *((void **)Block_8[0] - 1);
if ( (unsigned __int64)((char *)Block_8[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
v34[1] = nullptr;
v35 = _mm_load_si128((const __m128i *)&xmmword_140836590);
v34[0] = (void *)0x44492065736C6146LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v14, v12 - 60.0);
IDNameInput::create((__int64)a1, v16, 1, 71, (__int64)v34, v23, 1060320051, 6, 0, 0, 0);
if ( v35.m128i_i64[1] > 0xFuLL )
{
v24 = v34[0];
if ( (unsigned __int64)(v35.m128i_i64[1] + 1) >= 0x1000 )
{
v24 = *((void **)v34[0] - 1);
if ( (unsigned __int64)((char *)v34[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
v29 = v34;
*(_OWORD *)v34 = 0;
v35.m128i_i64[0] = 2;
v35.m128i_i64[1] = 15;
strcpy((char *)v34, "P1");
v25 = (float)(v12 - 120.0) + 10.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&Block, (float)(v30[0] * 0.5) - 75.0, v25);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 138, (unsigned int)v34, v26, 0, 0, 0, 1065353216);
Block = v34;
*(_OWORD *)v34 = 0;
v35.m128i_i64[0] = 2;
v35.m128i_i64[1] = 15;
strcpy((char *)v34, "P2");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, (float)(v30[0] * 0.5) - 0.0, v25);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 200, (unsigned int)v34, v27, 0, 0, 0, 1065353216);
Block = v34;
*(_OWORD *)v34 = 0;
v35.m128i_i64[0] = 2;
v35.m128i_i64[1] = 15;
strcpy((char *)v34, "PP");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, (float)(v30[0] * 0.5) + 75.0, v25);
SetupTriggerPopup::createToggleValueControl((_DWORD)a1, 201, (unsigned int)v34, v28, 0, 0, 0, 1065353216);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}