//
// SpriteAnimationManager::createAnimations from 0x100322bbc to 0x100323374 (1976 bytes)
//
// 2 xrefs:
// > ObjectManager::setup @ 0x10024d758
// > SpriteAnimationManager::initWithOwner @ 0x100322b04
//
// 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
//
__int64 __fastcall SpriteAnimationManager::createAnimations(__int64 a1)
{
ObjectManager *v2; // x0
const char *v3; // x1
__int64 result; // x0
ObjectManager *v5; // x0
const char *v6; // x1
ObjectManager *v7; // x0
const char *v8; // x1
cocos2d::CCDictionary *Definition; // x20
cocos2d::CCArray *v10; // x20
unsigned int v11; // w23
cocos2d::CCString *v12; // x0
char *CString; // x0
__int64 v14; // x27
__int64 v15; // x0
cocos2d::CCString *v16; // x20
float v17; // s8
cocos2d::CCArray *v18; // x25
__int64 v19; // x0
cocos2d::CCString *v20; // x20
bool v21; // w26
cocos2d::CCString *v22; // x20
const char *v23; // x1
const char *v24; // x8
void **v25; // x9
cocos2d::CCString *v26; // x0
__int64 v27; // x0
__int64 v28; // x20
cocos2d::CCString *v29; // x0
char *v30; // x0
std::string *v31; // x1
cocos2d::CCSpriteFrame *v32; // x25
int v33; // w8
cocos2d::CCString *v34; // x0
bool v35; // w0
bool v36; // w20
cocos2d::CCString *v37; // x0
char *v38; // x0
char *v39; // x1
cocos2d::CCObject *v40; // x27
std::string *p_str; // x8
std::string::size_type size; // x20
std::string *v43; // x9
std::string::size_type v44; // x11
std::string *v45; // x10
__int64 v46; // x8
__int64 v47; // x19
cocos2d::CCSpriteFrameCache *v48; // x0
std::string *v49; // x1
const char *v50; // x8
void **v51; // x9
cocos2d::CCString *v52; // x0
const char *v53; // x0
cocos2d::CCString *v54; // x0
int v55; // w27
int v56; // w20
std::string *v57; // x8
cocos2d::CCSpriteFrame *v58; // x1
int v59; // w8
cocos2d::CCSpriteFrameCache *v60; // x28
std::string *v61; // x8
cocos2d::CCString *v62; // x0
const char *v63; // x0
std::string::size_type v64; // x28
std::string *v65; // x1
__int64 v66; // x21
bool v67; // zf
std::string::size_type v68; // x11
std::string *v69; // x8
_BYTE *v70; // x9
_BYTE *v71; // x10
std::string::size_type v72; // x11
__int64 v73; // x8
unsigned int v74; // w28
cocos2d::CCString *v75; // x0
int v76; // w0
int v77; // w21
std::string *v78; // x8
cocos2d::CCSpriteFrame *v79; // x1
int v80; // w8
cocos2d::CCSpriteFrameCache *v81; // x20
std::string *v82; // x8
cocos2d::CCString *v83; // x0
const char *v84; // x0
cocos2d::CCAnimation *v85; // x25
const char *v86; // x8
void **v87; // x9
cocos2d::CCString *v88; // x0
const char *v89; // x0
__int64 v90; // [xsp+18h] [xbp-118h]
__int64 v91; // [xsp+20h] [xbp-110h]
cocos2d::CCAnimationCache *v92; // [xsp+28h] [xbp-108h]
cocos2d::CCDictionary *v93; // [xsp+30h] [xbp-100h]
std::string __str; // [xsp+38h] [xbp-F8h] BYREF
void *v95[2]; // [xsp+50h] [xbp-E0h] BYREF
char v96; // [xsp+67h] [xbp-C9h]
std::string v97; // [xsp+68h] [xbp-C8h] BYREF
void *v98[2]; // [xsp+80h] [xbp-B0h] BYREF
char v99; // [xsp+97h] [xbp-99h]
void *__p[2]; // [xsp+98h] [xbp-98h] BYREF
char v101; // [xsp+AFh] [xbp-81h]
std::string v102; // [xsp+B0h] [xbp-80h] BYREF
v2 = ObjectManager::instance();
v3 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v3 = *(const char **)a1;
result = ObjectManager::animLoaded(v2, v3);
if ( (result & 1) == 0 )
{
v5 = ObjectManager::instance();
v6 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v6 = *(const char **)a1;
ObjectManager::setLoaded(v5, v6);
v92 = cocos2d::CCAnimationCache::sharedAnimationCache();
v7 = ObjectManager::instance();
v8 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v8 = *(const char **)a1;
Definition = ObjectManager::getDefinition(v7, v8);
sub_100009900(&v102, "animations");
v93 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1(Definition, &v102);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
v10 = cocos2d::CCDictionary::allKeys(v93);
result = sub_10024A36C((__int64)v10);
if ( (_DWORD)result )
{
v11 = 0;
v90 = a1;
v91 = (__int64)v10;
do
{
v12 = (cocos2d::CCString *)sub_10024A388((__int64)v10, v11);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_100009900(v98, CString);
v14 = cocos2d::CCDictionary::objectForKey_1(v93, v98);
sub_100009900(&v102, "delay");
v15 = cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v16 = (cocos2d::CCString *)v15;
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v102.__r_.__value_.__l.__data_);
if ( v16 )
{
LABEL_14:
v17 = cocos2d::CCString::floatValue(v16);
goto LABEL_17;
}
}
else if ( v15 )
{
goto LABEL_14;
}
v17 = 0.0;
LABEL_17:
v18 = (cocos2d::CCArray *)sub_10024A15C();
sub_100009900(&v102, "usesParts");
v19 = cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v20 = (cocos2d::CCString *)v19;
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v102.__r_.__value_.__l.__data_);
if ( v20 )
{
LABEL_19:
v21 = cocos2d::CCString::boolValue(v20);
goto LABEL_22;
}
}
else if ( v19 )
{
goto LABEL_19;
}
v21 = 0;
LABEL_22:
sub_100009900(&v102, "animFrameName");
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v14, &v102);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
memset(&v97, 0, sizeof(v97));
if ( v22 )
{
v23 = cocos2d::CCString::getCString(v22);
}
else
{
v24 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v24 = *(const char **)a1;
v25 = v98;
if ( v99 < 0 )
v25 = (void **)v98[0];
v26 = (cocos2d::CCString *)sub_100268F4C("%s_%s", v24, (const char *)v25);
v23 = cocos2d::CCString::getCString(v26);
}
std::string::assign(&v97, v23);
sub_100009900(&v102, "singleFrame");
v27 = cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v28 = v27;
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v102.__r_.__value_.__l.__data_);
if ( v28 )
{
LABEL_33:
sub_100009900(__p, "singleFrame");
v29 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v14, __p);
v30 = (char *)cocos2d::CCString::getCString(v29);
sub_100009900(&v102, v30);
if ( v101 < 0 )
{
operator delete(__p[0]);
if ( !v21 )
goto LABEL_61;
LABEL_35:
if ( (v102.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v31 = &v102;
else
v31 = (std::string *)v102.__r_.__value_.__r.__words[0];
sub_100009900(__p, (char *)v31);
v32 = (cocos2d::CCSpriteFrame *)sub_100268E48((__int128 *)__p);
if ( v101 < 0 )
operator delete(__p[0]);
v33 = 1;
}
else
{
if ( v21 )
goto LABEL_35;
LABEL_61:
v48 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( (v102.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v49 = &v102;
else
v49 = (std::string *)v102.__r_.__value_.__r.__words[0];
v32 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v48, (const char *)v49);
v33 = 2;
}
v32->m_eObjType = v33;
v50 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v50 = *(const char **)a1;
v51 = v98;
if ( v99 < 0 )
v51 = (void **)v98[0];
v52 = (cocos2d::CCString *)sub_100268F4C("%s_%s", v50, (const char *)v51);
v53 = cocos2d::CCString::getCString(v52);
cocos2d::CCAnimationCache::addAnimation(v92, (cocos2d::CCAnimation *)v32, v53);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
goto LABEL_137;
}
}
else if ( v27 )
{
goto LABEL_33;
}
sub_100009900(&v102, "other");
v34 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v35 = cocos2d::CCString::boolValue(v34);
v36 = v35;
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(v102.__r_.__value_.__l.__data_);
if ( v36 )
{
LABEL_44:
sub_100009900(&v102, "frames");
v37 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v38 = (char *)cocos2d::CCString::getCString(v37);
sub_100009900(v95, v38);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
if ( v96 >= 0 )
v39 = (char *)v95;
else
v39 = (char *)v95[0];
sub_100009900(&__str, v39);
v40 = sub_10024A15C();
p_str = &__str;
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
{
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
}
else
{
size = __str.__r_.__value_.__l.__size_;
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
}
if ( size )
{
v43 = (std::string *)((char *)p_str + size);
v44 = size;
v45 = p_str;
do
{
if ( v45->__r_.__value_.__s.__data_[0] == 32 )
goto LABEL_57;
v45 = (std::string *)((char *)v45 + 1);
--v44;
}
while ( v44 );
v45 = (std::string *)((char *)p_str + size);
LABEL_57:
v46 = (char *)v45 - (char *)p_str;
if ( v45 == v43 )
v47 = -1;
else
v47 = v46;
}
else
{
v47 = -1;
}
v64 = 0;
while ( 2 )
{
std::string::basic_string(&v102, &__str, v64, v47 - v64, (std::allocator *)__p);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v64 != size || v102.__r_.__value_.__l.__size_ )
{
v65 = (std::string *)v102.__r_.__value_.__r.__words[0];
goto LABEL_96;
}
}
else if ( v64 != size || *((_BYTE *)&v102.__r_.__value_.__s + 23) )
{
v65 = &v102;
LABEL_96:
sub_100009900(__p, (char *)v65);
sub_100268E48((__int128 *)__p);
sub_10024A2D0((__int64)v40);
if ( v101 < 0 )
operator delete(__p[0]);
}
if ( v47 == -1
|| ((v64 = v47 + 1,
v68 = __str.__r_.__value_.__l.__size_,
v69 = &__str,
(__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL)
? (std::string *)(v68 = HIBYTE(__str.__r_.__value_.__r.__words[2]))
: (v69 = (std::string *)__str.__r_.__value_.__r.__words[0]),
v68 <= v64) )
{
v66 = -1;
}
else
{
v70 = (char *)v69 + v68;
v71 = (char *)v69 + v64;
v72 = ~v47 + v68;
while ( *v71 != 32 )
{
++v71;
if ( !--v72 )
{
v71 = v70;
break;
}
}
v73 = v71 - (_BYTE *)v69;
if ( v71 == v70 )
v66 = -1;
else
v66 = v73;
}
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
v67 = v47 == -1;
v47 = v66;
if ( v67 )
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v74 = 0;
a1 = v90;
while ( v74 < (unsigned int)sub_10024A36C((__int64)v40) )
{
v75 = (cocos2d::CCString *)sub_10024A388((__int64)v40, v74);
v76 = cocos2d::CCString::intValue(v75);
v77 = v76;
if ( v21 )
{
if ( (v97.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v78 = &v97;
else
v78 = (std::string *)v97.__r_.__value_.__r.__words[0];
v79 = (cocos2d::CCSpriteFrame *)sub_100268F4C("%s_%03d.png", (const char *)v78, v76);
v80 = 1;
}
else
{
v81 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( (v97.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v82 = &v97;
else
v82 = (std::string *)v97.__r_.__value_.__r.__words[0];
v83 = (cocos2d::CCString *)sub_100268F4C("%s_%03d.png", (const char *)v82, v77);
v84 = cocos2d::CCString::getCString(v83);
v79 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v81, v84);
v80 = 2;
}
v79->m_eObjType = v80;
sub_10024A2D0((__int64)v18);
++v74;
}
if ( v96 < 0 )
operator delete(v95[0]);
goto LABEL_132;
}
continue;
}
}
}
else if ( v35 )
{
goto LABEL_44;
}
sub_100009900(&v102, "frames");
v54 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1(v14, &v102);
v55 = cocos2d::CCString::intValue(v54);
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
if ( v55 >= 1 )
{
v56 = 1;
do
{
if ( v21 )
{
if ( (v97.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v57 = &v97;
else
v57 = (std::string *)v97.__r_.__value_.__r.__words[0];
v58 = (cocos2d::CCSpriteFrame *)sub_100268F4C("%s_%03d.png", (const char *)v57, v56);
v59 = 1;
}
else
{
v60 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( (v97.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v61 = &v97;
else
v61 = (std::string *)v97.__r_.__value_.__r.__words[0];
v62 = (cocos2d::CCString *)sub_100268F4C("%s_%03d.png", (const char *)v61, v56);
v63 = cocos2d::CCString::getCString(v62);
v58 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v60, v63);
v59 = 2;
}
v58->m_eObjType = v59;
sub_10024A2D0((__int64)v18);
++v56;
--v55;
}
while ( v55 );
}
LABEL_132:
v85 = cocos2d::CCAnimation::createWithSpriteFrames(v18, v17);
v86 = (const char *)a1;
if ( *(char *)(a1 + 23) < 0 )
v86 = *(const char **)a1;
v87 = v98;
if ( v99 < 0 )
v87 = (void **)v98[0];
v88 = (cocos2d::CCString *)sub_100268F4C("%s_%s", v86, (const char *)v87);
v89 = cocos2d::CCString::getCString(v88);
cocos2d::CCAnimationCache::addAnimation(v92, v85, v89);
LABEL_137:
if ( SHIBYTE(v97.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v97.__r_.__value_.__l.__data_);
if ( v99 < 0 )
operator delete(v98[0]);
++v11;
v10 = (cocos2d::CCArray *)v91;
result = sub_10024A36C(v91);
}
while ( v11 < (unsigned int)result );
}
}
return result;
}