//
// cocos2d::CCSpriteBatchNode::appendChild from 0xb17e2c to 0xb18008 (476 bytes)
//
// 4 xrefs:
// > cocos2d::CCSprite::addChild @ 0xb16694
// > cocos2d::CCSpriteBatchNode::appendChild @ 0xb17f4c
// > cocos2d::CCSpriteBatchNode::addChild @ 0xb1868c
// > ??> @ 0x9bbf8
//
// 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)
{
cocos2d::CCSprite_vtbl *v4; // x2
cocos2d::CCObject **arr; // x21
cocos2d::ccArray *v6; // x2
cocos2d::CCSprite_vtbl *v7; // x1
cocos2d::CCSprite *v8; // x0
cocos2d::CCObject **v9; // x22
unsigned __int64 v10; // x22
cocos2d::CCSprite *v11; // x1
unsigned int v12; // w21
cocos2d::CCObject *v13; // x2
cocos2d *data; // x21
cocos2d::CCTextureAtlas *m_pobTextureAtlas; // x0
unsigned int v16; // w2
__int64 v17; // x11
cocos2d::ccTex2F texCoords; // x8
__int64 v19; // x9
__int64 v20; // x6
cocos2d::ccTex2F v21; // x7
__int64 v22; // x4
__int64 v23; // x5
cocos2d::ccTex2F v24; // x12
__int64 v25; // x13
__int64 v26; // x14
cocos2d::ccTex2F v27; // x15
cocos2d::ccV3F_C4B_T2F_Quad v28; // [xsp+38h] [xbp+38h] BYREF
v4 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_bReorderChildDirty = 1;
v4->setBatchNode(a2, a1);
a2->setDirty(a2, 1);
if ( !a2->m_bDontDraw )
{
v12 = a1->m_pobTextureAtlas->getTotalQuads(a1->m_pobTextureAtlas);
if ( v12 == a1->m_pobTextureAtlas->getCapacity(a1->m_pobTextureAtlas) )
cocos2d::CCSpriteBatchNode::increaseAtlasCapacity(a1);
data = (cocos2d *)a1->m_pobDescendants->data;
cocos2d::ccArrayAppendObjectWithResizeBatch(data, (cocos2d::_ccArray *)a2, v13);
m_pobTextureAtlas = a1->m_pobTextureAtlas;
v16 = *(_DWORD *)data - 1;
a2->m_uAtlasIndex = v16;
v17 = *(_QWORD *)&a2->m_sQuad.tl.vertices.z;
texCoords = a2->m_sQuad.tl.texCoords;
v19 = *(_QWORD *)&a2->m_sQuad.bl.vertices.x;
v20 = *(_QWORD *)&a2->m_sQuad.bl.vertices.z;
v21 = a2->m_sQuad.bl.texCoords;
v22 = *(_QWORD *)&a2->m_sQuad.tr.vertices.x;
v23 = *(_QWORD *)&a2->m_sQuad.tr.vertices.z;
v24 = a2->m_sQuad.tr.texCoords;
v25 = *(_QWORD *)&a2->m_sQuad.br.vertices.x;
v26 = *(_QWORD *)&a2->m_sQuad.br.vertices.z;
v27 = a2->m_sQuad.br.texCoords;
*(_QWORD *)&v28.tl.vertices.x = *(_QWORD *)&a2->m_sQuad.tl.vertices.x;
*(_QWORD *)&v28.tl.vertices.z = v17;
v28.tl.texCoords = texCoords;
*(_QWORD *)&v28.bl.vertices.x = v19;
*(_QWORD *)&v28.bl.vertices.z = v20;
v28.bl.texCoords = v21;
*(_QWORD *)&v28.tr.vertices.x = v22;
*(_QWORD *)&v28.tr.vertices.z = v23;
v28.tr.texCoords = v24;
*(_QWORD *)&v28.br.vertices.x = v25;
*(_QWORD *)&v28.br.vertices.z = v26;
v28.br.texCoords = v27;
cocos2d::CCTextureAtlas::insertQuad(m_pobTextureAtlas, &v28, v16);
}
if ( a2->getChildren(a2) )
{
if ( a2->getChildren(a2)->data->num )
{
arr = a2->getChildren(a2)->data->arr;
v6 = a2->getChildren(a2)->data;
v7 = a2->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v8 = a2;
v9 = v6->arr;
v10 = (unsigned __int64)&v9[v7->getChildren(v8)->data->num - 1];
while ( v10 >= (unsigned __int64)arr )
{
v11 = (cocos2d::CCSprite *)*arr;
if ( !*arr )
break;
++arr;
cocos2d::CCSpriteBatchNode::appendChild(a1, v11);
}
}
}
}