//
// SetupKeyframeAnimPopup::init from 0x1405b9c70 to 0x1405ba729 (2745 bytes)
//
// 3 xrefs:
// > SetupKeyframeAnimPopup::create @ 0x1405b9c2e
// > ??> @ 0x14092dea8
// > ??> @ 0x14092deb4
//
// 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:45 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall SetupKeyframeAnimPopup::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
__m128i v15; // xmm6
__int64 v16; // rax
void *v17; // rcx
__int64 v18; // rax
void *v19; // rcx
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax
void **v27; // [rsp+88h] [rbp-80h] BYREF
_BYTE v28[8]; // [rsp+90h] [rbp-78h] BYREF
void **v29; // [rsp+98h] [rbp-70h] BYREF
void **v30; // [rsp+A0h] [rbp-68h] BYREF
float v31; // [rsp+A8h] [rbp-60h] BYREF
float v32; // [rsp+ACh] [rbp-5Ch]
void *v33[2]; // [rsp+B0h] [rbp-58h] BYREF
__m128i v34; // [rsp+C0h] [rbp-48h]
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i si128; // [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 *)v33 = 0;
v33[0] = sub_14003D460(0x20u);
v34.m128i_i64[0] = 19;
v34.m128i_i64[1] = 31;
strcpy((char *)v33[0], "Setup Keyframe Anim");
SetupTriggerPopup::addTitle(a1, v33);
*(_OWORD *)v33 = 0;
v34.m128i_i64[0] = 2;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "OK");
SetupTriggerPopup::addCloseButton(a1, v33);
v27 = v33;
*(_OWORD *)v33 = 0;
v34 = 0u;
v6 = sub_14003D460(0x190u);
v33[0] = v6;
v34.m128i_i64[0] = 393;
v34.m128i_i64[1] = 399;
v7 = v6;
v8 = "Sets up a keyframe animation using Animation Group ID.\n"
"Use Target ID to specify a different target than the one set in the Keyframe trigger.\n"
"The animation itself is made in the Keyframe trigger.\n"
"By default, objects choose their own center for scaling and rotation, but you can set one using Parent ID"
"c>.\n"
"On page 2, you can put modifiers for the keyframe sequence.";
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 );
*(_QWORD *)v7 = *(_QWORD *)v8;
v7[8] = v8[8];
v6[393] = 0;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 4;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Help");
SetupTriggerPopup::addHelpButton(a1, Block, v33);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v28, v31 * 0.5, (float)(v32 * 0.5) + 60.0);
*(_OWORD *)Block = 0;
si128 = 0;
Block[0] = sub_14003D460(0x20u);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836630);
strcpy((char *)Block[0], "Animation Group ID");
v12 = (__int64)(a1 + 544);
if ( !a1 )
v12 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, 0.0);
cocos2d::CCPoint::operator+(v28, &v27, v13);
IDNameInput::create(
(__int64)a1,
v12,
1,
76,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v27,
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);
}
v33[1] = (void *)68;
v15 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v34 = v15;
v33[0] = (void *)0x4920746567726154LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, -85.0, -70.0);
cocos2d::CCPoint::operator+(v28, &v27, v16);
IDNameInput::create(
(__int64)a1,
v12,
1,
51,
(__int64)v33,
(const struct cocos2d::CCPoint *)&v27,
1061997773,
6,
0,
0,
0);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v17 = v33[0];
if ( (unsigned __int64)(v34.m128i_i64[1] + 1) >= 0x1000 )
{
v17 = *((void **)v33[0] - 1);
if ( (unsigned __int64)((char *)v33[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
v15 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
}
v33[1] = (void *)68;
v34 = v15;
v33[0] = (void *)0x4920746E65726150LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 85.0, -70.0);
cocos2d::CCPoint::operator+(v28, &v27, v18);
IDNameInput::create(
(__int64)a1,
v12,
1,
71,
(__int64)v33,
(const struct cocos2d::CCPoint *)&v27,
1061997773,
6,
0,
0,
0);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v19 = v33[0];
if ( (unsigned __int64)(v34.m128i_i64[1] + 1) >= 0x1000 )
{
v19 = *((void **)v33[0] - 1);
if ( (unsigned __int64)((char *)v33[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, v31 * 0.5, (float)(v32 * 0.5) + 95.0);
cocos2d::CCPoint::operator=(v28, v20);
v29 = v33;
v33[1] = (void *)58;
v34.m128i_i64[0] = 9;
v34.m128i_i64[1] = 15;
v33[0] = (void *)0x646F4D20656D6954LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v30, 0.0, 0.0);
cocos2d::CCPoint::operator+(v28, &v27, v21);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
520,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
0,
1065353216,
1,
0,
1,
2,
0);
v30 = v33;
v34.m128i_i64[0] = 15;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "Position X Mod:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, -30.0);
cocos2d::CCPoint::operator+(v28, &v27, v22);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
521,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
-1073741824,
0x40000000,
1,
0,
1,
2,
0);
v30 = v33;
v34.m128i_i64[0] = 15;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "Position Y Mod:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, -60.0);
cocos2d::CCPoint::operator+(v28, &v27, v23);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
545,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
-1073741824,
0x40000000,
1,
0,
1,
2,
0);
v30 = v33;
v34.m128i_i64[0] = 13;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "Rotation mod:");
HIWORD(v33[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, -90.0);
cocos2d::CCPoint::operator+(v28, &v27, v24);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
522,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
-1073741824,
0x40000000,
1,
0,
1,
2,
0);
v30 = v33;
v34.m128i_i64[0] = 12;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "Scale X Mod:");
BYTE5(v33[1]) = 0;
HIWORD(v33[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, -120.0);
cocos2d::CCPoint::operator+(v28, &v27, v25);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
523,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
-1073741824,
0x40000000,
1,
0,
1,
2,
0);
v30 = v33;
v34.m128i_i64[0] = 12;
v34.m128i_i64[1] = 15;
strcpy((char *)v33, "Scale Y Mod:");
BYTE5(v33[1]) = 0;
HIWORD(v33[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, 0.0, -150.0);
cocos2d::CCPoint::operator+(v28, &v27, v26);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
546,
(unsigned int)v33,
(unsigned int)&v27,
1060320051,
0,
1,
6,
0,
-1073741824,
0x40000000,
1,
0,
1,
2,
0);
SetupTriggerPopup::createPageButtons(a1);
SetupTriggerPopup::goToPage(a1, 0, 0);
(*(void (__fastcall **)(_BYTE *))(*(_QWORD *)a1 + 1136LL))(a1);
a1[744] = 0;
return 1;
}
return result;
}