//
// cocos2d::CCParticleSystem::initWithFile from 0xb01930 to 0xb01b8c (604 bytes)
//
// 3 xrefs:
// > cocos2d::CCParticleSystem::create @ 0xb01bb8
// > cocos2d::CCParticleSystemQuad::create @ 0xb03244
// > ??> @ 0x78ba0
//
// 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
//
bool cocos2d::CCParticleSystem::initWithFile(cocos2d::CCParticleSystem *a1, const char *a2, bool a3)
{
cocos2d::CCFileUtils *v6; // x0
void *v7; // x0
CCContentManager *v8; // x0
cocos2d::CCDictionary *v9; // x26
long double v10; // q0
__int64 v11; // x0
void *v12; // x0
char v13; // w0
char *v14; // x1
bool v15; // w21
char *v16; // x0
char v18; // w0
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
char *v25; // [xsp+58h] [xbp+58h] BYREF
__int64 v26; // [xsp+60h] [xbp+60h] BYREF
v6 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(__int64 *__return_ptr, cocos2d::CCFileUtils *, const char *, _QWORD))v6->createCCArrayWithContentsOfFile)(
&v26,
v6,
a2,
0);
sub_D163D4(&a1->m_sPlistFile, &v26);
v7 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v26 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v7);
}
v8 = CCContentManager::sharedManager();
v9 = CCContentManager::addDict(v8, a2, 1);
sub_D153B8((int)&v25, (char *)a2);
if ( sub_D16674(&v25, 47, 0, v10) == -1 )
{
v18 = cocos2d::CCParticleSystem::initWithDictionary(a1, v9, &byte_F288A0, a3);
v14 = v25;
v15 = v18;
v16 = v25 - 24;
if ( v25 - 24 == (char *)&qword_124B6B0 )
return v15;
goto LABEL_7;
}
v11 = sub_D16898(&v25, 47, -1);
sub_D14F84(&v26, &v25, 0, v11 + 1);
sub_D163D4(&v25, &v26);
v12 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v26 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v12);
}
v13 = cocos2d::CCParticleSystem::initWithDictionary(a1, v9, v25, a3);
v14 = v25;
v15 = v13;
v16 = v25 - 24;
if ( v25 - 24 != (char *)&qword_124B6B0 )
{
LABEL_7:
if ( &pthread_create )
{
v19 = (unsigned int *)(v14 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *((_DWORD *)v14 - 2);
*((_DWORD *)v14 - 2) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v16);
}
return v15;
}