//
// cocos2d::CCSpriteFrameCache::removeUnusedSpriteFrames from 0xb1b148 to 0xb1b2b8 (368 bytes)
//
// 1 xrefs:
// > ??> @ 0xbabb8
//
// 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 cocos2d::CCSpriteFrameCache::removeUnusedSpriteFrames(cocos2d::CCSpriteFrameCache *a1)
{
cocos2d::CCSpriteFrameCache_vtbl *v2; // x0
cocos2d::CCDictElement *canEncode; // x20
int v4; // w23
cocos2d::CCDictElement *next; // x19
int v6; // w2
_QWORD *v7; // x21
__int64 v8; // x19
void *v9; // x0
__int64 v10; // x20
__int64 v11; // x2
void *v12; // x0
unsigned int *v13; // x2
int v14; // w1
void *v15; // x0
v2 = a1[1].__vftable;
if ( v2 )
{
canEncode = (cocos2d::CCDictElement *)v2->canEncode;
if ( canEncode )
{
v4 = 0;
next = (cocos2d::CCDictElement *)canEncode->hh.next;
v6 = cocos2d::CCObject::retainCount(canEncode->m_pObject);
if ( v6 == 1 )
goto LABEL_6;
while ( next )
{
while ( 1 )
{
canEncode = next;
next = (cocos2d::CCDictElement *)next->hh.next;
v6 = cocos2d::CCObject::retainCount(canEncode->m_pObject);
if ( v6 != 1 )
break;
LABEL_6:
v4 = v6;
cocos2d::CCDictionary::removeObjectForElememt((cocos2d::CCDictionary *)a1[1].__vftable, canEncode);
if ( !next )
goto LABEL_7;
}
}
LABEL_7:
if ( v4 )
{
v7 = *(_QWORD **)&a1[1].m_nTag;
v8 = v7[2];
if ( v8 )
{
do
{
while ( 1 )
{
std::_Rb_tree,std::less,std::allocator>::_M_erase(
(__int64)v7,
*(_QWORD **)(v8 + 24));
v10 = *(_QWORD *)(v8 + 16);
v11 = *(_QWORD *)(v8 + 32);
v12 = (void *)(v11 - 24);
if ( (__int64 *)(v11 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v11 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v11 - 8);
*(_DWORD *)(v11 - 8) = v14 - 1;
}
if ( v14 <= 0 )
break;
}
v9 = (void *)v8;
v8 = v10;
operator delete(v9);
if ( !v10 )
goto LABEL_17;
}
operator delete(v12);
v15 = (void *)v8;
v8 = v10;
operator delete(v15);
}
while ( v10 );
}
LABEL_17:
v7[2] = 0;
v7[3] = v7 + 1;
v7[4] = v7 + 1;
v7[5] = 0;
}
}
}
}