//
// cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas from 0x1001d7644 to 0x1001d7790 (332 bytes)
//
// 5 xrefs:
// > cocos2d::CCSpriteBatchNode::removeChild @ 0x1001d7620
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x1001d76a8
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x1001d7770
// > cocos2d::CCSprite::removeChild @ 0x1002387f4
// > cocos2d::CCSprite::removeAllChildrenWithCleanup @ 0x10023888c
//
// 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 __fastcall cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(
cocos2d::CCSpriteBatchNode *a1,
cocos2d::CCSprite *a2)
{
__int64 v4; // x0
__int64 v5; // x20
unsigned int *v6; // x9
__int64 v7; // x8
cocos2d::CCSprite **v8; // x20
unsigned __int64 v9; // x21
unsigned int m_unknown2; // w21
unsigned int v11; // w22
__int64 v12; // x0
__int64 v13; // x20
unsigned int *v14; // x9
__int64 v15; // x8
cocos2d::CCSprite **v16; // x20
unsigned __int64 v17; // x21
if ( a2->m_bDontDraw )
{
v4 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getChildren)(a2);
if ( v4 )
{
v5 = v4;
if ( (unsigned int)sub_10024A36C(v4) )
{
v6 = *(unsigned int **)(v5 + 56);
v7 = *v6;
if ( (_DWORD)v7 )
{
v8 = *((cocos2d::CCSprite ***)v6 + 2);
v9 = (unsigned __int64)&v8[v7 - 1];
do
{
if ( !*v8 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1, *v8++);
}
while ( (unsigned __int64)v8 <= v9 );
}
}
}
}
else
{
m_unknown2 = a2->m_unknown2;
if ( m_unknown2 != -1 )
{
v11 = sub_10024A36C(a1->m_pobDescendants) - 1;
if ( m_unknown2 < v11 )
cocos2d::CCSpriteBatchNode::swap(a1, m_unknown2, v11);
cocos2d::CCTextureAtlas::removeQuadAtIndex(a1->m_pobTextureAtlas, v11);
a1->m_bReorderChildDirty = 1;
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a2->setBatchNode)(a2, 0);
sub_100353A30();
v12 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getChildren)(a2);
if ( v12 )
{
v13 = v12;
if ( (unsigned int)sub_10024A36C(v12) )
{
v14 = *(unsigned int **)(v13 + 56);
v15 = *v14;
if ( (_DWORD)v15 )
{
v16 = *((cocos2d::CCSprite ***)v14 + 2);
v17 = (unsigned __int64)&v16[v15 - 1];
do
{
if ( !*v16 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1, *v16++);
}
while ( (unsigned __int64)v16 <= v17 );
}
}
}
}
}
}