//
// SpriteAnimationManager::switchToFirstFrameOfAnimation from 0x1008033d0 to 0x100803564 (404 bytes)
//
// 0 xrefs:
//
// 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 12:36:38 +0000
//
__int64 __fastcall SpriteAnimationManager::switchToFirstFrameOfAnimation(__int64 *a1, __int128 *a2)
{
__int64 result; // rax
void *v3; // rax
int v4; // r15d
__int64 v5; // r15
__int64 v6; // rax
const char *CString; // r12
size_t v8; // rax
size_t v9; // r14
char *v10; // r13
size_t v11; // r15
__int64 v12; // r14
char v13; // [rsp+0h] [rbp-70h]
__int64 v14; // [rsp+8h] [rbp-68h]
__int128 v15; // [rsp+10h] [rbp-60h] BYREF
void *__p; // [rsp+20h] [rbp-50h]
_QWORD __dst[2]; // [rsp+30h] [rbp-40h] BYREF
void *v18; // [rsp+40h] [rbp-30h]
result = cocos2d::CCDictionary::objectForKey(a1[49], (char *)a2);
if ( *(_DWORD *)(result + 28) )
return result;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
sub_10001AD30(&v15, *((const void **)a2 + 2), *((_QWORD *)a2 + 1));
}
else
{
__p = *((void **)a2 + 2);
v15 = *a2;
}
v3 = cocos2d::CCDictionary::valueForKey(a1[42], (__int64)&v15);
v4 = cocos2d::CCString::intValue(v3);
if ( (v15 & 1) != 0 )
operator delete(__p);
CCAnimatedSprite::switchToMode(a1[40], v4);
v5 = a1[49];
v6 = sub_10088E820("%s_first", v13);
CString = (const char *)cocos2d::CCString::getCString(v6);
v8 = strlen(CString);
if ( v8 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v9 = v8;
if ( v8 >= 0x17 )
{
v14 = v5;
v11 = 26;
if ( (v8 | 7) != 0x17 )
v11 = (v8 | 7) + 1;
v10 = (char *)operator new(v11);
v18 = v10;
__dst[0] = v11 + 1;
v5 = v14;
__dst[1] = v9;
}
else
{
LOBYTE(__dst[0]) = 2 * v8;
v10 = (char *)__dst + 1;
if ( !v8 )
goto LABEL_15;
}
memmove(v10, CString, v9);
LABEL_15:
v10[v9] = 0;
v12 = cocos2d::CCDictionary::objectForKey(v5, (char *)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(v18);
result = (unsigned int)(*(_DWORD *)(v12 + 28) - 1);
if ( (unsigned int)result <= 1 )
return (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1[40] + 656) + 1160LL))(
*(_QWORD *)(a1[40] + 656),
v12);
return result;
}