//
// cocos2d::CCSpriteBatchNode::appendChild from 0x5e8198 to 0x5e8298 (256 bytes)
//
// 3 xrefs:
// > cocos2d::CCSprite::addChild @ 0x5e7444
// > cocos2d::CCSpriteBatchNode::appendChild @ 0x5e8280
// > cocos2d::CCSpriteBatchNode::addChild @ 0x5e862a
//
// 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 cocos2d::CCSpriteBatchNode::appendChild(cocos2d::CCSpriteBatchNode *a1, cocos2d::CCSprite *a2)
{
unsigned int v4; // r7
cocos2d::CCObject *v5; // r2
cocos2d *data; // r7
unsigned int v7; // r7
cocos2d::ccV3F_C4B_T2F_Quad *v8; // r0
cocos2d::CCObject **arr; // r7
cocos2d::CCObject **v10; // r8
cocos2d::CCObject **v11; // r4
cocos2d::CCSprite *v12; // r1
cocos2d::CCSprite *v13; // t1
_BYTE v14[96]; // [sp+4h] [bp-64h] BYREF
a1->m_bReorderChildDirty = 1;
a2->setBatchNode(a2, a1);
a2->setDirty(a2, 1);
if ( !a2->m_bDontDraw )
{
v4 = a1->m_pobTextureAtlas->getTotalQuads(a1->m_pobTextureAtlas);
if ( v4 == a1->m_pobTextureAtlas->getCapacity(a1->m_pobTextureAtlas) )
cocos2d::CCSpriteBatchNode::increaseAtlasCapacity(a1);
data = (cocos2d *)a1->m_pobDescendants->data;
cocos2d::ccArrayAppendObjectWithResizeBatch(data, (cocos2d::_ccArray *)a2, v5);
v7 = *(_DWORD *)data - 1;
a2->m_uAtlasIndex = v7;
v8 = (cocos2d::ccV3F_C4B_T2F_Quad *)memcpy(v14, &a2->m_sQuad, sizeof(v14));
cocos2d::CCTextureAtlas::insertQuad(a1->m_pobTextureAtlas, v8, v7);
}
if ( a2->getChildren(a2) && a2->getChildren(a2)->data->num )
{
arr = a2->getChildren(a2)->data->arr;
v10 = a2->getChildren(a2)->data->arr;
v11 = &v10[a2->getChildren(a2)->data->num] + 0x3FFFFFFF;
while ( arr <= v11 )
{
v13 = (cocos2d::CCSprite *)*arr++;
v12 = v13;
if ( !v13 )
break;
cocos2d::CCSpriteBatchNode::appendChild(a1, v12);
}
}
}