//
// SpriteAnimationManager::switchToFirstFrameOfAnimation from 0x1007244b0 to 0x100724644 (404 bytes)
//
// 0 xrefs:
//
// 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::switchToFirstFrameOfAnimation(__int64 a1, __int128 *a2, __m128 a3)
{
__int64 result; // rax
cocos2d::CCString *v4; // rax
spriteMode v5; // r15d
__int64 v6; // r15
cocos2d::CCString *v7; // rax
const char *CString; // r12
size_t v9; // rax
size_t v10; // r14
char *v11; // r13
size_t v12; // r15
__int64 v13; // r14
char v14; // [rsp+0h] [rbp-70h]
__int64 v15; // [rsp+8h] [rbp-68h]
__int128 v16; // [rsp+10h] [rbp-60h] BYREF
void *__p; // [rsp+20h] [rbp-50h]
_QWORD __dst[2]; // [rsp+30h] [rbp-40h] BYREF
void *v19; // [rsp+40h] [rbp-30h]
result = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 392), (char *)a2);
if ( *(_DWORD *)(result + 28) )
return result;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_100006B70(&v16, *((const void **)a2 + 2), *((_QWORD *)a2 + 1), *(double *)a3.i64);
}
else
{
__p = *((void **)a2 + 2);
a3 = (__m128)*a2;
v16 = *a2;
}
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1(*(_QWORD *)(a1 + 336), (__int64)&v16);
v5 = cocos2d::CCString::intValue(v4);
if ( (v16 & 1) != 0 )
operator delete(__p);
CCAnimatedSprite::switchToMode(*(CCAnimatedSprite **)(a1 + 320), v5);
v6 = *(_QWORD *)(a1 + 392);
v7 = (cocos2d::CCString *)sub_1007AB580("%s_first", v14);
CString = cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a3.i64);
v10 = v9;
if ( v9 >= 0x17 )
{
v15 = v6;
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v11 = (char *)operator new(v12);
v19 = v11;
__dst[0] = v12 + 1;
v6 = v15;
__dst[1] = v10;
}
else
{
LOBYTE(__dst[0]) = 2 * v9;
v11 = (char *)__dst + 1;
if ( !v9 )
goto LABEL_15;
}
memmove(v11, CString, v10);
LABEL_15:
v11[v10] = 0;
v13 = cocos2d::CCDictionary::objectForKey_1(v6, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(v19);
result = (unsigned int)(*(_DWORD *)(v13 + 28) - 1);
if ( (unsigned int)result <= 1 )
return (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 656LL) + 1144LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL),
v13);
return result;
}