//
// cocos2d::CCSpriteBatchNode::updateAtlasIndex from 0x1001d793c to 0x1001d7ae0 (420 bytes)
//
// 3 xrefs:
// > cocos2d::CCSpriteBatchNode::sortAllChildren @ 0x1001d7910
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x1001d79ac
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x1001d7a8c
//
// 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::updateAtlasIndex(
cocos2d::CCSpriteBatchNode *a1,
cocos2d::CCSprite *a2,
int *a3)
{
__int64 v6; // x0
__int64 v7; // x22
unsigned int *v8; // x9
__int64 v9; // x8
cocos2d::CCSprite **v10; // x23
unsigned __int64 v11; // x21
unsigned int v12; // w0
unsigned int v13; // w23
int v14; // w1
int v15; // w2
unsigned int *v16; // x9
__int64 v17; // x8
cocos2d::CCSprite **v18; // x24
unsigned __int64 v19; // x25
cocos2d::CCSprite *v20; // x22
int v21; // w1
int v22; // w2
int m_uAtlasIndex; // w1
int v24; // w2
v6 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a2->getChildren)(a2);
if ( !v6 || (v7 = v6, v8 = *(unsigned int **)(v6 + 56), v9 = *v8, !(_DWORD)v9) )
{
if ( a2->m_bDontDraw )
return;
LABEL_26:
m_uAtlasIndex = a2->m_uAtlasIndex;
v24 = *a3;
a2->m_uAtlasIndex = *a3;
if ( m_uAtlasIndex != v24 )
{
cocos2d::CCSpriteBatchNode::swap(a1, m_uAtlasIndex, v24);
m_uAtlasIndex = *a3;
}
*a3 = m_uAtlasIndex + 1;
return;
}
v10 = *((cocos2d::CCSprite ***)v8 + 2);
if ( a2->m_bDontDraw )
{
v11 = (unsigned __int64)&v10[v9 - 1];
do
{
if ( !*v10 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, *v10++, a3);
}
while ( (unsigned __int64)v10 <= v11 );
return;
}
v12 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))(*v10)->getZOrder)(*v10);
v13 = v12 >> 31;
if ( (v12 & 0x80000000) == 0 )
{
v14 = a2->m_uAtlasIndex;
v15 = *a3;
a2->m_uAtlasIndex = *a3;
if ( v14 != v15 )
{
cocos2d::CCSpriteBatchNode::swap(a1, v14, v15);
v14 = *a3;
}
*a3 = v14 + 1;
}
v16 = *(unsigned int **)(v7 + 56);
v17 = *v16;
if ( (_DWORD)v17 )
{
v18 = *((cocos2d::CCSprite ***)v16 + 2);
v19 = (unsigned __int64)&v18[v17 - 1];
do
{
v20 = *v18;
if ( !*v18 )
break;
if ( (v13 & 1) != 0 )
{
if ( (((__int64 (__fastcall *)(cocos2d::CCSprite *))v20->getZOrder)(*v18) & 0x80000000) != 0 )
{
LOBYTE(v13) = 1;
}
else
{
v21 = a2->m_uAtlasIndex;
v22 = *a3;
a2->m_uAtlasIndex = *a3;
if ( v21 != v22 )
{
cocos2d::CCSpriteBatchNode::swap(a1, v21, v22);
v21 = *a3;
}
LOBYTE(v13) = 0;
*a3 = v21 + 1;
}
}
else
{
LOBYTE(v13) = 0;
}
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, v20, a3);
++v18;
}
while ( (unsigned __int64)v18 <= v19 );
}
if ( (v13 & 1) != 0 )
goto LABEL_26;
}