//
// cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas from 0x100155f80 to 0x1001561e8 (616 bytes)
//
// 5 xrefs:
// > cocos2d::CCSpriteBatchNode::removeChild @ 0x100155f57
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x100155fff
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x1001561cb
// > cocos2d::CCSprite::removeChild @ 0x100275031
// > cocos2d::CCSprite::removeAllChildrenWithCleanup @ 0x1002750de
//
// 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 12:25:04 +0000
//
void __fastcall cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(__int64 a1, __int64 a2)
{
__int64 v4; // rax
__int64 v5; // r14
unsigned int *v6; // rax
_QWORD *v7; // r14
unsigned __int64 v8; // r15
__int64 v9; // r12
signed int v10; // r15d
__int64 v11; // r13
__int64 v12; // rax
__int64 v13; // rcx
__int64 v14; // rsi
__int64 v15; // rdi
__int64 v16; // rdi
__int128 v17; // xmm0
__int128 v18; // xmm1
__int128 v19; // xmm2
__int64 v20; // rax
__int64 v21; // r14
unsigned int *v22; // rax
_QWORD *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 ( *(_BYTE *)(a2 + 559) )
{
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 488LL))(a2);
if ( v4 )
{
v5 = v4;
if ( (unsigned int)sub_1007FEF90(v4) )
{
v6 = *(unsigned int **)(v5 + 56);
if ( *v6 )
{
v7 = *((_QWORD **)v6 + 2);
v8 = (unsigned __int64)&v7[*v6 - 1];
do
{
if ( !*v7 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1);
++v7;
}
while ( (unsigned __int64)v7 <= v8 );
}
}
}
}
else
{
v9 = *(int *)(a2 + 40);
if ( v9 != -1 )
{
v10 = sub_1007FEF90(*(_QWORD *)(a1 + 344)) - 1;
if ( (unsigned int)v9 < v10 )
{
v11 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 344) + 56LL) + 16LL);
v12 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 328) + 112LL))(*(_QWORD *)(a1 + 328));
v13 = *(_QWORD *)(v11 + 8 * v9);
v14 = 96 * v9;
v30 = *(_OWORD *)(v12 + 96 * v9 + 80);
v29 = *(_OWORD *)(v12 + 96 * v9 + 64);
v28 = *(_OWORD *)(v12 + 96 * v9 + 48);
v27 = *(_OWORD *)(v12 + 96 * v9 + 32);
v26 = *(_OWORD *)(v12 + 96 * v9 + 16);
v25 = *(_OWORD *)(v12 + 96 * v9);
v15 = *(_QWORD *)(v11 + 8LL * v10);
*(_DWORD *)(v15 + 360) = v9;
*(_QWORD *)(v11 + 8 * v9) = 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;
*(_QWORD *)(v11 + 8LL * 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;
*(_DWORD *)(*(_QWORD *)(v11 + 8 * v9) + 40LL) = v9;
*(_DWORD *)(*(_QWORD *)(v11 + 8LL * v10) + 40LL) = v10;
}
cocos2d::CCTextureAtlas::removeQuadAtIndex(*(_QWORD *)(a1 + 328), (unsigned int)v10);
*(_BYTE *)(a1 + 288) = 1;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 1120LL))(a2, 0);
sub_100747310(
*(_QWORD *)(*(_QWORD *)(a1 + 344) + 56LL),
(unsigned int)(**(_DWORD **)(*(_QWORD *)(a1 + 344) + 56LL) - 1),
1);
v20 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 488LL))(a2);
if ( v20 )
{
v21 = v20;
if ( (unsigned int)sub_1007FEF90(v20) )
{
v22 = *(unsigned int **)(v21 + 56);
if ( *v22 )
{
v23 = *((_QWORD **)v22 + 2);
v24 = (unsigned __int64)&v23[*v22 - 1];
do
{
if ( !*v23 )
break;
cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas(a1);
++v23;
}
while ( (unsigned __int64)v23 <= v24 );
}
}
}
}
}
}