{"type": "func", "start": 5368974208, "end": 5368974573, "name": "CCAnimatedSprite::switchToMode", "pseudocode": "// \n// CCAnimatedSprite::switchToMode from 0x140040b80 to 0x140040ced (365 bytes)\n// \n// 5 xrefs:\n// > SpriteAnimationManager::executeAnimation @ 0x1400741bc\n// > SpriteAnimationManager::executeAnimation @ 0x1400743f3\n// > <???> @ 0x1406620ec\n// > <???> @ 0x140662120\n// > <???> @ 0x1406c4230\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nvoid CCAnimatedSprite::switchToMode(CCAnimatedSprite *a1, spriteMode a2)\n{\n  CCPartAnimSprite *m_sprite; // rcx\n  cocos2d::CCSprite *m_fbfSprite; // rbx\n  cocos2d::CCRGBAProtocol_vtbl *v6; // rbx\n  __int64 v7; // rax\n  bool isFlipX; // al\n  __int64 v9; // rax\n  __int16 v10; // cx\n  CCPartAnimSprite *m_paSprite; // rcx\n  bool v12; // al\n  CCPartAnimSprite *v13; // rbx\n  bool v14; // bp\n  _BOOL8 v15; // rdx\n  cocos2d::ccColor3B v16; // [rsp+30h] [rbp+8h] BYREF\n\n  if ( a1->m_spriteMode != a2 )\n  {\n    cocos2d::CCNode::stopAllActions(a1->m_sprite);\n    a1->m_sprite->setVisible(a1->m_sprite, 0);\n    m_sprite = (CCPartAnimSprite *)a1->m_sprite;\n    if ( a2 == FrameByFrame )\n    {\n      m_fbfSprite = a1->m_fbfSprite;\n      if ( !m_fbfSprite )\n      {\nLABEL_9:\n        cocos2d::CCNode::stopAllActions(m_sprite);\n        LOBYTE(v15) = 1;\n        a1->m_sprite->setVisible(a1->m_sprite, v15);\n        a1->m_spriteMode = a2;\n        return;\n      }\n      v6 = m_fbfSprite->cocos2d::CCNodeRGBA::cocos2d::CCRGBAProtocol::__vftable;\n      v7 = (__int64)m_sprite->getColor(&m_sprite->cocos2d::CCRGBAProtocol);\n      v6->setColor(&a1->m_fbfSprite->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)v7);\n      isFlipX = cocos2d::CCSprite::isFlipX(a1->m_sprite);\n      cocos2d::CCSprite::setFlipX(a1->m_fbfSprite, isFlipX);\n      m_sprite = (CCPartAnimSprite *)a1->m_fbfSprite;\n    }\n    else\n    {\n      v9 = (__int64)m_sprite->getColor(&m_sprite->cocos2d::CCRGBAProtocol);\n      v10 = *(_WORD *)v9;\n      LOBYTE(v9) = *(_BYTE *)(v9 + 2);\n      *(_WORD *)&v16.r = v10;\n      m_paSprite = a1->m_paSprite;\n      v16.b = v9;\n      CCPartAnimSprite::setColor(m_paSprite, &v16);\n      v12 = cocos2d::CCSprite::isFlipX(a1->m_sprite);\n      v13 = a1->m_paSprite;\n      v14 = v12;\n      if ( v12 != cocos2d::CCSprite::isFlipX(v13) )\n        ((void (__fastcall *)(CCPartAnimSprite *))v13->setScaleX)(v13);\n      cocos2d::CCSprite::setFlipX(v13, v14);\n      v13->m_hasChanged = 1;\n      m_sprite = a1->m_paSprite;\n    }\n    a1->m_sprite = m_sprite;\n    goto LABEL_9;\n  }\n}", "assembly": "; \n; CCAnimatedSprite::switchToMode from 0x140040b80 to 0x140040ced (365 bytes)\n; \n; 5 xrefs:\n; > SpriteAnimationManager::executeAnimation @ 0x1400741bc\n; > SpriteAnimationManager::executeAnimation @ 0x1400743f3\n; > <???> @ 0x1406620ec\n; > <???> @ 0x140662120\n; > <???> @ 0x1406c4230\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nmov     [rsp+arg_18], rsi                                              ; +0x0, 0x140040b80\npush    rdi                                                            ; +0x5, 0x140040b85\nsub     rsp, 20h                                                       ; +0x6, 0x140040b86\nmov     esi, edx                                                       ; +0xa, 0x140040b8a\nmov     rdi, rcx                                                       ; +0xc, 0x140040b8c\ncmp     [rcx+2B8h], edx                                                ; +0xf, 0x140040b8f\njz      loc_140040CE2                                                  ; +0x15, 0x140040b95\nmov     rcx, [rcx+2A0h]                                                ; +0x1b, 0x140040b9b\nmov     [rsp+28h+arg_8], rbx                                           ; +0x22, 0x140040ba2\ncall    cs:?stopAllActions@CCNode@cocos2d@@QEAAXXZ; cocos2d::CCNode::stopAllActions(void) ; +0x27, 0x140040ba7\nmov     rcx, [rdi+2A0h]                                                ; +0x2d, 0x140040bad\nxor     edx, edx                                                       ; +0x34, 0x140040bb4\nmov     rax, [rcx]                                                     ; +0x36, 0x140040bb6\ncall    qword ptr [rax+140h]                                           ; +0x39, 0x140040bb9\nmov     rcx, [rdi+2A0h]                                                ; +0x3f, 0x140040bbf\ncmp     esi, 1                                                         ; +0x46, 0x140040bc6\njnz     short loc_140040C2B                                            ; +0x49, 0x140040bc9\nmov     rbx, [rdi+2A8h]                                                ; +0x4b, 0x140040bcb\ntest    rbx, rbx                                                       ; +0x52, 0x140040bd2\njz      loc_140040CBF                                                  ; +0x55, 0x140040bd5\nmov     rbx, [rbx+140h]                                                ; +0x5b, 0x140040bdb\nadd     rcx, 140h                                                      ; +0x62, 0x140040be2\nmov     rax, [rcx]                                                     ; +0x69, 0x140040be9\ncall    qword ptr [rax+8]                                              ; +0x6c, 0x140040bec\nmov     rcx, [rdi+2A8h]                                                ; +0x6f, 0x140040bef\nmov     rdx, rax                                                       ; +0x76, 0x140040bf6\nadd     rcx, 140h                                                      ; +0x79, 0x140040bf9\ncall    qword ptr [rbx]                                                ; +0x80, 0x140040c00\nmov     rcx, [rdi+2A0h]                                                ; +0x82, 0x140040c02\ncall    cs:?isFlipX@CCSprite@cocos2d@@QEAA_NXZ; cocos2d::CCSprite::isFlipX(void) ; +0x89, 0x140040c09\nmov     rcx, [rdi+2A8h]                                                ; +0x8f, 0x140040c0f\nmovzx   edx, al                                                        ; +0x96, 0x140040c16\ncall    cs:?setFlipX@CCSprite@cocos2d@@QEAAX_N@Z; cocos2d::CCSprite::setFlipX(bool) ; +0x99, 0x140040c19\nmov     rcx, [rdi+2A8h]                                                ; +0x9f, 0x140040c1f\njmp     loc_140040CB8                                                  ; +0xa6, 0x140040c26\nadd     rcx, 140h                                                      ; +0xab, 0x140040c2b\nmov     [rsp+28h+arg_10], rbp                                          ; +0xb2, 0x140040c32\nmov     rax, [rcx]                                                     ; +0xb7, 0x140040c37\ncall    qword ptr [rax+8]                                              ; +0xba, 0x140040c3a\nlea     rdx, [rsp+28h+arg_0]                                           ; +0xbd, 0x140040c3d\nmovzx   ecx, word ptr [rax]                                            ; +0xc2, 0x140040c42\nmovzx   eax, byte ptr [rax+2]                                          ; +0xc5, 0x140040c45\nmov     [rsp+28h+arg_0], cx                                            ; +0xc9, 0x140040c49\nmov     rcx, [rdi+2B0h]                                                ; +0xce, 0x140040c4e\nmov     [rsp+28h+arg_2], al                                            ; +0xd5, 0x140040c55\ncall    CCPartAnimSprite__setColor                                     ; +0xd9, 0x140040c59\nmov     rcx, [rdi+2A0h]                                                ; +0xde, 0x140040c5e\ncall    cs:?isFlipX@CCSprite@cocos2d@@QEAA_NXZ; cocos2d::CCSprite::isFlipX(void) ; +0xe5, 0x140040c65\nmov     rbx, [rdi+2B0h]                                                ; +0xeb, 0x140040c6b\nmovzx   ebp, al                                                        ; +0xf2, 0x140040c72\nmov     rcx, rbx                                                       ; +0xf5, 0x140040c75\ncall    cs:?isFlipX@CCSprite@cocos2d@@QEAA_NXZ; cocos2d::CCSprite::isFlipX(void) ; +0xf8, 0x140040c78\ncmp     bpl, al                                                        ; +0xfe, 0x140040c7e\njz      short loc_140040C98                                            ; +0x101, 0x140040c81\nmov     rdx, [rbx]                                                     ; +0x103, 0x140040c83\nxor     al, 1                                                          ; +0x106, 0x140040c86\nmovzx   ecx, al                                                        ; +0x108, 0x140040c88\nmovd    xmm1, ecx                                                      ; +0x10b, 0x140040c8b\nmov     rcx, rbx                                                       ; +0x10f, 0x140040c8f\ncvtdq2ps xmm1, xmm1                                                    ; +0x112, 0x140040c92\ncall    qword ptr [rdx+78h]                                            ; +0x115, 0x140040c95\nmovzx   edx, bpl                                                       ; +0x118, 0x140040c98\nmov     rcx, rbx                                                       ; +0x11c, 0x140040c9c\ncall    cs:?setFlipX@CCSprite@cocos2d@@QEAAX_N@Z; cocos2d::CCSprite::setFlipX(bool) ; +0x11f, 0x140040c9f\nmov     rbp, [rsp+28h+arg_10]                                          ; +0x125, 0x140040ca5\nmov     byte ptr [rbx+268h], 1                                         ; +0x12a, 0x140040caa\nmov     rcx, [rdi+2B0h]                                                ; +0x131, 0x140040cb1\nmov     [rdi+2A0h], rcx                                                ; +0x138, 0x140040cb8\ncall    cs:?stopAllActions@CCNode@cocos2d@@QEAAXXZ; cocos2d::CCNode::stopAllActions(void) ; +0x13f, 0x140040cbf\nmov     rcx, [rdi+2A0h]                                                ; +0x145, 0x140040cc5\nmov     dl, 1                                                          ; +0x14c, 0x140040ccc\nmov     rax, [rcx]                                                     ; +0x14e, 0x140040cce\ncall    qword ptr [rax+140h]                                           ; +0x151, 0x140040cd1\nmov     rbx, [rsp+28h+arg_8]                                           ; +0x157, 0x140040cd7\nmov     [rdi+2B8h], esi                                                ; +0x15c, 0x140040cdc\nmov     rsi, [rsp+28h+arg_18]                                          ; +0x162, 0x140040ce2\nadd     rsp, 20h                                                       ; +0x167, 0x140040ce7\npop     rdi                                                            ; +0x16b, 0x140040ceb\nretn                                                                   ; +0x16c, 0x140040cec", "xrefs": ["SpriteAnimationManager::executeAnimation @ 0x1400741bc", "SpriteAnimationManager::executeAnimation @ 0x1400743f3", "<???> @ 0x1406620ec", "<???> @ 0x140662120", "<???> @ 0x1406c4230"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}