//
// GJBaseGameLayer::updateParticles from 0x140241340 to 0x1402415c0 (640 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::updateVisibility @ 0x1402d9dcb
// > PlayLayer::updateVisibility @ 0x1403b023d
// > ??> @ 0x1406ce430
//
// 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
//
// Hidden C++ exception states: #wind=1
void GJBaseGameLayer::updateParticles(GJBaseGameLayer *a1, float a2)
{
unsigned int v3; // esi
struct cocos2d::CCObject *v4; // rax
struct cocos2d::CCObject *v5; // rdi
int v6; // eax
unsigned int v7; // ebp
struct cocos2d::CCObject *v8; // r15
__int64 v9; // rdx
__int64 v10; // rcx
_QWORD *v11; // rsi
__int64 v12; // r8
__int64 v13; // r9
__int128 *v14; // r14
unsigned __int64 v15; // rsi
unsigned __int64 v16; // rdi
cocos2d::CCArray *v17; // rax
void *v18; // rcx
unsigned int m_uID; // [rsp+20h] [rbp-88h] BYREF
_BYTE v20[16]; // [rsp+28h] [rbp-80h] BYREF
__int128 v21; // [rsp+38h] [rbp-70h] BYREF
unsigned __int64 v22; // [rsp+48h] [rbp-60h]
unsigned __int64 v23; // [rsp+50h] [rbp-58h]
a1->m_particleCount = 0;
v3 = 0;
while ( v3 < cocos2d::CCArray::count(a1->m_temporaryParticles) )
{
v4 = cocos2d::CCArray::objectAtIndex(a1->m_temporaryParticles, v3);
v5 = v4;
if ( HIBYTE(v4[9].m_unknown5) )
{
m_uID = v4->m_uID;
sub_14005D780(&a1->m_customParticlesUIDs._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&m_uID);
cocos2d::CCArray::fastRemoveObjectAtIndex(a1->m_temporaryParticles, v3);
}
else
{
((void (__fastcall *)(struct cocos2d::CCObject *))v4->__vftable[20].update)(v4);
a1->m_particleCount += v6;
((void (__fastcall *)(struct cocos2d::CCObject *))v5->update)(v5);
++v3;
}
}
v7 = 0;
while ( v7 < cocos2d::CCArray::count(a1->m_unclaimedParticles) )
{
v8 = cocos2d::CCArray::objectAtIndex(a1->m_unclaimedParticles, v7);
if ( ((unsigned int (__fastcall *)(struct cocos2d::CCObject *))v8->__vftable[12].acceptVisitor)(v8) )
{
++v7;
}
else
{
v11 = *(_QWORD **)sub_1400608D0(
(__int64)&a1->m_particleCountToParticleString,
(__int64)v20,
(unsigned __int8 *)&v8[14].__vftable + 4);
v21 = 0;
v22 = 0;
v23 = 0;
v14 = (__int128 *)(v11 + 3);
if ( v11[6] > 0xFu )
v14 = (__int128 *)v11[3];
v15 = v11[5];
if ( v15 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v10, v9, v12, v13);
v23 = 15;
if ( v15 > 0xF )
{
v16 = v15 | 0xF;
if ( (v15 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v16 < 0x16 )
v16 = 22;
}
else
{
v16 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v21 = sub_14003AA10(v16 + 1);
v22 = v15;
v23 = v16;
memcpy((void *)v21, v14, v15 + 1);
}
else
{
v22 = v15;
v21 = *v14;
}
v17 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_customParticles, &v21);
if ( v17 )
cocos2d::CCArray::addObject(v17, v8);
cocos2d::CCArray::fastRemoveObjectAtIndex(a1->m_unclaimedParticles, v7);
if ( v23 > 0xF )
{
v18 = (void *)v21;
if ( v23 + 1 >= 0x1000 )
{
v18 = *(void **)(v21 - 8);
if ( (unsigned __int64)(v21 - (_QWORD)v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v18);
}
}
}
}