//
// cocos2d::CCParticleSystem::initWithTotalParticles from 0xafd48c to 0xafd564 (216 bytes)
//
// 3 xrefs:
// > cocos2d::CCParticleSystemQuad::initWithTotalParticles @ 0xb03908
// > ??> @ 0x6a290
// > ??> @ 0x1216dc8
//
// 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
//
bool cocos2d::CCParticleSystem::initWithTotalParticles(cocos2d::CCParticleSystem *a1, unsigned int a2, bool a3)
{
cocos2d::tCCParticle *m_pParticles; // x0
_BOOL4 v6; // w22
unsigned int m_uTotalParticles; // w20
cocos2d::tCCParticle *v8; // x0
cocos2d::CCParticleBatchNode *m_pBatchNode; // x1
cocos2d::sCCParticle::$D631DC10D9180B16F31D0A61BBB718E6 *p_modeA; // x0
float v11; // w1
bool v12; // w20
m_pParticles = a1->m_pParticles;
v6 = a3;
a1->m_uTotalParticles = a2;
if ( m_pParticles )
{
free(m_pParticles);
m_uTotalParticles = a1->m_uTotalParticles;
}
else
{
m_uTotalParticles = a2;
}
v8 = (cocos2d::tCCParticle *)calloc(m_uTotalParticles, 0x94u);
a1->m_pParticles = v8;
if ( v8 )
{
m_pBatchNode = a1->m_pBatchNode;
a1->m_uAllocatedParticles = a2;
if ( m_pBatchNode && m_uTotalParticles )
{
p_modeA = &v8->modeA;
v11 = 0.0;
do
{
p_modeA->dir.x = v11;
p_modeA = (cocos2d::sCCParticle::$D631DC10D9180B16F31D0A61BBB718E6 *)((char *)p_modeA + 148);
++LODWORD(v11);
}
while ( LODWORD(v11) != m_uTotalParticles );
}
a1->m_tBlendFunc.src = 1;
v12 = 1;
a1->m_bIsActive = 1;
a1->m_ePositionType = kCCPositionTypeFree;
a1->m_tBlendFunc.dst = 771;
a1->m_nEmitterMode = 0;
a1->m_bIsAutoRemoveOnFinish = 0;
a1->m_bTransformSystemDirty = 0;
if ( !v6 )
{
cocos2d::CCNode::scheduleUpdateWithPriority(a1, 1);
a1->m_bUsingSchedule = 1;
}
}
else
{
v12 = 0;
cocos2d::CCObject::release(a1);
}
return v12;
}