//
// cocos2d::CCParticleSystem::initWithFile from 0x1007c6c20 to 0x1007c6e68 (584 bytes)
//
// 2 xrefs:
// > cocos2d::CCParticleSystemQuad::create @ 0x100602ba5
// > cocos2d::CCParticleSystem::create @ 0x1007c6be7
//
// 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 __fastcall cocos2d::CCParticleSystem::initWithFile(cocos2d::CCParticleSystem *a1, const char *a2, bool a3)
{
_BOOL4 v3; // r15d
cocos2d::CCFileUtils *v4; // rax
double v5; // xmm0_8
CCContentManager *v6; // rax
size_t v7; // rax
std::string::size_type v8; // r14
char *data; // r15
size_t v10; // r13
const char *v11; // r12
std::string::size_type v12; // r13
unsigned __int128 v13; // kr00_16
bool result; // al
char *v15; // r15
bool v16; // bl
size_t v17; // r14
std::string v18; // [rsp+8h] [rbp-68h] BYREF
cocos2d::CCDictionary *v19; // [rsp+20h] [rbp-50h]
_BOOL4 v20; // [rsp+2Ch] [rbp-44h]
std::string __dst[2]; // [rsp+30h] [rbp-40h] BYREF
v3 = a3;
v4 = cocos2d::CCFileUtils::sharedFileUtils();
((void (__fastcall *)(std::string *, cocos2d::CCFileUtils *, const char *, _QWORD))v4->createCCArrayWithContentsOfFile)(
__dst,
v4,
a2,
0);
if ( (a1->m_sPlistFile.m_data.m_short.sizex2 & 1) != 0 )
operator delete(a1->m_sPlistFile.m_data.m_long.longStorage);
a1->m_sPlistFile.m_data.m_long.longStorage = __dst[0].__r_.__value_.__l.__data_;
v5 = *(double *)__dst[0].__r_.__value_.__r.__words;
*(_OWORD *)&a1->m_sPlistFile.m_data.m_short.sizex2 = *(_OWORD *)&__dst[0].__r_.__value_.__l.0;
v6 = CCContentManager::sharedManager();
v19 = CCContentManager::addDict(v6, a2, 1);
v7 = strlen(a2);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v5);
v8 = v7;
v20 = v3;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
data = (char *)operator new(v10);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v10 + 1;
__dst[0].__r_.__value_.__l.__size_ = v8;
goto LABEL_10;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v7 )
LABEL_10:
memcpy(data, a2, v8);
data[v8] = 0;
if ( std::string::find(__dst, 47, 0) == -1 )
{
result = cocos2d::CCParticleSystem::initWithDictionary(a1, v19, "", v20);
goto LABEL_26;
}
v11 = __dst[0].__r_.__value_.__s.__data_;
v12 = std::string::rfind(__dst, 47, 0xFFFFFFFFFFFFFFFFLL) + 1;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v13 = *(_OWORD *)&__dst[0].__r_.__value_.__r.__words[1];
else
v13 = __PAIR128__(
(std::string *)((char *)&__dst[0].__r_.__value_.__l.0 + 1),
*(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1);
if ( (unsigned __int64)v13 < v12 )
v12 = v13;
if ( v12 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v5);
if ( v12 >= 0x17 )
{
v17 = 26;
if ( (v12 | 7) != 0x17 )
v17 = (v12 | 7) + 1;
v15 = (char *)operator new(v17);
v18.__r_.__value_.__r.__words[2] = (std::string::size_type)v15;
v18.__r_.__value_.__r.__words[0] = v17 | 1;
v18.__r_.__value_.__l.__size_ = v12;
LABEL_32:
memmove(v15, *((const void **)&v13 + 1), v12);
v15[v12] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_23;
goto LABEL_22;
}
v18.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v12);
v15 = v18.__r_.__value_.__s.__data_;
if ( v12 )
goto LABEL_32;
v18.__r_.__value_.__s.__data_[0] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_22:
operator delete(__dst[0].__r_.__value_.__l.__data_);
LABEL_23:
__dst[0] = v18;
if ( (*(_BYTE *)&v18.__r_.__value_.__s.0 & 1) != 0 )
v11 = v18.__r_.__value_.__l.__data_;
result = cocos2d::CCParticleSystem::initWithDictionary(a1, v19, v11, v20);
LABEL_26:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v16 = result;
operator delete(__dst[0].__r_.__value_.__l.__data_);
return v16;
}
return result;
}