//
// GJBaseGameLayer::claimCustomParticle from 0x100204de0 to 0x100205020 (576 bytes)
//
// 2 xrefs:
// > ??> @ 0x10078fe38
// > ??> @ 0x1007c0c50
//
// 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
//
cocos2d::CCParticleSystem *__fastcall GJBaseGameLayer::claimCustomParticle(
GJBaseGameLayer *a1,
__int64 a2,
__int64 a3,
int a4,
__int64 a5,
int a6,
__int64 a7)
{
cocos2d::CCParticleSystem *v7; // x22
__int64 v15; // x0
__int64 v16; // x26
bool v17; // zf
__int64 v18; // x0
cocos2d::CCNode *v19; // x23
__int64 v20; // x0
cocos2d::CCParticleSystem_vtbl *v21; // x8
__int64 v22; // x8
char v23; // w1
unsigned int m_uID; // [xsp+Ch] [xbp-44h] BYREF
if ( a1->m_particleCount > 99999 )
return nullptr;
v15 = cocos2d::CCDictionary::objectForKey_1(a1->m_customParticles, a2);
if ( !v15 )
{
v7 = (cocos2d::CCParticleSystem *)((__int64 (__fastcall *)(GJBaseGameLayer *, __int64, __int64, _QWORD, __int64))a1->createCustomParticle)(
a1,
a2,
a3,
0,
a7);
v16 = cocos2d::CCDictionary::objectForKey_1(a1->m_customParticles, a2);
if ( (a7 & 1) != 0 )
goto LABEL_12;
goto LABEL_11;
}
v16 = v15;
if ( (unsigned int)sub_10024A36C(v15) )
v17 = (_DWORD)a7 == 0;
else
v17 = 0;
if ( !v17 )
{
v7 = (cocos2d::CCParticleSystem *)((__int64 (__fastcall *)(GJBaseGameLayer *, __int64, __int64, _QWORD, __int64))a1->createCustomParticle)(
a1,
a2,
a3,
0,
a7);
if ( (a7 & 1) != 0 )
goto LABEL_12;
LABEL_11:
v7 = (cocos2d::CCParticleSystem *)sub_10024A398(v16);
v18 = cocos2d::CCDictionary::objectForKey_1(a1->m_claimedParticles, a2);
sub_10024A2D0(v18, v7);
sub_10024A430(v16, 1);
goto LABEL_12;
}
v7 = nullptr;
if ( (a7 & 1) == 0 )
goto LABEL_11;
LABEL_12:
if ( !v7 )
return v7;
v19 = GJBaseGameLayer::parentForZLayer(a1, a4, 0, 4, a6);
v20 = ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v7->getParent)(v7);
v21 = v7->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( (cocos2d::CCNode *)v20 != v19 )
{
if ( ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v21->getParent)(v7) )
((void (__fastcall *)(cocos2d::CCParticleSystem *, _QWORD))v7->removeFromParentAndCleanup)(v7, 0);
v22 = 448;
goto LABEL_21;
}
if ( ((unsigned int (__fastcall *)(cocos2d::CCParticleSystem *))v21->getZOrder)(v7) != (_DWORD)a5 )
{
v22 = 576;
LABEL_21:
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCParticleSystem *, __int64))((char *)&v19->copyWithZone + v22))(
v19,
v7,
a5);
}
m_uID = v7->m_uID;
sub_10001C1B0((unsigned __int64)&a1->m_customParticlesUIDs, (int *)&m_uID, &m_uID);
if ( (v23 & 1) != 0 )
sub_10024A2D0(a1->m_temporaryParticles, v7);
cocos2d::CCParticleSystem::resetSystem(v7);
((void (__fastcall *)(cocos2d::CCParticleSystem *, __int64))v7->setVisible)(v7, 1);
((void (__fastcall *)(cocos2d::CCParticleSystem *, __int64))v7->setAutoRemoveOnFinish)(v7, a7);
a1->m_particleCount += ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v7->getTotalParticles)(v7);
return v7;
}