//
// SetupCollisionStateTriggerPopup::init from 0x1405b10c0 to 0x1405b14e8 (1064 bytes)
//
// 3 xrefs:
// > SetupCollisionStateTriggerPopup::create @ 0x1405b107e
// > ??> @ 0x14092dadc
// > ??> @ 0x14092dae8
//
// 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 SetupCollisionStateTriggerPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
float v8; // xmm6_4
__int64 v9; // rdi
float v10; // xmm7_4
const struct cocos2d::CCPoint *v11; // rax
void *v12; // rcx
const struct cocos2d::CCPoint *v13; // rax
void *v14; // rcx
void **v15; // [rsp+68h] [rbp-49h] BYREF
float v16[2]; // [rsp+70h] [rbp-41h] BYREF
void *v17[2]; // [rsp+78h] [rbp-39h] BYREF
__m128i v18; // [rsp+88h] [rbp-29h]
void *Block[2]; // [rsp+98h] [rbp-19h] BYREF
__m128i si128; // [rsp+A8h] [rbp-9h]
result = SetupTriggerPopup::init((_DWORD)a1, a2, a3, a4, 1128792064, 1, 0);
if ( result )
{
a1[744] = 1;
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1096LL))(a1);
v18.m128i_i64[0] = 15;
v18.m128i_i64[1] = 15;
strcpy((char *)v17, "Collision State");
SetupTriggerPopup::addTitle(a1, v17);
*(_OWORD *)v17 = 0;
v18.m128i_i64[0] = 2;
v18.m128i_i64[1] = 15;
strcpy((char *)v17, "OK");
SetupTriggerPopup::addCloseButton(a1, v17);
v15 = v17;
*(_OWORD *)v17 = 0;
v18 = 0u;
v17[0] = sub_14003D460(0xA0u);
v18.m128i_i64[0] = 149;
v18.m128i_i64[1] = 159;
strcpy(
(char *)v17[0],
"Activates a group when the player collides with the hitbox.\n"
"State On is activated upon entering.\n"
"State Off is activated upon exiting.");
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 4;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Help");
SetupTriggerPopup::addHelpButton(a1, Block, v17);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, v16);
v8 = v16[0] * 0.5;
si128 = _mm_load_si128((const __m128i *)&xmmword_140836590);
Block[0] = (void *)0x6E4F206574617453LL;
Block[1] = nullptr;
v9 = (__int64)(a1 + 544);
if ( !a1 )
v9 = 0;
v10 = (float)((float)(v16[1] * 0.5) + 70.0) - 60.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v15, v8 - 70.0, v10);
IDNameInput::create((__int64)a1, v9, 1, 51, (__int64)Block, v11, 1060320051, 6, 0, 0, 0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v12 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
v17[1] = (void *)102;
v18 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v17[0] = (void *)0x664F206574617453LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v15, v8 + 70.0, v10);
IDNameInput::create((__int64)a1, v9, 1, 71, (__int64)v17, v13, 1060320051, 6, 0, 0, 0);
if ( v18.m128i_i64[1] > 0xFuLL )
{
v14 = v17[0];
if ( (unsigned __int64)(v18.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)v17[0] - 1);
if ( (unsigned __int64)((char *)v17[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}