//
// GJBaseGameLayer::createCustomParticle from 0x14034a9f0 to 0x14034ad39 (841 bytes)
//
// 4 xrefs:
// > ??> @ 0x14076b898
// > ??> @ 0x14078b310
// > ??> @ 0x1407d5ef8
// > ??> @ 0x14092000c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:30:44 +0000
//
// Hidden C++ exception states: #wind=2
struct cocos2d::CCParticleSystemQuad *__fastcall GJBaseGameLayer::createCustomParticle(
__int64 a1,
void **a2,
unsigned int *a3,
int a4,
char a5)
{
void **v7; // rbx
size_t v9; // rdi
size_t v10; // r8
__int64 v11; // rcx
cocos2d::CCArray *v12; // rsi
void *v13; // rax
void **v14; // rcx
void **v15; // rdx
void **v16; // rdx
size_t v17; // r8
void *v18; // rcx
__int64 v19; // rbx
__int64 v20; // rcx
__int64 v21; // rax
void *v22; // rcx
struct cocos2d::CCParticleSystemQuad *v24; // rbx
int v25; // [rsp+30h] [rbp-78h] BYREF
void *v26[2]; // [rsp+38h] [rbp-70h] BYREF
__int128 v27; // [rsp+48h] [rbp-60h]
void *Block[2]; // [rsp+58h] [rbp-50h] BYREF
__m128i si128; // [rsp+68h] [rbp-40h]
v7 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
a2 = (void **)*a2;
*(_OWORD *)Block = 0;
si128 = 0;
v9 = -1;
v10 = -1;
do
++v10;
while ( *((_BYTE *)a2 + v10) );
sub_14003D230(Block, a2, v10);
v12 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 12720), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v13 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
if ( !v12 && !a5 )
{
v12 = (cocos2d::CCArray *)cocos2d::CCArray::create(v11);
(*(void (__fastcall **)(cocos2d::CCArray *, _QWORD))(*(_QWORD *)v12 + 64LL))(
v12,
(unsigned int)++*(_DWORD *)(a1 + 12700));
v25 = (*(__int64 (__fastcall **)(cocos2d::CCArray *))(*(_QWORD *)v12 + 56LL))(v12);
v14 = (void **)(*(_QWORD *)sub_140067D30(a1 + 12736, (__int64)v26, (unsigned __int8 *)&v25) + 24LL);
if ( v14 != v7 )
{
v15 = v7;
if ( (unsigned __int64)v7[3] > 0xF )
v15 = (void **)*v7;
sub_1400405A0(v14, v15, (size_t)v7[2]);
}
v16 = v7;
if ( (unsigned __int64)v7[3] > 0xF )
v16 = (void **)*v7;
*(_OWORD *)v26 = 0;
v27 = 0;
v17 = -1;
do
++v17;
while ( *((_BYTE *)v16 + v17) );
sub_14003D230(v26, v16, v17);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 12720), v12, v26);
if ( *((_QWORD *)&v27 + 1) > 0xFu )
{
v18 = v26[0];
if ( (unsigned __int64)(*((_QWORD *)&v27 + 1) + 1LL) >= 0x1000 )
{
v18 = *((void **)v26[0] - 1);
if ( (unsigned __int64)((char *)v26[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
if ( (unsigned __int64)v7[3] > 0xF )
v7 = (void **)*v7;
*(_OWORD *)v26 = 0;
v27 = 0;
do
++v9;
while ( *((_BYTE *)v7 + v9) );
sub_14003D230(v26, v7, v9);
v19 = *(_QWORD *)(a1 + 12800);
v21 = cocos2d::CCArray::create(v20);
cocos2d::CCDictionary::setObject(v19, v21, v26);
if ( *((_QWORD *)&v27 + 1) > 0xFu )
{
v22 = v26[0];
if ( (unsigned __int64)(*((_QWORD *)&v27 + 1) + 1LL) >= 0x1000 )
{
v22 = *((void **)v26[0] - 1);
if ( (unsigned __int64)((char *)v26[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
}
if ( a4 > 0 && cocos2d::CCArray::count(v12) >= a4 )
return nullptr;
v24 = GameToolbox::particleFromStruct(a3, nullptr, 1);
(*(void (__fastcall **)(struct cocos2d::CCParticleSystemQuad *, _QWORD))(*(_QWORD *)v24 + 64LL))(v24, 0);
cocos2d::CCParticleSystem::stopSystem(v24);
(*(void (__fastcall **)(struct cocos2d::CCParticleSystemQuad *, _QWORD))(*(_QWORD *)v24 + 336LL))(v24, 0);
if ( !a5 )
{
cocos2d::CCArray::addObject(v12, v24);
*((_DWORD *)v24 + 197) = (*(__int64 (__fastcall **)(cocos2d::CCArray *))(*(_QWORD *)v12 + 56LL))(v12);
}
return v24;
}