//
// cocos2d::CCParticleSystem::initWithTotalParticles from 0x1008b0220 to 0x1008b0389 (361 bytes)
//
// 2 xrefs:
// > cocos2d::CCParticleSystemQuad::initWithTotalParticles @ 0x1006d9a79
// > ??> @ 0x100bacc90
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:37:20 +0000
//
bool __fastcall cocos2d::CCParticleSystem::initWithTotalParticles(__int64 a1, unsigned int a2, char a3)
{
void *v5; // rdi
unsigned int v6; // eax
unsigned int v7; // r12d
char *v8; // rax
char *v9; // r15
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // r12
_DWORD *v13; // rdx
__int64 v14; // rdx
__int64 v15; // rcx
__int64 v16; // rsi
*(_DWORD *)(a1 + 660) = a2;
v5 = *(void **)(a1 + 416);
v6 = a2;
if ( v5 )
{
free(v5);
v6 = *(_DWORD *)(a1 + 660);
}
v7 = v6;
v8 = (char *)calloc(v6, 0x94u);
v9 = v8;
*(_QWORD *)(a1 + 416) = v8;
if ( v8 )
{
*(_DWORD *)(a1 + 448) = a2;
if ( *(_QWORD *)(a1 + 432) && v7 )
{
v10 = v7 & 3;
if ( v7 >= 4 )
{
v12 = v7 & 0xFFFFFFFC;
v13 = v8 + 516;
v11 = 0;
do
{
*(v13 - 111) = v11;
*(v13 - 74) = v11 + 1;
*(v13 - 37) = v11 + 2;
*v13 = v11 + 3;
v11 += 4;
v13 += 148;
}
while ( v11 != v12 );
}
else
{
v11 = 0;
}
if ( v10 )
{
v14 = (__int64)&v9[148 * v11 + 72];
v15 = 148 * v10;
v16 = 0;
do
{
*(_DWORD *)(v14 + v16) = v11;
LODWORD(v11) = v11 + 1;
v16 += 148;
}
while ( v15 != v16 );
}
}
*(_BYTE *)(a1 + 452) = 1;
*(_QWORD *)(a1 + 672) = 0x30300000001LL;
*(_DWORD *)(a1 + 684) = 0;
*(_DWORD *)(a1 + 692) = 0;
*(_BYTE *)(a1 + 688) = 0;
*(_BYTE *)(a1 + 444) = 0;
if ( !a3 )
{
cocos2d::CCNode::scheduleUpdateWithPriority(a1, 1u);
*(_BYTE *)(a1 + 557) = 1;
}
}
else
{
cocos2d::CCObject::release((_DWORD *)a1);
}
return v9 != nullptr;
}