//
// SpriteAnimationManager::loadAnimations from 0x1400853e0 to 0x140085e85 (2725 bytes)
//
// 2 xrefs:
// > SpriteAnimationManager::initWithOwner @ 0x1400853a4
// > ??> @ 0x140912524
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:25:57 +0000
//
// Hidden C++ exception states: #wind=10
void __fastcall SpriteAnimationManager::loadAnimations(__int64 a1, _QWORD *a2)
{
_QWORD *v2; // r15
int v3; // r12d
_BYTE *v4; // rbx
__int64 v5; // rax
__int64 Definition; // rax
__m128i si128; // xmm8
cocos2d::CCDictionary *v8; // rsi
void *v9; // r8
__m128i v10; // xmm7
cocos2d::CCArray *v11; // rdi
unsigned int v12; // ebx
__m128i v13; // xmm14
__m128i v14; // xmm11
__m128i v15; // xmm13
__m128i v16; // xmm12
__m128i v17; // xmm10
__m128i v18; // xmm9
const char *CString; // rax
size_t v20; // r8
__int64 v21; // r13
void *v22; // rcx
cocos2d::CCString *v23; // rax
void *v24; // rcx
cocos2d::CCString *v25; // rax
void *v26; // rcx
cocos2d::CCString *v27; // rax
void *v28; // rcx
cocos2d::CCString *v29; // rax
void *v30; // rcx
cocos2d::CCString *v31; // r15
void *v32; // rcx
unsigned __int64 v33; // r14
int v34; // r12d
const char *v35; // rax
size_t v36; // r8
void **v37; // rcx
char *v38; // rbx
unsigned __int64 v39; // rdi
__int64 v40; // rsi
size_t v41; // r8
char v42; // si
char *v43; // rax
void *v44; // rcx
cocos2d::CCString *v45; // rax
float v46; // xmm6_4
void *v47; // rcx
cocos2d::CCString *v48; // rdi
const char *v49; // rax
size_t v50; // r8
__int64 v51; // rbx
struct cocos2d::CCString *v52; // rax
_QWORD *v53; // rax
const char *v54; // rax
struct cocos2d::CCAnimation *v55; // rbx
__int64 v56; // rdi
void *v57; // rcx
struct cocos2d::CCFiniteTimeAction *v58; // rdi
__int64 v59; // rsi
struct cocos2d::CCObject *v60; // rax
struct cocos2d::CCAnimate *v61; // rax
struct cocos2d::CCRepeatForever *v62; // rax
__int64 v63; // rax
const char *v64; // rax
size_t v65; // r8
bool v66; // [rsp+48h] [rbp-C0h]
bool v67; // [rsp+49h] [rbp-BFh]
bool v68; // [rsp+4Ah] [rbp-BEh]
unsigned int v69; // [rsp+4Ch] [rbp-BCh]
int v70; // [rsp+58h] [rbp-B0h]
cocos2d::CCString *v71; // [rsp+60h] [rbp-A8h]
cocos2d::CCAnimationCache *v74; // [rsp+78h] [rbp-90h]
cocos2d::CCArray *v75; // [rsp+80h] [rbp-88h]
cocos2d::CCDictionary *v76; // [rsp+88h] [rbp-80h]
_QWORD v77[2]; // [rsp+98h] [rbp-70h] BYREF
_QWORD v78[2]; // [rsp+A8h] [rbp-60h] BYREF
_QWORD v79[3]; // [rsp+B8h] [rbp-50h] BYREF
void *Buf1[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i v81; // [rsp+E0h] [rbp-28h]
__int128 Buf2; // [rsp+F0h] [rbp-18h] BYREF
__m128i v83; // [rsp+100h] [rbp-8h]
void *Block[2]; // [rsp+110h] [rbp+8h] BYREF
__m128i v85; // [rsp+120h] [rbp+18h]
__int128 v86; // [rsp+130h] [rbp+28h] BYREF
__m128i v87; // [rsp+140h] [rbp+38h]
__int128 v88; // [rsp+150h] [rbp+48h] BYREF
__m128i v89; // [rsp+160h] [rbp+58h]
_BYTE v90[528]; // [rsp+178h] [rbp+70h] BYREF
v2 = a2;
v79[2] = a2;
v3 = 0;
v74 = (cocos2d::CCAnimationCache *)cocos2d::CCAnimationCache::sharedAnimationCache();
v4 = v2;
if ( v2[3] > 0xFu )
v4 = (_BYTE *)*v2;
v5 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v5, v4);
Block[1] = (void *)29550;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
v85 = si128;
Block[0] = (void *)0x6F6974616D696E61LL;
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(Definition, Block);
v76 = v8;
if ( v85.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(v85.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
v10 = _mm_load_si128((const __m128i *)&Size);
v85 = v10;
LOBYTE(Block[0]) = 0;
v11 = cocos2d::CCDictionary::allKeys(v8);
v75 = v11;
v12 = 0;
v69 = 0;
if ( cocos2d::CCArray::count(v11) )
{
v13 = _mm_load_si128((const __m128i *)&xmmword_1408365C0);
v14 = _mm_load_si128((const __m128i *)&xmmword_140836560);
v15 = _mm_load_si128((const __m128i *)&xmmword_1408365D0);
v16 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
v17 = _mm_load_si128((const __m128i *)&xmmword_140836570);
v18 = _mm_load_si128((const __m128i *)&xmmword_140836550);
while ( 1 )
{
v71 = cocos2d::CCArray::objectAtIndex(v11, v12);
CString = cocos2d::CCString::getCString(v71);
v88 = 0;
v89 = 0;
v20 = -1;
do
++v20;
while ( CString[v20] );
sub_14003D230(&v88, CString, v20);
v21 = cocos2d::CCDictionary::objectForKey(v8, &v88);
if ( v89.m128i_i64[1] > 0xFuLL )
{
v22 = (void *)v88;
if ( (unsigned __int64)(v89.m128i_i64[1] + 1) >= 0x1000 )
{
v22 = *(void **)(v88 - 8);
if ( (unsigned __int64)(v88 - (_QWORD)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
v89 = v10;
LOBYTE(v88) = 0;
Buf2 = 0;
v83 = v18;
strcpy((char *)&Buf2, "prio");
v23 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21, &Buf2);
v70 = cocos2d::CCString::intValue(v23);
if ( v83.m128i_i64[1] > 0xFuLL )
{
v24 = (void *)Buf2;
if ( (unsigned __int64)(v83.m128i_i64[1] + 1) >= 0x1000 )
{
v24 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
*(_OWORD *)Buf1 = 0;
v81 = v17;
strcpy((char *)Buf1, "looped");
v25 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21, Buf1);
v67 = cocos2d::CCString::boolValue(v25);
if ( v81.m128i_i64[1] > 0xFuLL )
{
v26 = Buf1[0];
if ( (unsigned __int64)(v81.m128i_i64[1] + 1) >= 0x1000 )
{
v26 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
Buf1[1] = (void *)115;
v81 = v16;
Buf1[0] = (void *)0x7472615073657375LL;
v27 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21, Buf1);
v66 = cocos2d::CCString::boolValue(v27);
if ( v81.m128i_i64[1] > 0xFuLL )
{
v28 = Buf1[0];
if ( (unsigned __int64)(v81.m128i_i64[1] + 1) >= 0x1000 )
{
v28 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v28 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v28);
}
v81 = v15;
strcpy((char *)Buf1, "dontPlayNext");
BYTE5(Buf1[1]) = 0;
HIWORD(Buf1[1]) = 0;
v29 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21, Buf1);
v68 = cocos2d::CCString::boolValue(v29);
if ( v81.m128i_i64[1] > 0xFuLL )
{
v30 = Buf1[0];
if ( (unsigned __int64)(v81.m128i_i64[1] + 1) >= 0x1000 )
{
v30 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v30 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v30);
}
v86 = 0;
v87 = v14;
strcpy((char *)&v86, "sound");
v31 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v21, &v86);
if ( v87.m128i_i64[1] > 0xFuLL )
{
v32 = (void *)v86;
if ( (unsigned __int64)(v87.m128i_i64[1] + 1) >= 0x1000 )
{
v32 = *(void **)(v86 - 8);
if ( (unsigned __int64)(v86 - (_QWORD)v32 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v32);
}
v87 = v10;
LOBYTE(v86) = 0;
if ( !v31 )
break;
Buf2 = 0;
v83.m128i_i64[0] = 1;
v33 = 15;
v83.m128i_i64[1] = 15;
LOWORD(Buf2) = 48;
v34 = v3 | 1;
v35 = cocos2d::CCString::getCString(v31);
*(_OWORD *)Buf1 = 0;
v81 = 0u;
v36 = -1;
do
++v36;
while ( v35[v36] );
sub_14003D230(Buf1, v35, v36);
v3 = v34 | 2;
v37 = Buf1;
v38 = (char *)Buf1[0];
v39 = v81.m128i_u64[1];
if ( v81.m128i_i64[1] > 0xFuLL )
v37 = (void **)Buf1[0];
v40 = v81.m128i_i64[0];
v41 = v81.m128i_i64[0];
if ( v81.m128i_i64[0] > 1uLL )
v41 = 1;
if ( !memcmp(v37, &Buf2, v41) && v40 == 1 )
goto LABEL_47;
v42 = 1;
LABEL_48:
if ( (v3 & 2) != 0 )
{
v3 &= ~2u;
if ( v39 > 0xF )
{
v43 = v38;
if ( v39 + 1 >= 0x1000 )
{
v38 = *((char **)v38 - 1);
if ( (unsigned __int64)(v43 - v38 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v38);
}
}
if ( (v3 & 1) != 0 )
{
v3 &= ~1u;
if ( v33 > 0xF )
{
v44 = (void *)Buf2;
if ( v33 + 1 >= 0x1000 )
{
v44 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v44 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v44);
}
}
if ( v42 )
{
*((_QWORD *)&Buf2 + 1) = 31073;
v83 = si128;
*(_QWORD *)&Buf2 = 0x6C6544646E756F73LL;
v45 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v21, &Buf2);
v46 = cocos2d::CCString::floatValue(v45);
if ( v83.m128i_i64[1] > 0xFuLL )
{
v47 = (void *)Buf2;
if ( (unsigned __int64)(v83.m128i_i64[1] + 1) >= 0x1000 )
{
v47 = *(void **)(Buf2 - 8);
if ( (unsigned __int64)(Buf2 - (_QWORD)v47 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v47);
}
v48 = v71;
v49 = cocos2d::CCString::getCString(v71);
*(_OWORD *)Buf1 = 0;
v81 = 0u;
v50 = -1;
do
++v50;
while ( v49[v50] );
sub_14003D230(Buf1, v49, v50);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 344), v31, Buf1);
v51 = *(_QWORD *)(a1 + 344);
v52 = cocos2d::CCString::createWithFormat("%f", v46);
cocos2d::CCDictionary::setObject(v51, v52, Buf1);
sub_14003D310((__int64)Buf1);
}
else
{
v48 = v71;
}
fmt::BasicWriter::BasicWriter(v90);
v2 = a2;
v53 = a2;
if ( a2[3] > 0xFu )
v53 = (_QWORD *)*a2;
v77[0] = v53;
v77[1] = 0;
fmt::BasicWriter::operator<<(v90, v77);
v78[0] = "_";
v78[1] = 0;
fmt::BasicWriter::operator<<(v90, v78);
v79[0] = cocos2d::CCString::getCString(v48);
v79[1] = 0;
fmt::BasicWriter::operator<<(v90, v79);
v54 = (const char *)fmt::BasicWriter::c_str(v90);
v55 = cocos2d::CCAnimationCache::animationByName(v74, v54);
v81 = v13;
Buf1[0] = (void *)0x7246656C676E6973LL;
Buf1[1] = (void *)6647137;
v56 = cocos2d::CCDictionary::objectForKey(v21, Buf1);
if ( v81.m128i_i64[1] > 0xFuLL )
{
v57 = Buf1[0];
if ( (unsigned __int64)(v81.m128i_i64[1] + 1) >= 0x1000 )
{
v57 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v57 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v57);
}
if ( !v56 )
{
v60 = cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)v55 + 9), 0);
v59 = (__int64)v60;
if ( *((_DWORD *)v60 + 7) == 14 )
v59 = *((_QWORD *)v60 + 7);
v61 = cocos2d::CCAnimate::create(v55);
v58 = v61;
*((_DWORD *)v61 + 7) = 0;
v55 = v61;
if ( v67 )
{
v62 = cocos2d::CCRepeatForever::create(v61);
goto LABEL_81;
}
if ( !v68 )
{
v63 = cocos2d::CCCallFunc::create(a1, SpriteAnimationManager::animationFinished);
v62 = cocos2d::CCSequence::create(v58, v63, 0);
LABEL_81:
v55 = v62;
}
*((_DWORD *)v55 + 7) = 0;
goto LABEL_83;
}
LODWORD(v58) = (_DWORD)v55;
v59 = (__int64)v55;
*((_DWORD *)v55 + 7) = 2;
LABEL_83:
v64 = cocos2d::CCString::getCString(v71);
Buf2 = 0;
v83 = 0u;
v65 = -1;
do
++v65;
while ( v64[v65] );
sub_14003D230(&Buf2, v64, v65);
SpriteAnimationManager::storeAnimation(a1, (_DWORD)v58, (_DWORD)v55, (unsigned int)&Buf2, v70, v66 + 1, v59);
fmt::BasicWriter::~BasicWriter(v90);
v12 = ++v69;
v11 = v75;
if ( v69 >= cocos2d::CCArray::count(v75) )
goto LABEL_97;
v8 = v76;
}
v33 = v83.m128i_u64[1];
v39 = v81.m128i_u64[1];
v38 = (char *)Buf1[0];
LABEL_47:
v42 = 0;
goto LABEL_48;
}
LABEL_97:
sub_14003D310((__int64)v2);
}