//
// SpriteAnimationManager::loadAnimations from 0x2f3b1c to 0x2f3e84 (872 bytes)
//
// 1 xrefs:
// > SpriteAnimationManager::initWithOwner @ 0x2f3fa4
//
// 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::loadAnimations(_DWORD *a1, const char **a2)
{
ObjectManager *v4; // r0
cocos2d::CCDictionary *Definition; // r4
unsigned int v6; // r10
unsigned int result; // r0
cocos2d::CCString *v8; // r8
char *CString; // r0
cocos2d::CCDictionary *v10; // r5
cocos2d::CCString *v11; // r0
cocos2d::CCString *v12; // r0
cocos2d::CCString *v13; // r0
cocos2d::CCString *v14; // r0
cocos2d::CCString *v15; // r9
char *v16; // r0
cocos2d::CCString *v17; // r0
float v18; // r6
char *v19; // r0
int v20; // r3
unsigned int v21; // r6
cocos2d::CCAnimation *v22; // r4
int v23; // r5
cocos2d::CCSequence *v24; // r5
cocos2d::CCObject *v25; // r9
int v26; // r0
cocos2d::CCAnimation *v27; // r6
cocos2d::CCAnimate *v28; // r0
cocos2d::CCRepeatForever *v29; // r0
cocos2d::CCFiniteTimeAction *v30; // r0
char *v31; // r0
cocos2d::CCDictionary *v32; // [sp+14h] [bp-260h]
cocos2d::CCArray *v33; // [sp+18h] [bp-25Ch]
_BOOL4 v34; // [sp+1Ch] [bp-258h]
_BOOL4 v35; // [sp+20h] [bp-254h]
char *v36; // [sp+20h] [bp-254h]
cocos2d::CCAnimationCache *v37; // [sp+24h] [bp-250h]
char *v38; // [sp+28h] [bp-24Ch]
_BOOL4 v39; // [sp+2Ch] [bp-248h]
int v40; // [sp+4Ch] [bp-228h]
std::string v41; // [sp+58h] [bp-21Ch] BYREF
std::string v42; // [sp+5Ch] [bp-218h] BYREF
int v43; // [sp+60h] [bp-214h]
std::string v44[2]; // [sp+64h] [bp-210h] BYREF
unsigned int v45; // [sp+6Ch] [bp-208h] BYREF
unsigned int v46; // [sp+70h] [bp-204h]
char *v47; // [sp+74h] [bp-200h]
_BYTE v48[500]; // [sp+78h] [bp-1FCh] BYREF
v37 = cocos2d::CCAnimationCache::sharedAnimationCache();
v4 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v4, *a2);
sub_776584((int)v44, "animations");
v32 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(Definition, v44);
sub_774008(v44);
v6 = 0;
v33 = cocos2d::CCDictionary::allKeys(v32);
while ( 1 )
{
result = cocos2d::CCArray::count(v33);
if ( v6 >= result )
return result;
v8 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v33, v6);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_776584((int)&v42, CString);
v10 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v32, &v42);
sub_774008(&v42);
sub_776584((int)&v42, "prio");
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, &v42);
v38 = (char *)cocos2d::CCString::intValue(v11);
sub_774008(&v42);
sub_776584((int)&v42, "looped");
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, &v42);
v39 = cocos2d::CCString::boolValue(v12);
sub_774008(&v42);
sub_776584((int)&v42, "usesParts");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, &v42);
v35 = cocos2d::CCString::boolValue(v13);
sub_774008(&v42);
sub_776584((int)&v42, "dontPlayNext");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v10, &v42);
v34 = cocos2d::CCString::boolValue(v14);
sub_774008(&v42);
sub_776584((int)&v42, "sound");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v10, &v42);
sub_774008(&v42);
if ( v15 )
{
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_776584((int)&v41, v16);
sub_776584((int)&v42, "0");
v40 = sub_774DBC(&v41, &v42);
sub_774008(&v42);
sub_774008(&v41);
if ( v40 )
{
sub_776584((int)&v42, "soundDelay");
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v10, &v42);
v18 = cocos2d::CCString::floatValue(v17);
sub_774008(&v42);
v19 = (char *)cocos2d::CCString::getCString(v8);
sub_776584((int)&v42, v19);
SpriteAnimationManager::storeSoundForAnimation((int)a1, v15, (int)&v42, v18);
sub_774008(&v42);
}
}
v45 = 0;
if ( v35 )
v20 = 2;
else
v20 = 1;
v36 = (char *)v20;
v46 = 500;
v47 = v48;
v42.m_data.m_data = (stl::StringData::Internal *)*a2;
v43 = 0;
fmt::BasicWriter::operator<<(&v45, (char *)v42.m_data.m_data, 0);
v42.m_data.m_data = (stl::StringData::Internal *)"_";
v43 = 0;
fmt::BasicWriter::operator<<(&v45, "_", 0);
v42.m_data.m_data = (stl::StringData::Internal *)cocos2d::CCString::getCString(v8);
v43 = 0;
fmt::BasicWriter::operator<<(&v45, (char *)v42.m_data.m_data, 0);
v21 = v45;
if ( v45 + 1 > v46 )
fmt::internal::Array::grow((int)&v45, v45 + 1);
v47[v21] = 0;
v22 = cocos2d::CCAnimationCache::animationByName(v37, v47);
sub_776584((int)&v41, "singleFrame");
v23 = cocos2d::CCDictionary::objectForKey(v10, &v41);
sub_774008(&v41);
if ( v23 )
{
v24 = (cocos2d::CCSequence *)v22;
v22->m_eObjType = 2;
v25 = v22;
goto LABEL_22;
}
v26 = cocos2d::CCArray::objectAtIndex(v22->m_pFrames, 0);
v27 = (cocos2d::CCAnimation *)v26;
if ( *(_DWORD *)(v26 + 24) == 14 )
v27 = *(cocos2d::CCAnimation **)(v26 + 52);
v28 = cocos2d::CCAnimate::create(v22);
v28->m_eObjType = 0;
v24 = (cocos2d::CCSequence *)v28;
if ( v39 )
{
v29 = cocos2d::CCRepeatForever::create(v28);
}
else
{
if ( v34 )
{
v25 = v28;
goto LABEL_21;
}
v44[0].m_data.m_data = (stl::StringData::Internal *)SpriteAnimationManager::animationFinished;
v44[1].m_data.m_data = nullptr;
v30 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, SpriteAnimationManager::animationFinished, 0);
v29 = (cocos2d::CCRepeatForever *)cocos2d::CCSequence::create(v24, v30, 0);
}
v25 = v29;
LABEL_21:
v22 = v27;
v25->m_eObjType = 0;
LABEL_22:
v31 = (char *)cocos2d::CCString::getCString(v8);
sub_776584((int)&v42, v31);
SpriteAnimationManager::storeAnimation(a1, v24, v25, (const char **)&v42, v38, v36, v22);
sub_774008(&v42);
if ( v47 != v48 )
{
if ( v47 )
operator delete[](v47);
}
++v6;
}
}