//
// cocos2d::CCParticleSystemQuad::setTotalParticles from 0xb035fc to 0xb03780 (388 bytes)
//
// 13 xrefs:
// > ??> @ 0x898f8
// > ??> @ 0x1212390
// > ??> @ 0x1212a40
// > ??> @ 0x12130f0
// > ??> @ 0x12137a0
// > ??> @ 0x1213e50
// > ??> @ 0x1214500
// > ??> @ 0x1214bb0
// > ??> @ 0x1215260
// > ??> @ 0x1215910
// > ??> @ 0x1215fc0
// > ??> @ 0x1216670
// > ??> @ 0x1217830
//
// 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::CCParticleSystemQuad::setTotalParticles(cocos2d::CCParticleSystemQuad *a1, unsigned int a2)
{
size_t v4; // x23
size_t v5; // x22
size_t v6; // x21
cocos2d::tCCParticle *v7; // x24
cocos2d::ccV3F_C4B_T2F_Quad *v8; // x25
GLushort *v9; // x3
cocos2d::CCParticleBatchNode *m_pBatchNode; // x0
float v11; // w0
cocos2d::sCCParticle::$D631DC10D9180B16F31D0A61BBB718E6 *p_modeA; // x1
if ( a1->m_uAllocatedParticles >= a2 )
{
a1->m_uTotalParticles = a2;
cocos2d::CCParticleSystem::resetSystem(a1);
return;
}
v4 = 148LL * a2;
v5 = 96LL * a2;
v6 = 12LL * a2;
v7 = (cocos2d::tCCParticle *)realloc(a1->m_pParticles, v4);
v8 = (cocos2d::ccV3F_C4B_T2F_Quad *)realloc(a1->m_pQuads, v5);
v9 = (GLushort *)realloc(a1->m_pIndices, v6);
if ( v8 )
{
if ( !v7 )
goto LABEL_14;
if ( v9 )
{
a1->m_pIndices = v9;
a1->m_pParticles = v7;
a1->m_pQuads = v8;
memset(v7, 0, v4);
memset(a1->m_pQuads, 0, v5);
memset(a1->m_pIndices, 0, v6);
a1->m_uAllocatedParticles = a2;
m_pBatchNode = a1->m_pBatchNode;
a1->m_uTotalParticles = a2;
if ( m_pBatchNode && a2 )
{
v11 = 0.0;
p_modeA = &a1->m_pParticles->cocos2d::CCParticleSystem::modeA;
do
{
p_modeA->dir.x = v11;
p_modeA = (cocos2d::sCCParticle::$D631DC10D9180B16F31D0A61BBB718E6 *)((char *)p_modeA + 148);
++LODWORD(v11);
}
while ( LODWORD(v11) != a2 );
}
cocos2d::CCParticleSystemQuad::initIndices(a1);
cocos2d::CCParticleSystemQuad::setupVBO(a1);
cocos2d::CCParticleSystemQuad::updateTexCoords(a1);
cocos2d::CCParticleSystem::resetSystem(a1);
return;
}
LABEL_13:
a1->m_pParticles = v7;
LABEL_14:
if ( v8 )
a1->m_pQuads = v8;
goto LABEL_16;
}
if ( v7 )
goto LABEL_13;
LABEL_16:
if ( v9 )
a1->m_pIndices = v9;
}