//
// cocos2d::CCParticleSystem::initWithFile from 0x180068950 to 0x180068bc5 (629 bytes)
//
// 4 xrefs:
// > cocos2d::CCParticleSystem::create @ 0x180065a6e
// > cocos2d::CCParticleSystemQuad::create @ 0x18006a4a7
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3bdc
//
// 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
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall cocos2d::CCParticleSystem::initWithFile(
cocos2d::CCParticleSystem *this,
char *a2,
unsigned __int8 a3)
{
struct cocos2d::CCFileUtils *v6; // rax
__int64 v7; // rax
void *v8; // rcx
CCContentManager *v9; // rax
struct cocos2d::CCDictionary *v10; // r15
size_t v11; // r8
void **v12; // rbx
size_t v13; // rdi
_BYTE *v14; // rax
void **v15; // rcx
void **v16; // r8
__int64 v17; // r8
size_t v18; // r8
void **v19; // rdx
void *v20; // rcx
const char *v21; // r8
unsigned __int8 v22; // bl
void *v23; // rcx
void *Buf[2]; // [rsp+28h] [rbp-48h] BYREF
size_t MaxCount[2]; // [rsp+38h] [rbp-38h]
void *Block[2]; // [rsp+48h] [rbp-28h] BYREF
__m128i v28; // [rsp+58h] [rbp-18h]
v6 = cocos2d::CCFileUtils::sharedFileUtils();
v7 = ((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **, char *, _QWORD))v6->createCCArrayWithContentsOfFile)(
v6,
Block,
a2,
0);
sub_1800656E0((__int64)&this->m_sPlistFile, v7);
if ( v28.m128i_i64[1] > 0xFuLL )
{
v8 = Block[0];
if ( (unsigned __int64)(v28.m128i_i64[1] + 1) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v8);
}
v9 = CCContentManager::sharedManager();
v10 = CCContentManager::addDictDS(v9, a2);
*(_OWORD *)Buf = 0;
MaxCount[0] = 0;
MaxCount[1] = 0;
v11 = -1;
do
++v11;
while ( a2[v11] );
sub_18000CE60(Buf, a2, v11);
v12 = Buf;
if ( MaxCount[1] > 0xF )
v12 = (void **)Buf[0];
v13 = MaxCount[0];
if ( !MaxCount[0] || (v14 = memchr(v12, 47, MaxCount[0])) == nullptr || v14 - (_BYTE *)v12 == -1 )
{
v21 = Buf2;
goto LABEL_34;
}
v15 = Buf;
if ( MaxCount[1] > 0xF )
v15 = (void **)Buf[0];
if ( !v13 )
goto LABEL_20;
v16 = (void **)((char *)v15 + v13 - 1);
if ( *(_BYTE *)v16 != 47 )
{
while ( v16 != v15 )
{
v16 = (void **)((char *)v16 - 1);
if ( *(_BYTE *)v16 == 47 )
goto LABEL_19;
}
LABEL_20:
v17 = -1;
goto LABEL_21;
}
LABEL_19:
v17 = (char *)v16 - (char *)v15;
LABEL_21:
*(_OWORD *)Block = 0;
v28 = 0;
v18 = v17 + 1;
if ( v13 < v18 )
v18 = v13;
v19 = Buf;
if ( MaxCount[1] > 0xF )
v19 = (void **)Buf[0];
sub_18000CE60(Block, v19, v18);
if ( MaxCount[1] > 0xF )
{
v20 = Buf[0];
if ( MaxCount[1] + 1 >= 0x1000 )
{
v20 = *((void **)Buf[0] - 1);
if ( (unsigned __int64)((char *)Buf[0] - (char *)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v20);
}
*(_OWORD *)Buf = *(_OWORD *)Block;
*(__m128i *)MaxCount = v28;
v21 = (const char *)Buf;
if ( _mm_srli_si128(v28, 8).m128i_u64[0] > 0xF )
v21 = (const char *)Block[0];
LABEL_34:
v22 = cocos2d::CCParticleSystem::initWithDictionary(this, v10, v21, a3);
if ( MaxCount[1] > 0xF )
{
v23 = Buf[0];
if ( MaxCount[1] + 1 >= 0x1000 )
{
v23 = *((void **)Buf[0] - 1);
if ( (unsigned __int64)((char *)Buf[0] - (char *)v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v23);
}
return v22;
}