//
// CCPartAnimSprite::initWithAnimDesc from 0x10007e618 to 0x10007ea10 (1016 bytes)
//
// 1 xrefs:
// > CCPartAnimSprite::createWithAnimDesc @ 0x10007e5c8
//
// 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 CCPartAnimSprite::initWithAnimDesc(
CCPartAnimSprite *a1,
const char *a2,
cocos2d::CCTexture2D *a3,
bool a4)
{
_BOOL4 v4; // w19
_BOOL8 v7; // x0
cocos2d::CCArray *v8; // x0
cocos2d::CCDictionary *v9; // x0
CCAnimateFrameCache *v10; // x0
cocos2d::CCDictionary *v11; // x22
cocos2d::CCDictionary *v12; // x23
__int64 v13; // x24
_BYTE *v14; // x25
__int64 v15; // x25
cocos2d::CCString *v16; // x0
char *CString; // x0
cocos2d::CCString *v18; // x0
__int64 v19; // x26
_BOOL4 v20; // w28
std::string *v21; // x27
std::string *v22; // x0
__int64 v23; // x0
__int64 v24; // x28
cocos2d::CCString *v25; // x28
cocos2d::CCDictionary *m_spritePartIDs; // x25
char *v27; // x0
__n128 v28; // q0
bool v30; // [xsp+0h] [xbp-2E0h]
std::string __str; // [xsp+20h] [xbp-2C0h] BYREF
void *v33[2]; // [xsp+40h] [xbp-2A0h] BYREF
char v34; // [xsp+57h] [xbp-289h]
std::string v35; // [xsp+58h] [xbp-288h] BYREF
void *__p[2]; // [xsp+70h] [xbp-270h] BYREF
char *v37; // [xsp+80h] [xbp-260h]
_BYTE v38[504]; // [xsp+88h] [xbp-258h] BYREF
v4 = a4;
v7 = cocos2d::CCSprite::initWithTexture_1(a1, a3, &stru_10086ACA0);
v30 = v7;
if ( v7 )
{
v8 = (cocos2d::CCArray *)sub_10024A15C(v7);
a1->m_spriteParts = v8;
cocos2d::CCObject::retain(v8);
v9 = cocos2d::CCDictionary::create();
a1->m_spritePartIDs = v9;
cocos2d::CCObject::retain(v9);
v10 = CCAnimateFrameCache::sharedSpriteFrameCache();
v11 = CCAnimateFrameCache::addSpriteFramesWithFile(v10, a2);
a1->m_hasChanged = 1;
sub_100009900(__p, "usedTextures");
v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1(v11, __p);
if ( SHIBYTE(v37) < 0 )
operator delete(__p[0]);
if ( cocos2d::CCDictionary::count(v12) )
{
v13 = 0;
do
{
*(_OWORD *)__p = xmmword_1006350E0;
v37 = v38;
sub_10000CB18((__int64 *)__p, "texture_", 0);
LODWORD(v35.__r_.__value_.__l.__data_) = v13;
sub_100009A40((int)__p, v13, (int)&v35);
v14 = __p[0];
if ( __p[1] < (char *)__p[0] + 1 )
sub_100009ED4((__int64)__p, (size_t)__p[0] + 1);
v14[(_QWORD)v37] = 0;
sub_100009900(&v35, v37);
v15 = cocos2d::CCDictionary::objectForKey_1(v12, &v35);
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v35.__r_.__value_.__l.__data_);
sub_100009900(v33, "texture");
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v15, v33);
CString = (char *)cocos2d::CCString::getCString(v16);
sub_100009900(&v35, CString);
if ( v34 < 0 )
operator delete(v33[0]);
sub_100009900(v33, "tag");
v18 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(v15, v33);
v19 = cocos2d::CCString::intValue(v18);
if ( v34 < 0 )
operator delete(v33[0]);
sub_100009900(v33, "0");
v20 = sub_1000045BC(&v35, v33);
if ( v34 < 0 )
operator delete(v33[0]);
if ( v4 || v20 )
{
v21 = (std::string *)CCSpritePart::create(a3);
if ( !v20 && v4 )
{
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__str, v35.__r_.__value_.__l.__data_, v35.__r_.__value_.__l.__size_);
else
__str = v35;
std::string::operator=(v21 + 26, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}
}
else
{
if ( (v35.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v22 = &v35;
else
v22 = (std::string *)v35.__r_.__value_.__r.__words[0];
v21 = (std::string *)CCSpritePart::createWithSpriteFrameName((const char *)v22);
}
(*(void (__fastcall **)(std::string *, __int64))(v21->__r_.__value_.__r.__words[0] + 72))(v21, v19);
sub_100009900(v33, "customID");
v23 = cocos2d::CCDictionary::objectForKey_1(v15, v33);
v24 = v23;
if ( v34 < 0 )
{
operator delete(v33[0]);
if ( v24 )
{
LABEL_31:
sub_100009900(v33, "customID");
v25 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v15, v33);
if ( v34 < 0 )
operator delete(v33[0]);
m_spritePartIDs = a1->m_spritePartIDs;
v27 = (char *)cocos2d::CCString::getCString(v25);
sub_100009900(v33, v27);
cocos2d::CCDictionary::setObject_1(m_spritePartIDs, v21, v33);
if ( v34 < 0 )
operator delete(v33[0]);
}
}
else if ( v23 )
{
goto LABEL_31;
}
v28 = sub_10024A2D0(a1->m_spriteParts, v21);
((void (__fastcall *)(CCPartAnimSprite *, std::string *, _QWORD, __int64, __n128))a1->addChild_1)(
a1,
v21,
0,
v19,
v28);
(*(void (__fastcall **)(std::string *, _QWORD))(v21->__r_.__value_.__r.__words[0] + 328))(v21, 0);
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v35.__r_.__value_.__l.__data_);
if ( v37 != v38 && v37 )
operator delete[](v37);
v13 = (unsigned int)(v13 + 1);
}
while ( (unsigned int)v13 < cocos2d::CCDictionary::count(v12) );
}
}
return v30;
}