//
// cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas from 0x100176bd0 to 0x100176e38 (616 bytes)
//
// 5 xrefs:
// > cocos2d::CCSpriteBatchNode::removeChild @ 0x100176ba7
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x100176c4f
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x100176e1b
// > cocos2d::CCSprite::removeChild @ 0x100289ad1
// > cocos2d::CCSprite::removeAllChildrenWithCleanup @ 0x100289b7e
//
// 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; // rax
__int64 v5; // r14
unsigned int *v6; // rax
cocos2d::CCSprite **v7; // r14
unsigned __int64 v8; // r15
__int64 m_unknown2; // r12
signed int v10; // r15d
cocos2d::CCObject **arr; // r13
__int64 v12; // rax
cocos2d::CCObject *v13; // rcx
__int64 v14; // rsi
cocos2d::CCObject *v15; // rdi
__int64 v16; // rdi
__int128 v17; // xmm0
__int128 v18; // xmm1
__int128 v19; // xmm2
__int64 v20; // rax
__int64 v21; // r14
unsigned int *v22; // rax
cocos2d::CCSprite **v23; // r14
unsigned __int64 v24; // r15
__int128 v25; // [rsp+0h] [rbp-90h]
__int128 v26; // [rsp+10h] [rbp-80h]
__int128 v27; // [rsp+20h] [rbp-70h]
__int128 v28; // [rsp+30h] [rbp-60h]
__int128 v29; // [rsp+40h] [rbp-50h]
__int128 v30; // [rsp+50h] [rbp-40h]
if ( a2->m_bDontDraw )
{
v4 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getChildren)(a2);
if ( v4 )
{
v5 = v4;
if ( (unsigned int)sub_100720070(v4) )
{
v6 = *(unsigned int **)(v5 + 56);
if ( *v6 )
{
v7 = *((cocos2d::CCSprite ***)v6 + 2);
v8 = (unsigned __int64)&v7[*v6 - 1];
do
{
if ( !*v7 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1, *v7++);
}
while ( (unsigned __int64)v7 <= v8 );
}
}
}
}
else
{
m_unknown2 = a2->m_unknown2;
if ( m_unknown2 != -1 )
{
v10 = sub_100720070(a1->m_pobDescendants) - 1;
if ( (unsigned int)m_unknown2 < v10 )
{
arr = a1->m_pobDescendants->data->arr;
v12 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))a1->m_pobTextureAtlas->getQuads)(a1->m_pobTextureAtlas);
v13 = arr[m_unknown2];
v14 = 96 * m_unknown2;
v30 = *(_OWORD *)(v12 + 96 * m_unknown2 + 80);
v29 = *(_OWORD *)(v12 + 96 * m_unknown2 + 64);
v28 = *(_OWORD *)(v12 + 96 * m_unknown2 + 48);
v27 = *(_OWORD *)(v12 + 96 * m_unknown2 + 32);
v26 = *(_OWORD *)(v12 + 96 * m_unknown2 + 16);
v25 = *(_OWORD *)(v12 + 96 * m_unknown2);
v15 = arr[v10];
v15[6].m_uAutoReleaseCount = m_unknown2;
arr[m_unknown2] = v15;
v16 = 96LL * v10;
*(_OWORD *)(v12 + v14 + 80) = *(_OWORD *)(v12 + v16 + 80);
*(_OWORD *)(v12 + v14 + 64) = *(_OWORD *)(v12 + v16 + 64);
v17 = *(_OWORD *)(v12 + v16);
v18 = *(_OWORD *)(v12 + v16 + 16);
v19 = *(_OWORD *)(v12 + v16 + 32);
*(_OWORD *)(v12 + v14 + 48) = *(_OWORD *)(v12 + v16 + 48);
*(_OWORD *)(v12 + v14 + 32) = v19;
*(_OWORD *)(v12 + v14 + 16) = v18;
*(_OWORD *)(v12 + v14) = v17;
arr[v10] = v13;
*(_OWORD *)(v12 + v16 + 80) = v30;
*(_OWORD *)(v12 + v16 + 64) = v29;
*(_OWORD *)(v12 + v16 + 48) = v28;
*(_OWORD *)(v12 + v16 + 32) = v27;
*(_OWORD *)(v12 + v16 + 16) = v26;
*(_OWORD *)(v12 + v16) = v25;
arr[m_unknown2]->m_unknown2 = m_unknown2;
arr[v10]->m_unknown2 = v10;
}
cocos2d::CCTextureAtlas::removeQuadAtIndex(a1->m_pobTextureAtlas, v10);
a1->m_bReorderChildDirty = 1;
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a2->setBatchNode)(a2, 0);
sub_100667DE0(a1->m_pobDescendants->data, a1->m_pobDescendants->data->num - 1, 1);
v20 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getChildren)(a2);
if ( v20 )
{
v21 = v20;
if ( (unsigned int)sub_100720070(v20) )
{
v22 = *(unsigned int **)(v21 + 56);
if ( *v22 )
{
v23 = *((cocos2d::CCSprite ***)v22 + 2);
v24 = (unsigned __int64)&v23[*v22 - 1];
do
{
if ( !*v23 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1, *v23++);
}
while ( (unsigned __int64)v23 <= v24 );
}
}
}
}
}
}