//
// GJRobotSprite::updateFrame from 0xa3c8f8 to 0xa3cec8 (1488 bytes)
//
// 3 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x8bc86c
// > GJRobotSprite::init @ 0xa3d270
// > ??> @ 0x8da18
//
// 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:59:54 +0000
//
__int64 __fastcall GJRobotSprite::updateFrame(GJRobotSprite *this, int a2)
{
__int64 v3; // x0
int v4; // w1
__int64 **v5; // x0
unsigned int v6; // w21
cocos2d::CCSpriteFrameCache *Icon; // x0
cocos2d::CCArray *v8; // x28
cocos2d::CCSpriteFrameCache **v9; // x20
__int64 v10; // x2
int v11; // w0
cocos2d::CCString *v12; // x0
size_t v13; // x0
const char *v14; // x1
cocos2d::CCString *v15; // x0
size_t v16; // x0
const char *v17; // x1
cocos2d::CCString *v18; // x0
size_t v19; // x0
const char *v20; // x1
cocos2d::CCString *v21; // x0
size_t v22; // x0
void (__fastcall *v23)(cocos2d::CCSpriteFrameCache **, __int64); // x22
cocos2d::CCSpriteFrameCache *v24; // x0
const char *v25; // x1
__int64 v26; // x0
cocos2d::CCSpriteFrameCache **v27; // x0
cocos2d::CCSpriteFrameCache **v28; // x22
cocos2d::CCSpriteFrameCache *v29; // x0
void (__fastcall *v30)(cocos2d::CCSpriteFrameCache **, __int64); // x27
cocos2d::CCSpriteFrameCache *v31; // x0
const char *v32; // x1
__int64 v33; // x0
float v34; // s8
__int64 v35; // x0
cocos2d::CCArray *v36; // x0
cocos2d::CCSpriteFrameCache **v37; // x22
void (__fastcall *v38)(cocos2d::CCSpriteFrameCache **, __int64); // x27
cocos2d::CCSpriteFrameCache *v39; // x0
const char *v40; // x1
__int64 v41; // x0
const char *v43; // x1
cocos2d::CCString *v44; // x0
size_t v45; // x0
cocos2d::CCSpriteFrameCache *v46; // x0
cocos2d::CCSpriteFrameCache *v47; // x0
const char *v48; // x1
cocos2d::CCSprite *v49; // x0
__int64 v50; // x2
float v51; // s8
__int64 v52; // x0
__int64 v53; // x1
__int64 v54; // x0
__int64 v55; // x3
void (__fastcall *v56)(char *, char *); // [xsp+78h] [xbp+78h]
signed int v57; // [xsp+94h] [xbp+94h]
char *CString; // [xsp+98h] [xbp+98h]
char *v59; // [xsp+98h] [xbp+98h]
char *v60; // [xsp+98h] [xbp+98h]
char *v61; // [xsp+98h] [xbp+98h]
char *v62; // [xsp+98h] [xbp+98h]
char *v63; // [xsp+98h] [xbp+98h]
char *v64; // [xsp+98h] [xbp+98h]
char v65[8]; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v66[2]; // [xsp+B0h] [xbp+B0h] BYREF
void *v67; // [xsp+C0h] [xbp+C0h]
__int64 v68[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v69; // [xsp+D8h] [xbp+D8h]
__int64 v70[2]; // [xsp+E0h] [xbp+E0h] BYREF
void *v71; // [xsp+F0h] [xbp+F0h]
__int64 v72[2]; // [xsp+F8h] [xbp+F8h] BYREF
void *v73; // [xsp+108h] [xbp+108h]
__int64 v74[2]; // [xsp+110h] [xbp+110h] BYREF
void *v75; // [xsp+120h] [xbp+120h]
v57 = a2;
v3 = *((unsigned int *)this + 190);
if ( (_DWORD)v3 != 5 )
{
if ( a2 > 1 )
{
v4 = 69;
goto LABEL_4;
}
LABEL_51:
v3 = 1;
v57 = 1;
goto LABEL_5;
}
v4 = 68;
if ( v57 <= 1 )
goto LABEL_51;
LABEL_4:
if ( v4 < v57 )
{
if ( (_DWORD)v3 == 5 )
v3 = 68;
else
v3 = 69;
v57 = v3;
}
LABEL_5:
v5 = (__int64 **)GameManager::sharedState((GameManager *)v3);
v6 = 0;
Icon = GameManager::loadIcon(v5, v57, *((_DWORD *)this + 190), *((_DWORD *)this + 191));
(*(void (__fastcall **)(GJRobotSprite *, cocos2d::CCSpriteFrameCache *))(*(_QWORD *)this + 1064LL))(this, Icon);
v8 = *(cocos2d::CCArray **)(*((_QWORD *)this + 84) + 632LL);
if ( (unsigned int)cocos2d::CCArray::count(v8) )
{
do
{
v9 = (cocos2d::CCSpriteFrameCache **)cocos2d::CCArray::objectAtIndex(v8, v6);
v10 = (*((unsigned int (__fastcall **)(cocos2d::CCSpriteFrameCache **))*v9 + 8))(v9);
v11 = *((_DWORD *)this + 190);
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
if ( v11 == 5 )
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"robot_%02d_%02d",
(const char *)(unsigned int)v57,
v10);
else
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"spider_%02d_%02d",
(const char *)(unsigned int)v57,
v10);
CString = (char *)cocos2d::CCString::getCString(v12);
v13 = strlen(CString);
std::string::assign(v66, CString, v13);
v14 = (char *)v66 + 1;
if ( (v66[0] & 1) != 0 )
v14 = (const char *)v67;
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_001.png", v14);
v59 = (char *)cocos2d::CCString::getCString(v15);
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
v16 = strlen(v59);
std::string::__init(v68, v59, v16);
v17 = (char *)v66 + 1;
if ( (v66[0] & 1) != 0 )
v17 = (const char *)v67;
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_2_001.png", v17);
v60 = (char *)cocos2d::CCString::getCString(v18);
v70[0] = 0;
v70[1] = 0;
v71 = nullptr;
v19 = strlen(v60);
std::string::__init(v70, v60, v19);
v20 = (char *)v66 + 1;
if ( (v66[0] & 1) != 0 )
v20 = (const char *)v67;
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_glow_001.png", v20);
v61 = (char *)cocos2d::CCString::getCString(v21);
v72[0] = 0;
v72[1] = 0;
v73 = nullptr;
v22 = strlen(v61);
std::string::__init(v72, v61, v22);
v23 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))*v9 + 145);
v24 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v9);
v25 = (char *)v68 + 1;
if ( (v68[0] & 1) != 0 )
v25 = (const char *)v69;
v26 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v24, v25);
v23(v9, v26);
v27 = (cocos2d::CCSpriteFrameCache **)cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 92), v6);
v28 = v27;
if ( v27 )
{
v29 = *v27;
v30 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))v29 + 145);
v31 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v29);
v32 = (char *)v70 + 1;
if ( (v70[0] & 1) != 0 )
v32 = (const char *)v71;
v33 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v31, v32);
v30(v28, v33);
v62 = *((char **)*v28 + 23);
v34 = *(float *)(*((__int64 (__fastcall **)(cocos2d::CCSpriteFrameCache **))*v9 + 41))(v9);
v35 = (*((__int64 (__fastcall **)(cocos2d::CCSpriteFrameCache **))*v9 + 41))(v9);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v34 * 0.5, *(float *)(v35 + 4) * 0.5);
((void (__fastcall *)(cocos2d::CCSpriteFrameCache **, char *))v62)(v28, v65);
}
v36 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 93) + 488LL))(*((_QWORD *)this + 93));
v37 = (cocos2d::CCSpriteFrameCache **)cocos2d::CCArray::objectAtIndex(v36, v6);
v38 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))*v37 + 145);
v39 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v37);
v40 = (char *)v72 + 1;
if ( (v72[0] & 1) != 0 )
v40 = (const char *)v73;
v41 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v39, v40);
v38(v37, v41);
if ( v9 == *((cocos2d::CCSpriteFrameCache ***)this + 96) )
{
v43 = (char *)v66 + 1;
if ( (v66[0] & 1) != 0 )
v43 = (const char *)v67;
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_extra_001.png", v43);
v63 = (char *)cocos2d::CCString::getCString(v44);
v74[0] = 0;
v74[1] = 0;
v75 = nullptr;
v45 = strlen(v63);
v46 = (cocos2d::CCSpriteFrameCache *)std::string::__init(v74, v63, v45);
v47 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v46);
v48 = (char *)v74 + 1;
if ( (v74[0] & 1) != 0 )
v48 = (const char *)v75;
v49 = (cocos2d::CCSprite *)cocos2d::CCSpriteFrameCache::spriteFrameByName(v47, v48);
if ( v49 )
{
v50 = *((_QWORD *)this + 94);
if ( v50 )
{
(*(void (__fastcall **)(_QWORD, cocos2d::CCSprite *))(*(_QWORD *)v50 + 1160LL))(*((_QWORD *)this + 94), v49);
}
else
{
v54 = cocos2d::CCSprite::createWithSpriteFrame(v49, v49);
v55 = *((_QWORD *)this + 96);
*((_QWORD *)this + 94) = v54;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v55 + 464LL))(v55, v54, 2);
}
v64 = *((char **)this + 94);
v56 = *(void (__fastcall **)(char *, char *))(*(_QWORD *)v64 + 184LL);
v51 = *(float *)(*((__int64 (__fastcall **)(cocos2d::CCSpriteFrameCache **))*v9 + 41))(v9);
v52 = (*((__int64 (__fastcall **)(cocos2d::CCSpriteFrameCache **))*v9 + 41))(v9);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v51 * 0.5, *(float *)(v52 + 4) * 0.5);
v56(v64, v65);
v53 = 1;
*((_BYTE *)this + 728) = 1;
}
else
{
*((_BYTE *)this + 728) = 0;
v53 = 0;
}
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 94) + 344LL))(*((_QWORD *)this + 94), v53);
if ( (v74[0] & 1) != 0 )
operator delete(v75);
}
if ( (v72[0] & 1) != 0 )
operator delete(v73);
if ( (v70[0] & 1) != 0 )
operator delete(v71);
if ( (v68[0] & 1) != 0 )
operator delete(v69);
++v6;
if ( (v66[0] & 1) != 0 )
operator delete(v67);
}
while ( v6 < (unsigned int)cocos2d::CCArray::count(v8) );
}
return _stack_chk_guard;
}