// // CCPartAnimSprite::initWithAnimDesc from 0x140045980 to 0x140046124 (1956 bytes) // // 2 xrefs: // > CCAnimatedSprite::loadType @ 0x1400408fb // > @ 0x1406c477c // // 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 // // Hidden C++ exception states: #wind=12 bool CCPartAnimSprite::initWithAnimDesc(CCPartAnimSprite *a1, const char *a2, cocos2d::CCTexture2D *a3, bool a4) { bool v4; // r14 bool result; // al __int64 v8; // rcx cocos2d::CCArray *v9; // rax cocos2d::CCDictionary *v10; // rax CCAnimateFrameCache *v11; // rax cocos2d::CCDictionary *v12; // rax cocos2d::CCDictionary *v13; // rbx unsigned int v14; // esi _BYTE *v15; // rax size_t v16; // r8 __int64 v17; // r15 void *v18; // rcx cocos2d::CCString *v19; // rax const char *CString; // rax size_t v21; // r8 void *v22; // rcx cocos2d::CCString *v23; // rax unsigned int v24; // r12d int v25; // ebx void **v26; // rbx CCSpritePart *v27; // rax CCSpritePart *v28; // rdi size_t v29; // r8 void **v30; // rdx CCSpritePart *v31; // rax void **v32; // r14 size_t v33; // rsi unsigned __int64 v34; // rax size_t v35; // rbx void **v36; // rdx __int64 v37; // rbx cocos2d::CCString *v38; // rbx void *v39; // rcx const char *v40; // rax size_t v41; // r8 void *v42; // rcx unsigned int v44; // [rsp+28h] [rbp-D8h] void *v45[2]; // [rsp+30h] [rbp-D0h] BYREF size_t v46; // [rsp+40h] [rbp-C0h] __int64 v47; // [rsp+48h] [rbp-B8h] void *v48[2]; // [rsp+50h] [rbp-B0h] BYREF size_t Size; // [rsp+60h] [rbp-A0h] unsigned __int64 v50; // [rsp+68h] [rbp-98h] cocos2d::CCTexture2D *v51; // [rsp+70h] [rbp-90h] cocos2d::CCDictionary *v52; // [rsp+78h] [rbp-88h] CCSpritePart *v53; // [rsp+80h] [rbp-80h] CCSpritePart *v54; // [rsp+88h] [rbp-78h] __int128 Buf2; // [rsp+90h] [rbp-70h] BYREF __int64 v56; // [rsp+A0h] [rbp-60h] unsigned __int64 v57; // [rsp+A8h] [rbp-58h] __int128 v58; // [rsp+B0h] [rbp-50h] BYREF __int64 v59; // [rsp+C0h] [rbp-40h] unsigned __int64 v60; // [rsp+C8h] [rbp-38h] __int128 v61; // [rsp+D0h] [rbp-30h] BYREF __int64 v62; // [rsp+E0h] [rbp-20h] unsigned __int64 v63; // [rsp+E8h] [rbp-18h] void *Src[2]; // [rsp+F0h] [rbp-10h] BYREF size_t v65; // [rsp+100h] [rbp+0h] unsigned __int64 v66; // [rsp+108h] [rbp+8h] _WORD v67[8]; // [rsp+110h] [rbp+10h] BYREF __int64 v68; // [rsp+120h] [rbp+20h] __int64 v69; // [rsp+128h] [rbp+28h] _BYTE v70[528]; // [rsp+130h] [rbp+30h] BYREF v4 = a4; v51 = a3; result = cocos2d::CCSprite::initWithTexture(a1, a3, &stru_1406C1370); if ( result ) { v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8); a1->m_spriteParts = v9; cocos2d::CCObject::retain(v9); v10 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(); a1->m_spritePartIDs = v10; cocos2d::CCObject::retain(v10); v11 = CCAnimateFrameCache::sharedSpriteFrameCache(); v12 = CCAnimateFrameCache::addSpriteFramesWithFile(v11, a2); a1->m_hasChanged = 1; HIBYTE(v67[6]) = 0; v67[7] = 0; v68 = 12; v69 = 15; strcpy((char *)v67, "usedTextures"); v13 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v12, v67); v52 = v13; sub_14003A830((__int64)v67); v14 = 0; v44 = 0; if ( cocos2d::CCDictionary::count(v13) ) { *(_QWORD *)&Buf2 = "texture_"; *((_QWORD *)&Buf2 + 1) = 0; do { fmt::BasicWriter::BasicWriter(v70); Buf2 = (unsigned __int64)"texture_"; fmt::BasicWriter::operator<<(v70, &Buf2); fmt::BasicWriter::operator<<(v70, v14); v15 = (_BYTE *)fmt::BasicWriter::c_str(v70); v58 = 0; v59 = 0; v60 = 0; v16 = -1; do ++v16; while ( v15[v16] ); sub_14003A930(&v58, v15, v16); v17 = cocos2d::CCDictionary::objectForKey(v13, &v58); if ( v60 > 0xF ) { v18 = (void *)v58; if ( v60 + 1 >= 0x1000 ) { v18 = *(void **)(v58 - 8); if ( (unsigned __int64)(v58 - (_QWORD)v18 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v18); } v59 = 0; v60 = 15; LOBYTE(v58) = 0; v62 = 7; v63 = 15; v61 = 0x65727574786574uLL; v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v17, &v61); CString = cocos2d::CCString::getCString(v19); *(_OWORD *)Src = 0; v65 = 0; v66 = 0; v21 = -1; do ++v21; while ( CString[v21] ); sub_14003A930(Src, CString, v21); if ( v63 > 0xF ) { v22 = (void *)v61; if ( v63 + 1 >= 0x1000 ) { v22 = *(void **)(v61 - 8); if ( (unsigned __int64)(v61 - (_QWORD)v22 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v22); } v62 = 0; v63 = 15; LOBYTE(v61) = 0; Buf2 = 0; v56 = 3; v57 = 15; LODWORD(Buf2) = 6775156; v23 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v17, &Buf2); v24 = cocos2d::CCString::intValue(v23); sub_14003A830((__int64)&Buf2); Buf2 = 0; v56 = 1; v57 = 15; LOWORD(Buf2) = (unsigned __int8)a0[0]; v25 = sub_14003A760(Src, &Buf2); sub_14003A830((__int64)&Buf2); if ( v4 || !v25 ) { v54 = (CCSpritePart *)operator new(0x2A0u); v31 = CCSpritePart::CCSpritePart(v54); v28 = v31; if ( v31 ) { if ( v31->initWithTexture_1(v31, v51) ) { cocos2d::CCObject::autorelease(v28); LABEL_36: if ( v25 && v4 ) { *(_OWORD *)v45 = 0; v46 = 0; v47 = 0; v32 = Src; if ( v66 > 0xF ) v32 = (void **)Src[0]; v33 = v65; if ( v65 > 0x7FFFFFFFFFFFFFFFLL ) sub_140007B50(); if ( v65 > 0xF ) { v47 = 15; v35 = v65 | 0xF; if ( (v65 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL ) { if ( v35 < 0x16 ) v35 = 22; } else { v35 = 0x7FFFFFFFFFFFFFFFLL; } v45[0] = sub_14003AA10(v35 + 1); v46 = v33; v47 = v35; memcpy(v45[0], v32, v33 + 1); v34 = v47; v33 = v46; } else { v46 = v65; v34 = 15; v47 = 15; *(_OWORD *)v45 = *(_OWORD *)v32; } *(_QWORD *)&Buf2 = v45; if ( &v28->m_spriteFrameName != (std::string *)v45 ) { v36 = v45; if ( v34 > 0xF ) v36 = (void **)v45[0]; sub_14003CCE0((void **)&v28->m_spriteFrameName, v36, v33); } sub_14003A830((__int64)v45); v14 = v44; v4 = a4; } goto LABEL_53; } ((void (__fastcall *)(CCSpritePart *, __int64))v28->~CCSpritePart)(v28, 1); } v28 = nullptr; goto LABEL_36; } v26 = Src; if ( v66 > 0xF ) v26 = (void **)Src[0]; v53 = (CCSpritePart *)operator new(0x2A0u); v27 = CCSpritePart::CCSpritePart(v53); v28 = v27; if ( v27 ) { if ( v27->initWithSpriteFrameName(v27, (const char *)v26) ) { *(_OWORD *)v48 = 0; Size = 0; v50 = 0; v29 = -1; do ++v29; while ( *((_BYTE *)v26 + v29) ); sub_14003A930(v48, v26, v29); if ( &v28->m_spriteFrameName != (std::string *)v48 ) { v30 = v48; if ( v50 > 0xF ) v30 = (void **)v48[0]; sub_14003CCE0((void **)&v28->m_spriteFrameName, v30, Size); } sub_14003A830((__int64)v48); cocos2d::CCObject::autorelease(v28); goto LABEL_53; } ((void (__fastcall *)(CCSpritePart *, __int64))v28->~CCSpritePart)(v28, 1); } v28 = nullptr; LABEL_53: v28->setTag(v28, v24); v56 = 8; v57 = 15; Buf2 = *(unsigned __int64 *)"customID"; v37 = cocos2d::CCDictionary::objectForKey(v17, &Buf2); sub_14003A830((__int64)&Buf2); if ( v37 ) { v56 = 8; v57 = 15; Buf2 = *(unsigned __int64 *)"customID"; v38 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v17, &Buf2); if ( v57 > 0xF ) { v39 = (void *)Buf2; if ( v57 + 1 >= 0x1000 ) { v39 = *(void **)(Buf2 - 8); if ( (unsigned __int64)(Buf2 - (_QWORD)v39 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v39); } v56 = 0; v57 = 15; LOBYTE(Buf2) = 0; v40 = cocos2d::CCString::getCString(v38); v58 = 0; v59 = 0; v60 = 0; v41 = -1; do ++v41; while ( v40[v41] ); sub_14003A930(&v58, v40, v41); cocos2d::CCDictionary::setObject(a1->m_spritePartIDs, v28, &v58); if ( v60 > 0xF ) { v42 = (void *)v58; if ( v60 + 1 >= 0x1000 ) { v42 = *(void **)(v58 - 8); if ( (unsigned __int64)(v58 - (_QWORD)v42 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v42); } } cocos2d::CCArray::addObject(a1->m_spriteParts, v28); a1->addChild(a1, v28, 0, v24); v28->setVisible(v28, 0); sub_14003A830((__int64)Src); fmt::BasicWriter::~BasicWriter(v70); v44 = ++v14; v13 = v52; } while ( v14 < cocos2d::CCDictionary::count(v52) ); } return 1; } return result; }