//
// SetupKeyframePopup::refreshPreviewArt from 0x100201750 to 0x100201931 (481 bytes)
//
// 2 xrefs:
// > SetupKeyframePopup::valueDidChange @ 0x100201742
// > SetupKeyframePopup::onCustomButton @ 0x100201a95
//
// 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 __fastcall SetupKeyframePopup::refreshPreviewArt(SetupKeyframePopup *a1)
{
_QWORD *v2; // r15
EffectGameObject *m_gameObject; // rdi
cocos2d::CCArray *m_gameObjects; // r14
cocos2d::ccArray *data; // rax
unsigned __int64 arr; // r14
__int64 v7; // rax
int v8; // r13d
_QWORD *v9; // r12
int v10; // eax
_DWORD *v11; // rax
_OWORD *v12; // r14
cocos2d::CCObject *v13; // rax
cocos2d::CCObject_vtbl *v14; // rax
__int64 copyWithZone_low; // rcx
unsigned __int64 v16; // rax
unsigned __int64 v17; // rcx
_QWORD *v18; // rcx
_OWORD *v19; // rax
bool v20; // zf
unsigned __int64 v21; // [rsp+8h] [rbp-48h]
_OWORD *v22; // [rsp+10h] [rbp-40h] BYREF
_OWORD v23[3]; // [rsp+18h] [rbp-38h] BYREF
if ( !a1->m_editorLayer )
return;
v2 = v23;
v23[0] = 0;
v22 = v23;
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
m_gameObjects = (cocos2d::CCArray *)sub_10071FA80(m_gameObject);
if ( !m_gameObjects )
goto LABEL_21;
LABEL_6:
if ( (unsigned int)sub_100720070(m_gameObjects) )
{
data = m_gameObjects->data;
if ( data->num )
{
arr = (unsigned __int64)data->arr;
v21 = arr + 8LL * data->num - 8;
do
{
if ( !*(_QWORD *)arr )
break;
v7 = *(_QWORD *)&v23[0];
v8 = *(_DWORD *)(*(_QWORD *)arr + 1856LL);
LABEL_14:
v9 = v2;
if ( v7 )
{
do
{
v2 = (_QWORD *)v7;
v10 = *(_DWORD *)(v7 + 28);
if ( v8 < v10 )
{
v7 = *v2;
goto LABEL_14;
}
if ( v8 <= v10 )
goto LABEL_10;
v7 = v2[1];
}
while ( v7 );
v9 = v2 + 1;
}
v11 = operator new(0x20u);
v11[7] = v8;
*(_OWORD *)v11 = 0;
*((_QWORD *)v11 + 2) = v2;
*v9 = v11;
if ( *(_QWORD *)v22 )
v22 = *(_OWORD **)v22;
sub_100054DD0(*(__int64 **)&v23[0], (__int64 *)v11);
++*((_QWORD *)&v23[0] + 1);
LABEL_10:
arr += 8LL;
v2 = v23;
}
while ( arr <= v21 );
}
}
goto LABEL_21;
}
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
goto LABEL_6;
LABEL_21:
v12 = v22;
if ( v22 != v23 )
{
do
{
v13 = cocos2d::CCDictionary::objectForKey(a1->m_editorLayer->m_keyframeGroups, *((int *)v12 + 7));
if ( v13 )
{
v14 = v13[1].__vftable;
copyWithZone_low = LODWORD(v14->copyWithZone);
if ( LODWORD(v14->copyWithZone) )
{
v16 = (unsigned __int64)v14->~CCObject_0;
v17 = v16 + 8 * copyWithZone_low - 8;
do
{
if ( !*(_QWORD *)v16 )
break;
*(_BYTE *)(*(_QWORD *)v16 + 1881LL) = 1;
v16 += 8LL;
}
while ( v16 <= v17 );
}
}
v18 = *((_QWORD **)v12 + 1);
if ( v18 )
{
do
{
v19 = v18;
v18 = (_QWORD *)*v18;
}
while ( v18 );
}
else
{
do
{
v19 = *((_OWORD **)v12 + 2);
v20 = *(_QWORD *)v19 == (_QWORD)v12;
v12 = v19;
}
while ( !v20 );
}
v12 = v19;
}
while ( v19 != v23 );
}
sub_100054D90((__int64)&v22, *(_QWORD **)&v23[0]);
}