//
// cocos2d::CCParticleBatchNode::insertChild from 0x1800617d0 to 0x180061910 (320 bytes)
//
// 3 xrefs:
// > cocos2d::CCParticleBatchNode::addChild @ 0x1800611ec
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3660
//
// 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::CCParticleBatchNode::insertChild(
cocos2d::CCParticleBatchNode *this,
struct cocos2d::CCParticleSystem *a2,
unsigned int a3)
{
int v6; // edi
unsigned int v7; // edi
int v8; // ebx
int v9; // eax
cocos2d::CCParticleSystem_vtbl *v10; // rbx
int v11; // edi
int v12; // eax
int v13; // ebx
int v14; // eax
unsigned int v15; // eax
a2->m_uAtlasIndex = a3;
v6 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getTotalQuads)(this->m_pTextureAtlas);
v7 = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2) + v6;
if ( v7 > ((unsigned int (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getCapacity)(this->m_pTextureAtlas) )
{
v8 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getTotalQuads)(this->m_pTextureAtlas);
v9 = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2);
cocos2d::CCTextureAtlas::resizeCapacity(this->m_pTextureAtlas, v8 + v9);
v10 = a2->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v11 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getCapacity)(this->m_pTextureAtlas);
LODWORD(v10) = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))v10->getTotalParticles)(a2);
v12 = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2);
cocos2d::CCTextureAtlas::fillWithEmptyQuadsFromIndex(this->m_pTextureAtlas, v11 - v12, (unsigned int)v10);
}
v13 = ((__int64 (__fastcall *)(cocos2d::CCTextureAtlas *))this->m_pTextureAtlas->getTotalQuads)(this->m_pTextureAtlas);
if ( a2->m_uAtlasIndex + ((unsigned int (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2) != v13 )
{
v14 = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2);
cocos2d::CCTextureAtlas::moveQuadsFromIndex(this->m_pTextureAtlas, a3, a3 + v14);
}
v15 = ((__int64 (__fastcall *)(struct cocos2d::CCParticleSystem *))a2->getTotalParticles)(a2);
cocos2d::CCTextureAtlas::increaseTotalQuadsWith(this->m_pTextureAtlas, v15);
cocos2d::CCParticleBatchNode::updateAllAtlasIndexes(this);
}