//
// GJBaseGameLayer::refreshKeyframeAnims from 0x8650b8 to 0x86528c (468 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::init @ 0x67cb74
// > GJBaseGameLayer::updateSpecialGroupData @ 0x897fc4
// > ??> @ 0x2c1d8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJBaseGameLayer::refreshKeyframeAnims(GJBaseGameLayer *a1)
{
cocos2d::CCDictionary *v2; // x24
cocos2d::CCArray *m_objects; // x0
cocos2d::ccArray *data; // x1
unsigned int v5; // w22
cocos2d::CCArray *v6; // x23
unsigned int v7; // w19
__int64 v8; // x0
cocos2d::CCArray *v9; // x20
__int64 v10; // x0
cocos2d::CCObject **arr; // x19
cocos2d::CCObject **i; // x22
cocos2d::CCObject *v13; // x20
cocos2d::CCArray *v14; // x23
cocos2d::CCDictionary::removeAllObjects(a1->m_keyframeGroups);
a1->m_keyframeGroup = 0;
v2 = cocos2d::CCDictionary::create();
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
if ( data->num )
{
arr = data->arr;
for ( i = &arr[data->num - 1]; i >= arr; ++arr )
{
v13 = *arr;
if ( !*arr )
break;
if ( HIDWORD(v13[18].__vftable) == 3032 )
{
v14 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v2, v13[32].m_uOrderOfArrival);
if ( !v14 )
{
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
v14->setTag(v14, v13[32].m_uOrderOfArrival);
cocos2d::CCDictionary::setObject(v2, v14, v13[32].m_uOrderOfArrival);
}
cocos2d::CCArray::addObject(v14, v13);
}
}
}
}
v5 = 0;
v6 = cocos2d::CCDictionary::allKeys(v2);
qsort(v6->data->arr, v6->data->num, 8u, (int (*)(const void *, const void *))compKeyframeID);
if ( (unsigned int)cocos2d::CCArray::count(v6) )
{
do
{
v7 = 0;
v8 = cocos2d::CCArray::objectAtIndex(v6, v5);
v9 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v2, *(int *)(v8 + 56));
qsort(v9->data->arr, v9->data->num, 8u, (int (*)(const void *, const void *))compShadowCopy);
v9->setTag(v9, a1->m_keyframeGroup);
cocos2d::CCDictionary::setObject(a1->m_keyframeGroups, v9, a1->m_keyframeGroup);
while ( v7 < (unsigned int)cocos2d::CCArray::count(v9) )
{
v10 = cocos2d::CCArray::objectAtIndex(v9, v7);
*(_DWORD *)(v10 + 1840) = a1->m_keyframeGroup;
*(_DWORD *)(v10 + 1844) = v7++;
}
++v5;
++a1->m_keyframeGroup;
}
while ( v5 < (unsigned int)cocos2d::CCArray::count(v6) );
}
}