//
// GJRobotSprite::updateFrame from 0x5e6718 to 0x5e6aae (918 bytes)
//
// 2 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x50c860
// > GJRobotSprite::init @ 0x5e6e80
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:54:20 +0000
//
unsigned int __fastcall GJRobotSprite::updateFrame(GJRobotSprite *this, const char *a2)
{
const char *v3; // r6
int **v4; // r0
unsigned int v5; // r7
int Icon; // r0
unsigned int result; // r0
int v8; // r5
int v9; // r0
int v10; // r2
char *v11; // r0
cocos2d::CCString *v12; // r0
char *CString; // r0
cocos2d::CCString *v14; // r0
const char *v15; // r8
size_t v16; // r0
cocos2d::CCString *v17; // r0
const char *v18; // r8
size_t v19; // r0
cocos2d::CCString *v20; // r0
const char *v21; // r8
size_t v22; // r0
cocos2d::CCSpriteFrameCache *v23; // r0
void (__fastcall *v24)(int, int); // r8
cocos2d::CCSpriteFrameCache *v25; // r0
char *v26; // r1
int v27; // r0
cocos2d::CCSpriteFrameCache *v28; // r0
cocos2d::CCSpriteFrameCache *v29; // r8
void (__fastcall *v30)(cocos2d::CCSpriteFrameCache *, int); // r10
cocos2d::CCSpriteFrameCache *v31; // r0
char *v32; // r1
int v33; // r0
float v34; // s17
int v35; // r0
cocos2d::CCArray *v36; // r0
cocos2d::CCSpriteFrameCache *v37; // r8
void (__fastcall *v38)(cocos2d::CCSpriteFrameCache *, int); // r10
cocos2d::CCSpriteFrameCache *v39; // r0
char *v40; // r1
int v41; // r0
int v42; // r2
cocos2d::CCString *v43; // r0
const char *v44; // r8
size_t v45; // r0
cocos2d::CCSpriteFrameCache *v46; // r0
cocos2d::CCSpriteFrameCache *v47; // r0
char *v48; // r1
cocos2d::CCSprite *v49; // r0
int v50; // r3
int v51; // r0
int v52; // r8
void (__fastcall *v53)(int, _BYTE *); // r10
float v54; // s17
int v55; // r0
cocos2d::CCArray *v56; // [sp+0h] [bp-74h]
int *v57; // [sp+4h] [bp-70h]
void (__fastcall *v58)(cocos2d::CCSpriteFrameCache *, _BYTE *); // [sp+8h] [bp-6Ch]
_BYTE v59[8]; // [sp+28h] [bp-4Ch] BYREF
int v60[2]; // [sp+30h] [bp-44h] BYREF
char *v61; // [sp+38h] [bp-3Ch]
int v62[2]; // [sp+3Ch] [bp-38h] BYREF
char *v63; // [sp+44h] [bp-30h]
int v64[2]; // [sp+48h] [bp-2Ch] BYREF
char *v65; // [sp+50h] [bp-24h]
int v66[2]; // [sp+54h] [bp-20h] BYREF
char *v67; // [sp+5Ch] [bp-18h]
int v68[2]; // [sp+60h] [bp-14h] BYREF
char *v69; // [sp+68h] [bp-Ch]
v3 = a2;
if ( *((_DWORD *)this + 148) == 5 )
{
if ( (int)a2 > 68 )
{
v3 = (const char *)&dword_44;
goto LABEL_6;
}
}
else if ( (int)a2 > 69 )
{
v3 = (_BYTE *)(&dword_44 + 1);
goto LABEL_6;
}
if ( (int)a2 < 1 )
v3 = (_BYTE *)(&dword_0 + 1);
LABEL_6:
v4 = (int **)GameManager::sharedState(this);
v5 = 0;
Icon = GameManager::loadIcon(v4, (int)v3, *((_DWORD *)this + 148), *((_DWORD *)this + 149));
(*(void (__fastcall **)(GJRobotSprite *, int))(*(_DWORD *)this + 532))(this, Icon);
v56 = *(cocos2d::CCArray **)(*((_DWORD *)this + 136) + 528);
while ( 1 )
{
result = cocos2d::CCArray::count(v56);
if ( v5 >= result )
break;
v8 = cocos2d::CCArray::objectAtIndex(v56, v5);
v9 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 32))(v8);
v60[0] = 0;
v60[1] = 0;
v61 = nullptr;
v10 = v9;
if ( *((_DWORD *)this + 148) == 5 )
v11 = "robot_%02d_%02d";
else
v11 = "spider_%02d_%02d";
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v11, v3, v10);
CString = (char *)cocos2d::CCString::getCString(v12);
std::string::assign(v60, CString);
if ( (v60[0] & 1) != 0 )
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_001.png", v61);
else
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_001.png",
(const char *)v60 + 1);
v15 = (const char *)cocos2d::CCString::getCString(v14);
v62[0] = 0;
v62[1] = 0;
v63 = nullptr;
v16 = strlen(v15);
std::string::__init(v62, v15, v16);
if ( (v60[0] & 1) != 0 )
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_2_001.png", v61);
else
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_2_001.png",
(const char *)v60 + 1);
v18 = (const char *)cocos2d::CCString::getCString(v17);
v64[0] = 0;
v64[1] = 0;
v65 = nullptr;
v19 = strlen(v18);
v57 = v64;
std::string::__init(v64, v18, v19);
if ( (v60[0] & 1) != 0 )
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_glow_001.png", v61);
else
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_glow_001.png",
(const char *)v60 + 1);
v21 = (const char *)cocos2d::CCString::getCString(v20);
v66[0] = 0;
v66[1] = 0;
v67 = nullptr;
v22 = strlen(v21);
v23 = (cocos2d::CCSpriteFrameCache *)std::string::__init(v66, v21, v22);
v24 = *(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 580);
v25 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v23);
if ( (v62[0] & 1) != 0 )
v26 = v63;
else
v26 = (char *)v62 + 1;
v27 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v25, v26);
v24(v8, v27);
v28 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 145), v5);
v29 = v28;
if ( v28 )
{
v30 = *(void (__fastcall **)(cocos2d::CCSpriteFrameCache *, int))(*(_DWORD *)v28 + 580);
v31 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v28);
if ( (v64[0] & 1) != 0 )
v32 = v65;
else
v32 = (char *)v64 + 1;
v33 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v31, v32);
v30(v29, v33);
v58 = *(void (__fastcall **)(cocos2d::CCSpriteFrameCache *, _BYTE *))(*(_DWORD *)v29 + 92);
v34 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v8 + 164))(v8);
v35 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 164))(v8);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v34 * 0.5, *(float *)(v35 + 4) * 0.5);
v58(v29, v59);
}
v36 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 146) + 244))(*((_DWORD *)this + 146));
v37 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCArray::objectAtIndex(v36, v5);
v38 = *(void (__fastcall **)(cocos2d::CCSpriteFrameCache *, int))(*(_DWORD *)v37 + 580);
v39 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v37);
if ( (v66[0] & 1) != 0 )
v40 = v67;
else
v40 = (char *)v66 + 1;
v41 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v39, v40);
v38(v37, v41);
if ( v8 == *((_DWORD *)this + 150) )
{
v42 = LOBYTE(v60[0]) << 31;
if ( (v60[0] & 1) != 0 )
v43 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_extra_001.png",
v61,
v42,
LOBYTE(v60[0]),
v56,
v64);
else
v43 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_extra_001.png",
(const char *)v60 + 1,
v42,
LOBYTE(v60[0]),
v56,
v64);
v44 = (const char *)cocos2d::CCString::getCString(v43);
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
v45 = strlen(v44);
v46 = (cocos2d::CCSpriteFrameCache *)std::string::__init(v68, v44, v45);
v47 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v46);
if ( (v68[0] & 1) != 0 )
v48 = v69;
else
v48 = (char *)v68 + 1;
v49 = (cocos2d::CCSprite *)cocos2d::CCSpriteFrameCache::spriteFrameByName(v47, v48);
if ( v49 )
{
v50 = *((_DWORD *)this + 147);
if ( v50 )
{
(*(void (__fastcall **)(_DWORD, cocos2d::CCSprite *))(*(_DWORD *)v50 + 580))(*((_DWORD *)this + 147), v49);
}
else
{
v51 = cocos2d::CCSprite::createWithSpriteFrame(v49, v49);
*((_DWORD *)this + 147) = v51;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 150) + 232))(*((_DWORD *)this + 150), v51, 2);
}
v52 = *((_DWORD *)this + 147);
v53 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v52 + 92);
v54 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v8 + 164))(v8);
v55 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 164))(v8);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v54 * 0.5, *(float *)(v55 + 4) * 0.5);
v53(v52, v59);
*((_BYTE *)this + 572) = 1;
}
else
{
*((_BYTE *)this + 572) = 0;
}
(*(void (__fastcall **)(_DWORD, _DWORD))(**((_DWORD **)this + 147) + 172))(
*((_DWORD *)this + 147),
*((unsigned __int8 *)this + 572));
std::string::~string((int)v68);
}
++v5;
std::string::~string((int)v66);
std::string::~string((int)v57);
std::string::~string((int)v62);
std::string::~string((int)v60);
}
return result;
}