//
// SpriteAnimationManager::loadAnimations from 0x140072600 to 0x140072fce (2510 bytes)
//
// 2 xrefs:
// > SpriteAnimationManager::initWithOwner @ 0x1400725c3
// > ??> @ 0x1406c6300
//
// 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
//
// Hidden C++ exception states: #wind=9
void __fastcall SpriteAnimationManager::loadAnimations(__int64 a1, const char *a2)
{
const char *v2; // r15
int v3; // r13d
const char *v4; // rbx
ObjectManager *v5; // rax
cocos2d::CCDictionary *Definition; // rax
cocos2d::CCDictionary *v7; // rsi
void *v8; // rcx
cocos2d::CCArray *v9; // rdi
unsigned int v10; // ebx
const char *CString; // rax
size_t v12; // r8
__int64 v13; // r12
void *v14; // rcx
cocos2d::CCString *v15; // rax
void *v16; // rcx
cocos2d::CCString *v17; // rax
void *v18; // rcx
cocos2d::CCString *v19; // rax
void *v20; // rcx
cocos2d::CCString *v21; // rax
void *v22; // rcx
cocos2d::CCString *v23; // r15
void *v24; // rcx
unsigned __int64 v25; // r14
int v26; // r13d
const char *v27; // rax
size_t v28; // r8
void **v29; // rcx
char *v30; // rbx
unsigned __int64 v31; // rsi
unsigned __int64 v32; // rdi
size_t v33; // r8
char v34; // di
char *v35; // rax
void *v36; // rcx
cocos2d::CCString *v37; // rax
float v38; // xmm6_4
void *v39; // rcx
cocos2d::CCString *v40; // rbx
const char *v41; // rax
size_t v42; // r8
__int64 v43; // rdi
struct cocos2d::CCString *v44; // rax
const char *v45; // rax
const char *v46; // rax
struct cocos2d::CCAnimation *v47; // rbx
__int64 v48; // rdi
void *v49; // rcx
struct cocos2d::CCFiniteTimeAction *v50; // rdi
__int64 v51; // rsi
struct cocos2d::CCObject *v52; // rax
struct cocos2d::CCAnimate *v53; // rax
struct cocos2d::CCRepeatForever *v54; // rax
__int64 v55; // rax
const char *v56; // rax
size_t v57; // r8
bool v58; // [rsp+40h] [rbp-C0h]
bool v59; // [rsp+41h] [rbp-BFh]
bool v60; // [rsp+42h] [rbp-BEh]
unsigned int v61; // [rsp+44h] [rbp-BCh]
__int128 v62; // [rsp+50h] [rbp-B0h] BYREF
int v63; // [rsp+60h] [rbp-A0h]
cocos2d::CCString *v64; // [rsp+68h] [rbp-98h]
__int64 v65; // [rsp+70h] [rbp-90h]
const char *v66; // [rsp+78h] [rbp-88h]
cocos2d::CCAnimationCache *v67; // [rsp+80h] [rbp-80h]
cocos2d::CCArray *v68; // [rsp+88h] [rbp-78h]
cocos2d::CCDictionary *v69; // [rsp+90h] [rbp-70h]
__int128 v70; // [rsp+A0h] [rbp-60h]
const char *v71; // [rsp+B0h] [rbp-50h]
__int64 v72; // [rsp+B8h] [rbp-48h]
__int128 v73; // [rsp+C0h] [rbp-40h]
const char *v74; // [rsp+D0h] [rbp-30h]
void *Buf1[2]; // [rsp+D8h] [rbp-28h] BYREF
unsigned __int64 v76; // [rsp+E8h] [rbp-18h]
unsigned __int64 v77; // [rsp+F0h] [rbp-10h]
__int128 Buf2; // [rsp+F8h] [rbp-8h] BYREF
__int64 v79; // [rsp+108h] [rbp+8h]
__int64 v80; // [rsp+110h] [rbp+10h]
void *Block[2]; // [rsp+118h] [rbp+18h] BYREF
__int64 v82; // [rsp+128h] [rbp+28h]
unsigned __int64 v83; // [rsp+130h] [rbp+30h]
__int128 v84; // [rsp+138h] [rbp+38h] BYREF
__int64 v85; // [rsp+148h] [rbp+48h]
unsigned __int64 v86; // [rsp+150h] [rbp+50h]
__int128 v87; // [rsp+158h] [rbp+58h] BYREF
__int64 v88; // [rsp+168h] [rbp+68h]
unsigned __int64 v89; // [rsp+170h] [rbp+70h]
_BYTE v90[528]; // [rsp+180h] [rbp+80h] BYREF
v2 = a2;
v66 = a2;
v65 = a1;
v74 = a2;
v3 = 0;
LODWORD(v62) = 0;
v67 = (cocos2d::CCAnimationCache *)cocos2d::CCAnimationCache::sharedAnimationCache();
v4 = v2;
if ( *((_QWORD *)v2 + 3) > 0xFu )
v4 = *(const char **)v2;
v5 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v5, v4);
Block[1] = (void *)29550;
v82 = 10;
v83 = 15;
Block[0] = (void *)0x6F6974616D696E61LL;
v7 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(Definition, Block);
v69 = v7;
if ( v83 > 0xF )
{
v8 = Block[0];
if ( v83 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v82 = 0;
v83 = 15;
LOBYTE(Block[0]) = 0;
v9 = cocos2d::CCDictionary::allKeys(v7);
v68 = v9;
v10 = 0;
v61 = 0;
if ( cocos2d::CCArray::count(v9) )
{
while ( 1 )
{
v64 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v9, v10);
CString = cocos2d::CCString::getCString(v64);
v87 = 0;
v88 = 0;
v89 = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003A930(&v87, CString, v12);
v13 = cocos2d::CCDictionary::objectForKey(v7, &v87);
if ( v89 > 0xF )
{
v14 = (void *)v87;
if ( v89 + 1 >= 0x1000 )
{
v14 = *(void **)(v87 - 8);
if ( (unsigned __int64)(v87 - (_QWORD)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
v88 = 0;
v89 = 15;
LOBYTE(v87) = 0;
*(_OWORD *)Buf1 = 0;
v76 = 4;
v77 = 15;
strcpy((char *)Buf1, "prio");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v13, Buf1);
v63 = cocos2d::CCString::intValue(v15);
if ( v77 > 0xF )
{
v16 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v16 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
*(_OWORD *)Buf1 = 0;
v76 = 6;
v77 = 15;
strcpy((char *)Buf1, "looped");
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v13, Buf1);
v59 = cocos2d::CCString::boolValue(v17);
if ( v77 > 0xF )
{
v18 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v18 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v18 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v18);
}
Buf1[1] = (void *)115;
v76 = 9;
v77 = 15;
Buf1[0] = (void *)0x7472615073657375LL;
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v13, Buf1);
v58 = cocos2d::CCString::boolValue(v19);
if ( v77 > 0xF )
{
v20 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v20 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v20);
}
v76 = 12;
v77 = 15;
strcpy((char *)Buf1, "dontPlayNext");
BYTE5(Buf1[1]) = 0;
HIWORD(Buf1[1]) = 0;
v21 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v13, Buf1);
v60 = cocos2d::CCString::boolValue(v21);
if ( v77 > 0xF )
{
v22 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v22 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v22 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v22);
}
v84 = 0;
v85 = 5;
v86 = 15;
strcpy((char *)&v84, "sound");
v23 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v13, &v84);
if ( v86 > 0xF )
{
v24 = (void *)v84;
if ( v86 + 1 >= 0x1000 )
{
v24 = *(void **)(v84 - 8);
if ( (unsigned __int64)(v84 - (_QWORD)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
v85 = 0;
v86 = 15;
LOBYTE(v84) = 0;
if ( !v23 )
break;
Buf2 = 0;
v79 = 1;
v25 = 15;
v80 = 15;
LOWORD(Buf2) = 48;
v26 = v3 | 1;
LODWORD(v62) = v26;
v27 = cocos2d::CCString::getCString(v23);
*(_OWORD *)Buf1 = 0;
v76 = 0;
v77 = 0;
v28 = -1;
do
++v28;
while ( v27[v28] );
sub_14003A930(Buf1, v27, v28);
v3 = v26 | 2;
v29 = Buf1;
v30 = (char *)Buf1[0];
v31 = v77;
if ( v77 > 0xF )
v29 = (void **)Buf1[0];
v32 = v76;
v33 = v76;
if ( v76 > 1 )
v33 = 1;
if ( !memcmp(v29, &Buf2, v33) && v32 == 1 )
goto LABEL_46;
v34 = 1;
LABEL_47:
if ( (v3 & 2) != 0 )
{
v3 &= ~2u;
if ( v31 > 0xF )
{
v35 = v30;
if ( v31 + 1 >= 0x1000 )
{
v30 = *((char **)v30 - 1);
if ( (unsigned __int64)(v35 - v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v30);
}
}
if ( (v3 & 1) != 0 )
{
v3 &= ~1u;
if ( v25 > 0xF )
{
v36 = (void *)Buf2;
if ( v25 + 1 >= 0x1000 )
{
v36 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v36 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v36);
}
}
if ( v34 )
{
Buf1[1] = (void *)31073;
v76 = 10;
v77 = 15;
Buf1[0] = (void *)0x6C6544646E756F73LL;
v37 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v13, Buf1);
v38 = cocos2d::CCString::floatValue(v37);
if ( v77 > 0xF )
{
v39 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v39 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v39 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v39);
}
v40 = v64;
v41 = cocos2d::CCString::getCString(v64);
*(_OWORD *)Buf1 = 0;
v76 = 0;
v77 = 0;
v42 = -1;
do
++v42;
while ( v41[v42] );
sub_14003A930(Buf1, v41, v42);
*(_QWORD *)&v62 = Buf1;
v43 = v65;
cocos2d::CCDictionary::setObject(*(_QWORD *)(v65 + 344), v23, Buf1);
v44 = cocos2d::CCString::createWithFormat("%f", v38);
cocos2d::CCDictionary::setObject(*(_QWORD *)(v43 + 344), v44, Buf1);
sub_14003A830((__int64)Buf1);
}
else
{
v40 = v64;
}
fmt::BasicWriter::BasicWriter(v90);
v2 = v66;
v45 = v66;
if ( *((_QWORD *)v66 + 3) > 0xFu )
v45 = *(const char **)v66;
v70 = (unsigned __int64)v45;
v62 = (unsigned __int64)v45;
fmt::BasicWriter::operator<<(v90, &v62);
v71 = "_";
v72 = 0;
v62 = (unsigned __int64)"_";
fmt::BasicWriter::operator<<(v90, &v62);
v73 = (unsigned __int64)cocos2d::CCString::getCString(v40);
v62 = v73;
fmt::BasicWriter::operator<<(v90, &v62);
v46 = (const char *)fmt::BasicWriter::c_str(v90);
v47 = cocos2d::CCAnimationCache::animationByName(v67, v46);
v76 = 11;
v77 = 15;
Buf1[0] = (void *)0x7246656C676E6973LL;
Buf1[1] = (void *)6647137;
v48 = cocos2d::CCDictionary::objectForKey(v13, Buf1);
if ( v77 > 0xF )
{
v49 = Buf1[0];
if ( v77 + 1 >= 0x1000 )
{
v49 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v49 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v49);
}
if ( !v48 )
{
v52 = cocos2d::CCArray::objectAtIndex(v47->m_pFrames, 0);
v51 = (__int64)v52;
if ( v52->m_eObjType == (LevelEditorLayerObjectType|0x8) )
v51 = (__int64)v52[1].__vftable;
v53 = cocos2d::CCAnimate::create(v47);
v50 = v53;
v53->m_eObjType = 0;
v47 = (struct cocos2d::CCAnimation *)v53;
if ( v59 )
{
v54 = cocos2d::CCRepeatForever::create(v53);
goto LABEL_80;
}
if ( !v60 )
{
v55 = cocos2d::CCCallFunc::create(v65, SpriteAnimationManager::animationFinished);
v54 = (struct cocos2d::CCRepeatForever *)cocos2d::CCSequence::create(v50, v55, 0);
LABEL_80:
v47 = (struct cocos2d::CCAnimation *)v54;
}
v47->m_eObjType = 0;
goto LABEL_82;
}
LODWORD(v50) = (_DWORD)v47;
v51 = (__int64)v47;
v47->m_eObjType = 2;
LABEL_82:
v56 = cocos2d::CCString::getCString(v64);
Buf2 = 0;
v79 = 0;
v80 = 0;
v57 = -1;
do
++v57;
while ( v56[v57] );
sub_14003A930(&Buf2, v56, v57);
SpriteAnimationManager::storeAnimation(v65, (_DWORD)v50, (_DWORD)v47, (unsigned int)&Buf2, v63, v58 + 1, v51);
fmt::BasicWriter::~BasicWriter(v90);
v10 = ++v61;
v9 = v68;
if ( v61 >= cocos2d::CCArray::count(v68) )
goto LABEL_96;
v7 = v69;
}
v25 = v80;
v31 = v77;
v30 = (char *)Buf1[0];
LABEL_46:
v34 = 0;
goto LABEL_47;
}
LABEL_96:
sub_14003A830((__int64)v2);
}