//
// GJBaseGameLayer::getParticleKey from 0x8904a8 to 0x8906f0 (584 bytes)
//
// 3 xrefs:
// > GameObject::createAndAddParticle @ 0x644818
// > GJBaseGameLayer::createParticle @ 0x890764
// > ??> @ 0x520b0
//
// 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
//
__int64 __usercall GJBaseGameLayer::getParticleKey@(
unsigned int a1@,
const char *a2@,
unsigned int a3@,
unsigned int a4@,
__int64 a5@)
{
size_t v9; // x0
size_t v10; // x20
size_t v11; // x22
unsigned __int64 v12; // x27
size_t v13; // x24
char *v14; // x0
unsigned int *v16; // x2
int v17; // w1
char *v18; // [xsp+80h] [xbp+80h] BYREF
size_t v19; // [xsp+88h] [xbp+88h] BYREF
size_t v20; // [xsp+90h] [xbp+90h]
char *v21; // [xsp+98h] [xbp+98h]
_BYTE v22[504]; // [xsp+A0h] [xbp+A0h] BYREF
v19 = 0;
v20 = 500;
v21 = v22;
fmt::BasicWriter::FormatInt,char>>(&v19, a1);
if ( a2 )
{
v9 = strlen(a2);
v10 = v19;
v11 = v9;
v12 = v9 + v19;
if ( v9 + v19 <= v20 )
goto LABEL_3;
}
else
{
v10 = v19;
if ( v19 <= v20 )
goto LABEL_5;
v12 = v19;
v11 = 0;
}
fmt::internal::Array::grow(&v19, v12);
LABEL_3:
v19 = v12;
if ( v11 )
memmove(&v21[v10], a2, v11);
LABEL_5:
fmt::BasicWriter::FormatInt,char>>(&v19, a3);
fmt::BasicWriter::FormatInt,char>>(&v19, a4);
v13 = v19;
if ( v20 < v19 + 1 )
fmt::internal::Array::grow(&v19, v19 + 1);
v21[v13] = 0;
sub_D153B8((int)&v18, v21);
sub_D153B8(a5, v18);
v14 = v18 - 24;
if ( v18 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v18 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v14);
}
if ( v21 != v22 && v21 )
operator delete[](v21);
return a5;
}