//
// SetupKeyframePopup::refreshPreviewArt from 0x140426b70 to 0x140426e08 (664 bytes)
//
// 3 xrefs:
// > SetupKeyframePopup::valueDidChange @ 0x140426636
// > SetupKeyframePopup::onCustomButton @ 0x1404267d6
// > ??> @ 0x1406d974c
//
// 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
//
// Hidden C++ exception states: #wind=2
void SetupKeyframePopup::refreshPreviewArt(SetupKeyframePopup *a1)
{
_QWORD *v2; // rbx
EffectGameObject *m_gameObject; // rcx
cocos2d::CCArray *m_gameObjects; // rdi
__int64 m_uAutoReleaseCount; // rdx
__int64 v6; // r8
cocos2d::ccArray *data; // rdi
__int64 num; // rax
cocos2d::CCObject **arr; // rdi
cocos2d::CCObject **v10; // rbp
cocos2d::CCObject *v11; // rsi
__int64 *v12; // rax
_QWORD *v13; // rcx
_DWORD *v14; // rax
__int64 *v15; // rbx
struct cocos2d::CCObject *v16; // rax
cocos2d::CCObject_vtbl *v17; // rcx
__int64 copyWithZone_low; // rax
bool (__fastcall *isEqual)(cocos2d::CCObject *__hidden, const cocos2d::CCObject *); // rcx
unsigned __int64 i; // rdx
__int64 **v21; // rax
__int64 *j; // rax
__int64 *k; // rcx
_QWORD *v24; // [rsp+20h] [rbp-58h] BYREF
__int64 v25; // [rsp+28h] [rbp-50h]
void **v26; // [rsp+30h] [rbp-48h]
__int64 v27; // [rsp+38h] [rbp-40h]
__int64 *v28; // [rsp+40h] [rbp-38h] BYREF
int v29; // [rsp+48h] [rbp-30h]
if ( a1->m_editorLayer )
{
v25 = 0;
v2 = operator new(0x20u);
*v2 = v2;
v2[1] = v2;
v2[2] = v2;
*((_WORD *)v2 + 12) = 257;
v24 = v2;
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
m_gameObjects = cocos2d::CCArray::createWithObject(m_gameObject);
v2 = v24;
}
else
{
m_gameObjects = a1->m_gameObjects;
}
if ( m_gameObjects )
{
if ( cocos2d::CCArray::count(m_gameObjects)
&& (data = m_gameObjects->data, num = data->num, (_DWORD)num)
&& (arr = data->arr, v10 = &arr[num - 1], arr <= v10) )
{
v2 = v24;
do
{
v11 = *arr;
if ( !*arr )
break;
v12 = (__int64 *)v2[1];
v28 = v12;
v29 = 0;
v13 = v2;
if ( !*((_BYTE *)v12 + 25) )
{
m_uAutoReleaseCount = v11[33].m_uAutoReleaseCount;
do
{
v28 = v12;
if ( *((_DWORD *)v12 + 7) >= (int)m_uAutoReleaseCount )
{
v29 = 1;
v13 = v12;
v12 = (__int64 *)*v12;
}
else
{
v29 = 0;
v12 = (__int64 *)v12[2];
}
}
while ( !*((_BYTE *)v12 + 25) );
}
if ( *((_BYTE *)v13 + 25) || (signed int)v11[33].m_uAutoReleaseCount < *((_DWORD *)v13 + 7) )
{
if ( v25 == 0x7FFFFFFFFFFFFFFLL )
sub_140052E40(v13, m_uAutoReleaseCount, v6);
v26 = (void **)&v24;
v27 = 0;
v14 = operator new(0x20u);
v14[7] = v11[33].m_uAutoReleaseCount;
*(_QWORD *)v14 = v2;
*((_QWORD *)v14 + 1) = v2;
*((_QWORD *)v14 + 2) = v2;
*((_WORD *)v14 + 12) = 0;
v27 = 0;
sub_1400636D0(&v24, (__int64)&v28, (__int64)v14);
v2 = v24;
}
++arr;
}
while ( arr <= v10 );
}
else
{
v2 = v24;
}
}
v15 = (__int64 *)*v2;
while ( !*((_BYTE *)v15 + 25) )
{
v16 = cocos2d::CCDictionary::objectForKey(a1->m_editorLayer->m_keyframeGroups, *((int *)v15 + 7));
if ( v16 )
{
v17 = v16[1].__vftable;
copyWithZone_low = LODWORD(v17->copyWithZone);
if ( (_DWORD)copyWithZone_low )
{
isEqual = v17->isEqual;
for ( i = (unsigned __int64)isEqual + 8 * copyWithZone_low - 8;
(unsigned __int64)isEqual <= i;
isEqual = (bool (__fastcall *)(cocos2d::CCObject *__hidden, const cocos2d::CCObject *))((char *)isEqual + 8) )
{
if ( !*(_QWORD *)isEqual )
break;
*(_BYTE *)(*(_QWORD *)isEqual + 1897LL) = 1;
}
}
}
v21 = (__int64 **)v15[2];
if ( *((_BYTE *)v21 + 25) )
{
for ( j = (__int64 *)v15[1]; !*((_BYTE *)j + 25); j = (__int64 *)j[1] )
{
if ( v15 != (__int64 *)j[2] )
break;
v15 = j;
}
v15 = j;
}
else
{
v15 = (__int64 *)v15[2];
for ( k = *v21; !*((_BYTE *)k + 25); k = (__int64 *)*k )
v15 = k;
}
}
sub_1400CDB90((void **)&v24);
}
}