// // GJRobotSprite::init from 0x1402a6740 to 0x1402a6ec9 (1929 bytes) // // 3 xrefs: // > GJRobotSprite::create @ 0x1402a6703 // > GJSpiderSprite::create @ 0x1402a7b75 // > @ 0x1406d2120 // // 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=7 char __fastcall GJRobotSprite::init(__int64 *a1, int a2, const char *a3) { const char *v3; // rdi int v6; // r15d GameManager *v7; // rcx int m_iconRequestID; // r9d struct cocos2d::CCTexture2D *Icon; // rax const char *v10; // r14 cocos2d::CCTexture2D *v11; // rbx ObjectManager *v12; // rax cocos2d::CCDictionary *Definition; // rax cocos2d::CCString *v14; // rax const char *CString; // rax size_t v16; // r8 void *v17; // rcx const char *v18; // rbx cocos2d::CCTextureCache *v19; // rax char *v20; // rcx const struct cocos2d::CCRect *v21; // rax SpriteAnimationManager *v23; // rbx cocos2d::CCNode *m_paSprite; // rcx cocos2d::CCNode *m_fbfSprite; // rcx __int64 v26; // rbx double v27; // xmm0_8 __int64 v28; // rax __int64 v29; // rbx float *v30; // rax double v31; // xmm0_8 __int64 v32; // rax __int64 v33; // rcx cocos2d::CCObject *v34; // rax __int64 v35; // rcx cocos2d::CCObject *v36; // rax __int64 v37; // rax int v38; // ebx cocos2d::CCArray *v39; // r14 unsigned int v40; // r12d struct cocos2d::CCObject *v41; // r14 unsigned int v42; // r13d unsigned __int64 v43; // rcx size_t v44; // r8 void **v45; // rdx const char *v46; // rcx struct cocos2d::CCSprite *v47; // rdi cocos2d::CCSprite_vtbl *v48; // rbx float *v49; // rax const cocos2d::CCPoint *v50; // rax struct cocos2d::CCTexture2D *v51; // rdi struct cocos2d::CCSprite *v52; // rbx __int64 v53; // rcx cocos2d::CCObject *v54; // rax struct cocos2d::CCSprite *v55; // rax __int64 v56; // rbx float *v57; // rax __int64 v58; // rax _QWORD *v59; // rax int v60; // [rsp+38h] [rbp-89h] cocos2d::CCArray *v61; // [rsp+40h] [rbp-81h] BYREF int v62; // [rsp+48h] [rbp-79h] struct cocos2d::CCTexture2D *v63; // [rsp+50h] [rbp-71h] const char *v64; // [rsp+58h] [rbp-69h] cocos2d::CCRect v65; // [rsp+68h] [rbp-59h] BYREF const char *v66; // [rsp+78h] [rbp-49h] char *String[2]; // [rsp+80h] [rbp-41h] BYREF __int64 v68; // [rsp+90h] [rbp-31h] unsigned __int64 v69; // [rsp+98h] [rbp-29h] void *Block[2]; // [rsp+A0h] [rbp-21h] BYREF unsigned __int64 v71; // [rsp+B0h] [rbp-11h] unsigned __int64 v72; // [rsp+B8h] [rbp-9h] v3 = a3; v64 = a3; v62 = a2; v66 = a3; v6 = 0; v7 = (GameManager *)qword_1406C2ED8; if ( !qword_1406C2ED8 ) { v61 = (cocos2d::CCArray *)operator new(0x668u); qword_1406C2ED8 = sub_14017AB00((__int64)v61); (*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8); v7 = (GameManager *)qword_1406C2ED8; } m_iconRequestID = v7->m_iconRequestID; v7->m_iconRequestID = m_iconRequestID + 1; *((_DWORD *)a1 + 197) = m_iconRequestID; Icon = GameManager::loadIcon(v7, a2, *((_DWORD *)a1 + 196), m_iconRequestID); v63 = Icon; v10 = v3; if ( *((_QWORD *)v3 + 3) > 0xFu ) v10 = *(const char **)v3; v11 = Icon; if ( !Icon ) { v12 = ObjectManager::instance(); Definition = ObjectManager::getDefinition(v12, v10); HIDWORD(Block[1]) = 0; v71 = 11; v72 = 15; strcpy((char *)Block, "spriteSheet"); v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(Definition, Block); CString = cocos2d::CCString::getCString(v14); *(_OWORD *)String = 0; v68 = 0; v69 = 0; v16 = -1; do ++v16; while ( CString[v16] ); sub_14003A930(String, CString, v16); if ( v72 > 0xF ) { v17 = Block[0]; if ( v72 + 1 >= 0x1000 ) { v17 = *((void **)Block[0] - 1); if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v17); } v71 = 0; v72 = 15; LOBYTE(Block[0]) = 0; sub_140041270(String, ".png", 4u); v18 = (const char *)String; if ( v69 > 0xF ) v18 = String[0]; v19 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(); v11 = cocos2d::CCTextureCache::addImage(v19, v18, 0); if ( v69 > 0xF ) { v20 = String[0]; if ( v69 + 1 >= 0x1000 ) { v20 = *((char **)String[0] - 1); if ( (unsigned __int64)(String[0] - v20 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free(v20); } v68 = 0; v69 = 15; LOBYTE(String[0]) = 0; } cocos2d::CCRect::CCRect(&v65, 0.0, 0.0, 0.0, 0.0); if ( cocos2d::CCSprite::initWithTexture((cocos2d::CCSprite *)a1, v11, v21) ) { *((_BYTE *)a1 + 559) = 1; sub_14003CCE0((void **)a1 + 75, byte_140518980, 0); CCAnimatedSprite::loadType((CCAnimatedSprite *)a1, v10, v11, 1); *((_BYTE *)a1 + 559) = 1; v23 = (SpriteAnimationManager *)a1[83]; SpriteAnimationManager::overridePrio(v23); m_paSprite = v23->m_sprite->m_paSprite; if ( m_paSprite ) cocos2d::CCNode::stopAllActions(m_paSprite); m_fbfSprite = v23->m_sprite->m_fbfSprite; if ( m_fbfSprite ) cocos2d::CCNode::stopAllActions(m_fbfSprite); v26 = *a1; v27 = cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v61, 30.0, 30.0); (*(void (__fastcall **)(__int64 *, __int64))(v26 + 296))(a1, v28); v29 = *(_QWORD *)a1[86]; (*(__int64 (__fastcall **)(__int64 *))(*a1 + 304))(a1); v30 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*a1 + 304))(a1); v31 = cocos2d::CCPoint::CCPoint(*(float *)&v27, *v30 * 0.5); (*(void (__fastcall **)(__int64, __int64))(v29 + 184))(a1[86], v32); v34 = (cocos2d::CCObject *)cocos2d::CCArray::create(v33); a1[95] = (__int64)v34; cocos2d::CCObject::retain(v34); v36 = (cocos2d::CCObject *)cocos2d::CCArray::create(v35); a1[93] = (__int64)v36; cocos2d::CCObject::retain(v36); v37 = cocos2d::CCSprite::create(); a1[96] = v37; (*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1[86] + 440LL))(a1[86], v37, 0xFFFFFFFFLL); (*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1[96] + 320LL))(a1[96], 0); *(_BYTE *)(a1[96] + 559) = 1; v38 = *((_DWORD *)a1 + 196); v60 = v38; v39 = *(cocos2d::CCArray **)(a1[86] + 632); v61 = v39; v40 = 0; if ( cocos2d::CCArray::count(v39) ) { do { v41 = cocos2d::CCArray::objectAtIndex(v39, v40); BYTE2(v41[11].__vftable) = 1; sub_14003BDB0((__int64)Block, (__int64)&v41[11].m_nTag); v6 |= 2u; if ( v71 ) { if ( v71 >= (unsigned __int64)(v38 == 6) + 11 ) { v43 = (v38 == 6) + 9LL; LODWORD(v31) = 0; *(_OWORD *)String = 0; v68 = 0; v69 = 0; if ( v71 < v43 ) sub_14003BCC0(v43); v44 = 2; if ( v71 - v43 < 2 ) v44 = v71 - v43; v45 = Block; if ( v72 > 0xF ) v45 = (void **)Block[0]; sub_14003A930(String, (char *)v45 + v43, v44); v6 |= 5u; v46 = (const char *)String; if ( v69 > 0xF ) v46 = String[0]; v42 = atoi(v46); } else { v42 = -1; } if ( (v6 & 1) != 0 ) { v6 &= ~1u; sub_14003A830((__int64)String); } v41->setTag(v41, v42); v47 = cocos2d::CCSprite::createWithTexture(v63, &stru_1406C1F30); ((void (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCSprite *, __int64))v41->__vftable[6].~CCObject)( v41, v47, 0xFFFFFFFFLL); v48 = v47->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v41->__vftable[4].isEqual)(v41); v49 = (float *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v41->__vftable[4].isEqual)(v41); v31 = cocos2d::CCPoint::CCPoint(*(float *)&v31, *v49 * 0.5); v48->setPosition_0(v47, v50); cocos2d::CCArray::addObject((cocos2d::CCArray *)a1[95], v47); v51 = v63; v52 = cocos2d::CCSprite::createWithTexture(v63, &stru_1406C1F30); (*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1[96] + 440LL))( a1[96], v52, 0xFFFFFFFFLL); LOBYTE(v41[11].__vftable) = 1; if ( !*(_QWORD *)&v41[10].m_unknown2 ) { v54 = (cocos2d::CCObject *)cocos2d::CCArray::create(v53); *(_QWORD *)&v41[10].m_unknown2 = v54; cocos2d::CCObject::retain(v54); } cocos2d::CCArray::addObject(*(cocos2d::CCArray **)&v41[10].m_unknown2, v52); BYTE1(v41[11].__vftable) = 1; if ( *((_DWORD *)a1 + 196) == 5 && v40 == 6 ) a1[100] = (__int64)v41; if ( v42 == 1 ) a1[99] = (__int64)v41; if ( v41 == (struct cocos2d::CCObject *)a1[99] && !a1[97] ) { v55 = cocos2d::CCSprite::createWithTexture(v51); a1[97] = (__int64)v55; *((_BYTE *)a1 + 752) = 0; (*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1[99] + 440LL))( a1[99], v55, 2); v56 = *(_QWORD *)a1[97]; (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[99] + 304LL))(a1[99]); v57 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a1[99] + 304LL))(a1[99]); v31 = cocos2d::CCPoint::CCPoint(*(float *)&v31, *v57 * 0.5); (*(void (__fastcall **)(__int64, __int64))(v56 + 184))(a1[97], v58); (*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1[97] + 320LL))( a1[97], *((unsigned __int8 *)a1 + 752)); } v38 = v60; } sub_14003A830((__int64)Block); ++v40; v39 = v61; } while ( v40 < cocos2d::CCArray::count(v61) ); v3 = v64; } GJRobotSprite::updateFrame((GJRobotSprite *)a1, v62); *(_OWORD *)String = 0; v68 = 4; v69 = 15; strcpy((char *)String, "idle"); v65.origin = (cocos2d::CCPoint)String; v59 = (_QWORD *)sub_14003BDB0((__int64)Block, (__int64)String); SpriteAnimationManager::runAnimation(a1[83], v59); sub_14003A830((__int64)String); sub_14003A830((__int64)v3); return 1; } else { sub_14003A830((__int64)v3); return 0; } }