//
// GJBaseGameLayer::claimCustomParticle from 0x10013d5e0 to 0x10013da2a (1098 bytes)
//
// 2 xrefs:
// > ??> @ 0x100abb0d8
// > ??> @ 0x100ac51a0
//
// 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 12:24:53 +0000
//
_DWORD *__fastcall GJBaseGameLayer::claimCustomParticle(
__int64 a1,
__int64 a2,
const std::string *a3,
int a4,
unsigned int a5,
int a6,
unsigned __int8 a7)
{
_DWORD *v8; // r13
int v11; // r12d
int v12; // eax
int v13; // ecx
int v14; // esi
int v15; // edi
int v16; // r8d
unsigned int v17; // edi
int v18; // r8d
__m128 v19; // xmm0
std::string *v20; // r13
__m128d v22; // xmm0
int v23; // eax
int v24; // ecx
__int64 v25; // r15
__int64 v26; // rax
_QWORD *v27; // r14
__int64 v28; // rax
__int64 v29; // rcx
__int64 v30; // r15
int v31; // eax
char v32; // dl
_BYTE __dst[264]; // [rsp+0h] [rbp-170h] BYREF
std::string v34; // [rsp+108h] [rbp-68h] BYREF
int v35; // [rsp+12Ch] [rbp-44h] BYREF
int v36; // [rsp+130h] [rbp-40h]
int v37; // [rsp+134h] [rbp-3Ch]
double v38; // [rsp+138h] [rbp-38h]
unsigned int v39; // [rsp+144h] [rbp-2Ch]
if ( *(int *)(a1 + 12256) > 99999 || *(_BYTE *)(a1 + 12260) )
return nullptr;
v39 = a5;
v11 = (int)a3->__r_.__value_.__l.0;
v36 = a6;
v37 = a4;
if ( v11 <= 0 )
{
v19 = 0;
memset(__dst, 0, 221);
memset(&__dst[224], 0, 21);
*(_OWORD *)&__dst[248] = 0;
memset(&v34, 0, sizeof(v34));
LABEL_26:
v20 = (std::string *)a3;
goto LABEL_27;
}
v12 = HIDWORD(a3[2].__r_.__value_.__r.__words[2]);
v13 = (int)a3[3].__r_.__value_.__l.0;
v14 = 0;
if ( v12 <= 0 )
v12 = 0;
v15 = -v13;
if ( v13 > 0 )
v15 = (int)a3[3].__r_.__value_.__l.0;
if ( SHIDWORD(a3[4].__r_.__value_.__r.__words[2]) > 0 )
v14 = HIDWORD(a3[4].__r_.__value_.__r.__words[2]);
v16 = -*(_DWORD *)&a3[5].__r_.__value_.__l.0;
if ( *(_DWORD *)&a3[5].__r_.__value_.__l.0 > 0 )
v16 = (int)a3[5].__r_.__value_.__l.0;
v17 = v12 + v15;
v18 = v14 + v16;
if ( v17 > v18 )
v18 = v17;
v19 = 0;
memset(__dst, 0, 221);
memset(&__dst[224], 0, 21);
*(_OWORD *)&__dst[248] = 0;
memset(&v34, 0, sizeof(v34));
if ( (int)fmin(
2147483647.0,
(double)v11 * ((float)((float)v18 * 0.5) * (float)((float)v18 * 0.5) * 3.141592653589793 / 10.0)) < 10000001 )
goto LABEL_26;
v38 = (float)((float)v18 * 0.5) * (float)((float)v18 * 0.5) * 3.141592653589793 / 10.0;
v20 = (std::string *)__dst;
memcpy(__dst, a3, sizeof(__dst));
std::string::operator=(&v34, a3 + 11);
v22 = (__m128d)0x416312D000000000uLL;
v22.f64[0] = 10000000.0 / v38;
v19 = (__m128)_mm_round_sd(v22, v22, 9);
v23 = (int)*(double *)v19.i64;
if ( v38 <= 0.0 )
v23 = v11;
if ( v23 >= v11 )
v23 = v11;
v24 = 1;
if ( v23 >= 2 )
v24 = v23;
*(_DWORD *)__dst = v24;
if ( *(int *)&__dst[16] > 60 * v24 )
*(_DWORD *)&__dst[16] = 60 * v24;
LABEL_27:
v25 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 12288), a2);
LODWORD(v38) = a7;
if ( v25 && ((a7 ^ 1) & ((unsigned int)sub_1007FEF90(v25) != 0)) != 0 )
{
v8 = nullptr;
if ( a7 )
goto LABEL_35;
goto LABEL_34;
}
v8 = (_DWORD *)(*(__int64 (__fastcall **)(__int64, __int64, std::string *, _QWORD, _QWORD))(*(_QWORD *)a1 + 1496LL))(
a1,
a2,
v20,
0,
LODWORD(v38));
if ( !v25 )
v25 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 12288), a2);
if ( !a7 )
{
LABEL_34:
v8 = (_DWORD *)sub_1007FF000(v25);
v26 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 12344), a2);
sub_1007FEBF0(v26, v8);
sub_1007FF120(v25, 1);
}
LABEL_35:
if ( v8 )
{
v27 = (_QWORD *)GJBaseGameLayer::parentForZLayer(a1, v37, 0, 4u, v36);
v28 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v8 + 512LL))(v8);
v29 = *(_QWORD *)v8;
if ( (_QWORD *)v28 == v27 )
{
v31 = (*(__int64 (__fastcall **)(_DWORD *))(v29 + 104))(v8);
v30 = 592;
if ( v31 == v39 )
{
LABEL_41:
v35 = v8[2];
sub_10001BC90((float *)(a1 + 12360), &v35, &v35, v19);
if ( (v32 & 1) != 0 )
sub_1007FEBF0(*(_QWORD *)(a1 + 12352), v8);
cocos2d::CCParticleSystem::resetSystem(v8);
(*(void (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)v8 + 344LL))(v8, 1);
(*(void (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)v8 + 1584LL))(v8, LODWORD(v38));
*(_DWORD *)(a1 + 12256) += (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v8 + 1496LL))(v8);
goto LABEL_44;
}
}
else
{
v30 = 464;
if ( (*(__int64 (__fastcall **)(_DWORD *))(v29 + 512))(v8) )
(*(void (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)v8 + 528LL))(v8, 0);
}
*(double *)v19.i64 = (*(double (__fastcall **)(_QWORD *, _DWORD *, _QWORD))(*v27 + v30))(v27, v8, v39);
goto LABEL_41;
}
LABEL_44:
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v34.__r_.__value_.__l.__data_);
return v8;
}