//
// SetupKeyframePopup::onCustomButton from 0x10024a788 to 0x10024aa3c (692 bytes)
//
// 1 xrefs:
// > ??> @ 0x100909360
//
// This function is hookable on this platform (idp: arm, 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:01:28 +0000
//
__int64 __fastcall SetupKeyframePopup::onCustomButton(_QWORD *a1, __int64 a2)
{
__int64 v4; // x21
unsigned int *v5; // x9
__int64 v6; // x8
unsigned __int64 v7; // x21
unsigned __int64 v8; // x22
__n128 v9; // q0
__int64 **i; // x20
double v11; // d0
__int64 **j; // x20
__int64 v13; // x0
__n128 v15; // q0
__int64 v16; // x20
unsigned int *v17; // x9
__int64 v18; // x8
unsigned __int64 v19; // x20
unsigned __int64 v20; // x22
_QWORD **v21; // x20
__int64 v22; // x0
_QWORD *v23; // x9
_QWORD **v24; // x8
bool v25; // zf
_QWORD **v26; // [xsp+8h] [xbp-68h] BYREF
_QWORD *v27[2]; // [xsp+10h] [xbp-60h] BYREF
__int128 v28; // [xsp+20h] [xbp-50h] BYREF
__int128 v29; // [xsp+30h] [xbp-40h]
int v30; // [xsp+40h] [xbp-30h]
v28 = 0u;
v29 = 0u;
v30 = 1065353216;
if ( a1[85] )
{
v4 = sub_1002E73C8((__n128)0LL);
if ( !v4 )
goto LABEL_10;
}
else
{
v4 = a1[86];
if ( !v4 )
goto LABEL_10;
}
if ( (unsigned int)sub_1002E757C(v4) )
{
v5 = *(unsigned int **)(v4 + 56);
v6 = *v5;
if ( (_DWORD)v6 )
{
v7 = *((_QWORD *)v5 + 2);
v8 = v7 + 8 * v6 - 8;
do
{
if ( !*(_QWORD *)v7 )
break;
sub_10001CC04((unsigned __int64)&v28, (int *)(*(_QWORD *)v7 + 1856LL), (_DWORD *)(*(_QWORD *)v7 + 1856LL));
v7 += 8LL;
}
while ( v7 <= v8 );
}
}
LABEL_10:
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2) == 2 )
{
sub_10024A580(a1, v9);
return sub_1000184EC((__int64)&v28);
}
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2) == 4 )
{
if ( a1[128] )
{
for ( i = (__int64 **)v29; i; i = (__int64 **)*i )
sub_10040642C(a1[128], *((unsigned int *)i + 4));
}
LABEL_21:
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1368LL))(a1, 0);
return sub_1000184EC((__int64)&v28);
}
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2) == 3 )
{
EditorUI::deselectAll(*(_QWORD *)(a1[128] + 14248LL), v11);
if ( a1[128] )
{
for ( j = (__int64 **)v29; j; j = (__int64 **)*j )
{
v13 = LevelEditorLayer::duplicateKeyframeAnimation(a1[128], *((unsigned int *)j + 4));
EditorUI::selectObjects(*(_QWORD *)(a1[128] + 14248LL), v13, 0);
}
}
goto LABEL_21;
}
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2) == 1 && a1[128] )
{
v27[0] = nullptr;
v27[1] = nullptr;
v26 = v27;
if ( a1[85] )
{
v16 = sub_1002E73C8(v15);
if ( !v16 )
goto LABEL_34;
}
else
{
v16 = a1[86];
if ( !v16 )
{
LABEL_34:
EditorUI::deselectAll(*(_QWORD *)(a1[128] + 14248LL), v15.n128_f64[0]);
v21 = v26;
if ( v26 != v27 )
{
do
{
cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1[128] + 13272LL), *((int *)v21 + 7));
EditorUI::selectObjects(*(_QWORD *)(a1[128] + 14248LL), v22, 0);
v23 = v21[1];
if ( v23 )
{
do
{
v24 = (_QWORD **)v23;
v23 = (_QWORD *)*v23;
}
while ( v23 );
}
else
{
do
{
v24 = (_QWORD **)v21[2];
v25 = *v24 == v21;
v21 = v24;
}
while ( !v25 );
}
v21 = v24;
}
while ( v24 != v27 );
}
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 1368LL))(a1, 0);
sub_1000187C4((__int64)&v26, v27[0]);
return sub_1000184EC((__int64)&v28);
}
}
if ( (unsigned int)sub_1002E757C(v16) )
{
v17 = *(unsigned int **)(v16 + 56);
v18 = *v17;
if ( (_DWORD)v18 )
{
v19 = *((_QWORD *)v17 + 2);
v20 = v19 + 8 * v18 - 8;
do
{
if ( !*(_QWORD *)v19 )
break;
sub_1000D8E78((__int64)&v26, (int *)(*(_QWORD *)v19 + 1856LL), (_DWORD *)(*(_QWORD *)v19 + 1856LL));
v19 += 8LL;
}
while ( v19 <= v20 );
}
}
goto LABEL_34;
}
return sub_1000184EC((__int64)&v28);
}