//
// SpriteAnimationManager::executeAnimation from 0x6afed0 to 0x6b0248 (888 bytes)
//
// 3 xrefs:
// > SpriteAnimationManager::runAnimation @ 0x6b0568
// > SpriteAnimationManager::runQueuedAnimation @ 0x6b13d0
// > ??> @ 0x978a0
//
// This function is hookable on this platform (idp: arm, 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:50:50 +0000
//
__int64 __fastcall SpriteAnimationManager::executeAnimation(__int64 a1, __int64 a2)
{
__int64 *v2; // x22
const void *v6; // x1
size_t v7; // x2
char v8; // w0
__int64 v9; // x0
__int64 v10; // x1
cocos2d::CCAction *v11; // x23
char v12; // w0
int v13; // w24
__int64 v14; // x0
__int64 v15; // x1
int AnimType; // w25
__int64 v17; // x24
cocos2d::CCString *v18; // x0
const char *CString; // x0
size_t v20; // x0
__int64 v21; // x1
char v22; // w0
__int64 v23; // x0
__int64 v24; // x1
int v25; // w19
_BOOL4 v26; // w24
char *v27; // [xsp+58h] [xbp+58h]
__int64 v28; // [xsp+58h] [xbp+58h]
__int64 v29; // [xsp+60h] [xbp+60h] BYREF
__int64 v30; // [xsp+68h] [xbp+68h]
void *v31; // [xsp+70h] [xbp+70h]
v2 = (__int64 *)(a1 + 400);
if ( sub_6AF58C(a1 + 400, a2) )
return _stack_chk_guard;
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)(*(_QWORD *)(a1 + 320) + 656LL));
if ( v2 != (__int64 *)a2 )
{
if ( (*(_BYTE *)a2 & 1) != 0 )
{
v6 = *(const void **)(a2 + 16);
v7 = *(_QWORD *)(a2 + 8);
}
else
{
v6 = (const void *)(a2 + 1);
v7 = *(_BYTE *)a2 >> 1;
}
std::string::assign(v2, v6, v7);
}
v8 = *(_BYTE *)a2;
v29 = 0;
v30 = 0;
v31 = nullptr;
if ( (v8 & 1) != 0 )
{
std::string::__init(&v29, *(void **)(a2 + 16), *(_QWORD *)(a2 + 8));
}
else
{
v9 = *(_QWORD *)a2;
v10 = *(_QWORD *)(a2 + 8);
v31 = *(void **)(a2 + 16);
v29 = v9;
v30 = v10;
}
SpriteAnimationManager::playSoundForAnimation(a1, (__int64)&v29);
if ( (v29 & 1) != 0 )
operator delete(v31);
v11 = (cocos2d::CCAction *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 392), a2);
if ( !*((_DWORD *)v11 + 7) )
{
v12 = *(_BYTE *)a2;
v13 = *(_DWORD *)(*(_QWORD *)(a1 + 320) + 680LL);
v29 = 0;
v30 = 0;
v31 = nullptr;
if ( (v12 & 1) != 0 )
{
std::string::__init(&v29, *(void **)(a2 + 16), *(_QWORD *)(a2 + 8));
}
else
{
v14 = *(_QWORD *)a2;
v15 = *(_QWORD *)(a2 + 8);
v31 = *(void **)(a2 + 16);
v29 = v14;
v30 = v15;
}
AnimType = SpriteAnimationManager::getAnimType(a1, (__int64)&v29);
if ( (v29 & 1) != 0 )
operator delete(v31);
CCAnimatedSprite::willPlayAnimation(*(CCAnimatedSprite **)(a1 + 320));
CCAnimatedSprite::switchToMode(*(_QWORD *)(a1 + 320), AnimType);
if ( v13 != *(_DWORD *)(*(_QWORD *)(a1 + 320) + 680LL) )
goto LABEL_17;
v29 = 0;
v30 = 0;
v31 = nullptr;
std::string::__init(&v29, "spawn", 5u);
v26 = sub_6AF58C(a2, (__int64)&v29);
if ( (v29 & 1) != 0 )
{
operator delete(v31);
if ( v26 )
goto LABEL_17;
}
else if ( v26 )
{
LABEL_17:
v17 = *(_QWORD *)(a1 + 392);
if ( (*(_BYTE *)a2 & 1) != 0 )
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_first",
*(const char **)(a2 + 16));
else
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_first",
(const char *)(a2 + 1));
CString = (const char *)cocos2d::CCString::getCString(v18);
v29 = 0;
v27 = (char *)CString;
v30 = 0;
v31 = nullptr;
v20 = strlen(CString);
std::string::__init(&v29, v27, v20);
v21 = cocos2d::CCDictionary::objectForKey(v17, &v29);
if ( (v29 & 1) != 0 )
{
v28 = v21;
operator delete(v31);
v21 = v28;
}
if ( (unsigned int)(*(_DWORD *)(v21 + 28) - 1) <= 1 )
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 656LL) + 1160LL))(*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL));
}
(*(void (__fastcall **)(cocos2d::CCAction *, __int64))(*(_QWORD *)v11 + 72LL))(v11, 1);
cocos2d::CCNode::runAction(*(cocos2d::CCNode **)(*(_QWORD *)(a1 + 320) + 656LL), v11);
return _stack_chk_guard;
}
v22 = *(_BYTE *)a2;
v29 = 0;
v30 = 0;
v31 = nullptr;
if ( (v22 & 1) != 0 )
{
std::string::__init(&v29, *(void **)(a2 + 16), *(_QWORD *)(a2 + 8));
}
else
{
v23 = *(_QWORD *)a2;
v24 = *(_QWORD *)(a2 + 8);
v31 = *(void **)(a2 + 16);
v29 = v23;
v30 = v24;
}
v25 = SpriteAnimationManager::getAnimType(a1, (__int64)&v29);
if ( (v29 & 1) != 0 )
operator delete(v31);
CCAnimatedSprite::willPlayAnimation(*(CCAnimatedSprite **)(a1 + 320));
CCAnimatedSprite::switchToMode(*(_QWORD *)(a1 + 320), v25);
(*(void (__fastcall **)(_QWORD, cocos2d::CCAction *))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 656LL) + 1160LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL),
v11);
return _stack_chk_guard;
}