//
// GJBaseGameLayer::updateParticles from 0x5b14a0 to 0x5b16a6 (518 bytes)
//
// 2 xrefs:
// > PlayLayer::updateVisibility @ 0x4071c2
// > LevelEditorLayer::updateVisibility @ 0x462f26
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:53:32 +0000
//
unsigned int __fastcall GJBaseGameLayer::updateParticles(GJBaseGameLayer *this, float a2)
{
_DWORD *v2; // r8
unsigned int v4; // r5
double v6; // d9
cocos2d::CCArray **v7; // r7
float v8; // s20
float v9; // s20
char v10; // r2
int v11; // r0
cocos2d::CCParticleSystem *v12; // r6
int v13; // r11
double v14; // d7
float v15; // s16
int v16; // r0
_BOOL4 v17; // r11
float v18; // s17
float v19; // s14
int v20; // r3
cocos2d::CCArray **v21; // r7
unsigned int v22; // r5
int v23; // s15
bool v24; // fzf
bool v25; // fnf
unsigned int result; // r0
unsigned int *v27; // r10
_DWORD *v28; // r0
cocos2d::CCArray *v29; // r0
unsigned int v30; // [sp+Ch] [bp-18h] BYREF
int v31[3]; // [sp+10h] [bp-14h] BYREF
v2 = (_DWORD *)((char *)this + 10624);
v4 = 0;
*((_DWORD *)this + 2656) = 0;
v6 = 0.0;
v7 = (cocos2d::CCArray **)((char *)this + 10680);
v8 = COERCE_FLOAT((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 68))(*((_DWORD *)this + 609)));
v9 = fabsf(v8 * (*(float (__fastcall **)(_DWORD))(**((_DWORD **)this + 609) + 76))(*((_DWORD *)this + 609)));
while ( v4 < cocos2d::CCArray::count(*v7) )
{
v11 = cocos2d::CCArray::objectAtIndex(*v7, v4);
v12 = (cocos2d::CCParticleSystem *)v11;
if ( *(_BYTE *)(v11 + 476) )
{
v30 = *(_DWORD *)(v11 + 4);
std::__hash_table,std::equal_to,std::allocator>::__erase_unique(
(int *)this + 2671,
&v30);
cocos2d::CCArray::fastRemoveObjectAtIndex(*v7, v4);
}
else
{
*v2 += (*(int (__fastcall **)(int))(*(_DWORD *)v11 + 748))(v11);
(*(void (__fastcall **)(cocos2d::CCParticleSystem *, _DWORD))(*(_DWORD *)v12 + 20))(v12, LODWORD(a2));
v13 = *((_DWORD *)this + 2813);
if ( !*((_BYTE *)v12 + 742) )
goto LABEL_6;
v15 = COERCE_FLOAT(cocos2d::CCParticleSystem::getParticleDrawCost(v12));
if ( v15 <= 0.0 )
goto LABEL_6;
v16 = (*(int (__fastcall **)(cocos2d::CCParticleSystem *))(*(_DWORD *)v12 + 256))(v12);
v17 = v16 && v13 == (*(int (__fastcall **)(int))(*(_DWORD *)v16 + 256))(v16);
v18 = COERCE_FLOAT((*(int (__fastcall **)(cocos2d::CCParticleSystem *))(*(_DWORD *)v12 + 68))(v12));
v19 = fabsf(v18 * (*(float (__fastcall **)(cocos2d::CCParticleSystem *))(*(_DWORD *)v12 + 76))(v12));
if ( !v17 )
v19 = v19 * v9;
v14 = v15 * v19;
if ( v14 <= 0.0 )
LABEL_6:
v14 = 0.0;
v6 = v6 + v14;
++v4;
}
}
v20 = 10628;
v21 = (cocos2d::CCArray **)((char *)this + 10652);
v22 = 0;
v23 = 1105199103;
if ( v6 > 20000000.0 )
v10 = 1;
v24 = v6 == 2147483650.0;
v25 = v6 < 2147483650.0;
if ( v6 <= 20000000.0 )
v10 = 0;
*((_BYTE *)this + 10628) = v10;
if ( v25 || v24 )
v23 = (int)v6;
else
v20 = 0x7FFFFFFF;
if ( v25 || v24 )
v20 = v23;
*((_DWORD *)this + 2658) = v20;
while ( 1 )
{
result = cocos2d::CCArray::count(*v21);
if ( v22 >= result )
break;
v27 = (unsigned int *)cocos2d::CCArray::objectAtIndex(*v21, v22);
if ( (*(int (__fastcall **)(unsigned int *))(*v27 + 456))(v27) )
{
++v22;
}
else
{
v28 = std::unordered_map::operator[]((int)this + 10656, v27 + 174);
std::string::basic_string(v31, (int)v28);
v29 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*((_DWORD *)this + 2662), v31);
if ( v29 )
cocos2d::CCArray::addObject(v29, (cocos2d::CCObject *)v27);
cocos2d::CCArray::fastRemoveObjectAtIndex(*v21, v22);
std::string::~string((int)v31);
}
}
return result;
}