//
// cocos2d::CCSpriteFrameCache::removeSpriteFramesFromDictionary from 0xb1a87c to 0xb1aaa8 (556 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteFrameCache::removeSpriteFramesFromFile @ 0xb1b72c
// > ??> @ 0x96fd8
//
// 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::removeSpriteFramesFromDictionary(
cocos2d::CCSpriteFrameCache *a1,
cocos2d::CCDictionary *a2)
{
__int64 v4; // x20
cocos2d::CCArray *v5; // x0
cocos2d::CCArray *v6; // x25
__int64 v7; // x21
__int64 i; // x20
cocos2d::CCSpriteFrameCache_vtbl *v9; // x28
__int64 v10; // x2
char *v11; // x0
cocos2d::CCObject *v12; // x0
cocos2d::CCObject *v13; // x2
char *v14; // x0
unsigned int *v15; // x1
int v16; // w3
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
__int64 v21; // [xsp+60h] [xbp+60h]
const char *v22; // [xsp+80h] [xbp+80h] BYREF
sub_D153B8((int)&v22, "frames");
v4 = cocos2d::CCDictionary::objectForKey((__int64)a2, &v22);
v5 = (cocos2d::CCArray *)(v22 - 24);
if ( v22 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v22 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v5);
}
v6 = cocos2d::CCArray::create(v5);
if ( v4 )
{
v7 = *(_QWORD *)(v4 + 56);
if ( v7 )
{
for ( i = *(_QWORD *)(v7 + 288); ; i = *(_QWORD *)(i + 288) )
{
v9 = a1[1].__vftable;
sub_D153B8((int)&v22, (char *)v7);
v10 = cocos2d::CCDictionary::objectForKey((__int64)v9, &v22);
v11 = (char *)(v22 - 24);
if ( v22 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v22 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v16 - 1;
}
if ( v16 <= 0 )
{
v21 = v10;
operator delete(v11);
v10 = v21;
}
}
if ( !v10 )
goto LABEL_8;
sub_D153B8((int)&v22, (char *)v7);
v12 = cocos2d::CCString::create();
cocos2d::CCArray::addObject(v6, (cocos2d::_ccArray *)v12, v13);
v14 = (char *)(v22 - 24);
if ( v22 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_8;
if ( &pthread_create )
{
v17 = (unsigned int *)(v22 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v18 - 1;
}
if ( v18 > 0 )
{
LABEL_8:
if ( !i )
break;
}
else
{
operator delete(v14);
if ( !i )
break;
}
v7 = i;
}
}
}
cocos2d::CCDictionary::removeObjectsForKeys((cocos2d::CCDictionary *)a1[1].__vftable, v6);
}