//
// GJBaseGameLayer::claimCustomParticle from 0x10015e120 to 0x10015e316 (502 bytes)
//
// 2 xrefs:
// > ??> @ 0x1008b73f8
// > ??> @ 0x1008c1978
//
// 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(
__int64 a1,
__int64 a2,
__int64 a3,
int a4,
unsigned int a5,
int a6,
__m128 a7,
unsigned __int8 a8)
{
__int64 v9; // rax
__int64 v10; // r12
cocos2d::CCParticleSystem *v11; // r14
__int64 v12; // rax
cocos2d::CCNode *v13; // r15
__int64 v14; // rax
cocos2d::CCParticleSystem_vtbl *v15; // rcx
__int64 v16; // r12
__int64 v17; // rdx
int v18; // eax
char v19; // dl
unsigned int m_uID; // [rsp+8h] [rbp-38h] BYREF
int v22; // [rsp+Ch] [rbp-34h]
int v23; // [rsp+10h] [rbp-30h]
unsigned int v24; // [rsp+14h] [rbp-2Ch]
if ( *(int *)(a1 + 12104) > 99999 )
return nullptr;
v23 = a4;
v22 = a6;
v24 = a5;
v9 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 12128), a2);
if ( !v9 )
{
v11 = (cocos2d::CCParticleSystem *)(*(__int64 (__fastcall **)(__int64, __int64, __int64, _QWORD, _QWORD))(*(_QWORD *)a1 + 1440LL))(
a1,
a2,
a3,
0,
a8);
v10 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 12128), a2);
if ( a8 )
goto LABEL_8;
goto LABEL_7;
}
v10 = v9;
if ( ((a8 ^ 1) & ((unsigned int)sub_100720070(v9) != 0)) == 0 )
{
v11 = (cocos2d::CCParticleSystem *)(*(__int64 (__fastcall **)(__int64, __int64, __int64, _QWORD, _QWORD))(*(_QWORD *)a1 + 1440LL))(
a1,
a2,
a3,
0,
a8);
if ( a8 )
goto LABEL_8;
LABEL_7:
v11 = (cocos2d::CCParticleSystem *)sub_1007200E0(v10);
v12 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 12184), a2);
sub_10071FCD0(v12, v11);
sub_100720200(v10, 1);
goto LABEL_8;
}
v11 = nullptr;
if ( !a8 )
goto LABEL_7;
LABEL_8:
if ( !v11 )
return nullptr;
v13 = GJBaseGameLayer::parentForZLayer((GJBaseGameLayer *)a1, v23, 0, 4, v22);
v14 = ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v11->getParent)(v11);
v15 = v11->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( (cocos2d::CCNode *)v14 != v13 )
{
v16 = 448;
if ( ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v15->getParent)(v11) )
((void (__fastcall *)(cocos2d::CCParticleSystem *, _QWORD))v11->removeFromParentAndCleanup)(v11, 0);
v17 = v24;
goto LABEL_17;
}
v18 = ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v15->getZOrder)(v11);
v16 = 576;
v17 = v24;
if ( v18 != v24 )
LABEL_17:
*(double *)a7.i64 = (*(double (__fastcall **)(cocos2d::CCNode *, cocos2d::CCParticleSystem *, __int64))((char *)&v13->copyWithZone + v16))(
v13,
v11,
v17);
m_uID = v11->m_uID;
sub_100056510((float *)(a1 + 12200), (int *)&m_uID, &m_uID, a7);
if ( (v19 & 1) != 0 )
sub_10071FCD0(*(_QWORD *)(a1 + 12192), v11);
cocos2d::CCParticleSystem::resetSystem(v11);
((void (__fastcall *)(cocos2d::CCParticleSystem *, __int64))v11->setVisible)(v11, 1);
((void (__fastcall *)(cocos2d::CCParticleSystem *, _QWORD))v11->setAutoRemoveOnFinish)(v11, a8);
*(_DWORD *)(a1 + 12104) += ((__int64 (__fastcall *)(cocos2d::CCParticleSystem *))v11->getTotalParticles)(v11);
return v11;
}