//
// cocos2d::CCSpriteBatchNode::sortAllChildren from 0x18008f080 to 0x18008f18c (268 bytes)
//
// 7 xrefs:
// > ??> @ 0x1800ec4c0
// > ??> @ 0x180103ec0
// > ??> @ 0x180105c28
// > ??> @ 0x18013d8e8
// > ??> @ 0x18013d8f8
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b6114
//
// 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::sortAllChildren(cocos2d::CCSpriteBatchNode *this)
{
cocos2d::CCArray *m_pChildren; // rax
cocos2d::ccArray *data; // rdi
__int64 num; // rax
cocos2d::CCObject **arr; // rdi
cocos2d::CCObject **i; // rsi
cocos2d::CCArray *v7; // rax
cocos2d::ccArray *v8; // rdi
__int64 v9; // rax
struct cocos2d::CCSprite **v10; // rdi
struct cocos2d::CCSprite **j; // rsi
int v12; // [rsp+30h] [rbp+8h] BYREF
if ( this->m_bReorderChildDirty && (!this->m_bManualSortChildren || this->m_bManualSortAllChildrenDirty) )
{
if ( this->m_bUseChildIndex )
cocos2d::CCNode::sortAllChildrenWithIndex(this);
else
cocos2d::CCNode::sortAllChildrenNoIndex(this);
if ( (unsigned int)cocos2d::CCArray::count(this->m_pChildren) )
{
m_pChildren = this->m_pChildren;
if ( m_pChildren )
{
data = m_pChildren->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
if ( !*arr )
break;
((void (__fastcall *)(cocos2d::CCObject *))(*arr)->__vftable[8].copyWithZone)(*arr);
}
}
}
v7 = this->m_pChildren;
v12 = 0;
if ( v7 )
{
v8 = v7->data;
v9 = v8->num;
if ( (_DWORD)v9 )
{
v10 = (struct cocos2d::CCSprite **)v8->arr;
for ( j = &v10[v9 - 1]; v10 <= j; ++v10 )
{
if ( !*v10 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(this, *v10, &v12);
}
}
}
}
this->m_bReorderChildDirty = 0;
this->m_bManualSortAllChildrenDirty = 0;
}
}