//
// SetupTimerEventTriggerPopup::init from 0x1405f8840 to 0x1405f8e00 (1472 bytes)
//
// 3 xrefs:
// > SetupTimerEventTriggerPopup::create @ 0x1405f87fe
// > ??> @ 0x14092f588
// > ??> @ 0x14092f594
//
// 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:08 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupTimerEventTriggerPopup::init(_BYTE *a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rdi
__int64 v9; // rax
void *v10; // rcx
__int64 v11; // rax
void *v12; // rcx
__int64 v13; // rax
__int64 v14; // rax
void **v15; // [rsp+88h] [rbp-80h] BYREF
_BYTE v16[8]; // [rsp+90h] [rbp-78h] BYREF
void **v17; // [rsp+98h] [rbp-70h] BYREF
float v18[2]; // [rsp+A0h] [rbp-68h] BYREF
void **v19; // [rsp+A8h] [rbp-60h] BYREF
void *Block[2]; // [rsp+B0h] [rbp-58h] BYREF
__m128i si128; // [rsp+C0h] [rbp-48h]
void *v22[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i v23; // [rsp+E0h] [rbp-28h]
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], "Time Event Trigger");
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);
v15 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
Block[0] = sub_14003D460(0x80u);
si128.m128i_i64[0] = 123;
si128.m128i_i64[1] = 127;
strcpy(
(char *)Block[0],
"Activates objects using TargetID when a specific TargetTime is reached for a timer given by ItemID.");
*(_OWORD *)v22 = 0;
v23.m128i_i64[0] = 4;
v23.m128i_i64[1] = 15;
strcpy((char *)v22, "Help");
SetupTriggerPopup::addHelpButton(a1, v22, Block);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, v18);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v16, v18[0] * 0.5, (float)(v18[1] * 0.5) + 85.0);
Block[1] = nullptr;
si128 = _mm_load_si128((const __m128i *)&xmmword_140836580);
Block[0] = (void *)0x444972656D6954LL;
v8 = (__int64)(a1 + 544);
if ( !a1 )
v8 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, -85.0, -15.0);
cocos2d::CCPoint::operator+(v16, &v15, v9);
IDNameInput::create(
(__int64)a1,
v8,
4,
80,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v15,
1061997773,
6,
0,
0,
0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v10 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
v22[1] = nullptr;
v23 = _mm_load_si128((const __m128i *)&xmmword_140836590);
v22[0] = (void *)0x4449746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, 85.0, -15.0);
cocos2d::CCPoint::operator+(v16, &v15, v11);
IDNameInput::create(
(__int64)a1,
v8,
1,
51,
(__int64)v22,
(const struct cocos2d::CCPoint *)&v15,
1061997773,
6,
0,
0,
0);
if ( v23.m128i_i64[1] > 0xFuLL )
{
v12 = v22[0];
if ( (unsigned __int64)(v23.m128i_i64[1] + 1) >= 0x1000 )
{
v12 = *((void **)v22[0] - 1);
if ( (unsigned __int64)((char *)v22[0] - (char *)v12 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v12);
}
v17 = Block;
Block[1] = (void *)25965;
si128.m128i_i64[0] = 10;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x6954746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v19, -85.0, -60.0);
cocos2d::CCPoint::operator+(v16, &v15, v13);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
473,
(unsigned int)Block,
(unsigned int)&v15,
1061997773,
0,
1,
10,
0,
0,
1120403456,
0,
0,
0,
2,
0,
v15);
v19 = Block;
si128.m128i_i64[0] = 14;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Multi\nActivate");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, 85.0, -60.0);
cocos2d::CCPoint::operator+(v16, &v15, v14);
SetupTriggerPopup::createToggleValueControl(
(_DWORD)a1,
475,
(unsigned int)Block,
(unsigned int)&v15,
0,
0,
0,
1065353216);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}