//
// CCPartAnimSprite::initWithAnimDesc from 0x2e77d0 to 0x2e7a8e (702 bytes)
//
// 1 xrefs:
// > CCPartAnimSprite::createWithAnimDesc @ 0x2e7b0c
//
// 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 CCPartAnimSprite::initWithAnimDesc(CCPartAnimSprite *a1, const char *a2, cocos2d::CCTexture2D *a3, bool a4)
{
cocos2d::CCArray *v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCDictionary *v8; // r0
CCAnimateFrameCache *v9; // r0
cocos2d::CCDictionary *v10; // r0
cocos2d::CCDictionary *v11; // r6
cocos2d::CCDictionary *v12; // r9
stl::StringData::Internal *i; // r6
void *v14; // r0
unsigned int v15; // r4
cocos2d::CCDictionary *v16; // r8
cocos2d::CCString *v17; // r0
char *CString; // r0
cocos2d::CCString *v19; // r0
int v20; // r10
unsigned int v21; // r7
unsigned int v22; // r7
CCSpritePart *v23; // r4
int v24; // r7
cocos2d::CCString *v25; // r11
cocos2d::CCDictionary *m_spritePartIDs; // r8
char *v27; // r0
bool v29; // [sp+0h] [bp-25Ch]
_BOOL4 v31; // [sp+8h] [bp-254h]
std::string v32; // [sp+2Ch] [bp-230h] BYREF
const char *v33; // [sp+30h] [bp-22Ch] BYREF
std::string v34; // [sp+34h] [bp-228h] BYREF
std::string v35; // [sp+38h] [bp-224h] BYREF
_BYTE v36[4]; // [sp+3Ch] [bp-220h] BYREF
_BYTE v37[4]; // [sp+40h] [bp-21Ch] BYREF
std::string v38; // [sp+44h] [bp-218h] BYREF
std::string v39; // [sp+48h] [bp-214h] BYREF
_BYTE v40[4]; // [sp+4Ch] [bp-210h] BYREF
std::string v41; // [sp+50h] [bp-20Ch] BYREF
unsigned int v42; // [sp+54h] [bp-208h] BYREF
unsigned int v43; // [sp+58h] [bp-204h]
void *v44; // [sp+5Ch] [bp-200h]
_BYTE v45[500]; // [sp+60h] [bp-1FCh] BYREF
v31 = a4;
v6 = (cocos2d::CCArray *)cocos2d::CCSprite::initWithTexture(a1, a3, &stru_AC5388);
v29 = (char)v6;
if ( v6 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_spriteParts = v7;
cocos2d::CCObject::retain(v7);
v8 = cocos2d::CCDictionary::create();
a1->m_spritePartIDs = v8;
cocos2d::CCObject::retain(v8);
v9 = CCAnimateFrameCache::sharedSpriteFrameCache();
v10 = CCAnimateFrameCache::addSpriteFramesWithFile(v9, a2);
a1->m_hasChanged = 1;
v11 = v10;
sub_776584((int)&v41, "usedTextures");
v12 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v11, &v41);
sub_774008(&v41);
for ( i = nullptr;
(unsigned int)i < cocos2d::CCDictionary::count(v12);
i = (stl::StringData::Internal *)((char *)i + 1) )
{
v42 = 0;
v43 = 500;
v44 = v45;
v14 = (void *)fmt::BasicWriter::GrowBuffer(&v42, 8);
std::__copy_move::__copy_m("texture_", "", v14);
v41.m_data.m_data = i;
fmt::BasicWriter::FormatInt,char>>(
&v42,
(int)i,
(int)&v41);
v15 = v42;
if ( v42 + 1 > v43 )
fmt::internal::Array::grow((int)&v42, v42 + 1);
*((_BYTE *)v44 + v15) = 0;
sub_776584((int)&v32, (char *)v44);
v16 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v12, &v32);
sub_774008(&v32);
sub_776584((int)&v34, "texture");
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v16, &v34);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_776584((int)&v33, CString);
sub_774008(&v34);
sub_776584((int)&v35, "tag");
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v16, &v35);
v20 = cocos2d::CCString::intValue(v19);
sub_774008(&v35);
sub_776584((int)v36, "0");
v21 = __clz(sub_774DBC(&v33, v36));
sub_774008(v36);
v22 = v21 >> 5;
if ( v31 || v22 )
{
v23 = CCSpritePart::create(a3);
if ( !v22 && v31 )
{
sub_775C20(v37, &v33);
sub_775D40(&v23->m_spriteFrameName, v37);
sub_774008(v37);
}
}
else
{
v23 = CCSpritePart::createWithSpriteFrameName(v33);
}
v23->setTag(v23, v20);
sub_776584((int)&v38, "customID");
v24 = cocos2d::CCDictionary::objectForKey(v16, &v38);
sub_774008(&v38);
if ( v24 )
{
sub_776584((int)&v39, "customID");
v25 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v16, &v39);
sub_774008(&v39);
m_spritePartIDs = a1->m_spritePartIDs;
v27 = (char *)cocos2d::CCString::getCString(v25);
sub_776584((int)v40, v27);
cocos2d::CCDictionary::setObject((int)m_spritePartIDs, v23);
sub_774008(v40);
}
cocos2d::CCArray::addObject(a1->m_spriteParts, v23);
a1->addChild_1(a1, v23, 0, v20);
v23->setVisible(v23, 0);
sub_774008(&v33);
if ( v44 != v45 )
{
if ( v44 )
operator delete[](v44);
}
}
}
return v29;
}