//
// SetupKeyframePopup::onCustomButton from 0x6af068 to 0x6af456 (1006 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:56:38 +0000
//
int __fastcall SetupKeyframePopup::onCustomButton(SetupKeyframePopup *this, cocos2d::CCObject *a2)
{
cocos2d::CCArray *v3; // r0
cocos2d::CCArray *v5; // r4
_DWORD *v6; // r3
int *v7; // r9
int v8; // r11
int v9; // t1
cocos2d::CCObject *v10; // r1
_DWORD *i; // r4
_DWORD *j; // r4
cocos2d::CCArray *v13; // r0
cocos2d::CCObject *v14; // r1
cocos2d::CCArray *v15; // r0
cocos2d::CCArray *v16; // r4
_DWORD *v17; // r4
unsigned int v19; // r4
unsigned int v20; // r10
unsigned int v21; // r7
int v22; // r6
_DWORD *v23; // r3
unsigned int v24; // r0
int v25; // r1
_DWORD *v26; // r0
int v27; // r3
_DWORD *v28; // r7
float v29; // s15
bool v30; // r6
unsigned int prime; // r4
unsigned int v32; // r0
unsigned int v33; // r6
unsigned int v34; // r1
unsigned int v35; // r0
_DWORD *v36; // r3
unsigned int v37; // r0
int v38; // r1
float v39; // r0
_DWORD *v40; // r2
int *v41; // r4
int *v42; // r6
int v43; // r2
int v44; // t1
cocos2d::CCArray *v45; // r0
_DWORD *v46; // r3
_DWORD *v47; // r3
int *v48; // [sp+0h] [bp-44h]
char v49[8]; // [sp+14h] [bp-30h] BYREF
_DWORD **v50; // [sp+1Ch] [bp-28h] BYREF
_DWORD *v51[2]; // [sp+20h] [bp-24h] BYREF
int v52; // [sp+28h] [bp-1Ch] BYREF
unsigned int v53; // [sp+2Ch] [bp-18h]
_DWORD *v54; // [sp+30h] [bp-14h] BYREF
unsigned int v55; // [sp+34h] [bp-10h]
float v56; // [sp+38h] [bp-Ch]
v3 = *((cocos2d::CCArray **)this + 132);
v52 = 0;
v53 = 0;
v54 = nullptr;
v55 = 0;
v56 = 1.0;
if ( v3 )
v5 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v3, a2);
else
v5 = *((cocos2d::CCArray **)this + 133);
if ( v5 )
{
if ( cocos2d::CCArray::count(v5) )
{
v6 = *((_DWORD **)v5 + 13);
if ( *v6 )
{
v7 = (int *)v6[3];
v48 = &v7[*v6 - 1];
while ( 1 )
{
LABEL_8:
if ( v7 > v48 )
break;
v9 = *v7++;
v8 = v9;
if ( !v9 )
break;
v19 = v53;
v20 = *(_DWORD *)(v8 + 1656);
if ( v53 )
{
v21 = v53 - 1;
if ( ((v53 - 1) & v53) != 0 )
v22 = v20 % v53;
else
v22 = v20 & v21;
v23 = *(_DWORD **)(v52 + 4 * v22);
if ( v23 )
{
while ( 1 )
{
v23 = (_DWORD *)*v23;
if ( !v23 )
break;
v24 = v23[1];
v25 = ((v53 - 1) & v53) != 0 ? v24 % v53 : v21 & v24;
if ( v25 != v22 )
break;
if ( v23[2] == v20 )
goto LABEL_8;
}
}
}
else
{
v22 = 0;
}
v26 = (_DWORD *)operator new(0xCu);
v27 = *(_DWORD *)(v8 + 1656);
v26[1] = v20;
v28 = v26;
v26[2] = v27;
*v26 = 0;
v29 = (float)(v55 + 1);
if ( v29 > (float)((float)v19 * v56) )
{
v30 = v19 > 2 && ((v19 - 1) & v19) == 0;
}
else
{
if ( v19 )
goto LABEL_65;
v30 = 0;
}
prime = 2 * v19 + !v30;
v32 = (unsigned int)ceilf(v29 / v56);
if ( prime < v32 )
prime = v32;
if ( prime == 1 )
{
prime = 2;
}
else if ( ((prime - 1) & prime) != 0 )
{
prime = std::__next_prime(prime);
}
v33 = v53;
if ( prime <= v53 )
{
if ( prime >= v53 )
goto LABEL_54;
if ( v53 <= 2 || ((v53 - 1) & v53) != 0 )
{
v39 = ceilf((float)v55 / v56);
v35 = std::__next_prime((unsigned int)v39);
}
else
{
v35 = 1 << (32 - __clz((unsigned int)ceilf((float)v55 / v56) - 1));
}
v34 = v35;
if ( v35 < prime )
v34 = prime;
if ( v34 >= v33 )
goto LABEL_54;
}
else
{
v34 = prime;
}
std::__hash_table,std::equal_to,std::allocator>::__rehash((int)&v52, v34);
LABEL_54:
v19 = v53;
if ( ((v53 - 1) & v53) != 0 )
v22 = v20 % v53;
else
v22 = v20 & (v53 - 1);
LABEL_65:
v36 = *(_DWORD **)(v52 + 4 * v22);
if ( v36 )
{
*v28 = *v36;
*v36 = v28;
}
else
{
*v28 = v54;
v54 = v28;
*(_DWORD *)(v52 + 4 * v22) = &v54;
if ( *v28 )
{
v37 = *(_DWORD *)(*v28 + 4);
if ( ((v19 - 1) & v19) != 0 )
v38 = v37 % v19;
else
v38 = (v19 - 1) & v37;
*(_DWORD *)(v52 + 4 * v38) = v28;
}
}
++v55;
}
}
}
}
if ( (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2) == 2 )
{
SetupKeyframePopup::refreshPreviewArt(this, v10);
return std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v52);
}
if ( (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2) == 4 )
{
if ( *((_DWORD *)this + 179) )
{
for ( i = v54; i; i = (_DWORD *)*i )
LevelEditorLayer::reverseKeyframeAnimationOrder(*((cocos2d::CCDictionary ***)this + 179), i[2]);
}
LABEL_19:
(*(void (__fastcall **)(SetupKeyframePopup *, _DWORD))(*(_DWORD *)this + 684))(this, 0);
return std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v52);
}
if ( (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2) == 3 )
{
EditorUI::deselectAll(*(EditorUI **)(*((_DWORD *)this + 179) + 11856));
if ( *((_DWORD *)this + 179) )
{
for ( j = v54; j; j = (_DWORD *)*j )
{
v13 = (cocos2d::CCArray *)LevelEditorLayer::duplicateKeyframeAnimation(
*((cocos2d::CCDictionary ***)this + 179),
j[2]);
EditorUI::selectObjects(*(EditorUI **)(*((_DWORD *)this + 179) + 11856), v13, 0);
}
}
goto LABEL_19;
}
if ( (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2) == 1 && *((_DWORD *)this + 179) )
{
v15 = *((cocos2d::CCArray **)this + 132);
v51[0] = nullptr;
v51[1] = nullptr;
v50 = v51;
if ( v15 )
v16 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v15, v14);
else
v16 = *((cocos2d::CCArray **)this + 133);
if ( v16 )
{
if ( cocos2d::CCArray::count(v16) )
{
v40 = *((_DWORD **)v16 + 13);
if ( *v40 )
{
v41 = (int *)v40[3];
v42 = &v41[*v40 - 1];
while ( v41 <= v42 )
{
v44 = *v41++;
v43 = v44;
if ( !v44 )
break;
std::__tree::__emplace_unique_key_args(
(int)v49,
(int)&v50,
(int *)(v43 + 1656),
(_DWORD *)(v43 + 1656));
}
}
}
}
EditorUI::deselectAll(*(EditorUI **)(*((_DWORD *)this + 179) + 11856));
v17 = v50;
while ( v17 != v51 )
{
v45 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(
*(cocos2d::CCDictionary **)(*((_DWORD *)this + 179) + 11232),
v17[4]);
EditorUI::selectObjects(*(EditorUI **)(*((_DWORD *)this + 179) + 11856), v45, 0);
v46 = (_DWORD *)v17[1];
if ( v46 )
{
do
{
v17 = v46;
v46 = (_DWORD *)*v46;
}
while ( v46 );
}
else
{
do
{
v47 = v17;
v17 = (_DWORD *)v17[2];
}
while ( v47 != (_DWORD *)*v17 );
}
}
(*(void (__fastcall **)(SetupKeyframePopup *, _DWORD))(*(_DWORD *)this + 684))(this, 0);
std::__tree::destroy((int)&v50, v51[0]);
}
return std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v52);
}