//
// cocos2d::CCTextureCache::removeUnusedTextures from 0xb341b8 to 0xb342cc (276 bytes)
//
// 1 xrefs:
// > ??> @ 0xa7058
//
// 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::CCTextureCache::removeUnusedTextures(cocos2d::CCTextureCache *a1)
{
cocos2d::CCDictionary *m_pTextures; // x0
cocos2d::CCDictElement *m_pElements; // x21
cocos2d::CCDictElement *next; // x19
_QWORD *v5; // x0
__int64 **v6; // x19
_QWORD *v7; // x0
_QWORD *v8; // x19
_QWORD v9[2]; // [xsp+48h] [xbp+48h] BYREF
if ( cocos2d::CCDictionary::count(a1->m_pTextures) )
{
m_pTextures = a1->m_pTextures;
v9[0] = v9;
v9[1] = v9;
if ( !m_pTextures || (m_pElements = m_pTextures->m_pElements) == nullptr )
{
v7 = v9;
LABEL_12:
while ( v7 != v9 )
{
v8 = (_QWORD *)*v7;
operator delete(v7);
v7 = v8;
}
return;
}
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( (unsigned int)cocos2d::CCObject::retainCount(m_pElements->m_pObject) == 1 )
goto LABEL_7;
while ( next )
{
while ( 1 )
{
m_pElements = next;
next = (cocos2d::CCDictElement *)next->hh.next;
if ( (unsigned int)cocos2d::CCObject::retainCount(m_pElements->m_pObject) != 1 )
break;
LABEL_7:
v5 = (_QWORD *)operator new(0x18u);
*v5 = 0;
v5[1] = 0;
v5[2] = m_pElements;
sub_CD8D88();
if ( !next )
goto LABEL_8;
}
}
LABEL_8:
v6 = (__int64 **)v9[0];
if ( (_QWORD *)v9[0] != v9 )
{
do
{
cocos2d::CCDictionary::removeObjectForElememt(a1->m_pTextures, (cocos2d::CCDictElement *)v6[2]);
v6 = (__int64 **)*v6;
}
while ( v6 != v9 );
v7 = (_QWORD *)v9[0];
goto LABEL_12;
}
}
}