//
// cocos2d::CCTextureCache::removeUnusedTextures from 0x1800ad130 to 0x1800ad2aa (378 bytes)
//
// 2 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c21a8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:18 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall cocos2d::CCTextureCache::removeUnusedTextures(cocos2d::CCTextureCache *this)
{
void **v2; // rcx
__int64 v3; // rdi
__int64 v4; // rdi
__int64 i; // rbx
_QWORD *v6; // rsi
_QWORD *v7; // rax
_QWORD *v8; // rcx
struct cocos2d::CCDictElement *v9; // rbx
void **v10; // rax
_QWORD *v11; // rcx
_QWORD *v12; // rbx
void *Block[2]; // [rsp+20h] [rbp-38h] BYREF
void **v14; // [rsp+30h] [rbp-28h]
__int64 v15; // [rsp+38h] [rbp-20h]
if ( (unsigned int)cocos2d::CCDictionary::count(*((cocos2d::CCDictionary **)this + 7)) )
{
*(_OWORD *)Block = 0;
v2 = (void **)sub_1800E4AC0(0x18u);
*v2 = v2;
v2[1] = v2;
Block[0] = v2;
v3 = *((_QWORD *)this + 7);
if ( v3 )
{
v4 = *(_QWORD *)(v3 + 56);
if ( v4 )
{
for ( i = *(_QWORD *)(v4 + 288); ; i = *(_QWORD *)(i + 288) )
{
if ( (unsigned int)cocos2d::CCObject::retainCount(*(cocos2d::CCObject **)(v4 + 264)) == 1 )
{
v6 = Block[0];
if ( Block[1] == (void *)0xAAAAAAAAAAAAAAALL )
std::_Xlength_error("list too long");
v14 = Block;
v15 = 0;
v7 = (_QWORD *)sub_1800E4AC0(0x18u);
v7[2] = v4;
++Block[1];
v8 = (_QWORD *)v6[1];
*v7 = v6;
v7[1] = v8;
v15 = 0;
v6[1] = v7;
*v8 = v7;
}
v4 = i;
if ( !i )
break;
}
v2 = (void **)Block[0];
}
}
v9 = (struct cocos2d::CCDictElement *)*v2;
v10 = v2;
if ( *v2 != v2 )
{
do
{
cocos2d::CCDictionary::removeObjectForElememt(
*((cocos2d::CCDictionary **)this + 7),
*((struct cocos2d::CCDictElement **)v9 + 2));
v9 = *(struct cocos2d::CCDictElement **)v9;
v2 = (void **)Block[0];
}
while ( v9 != Block[0] );
v10 = (void **)Block[0];
}
*(_QWORD *)v10[1] = 0;
v11 = *v2;
if ( v11 )
{
do
{
v12 = (_QWORD *)*v11;
j_j_free_0(v11);
v11 = v12;
}
while ( v12 );
}
j_j_free_0(Block[0]);
}
}