//
// CCAnimatedSprite::switchToMode from 0x68c7ac to 0x68c8cc (288 bytes)
//
// 4 xrefs:
// > SpriteAnimationManager::switchToFirstFrameOfAnimation @ 0x6afdb8
// > SpriteAnimationManager::executeAnimation @ 0x6b0014
// > SpriteAnimationManager::executeAnimation @ 0x6b0120
// > ??> @ 0xfbb00
//
// 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:33 +0000
//
__int64 __fastcall CCAnimatedSprite::switchToMode(__int64 result, int a2)
{
__int64 v2; // x19
__int64 v4; // x21
_QWORD *v5; // x0
CCPartAnimSprite *v6; // x21
char v7; // w0
cocos2d::CCNode *v8; // x0
__int64 v9; // x21
void (__fastcall *v10)(__int64, __int64); // x22
__int64 v11; // x0
cocos2d::CCSprite *v12; // x21
char isFlipX; // w0
if ( *(_DWORD *)(result + 680) != a2 )
{
v2 = result;
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)(result + 656));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v2 + 656) + 344LL))(*(_QWORD *)(v2 + 656), 0);
if ( a2 == 1 )
{
v9 = *(_QWORD *)(v2 + 664);
if ( v9 )
{
v10 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 960LL);
v11 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v2 + 656) + 944LL))(*(_QWORD *)(v2 + 656));
v10(v9, v11);
v12 = *(cocos2d::CCSprite **)(v2 + 664);
isFlipX = cocos2d::CCSprite::isFlipX(*(cocos2d::CCSprite **)(v2 + 656));
cocos2d::CCSprite::setFlipX(v12, isFlipX);
v8 = *(cocos2d::CCNode **)(v2 + 664);
*(_QWORD *)(v2 + 656) = v8;
}
else
{
v8 = *(cocos2d::CCNode **)(v2 + 656);
}
}
else
{
v4 = *(_QWORD *)(v2 + 672);
v5 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v2 + 656) + 944LL))(*(_QWORD *)(v2 + 656));
CCPartAnimSprite::setColor(v4, *v5);
v6 = *(CCPartAnimSprite **)(v2 + 672);
v7 = cocos2d::CCSprite::isFlipX(*(cocos2d::CCSprite **)(v2 + 656));
CCPartAnimSprite::setFlipX(v6, v7);
v8 = *(cocos2d::CCNode **)(v2 + 672);
*(_QWORD *)(v2 + 656) = v8;
}
cocos2d::CCNode::stopAllActions(v8);
result = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(v2 + 656) + 344LL))(*(_QWORD *)(v2 + 656), 1);
*(_DWORD *)(v2 + 680) = a2;
}
return result;
}