//
// GJBaseGameLayer::claimParticle from 0x477ec4 to 0x477fe6 (290 bytes)
//
// 2 xrefs:
// > GameObject::claimParticle @ 0x355ee0
// > GameObject::claimParticle @ 0x355f00
//
// 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::CCObject *__fastcall GJBaseGameLayer::claimParticle(int a1, char **a2)
{
cocos2d::CCDictionary *v3; // r4
cocos2d::CCArray *v4; // r8
cocos2d::CCObject *Object; // r0
cocos2d::CCDictionary *v6; // r11
cocos2d::CCObject *v7; // r4
cocos2d::CCArray *v8; // r10
int v9; // r5
int v10; // r3
void (__fastcall *v11)(int, cocos2d::CCObject *, int); // r7
int v12; // r0
const char *v14; // [sp+4h] [bp+0h] BYREF
std::string v15; // [sp+8h] [bp+4h] BYREF
v3 = *(cocos2d::CCDictionary **)(a1 + 10792);
sub_776584((int)&v15, *a2);
v4 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v3, &v15);
sub_774008(&v15);
if ( !v4 || !cocos2d::CCArray::count(v4) )
return nullptr;
Object = (cocos2d::CCObject *)cocos2d::CCArray::lastObject(v4);
v6 = *(cocos2d::CCDictionary **)(a1 + 10792);
v7 = Object;
sub_775C20(&v14);
GJBaseGameLayer::getParticleKey2((int)&v15, a1, &v14);
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v6, &v15);
sub_774008(&v15);
sub_774008(&v14);
cocos2d::CCArray::addObject(v8, v7);
cocos2d::CCArray::removeLastObject(v4, 1);
if ( !((int (__fastcall *)(cocos2d::CCObject *))v7->__vftable[6].~CCObject_0)(v7) )
{
v9 = *(_DWORD *)(a1 + 2544);
v10 = *(_DWORD *)(a1 + 10876);
if ( v10 && *(_BYTE *)(v10 + 958) && (unsigned int)(*(_DWORD *)(v10 + 948) - 2) <= 5 )
v9 = *(_DWORD *)(a1 + 2548);
v11 = *(void (__fastcall **)(int, cocos2d::CCObject *, int))(*(_DWORD *)v9 + 224);
v12 = v7->getTag(v7);
v11(v9, v7, v12);
}
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 10836), v7);
((void (__fastcall *)(cocos2d::CCObject *, int))v7->__vftable[4].~CCObject)(v7, 1);
return v7;
}