//
// GJBigSprite::unloadAll from 0x97f488 to 0x97f5f0 (360 bytes)
//
// 2 xrefs:
// > MapSelectLayer::onExit @ 0x980b7c
// > ??> @ 0x5a3f0
//
// 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 GJBigSprite::unloadAll(GJBigSprite *a1)
{
unsigned int v2; // w19
cocos2d::CCArray *m_spriteNodes; // x0
__int64 v4; // x20
__int64 v5; // x0
char *v6; // x0
unsigned int *v7; // x1
int v8; // w2
const char *v9; // [xsp+60h] [xbp+60h] BYREF
v2 = 0;
m_spriteNodes = a1->m_spriteNodes;
a1->m_unloadingAll = 1;
if ( (unsigned int)cocos2d::CCArray::count(m_spriteNodes) )
{
do
{
v4 = cocos2d::CCArray::objectAtIndex(a1->m_spriteNodes, v2);
v5 = *(_QWORD *)(v4 + 328);
*(_BYTE *)(v4 + 352) = 0;
if ( !v5 )
goto LABEL_4;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v5 + 520LL))(v5);
*(_QWORD *)(v4 + 328) = 0;
sub_D18D28(&v9);
GJBigSprite::unloadSprite((__int64)a1, &v9, v2);
v6 = (char *)(v9 - 24);
if ( v9 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_4;
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *((_DWORD *)v9 - 2);
*((_DWORD *)v9 - 2) = v8 - 1;
}
if ( v8 > 0 )
{
LABEL_4:
++v2;
}
else
{
++v2;
operator delete(v6);
}
}
while ( v2 < (unsigned int)cocos2d::CCArray::count(a1->m_spriteNodes) );
}
}