//
// cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas from 0xd894e8 to 0xd89660 (376 bytes)
//
// 6 xrefs:
// > cocos2d::CCSprite::removeChild @ 0xd87c84
// > cocos2d::CCSprite::removeAllChildrenWithCleanup @ 0xd87d20
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0xd895c0
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0xd89630
// > cocos2d::CCSpriteBatchNode::removeChild @ 0xd89cc4
// > ??> @ 0x766d8
//
// This function is hookable on this platform (idp: arm, 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 13:08:14 +0000
//
__int64 __fastcall cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(
cocos2d::CCTextureAtlas **this,
cocos2d::CCSprite *a2)
{
__int64 result; // x0
unsigned int v5; // w21
unsigned int v6; // w22
__int64 v7; // x19
unsigned int *v8; // x1
cocos2d::CCSprite **v9; // x19
char *v10; // x21
cocos2d::CCSprite *v11; // x1
__int64 v12; // x19
unsigned int *v13; // x1
cocos2d::CCSprite **v14; // x19
char *v15; // x21
cocos2d::CCSprite *v16; // x1
result = *((unsigned __int8 *)a2 + 559);
if ( *((_BYTE *)a2 + 559) )
{
result = (*(__int64 (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)a2 + 488LL))(a2);
v12 = result;
if ( result )
{
result = cocos2d::CCArray::count((cocos2d::CCArray *)result);
if ( (_DWORD)result )
{
v13 = *(unsigned int **)(v12 + 56);
result = *v13;
if ( (_DWORD)result )
{
v14 = *((cocos2d::CCSprite ***)v13 + 2);
result = 8LL * (unsigned int)result - 8;
v15 = (char *)v14 + result;
if ( v14 <= (cocos2d::CCSprite **)((char *)v14 + result) )
{
do
{
v16 = *v14;
if ( !*v14 )
break;
++v14;
result = cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas((cocos2d::CCSpriteBatchNode *)this, v16);
}
while ( v15 >= (char *)v14 );
}
}
}
}
}
else
{
v5 = *((_DWORD *)a2 + 10);
if ( v5 != -1 )
{
v6 = cocos2d::CCArray::count(*(this + 43)) - 1;
if ( v5 < v6 )
cocos2d::CCSpriteBatchNode::swap((cocos2d::CCSpriteBatchNode *)this, v5, v6);
cocos2d::CCTextureAtlas::removeQuadAtIndex(*(this + 41), v6);
*((_BYTE *)this + 288) = 1;
(*(void (__fastcall **)(cocos2d::CCSprite *, _QWORD))(*(_QWORD *)a2 + 1120LL))(a2, 0);
cocos2d::ccArrayRemoveObjectAtIndexBatch(
*((_QWORD *)*(this + 43) + 7),
(unsigned int)(**((_DWORD **)*(this + 43) + 7) - 1),
1);
result = (*(__int64 (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)a2 + 488LL))(a2);
v7 = result;
if ( result )
{
result = cocos2d::CCArray::count((cocos2d::CCArray *)result);
if ( (_DWORD)result )
{
v8 = *(unsigned int **)(v7 + 56);
result = *v8;
if ( (_DWORD)result )
{
v9 = *((cocos2d::CCSprite ***)v8 + 2);
result = 8LL * (unsigned int)result - 8;
v10 = (char *)v9 + result;
if ( v9 <= (cocos2d::CCSprite **)((char *)v9 + result) )
{
do
{
v11 = *v9;
if ( !*v9 )
break;
++v9;
result = cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas((cocos2d::CCSpriteBatchNode *)this, v11);
}
while ( v10 >= (char *)v9 );
}
}
}
}
}
}
return result;
}