//
// SpriteAnimationManager::createAnimations from 0x2f2e94 to 0x2f3368 (1236 bytes)
//
// 2 xrefs:
// > ObjectManager::setup @ 0x2f1cd0
// > SpriteAnimationManager::initWithOwner @ 0x2f3f8e
//
// 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
//
unsigned int __fastcall SpriteAnimationManager::createAnimations(const char **a1)
{
ObjectManager *v2; // r0
unsigned int result; // r0
ObjectManager *v4; // r0
ObjectManager *v5; // r0
cocos2d::CCDictionary *Definition; // r6
cocos2d::CCString *v7; // r0
char *CString; // r0
cocos2d::CCDictionary *v9; // r6
cocos2d::CCString *v10; // r7
float v11; // r0
cocos2d::CCString *v12; // r4
cocos2d::CCString *v13; // r8
cocos2d::CCString *v14; // r0
char *v15; // r0
int v16; // r7
cocos2d::CCString *v17; // r0
char *v18; // r0
cocos2d::CCSpriteFrameCache *v19; // r0
cocos2d::CCSpriteFrame *v20; // r6
int v21; // r3
const std::string *v22; // r1
cocos2d::CCString *v23; // r0
const char *v24; // r0
cocos2d::CCString *v25; // r0
_BOOL4 v26; // r8
cocos2d::CCString *v27; // r0
int v28; // r7
int i; // r6
cocos2d::CCSpriteFrameCache *v30; // r11
cocos2d::CCString *v31; // r0
const char *v32; // r0
cocos2d::CCSpriteFrame *v33; // r1
cocos2d::CCString *v34; // r0
char *v35; // r0
cocos2d::CCArray *v36; // r0
cocos2d::CCArray *v37; // r9
int v38; // r7
int v39; // r6
const std::string *v40; // r1
cocos2d::CCObject *v41; // r0
unsigned int v42; // r6
cocos2d::CCString *v43; // r0
int v44; // r7
cocos2d::CCSpriteFrameCache *v45; // r11
cocos2d::CCString *v46; // r0
const char *v47; // r0
cocos2d::CCSpriteFrame *v48; // r1
cocos2d::CCAnimation *v49; // r4
cocos2d::CCString *v50; // r0
const char *v51; // r0
unsigned int v52; // [sp+4h] [bp-78h]
cocos2d::CCArray *v53; // [sp+8h] [bp-74h]
cocos2d::CCArray *v54; // [sp+Ch] [bp-70h]
cocos2d::CCAnimationCache *v55; // [sp+10h] [bp-6Ch]
cocos2d::CCDictionary *v56; // [sp+14h] [bp-68h]
cocos2d::CCArray *v57; // [sp+18h] [bp-64h]
int v58; // [sp+1Ch] [bp-60h]
std::string v59; // [sp+3Ch] [bp-40h] BYREF
std::string v60; // [sp+40h] [bp-3Ch] BYREF
std::string v61; // [sp+44h] [bp-38h] BYREF
std::string v62; // [sp+48h] [bp-34h] BYREF
char *v63; // [sp+4Ch] [bp-30h] BYREF
std::string v64; // [sp+50h] [bp-2Ch] BYREF
std::string v65; // [sp+54h] [bp-28h] BYREF
char v66; // [sp+58h] [bp-24h] BYREF
std::string v67; // [sp+5Ch] [bp-20h] BYREF
char *v68; // [sp+60h] [bp-1Ch] BYREF
std::string v69; // [sp+64h] [bp-18h] BYREF
int v70; // [sp+68h] [bp-14h] BYREF
char *v71; // [sp+6Ch] [bp-10h] BYREF
char *v72; // [sp+70h] [bp-Ch] BYREF
v2 = ObjectManager::instance();
result = ObjectManager::animLoaded(v2, *a1);
if ( !result )
{
v4 = ObjectManager::instance();
ObjectManager::setLoaded(v4, *a1);
v55 = cocos2d::CCAnimationCache::sharedAnimationCache();
v5 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v5, *a1);
sub_776584((int)&v72, "animations");
v56 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(Definition, (const std::string *)&v72);
sub_774008(&v72);
v52 = 0;
v57 = cocos2d::CCDictionary::allKeys(v56);
while ( 1 )
{
result = cocos2d::CCArray::count(v57);
if ( v52 >= result )
break;
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v57, v52);
CString = (char *)cocos2d::CCString::getCString(v7);
sub_776584((int)&v59, CString);
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v56, &v59);
sub_776584((int)&v60, "delay");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v60);
v11 = COERCE_FLOAT(sub_774008(&v60));
if ( v10 )
{
v11 = cocos2d::CCString::floatValue(v10);
v54 = (cocos2d::CCArray *)LODWORD(v11);
}
else
{
v54 = nullptr;
}
v53 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)LODWORD(v11));
sub_776584((int)&v61, "usesParts");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v61);
sub_774008(&v61);
if ( v12 )
v12 = (cocos2d::CCString *)cocos2d::CCString::boolValue(v12);
sub_776584((int)&v62, "animFrameName");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v62);
sub_774008(&v62);
v63 = (char *)&unk_ACDDA8;
if ( v13 )
v14 = v13;
else
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%s",
*a1,
v59.m_data.m_data);
v15 = (char *)cocos2d::CCString::getCString(v14);
sub_7753D4((int)&v63, v15);
sub_776584((int)&v64, "singleFrame");
v16 = cocos2d::CCDictionary::objectForKey(v9, &v64);
sub_774008(&v64);
if ( v16 )
{
sub_776584((int)&v65, "singleFrame");
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v65);
v18 = (char *)cocos2d::CCString::getCString(v17);
sub_776584((int)&v72, v18);
sub_774008(&v65);
if ( v12 )
{
sub_776584((int)&v66, v72);
v20 = (cocos2d::CCSpriteFrame *)cocos2d::CCString::create((cocos2d::CCString *)&v66, v22);
sub_774008(&v66);
v21 = 1;
}
else
{
v19 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v20 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v19, v72);
v21 = 2;
}
v20->m_eObjType = v21;
v23 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%s",
*a1,
v59.m_data.m_data);
v24 = cocos2d::CCString::getCString(v23);
cocos2d::CCAnimationCache::addAnimation(v55, (cocos2d::CCAnimation *)v20, v24);
sub_774008(&v72);
}
else
{
sub_776584((int)&v67, "other");
v25 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v67);
v26 = cocos2d::CCString::boolValue(v25);
sub_774008(&v67);
if ( v26 )
{
sub_776584((int)&v69, "frames");
v34 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, &v69);
v35 = (char *)cocos2d::CCString::getCString(v34);
sub_776584((int)&v68, v35);
sub_774008(&v69);
v36 = (cocos2d::CCArray *)sub_776584((int)&v70, v68);
v37 = (cocos2d::CCArray *)cocos2d::CCArray::create(v36);
v38 = sub_774A78((int)&v70, " ");
v39 = 0;
v58 = *(_DWORD *)(v70 - 12);
while ( 1 )
{
sub_776158(&v71, &v70, v39, v38 - v39);
if ( *((_DWORD *)v71 - 3) || v39 != v58 )
{
sub_776584((int)&v72, v71);
v41 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v72, v40);
cocos2d::CCArray::addObject(v37, v41);
sub_774008(&v72);
}
if ( v38 == -1 )
break;
v39 = v38 + 1;
v38 = sub_774A78((int)&v70, " ");
sub_774008(&v71);
}
v42 = 0;
sub_774008(&v71);
sub_774008(&v70);
while ( v42 < cocos2d::CCArray::count(v37) )
{
v43 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v37, v42);
v44 = cocos2d::CCString::intValue(v43);
if ( v12 )
{
v48 = (cocos2d::CCSpriteFrame *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%03d.png",
v63,
v44);
v48->m_eObjType = 1;
}
else
{
v45 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v46 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%03d.png",
v63,
v44);
v47 = cocos2d::CCString::getCString(v46);
v48 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v45, v47);
v48->m_eObjType = 2;
}
cocos2d::CCArray::addObject(v53, v48);
++v42;
}
sub_774008(&v68);
}
else
{
sub_776584((int)&v68, "frames");
v27 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v9, (const std::string *)&v68);
v28 = cocos2d::CCString::intValue(v27);
sub_774008(&v68);
for ( i = 1; i <= v28; ++i )
{
if ( v12 )
{
v33 = (cocos2d::CCSpriteFrame *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%03d.png",
v63,
i);
v33->m_eObjType = 1;
}
else
{
v30 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_%03d.png", v63, i);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v30, v32);
v33->m_eObjType = 2;
}
cocos2d::CCArray::addObject(v53, v33);
}
}
v49 = cocos2d::CCAnimation::createWithSpriteFrames(v53, *(float *)&v54);
v50 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%s",
*a1,
v59.m_data.m_data);
v51 = cocos2d::CCString::getCString(v50);
cocos2d::CCAnimationCache::addAnimation(v55, v49, v51);
}
sub_774008(&v63);
sub_774008(&v59);
++v52;
}
}
return result;
}