//
// cocos2d::CCParticleSystem::initWithFile from 0x1008ae4c0 to 0x1008ae708 (584 bytes)
//
// 2 xrefs:
// > cocos2d::CCParticleSystemQuad::create @ 0x1006da585
// > cocos2d::CCParticleSystem::create @ 0x1008ae487
//
// 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:37:19 +0000
//
__int64 __fastcall cocos2d::CCParticleSystem::initWithFile(__int64 a1, const char *a2, int a3)
{
std::string *v6; // rdi
__int64 v7; // rsi
__int64 v8; // rax
size_t v9; // rax
std::string::size_type v10; // r14
char *data; // r15
size_t v12; // r13
std::string::pointer v13; // r12
std::string::size_type v14; // r13
unsigned __int128 v15; // kr00_16
__int64 result; // rax
char *v17; // r15
unsigned int v18; // ebx
size_t v19; // r14
std::string v20; // [rsp+8h] [rbp-68h] BYREF
__int64 v21; // [rsp+20h] [rbp-50h]
int v22; // [rsp+2Ch] [rbp-44h]
std::string __dst[2]; // [rsp+30h] [rbp-40h] BYREF
v6 = __dst;
v7 = cocos2d::CCFileUtils::sharedFileUtils();
(*(void (__fastcall **)(std::string *, __int64, const char *, _QWORD))(*(_QWORD *)v7 + 48LL))(__dst, v7, a2, 0);
if ( (*(_BYTE *)(a1 + 328) & 1) != 0 )
{
v6 = *(std::string **)(a1 + 344);
operator delete(v6);
}
*(std::string *)(a1 + 328) = __dst[0];
v8 = CCContentManager::sharedManager((__int64)v6, v7);
v21 = CCContentManager::addDict(v8, a2, 1);
v9 = strlen(a2);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v10 = v9;
v22 = a3;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
data = (char *)operator new(v12);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst[0].__r_.__value_.__r.__words[0] = v12 + 1;
__dst[0].__r_.__value_.__l.__size_ = v10;
goto LABEL_10;
}
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v9);
data = __dst[0].__r_.__value_.__s.__data_;
if ( v9 )
LABEL_10:
memcpy(data, a2, v10);
data[v10] = 0;
if ( std::string::find(__dst, 47, 0) == -1 )
{
result = cocos2d::CCParticleSystem::initWithDictionary(a1, v21, "", (unsigned __int8)v22);
goto LABEL_26;
}
v13 = __dst[0].__r_.__value_.__s.__data_;
v14 = std::string::rfind(__dst, 47, 0xFFFFFFFFFFFFFFFFLL) + 1;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
v15 = *(_OWORD *)&__dst[0].__r_.__value_.__r.__words[1];
else
v15 = __PAIR128__(
(std::string *)((char *)&__dst[0].__r_.__value_.__l.0 + 1),
*(_BYTE *)&__dst[0].__r_.__value_.__l.0 >> 1);
if ( (unsigned __int64)v15 < v14 )
v14 = v15;
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v14 >= 0x17 )
{
v19 = 26;
if ( (v14 | 7) != 0x17 )
v19 = (v14 | 7) + 1;
v17 = (char *)operator new(v19);
v20.__r_.__value_.__r.__words[2] = (std::string::size_type)v17;
v20.__r_.__value_.__r.__words[0] = v19 | 1;
v20.__r_.__value_.__l.__size_ = v14;
LABEL_32:
memmove(v17, *((const void **)&v15 + 1), v14);
v17[v14] = 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_23;
goto LABEL_22;
}
v20.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v14);
v17 = v20.__r_.__value_.__s.__data_;
if ( v14 )
goto LABEL_32;
v20.__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] = v20;
if ( (*(_BYTE *)&v20.__r_.__value_.__s.0 & 1) != 0 )
v13 = v20.__r_.__value_.__l.__data_;
result = cocos2d::CCParticleSystem::initWithDictionary(a1, v21, v13, (unsigned __int8)v22);
LABEL_26:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
v18 = result;
operator delete(__dst[0].__r_.__value_.__l.__data_);
return v18;
}
return result;
}