//
// GJRobotSprite::updateFrame from 0x1403ad5c0 to 0x1403adbad (1517 bytes)
//
// 4 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x140382d28
// > SimplePlayer::updatePlayerFrame @ 0x140382d92
// > GJRobotSprite::init @ 0x1403acf24
// > ??> @ 0x140923b04
//
// This function is hookable on this platform (idp: pc, 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 11:31:21 +0000
//
// Hidden C++ exception states: #wind=6
unsigned int __fastcall GJRobotSprite::updateFrame(__int64 a1, int a2)
{
unsigned int v2; // r13d
int v4; // ecx
int v5; // eax
__int64 *v6; // rcx
struct cocos2d::CCTexture2D *Icon; // rax
cocos2d::CCArray *v8; // rbx
unsigned int v9; // r12d
unsigned int result; // eax
struct cocos2d::CCObject *v11; // r15
unsigned int v12; // eax
const char *v13; // rcx
cocos2d::CCString *v14; // rax
char *CString; // rax
size_t v16; // r8
const char *v17; // rdx
cocos2d::CCString *v18; // rax
const char *v19; // rax
size_t v20; // r8
const char *v21; // rdx
cocos2d::CCString *v22; // rax
const char *v23; // rax
size_t v24; // r8
const char *v25; // rdx
cocos2d::CCString *v26; // rax
const char *v27; // rax
size_t v28; // r8
__int64 v29; // rdx
__int64 v30; // rcx
const char *v31; // rdi
__int64 v32; // rbx
cocos2d::CCSpriteFrameCache *v33; // rax
struct cocos2d::CCSpriteFrame *v34; // rax
struct cocos2d::CCObject *v35; // rax
__int64 v36; // rdx
__int64 v37; // rcx
struct cocos2d::CCObject *v38; // rsi
const char *v39; // rdi
__int64 v40; // rbx
cocos2d::CCSpriteFrameCache *v41; // rax
struct cocos2d::CCSpriteFrame *v42; // rax
__int64 v43; // rbx
float v44; // xmm6_4
float *v45; // rax
__int64 v46; // rax
cocos2d::CCArray *v47; // rax
struct cocos2d::CCObject *v48; // rax
__int64 v49; // rdx
__int64 v50; // rcx
struct cocos2d::CCObject *v51; // rsi
const char *v52; // rdi
__int64 v53; // rbx
cocos2d::CCSpriteFrameCache *v54; // rax
struct cocos2d::CCSpriteFrame *v55; // rax
const char *v56; // rdx
cocos2d::CCString *v57; // rax
const char *v58; // rax
size_t v59; // r8
__int64 v60; // rdx
__int64 v61; // rcx
const char *v62; // rbx
cocos2d::CCSpriteFrameCache *v63; // rax
struct cocos2d::CCSpriteFrame *v64; // rax
__int64 v65; // rcx
struct cocos2d::CCSprite *v66; // rax
__int64 v67; // rdi
float v68; // xmm6_4
float *v69; // rax
__int64 v70; // rbx
__int64 v71; // rax
char v72; // dl
void *v73; // rcx
void *v74; // rcx
cocos2d::CCArray *v75; // [rsp+38h] [rbp-D0h]
cocos2d::CCArray *v76; // [rsp+38h] [rbp-D0h]
_BYTE v77[8]; // [rsp+40h] [rbp-C8h] BYREF
__m256i v78; // [rsp+48h] [rbp-C0h] BYREF
__m256i v79; // [rsp+68h] [rbp-A0h] BYREF
unsigned __int64 v80; // [rsp+88h] [rbp-80h]
__int128 v81; // [rsp+90h] [rbp-78h] BYREF
__int64 v82; // [rsp+A0h] [rbp-68h]
unsigned __int64 v83; // [rsp+A8h] [rbp-60h]
__int128 v84; // [rsp+B0h] [rbp-58h] BYREF
__int64 v85; // [rsp+C0h] [rbp-48h]
unsigned __int64 v86; // [rsp+C8h] [rbp-40h]
__int128 v87; // [rsp+D0h] [rbp-38h] BYREF
__int64 v88; // [rsp+E0h] [rbp-28h]
unsigned __int64 v89; // [rsp+E8h] [rbp-20h]
v2 = a2;
v4 = (*(_DWORD *)(a1 + 784) != 5) + 68;
v5 = v4;
if ( a2 < v4 )
v5 = a2;
if ( v5 >= 1 )
{
if ( a2 >= v4 )
v2 = v4;
}
else
{
v2 = 1;
}
v6 = (__int64 *)qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v75 = (cocos2d::CCArray *)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v75);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = (__int64 *)qword_14090BFD0;
}
Icon = GameManager::loadIcon(v6, v2, *(_DWORD *)(a1 + 784), *(_DWORD *)(a1 + 788));
(*(void (__fastcall **)(__int64, struct cocos2d::CCTexture2D *))(*(_QWORD *)(a1 + 344) + 24LL))(a1 + 344, Icon);
v8 = *(cocos2d::CCArray **)(*(_QWORD *)(a1 + 688) + 632LL);
v76 = v8;
v9 = 0;
result = cocos2d::CCArray::count(v8);
if ( result )
{
do
{
v11 = cocos2d::CCArray::objectAtIndex(v8, v9);
v12 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v11 + 56LL))(v11);
memset(&v78.m256i_u64[1], 0, 24);
v79.m256i_i64[0] = 15;
v78.m256i_i8[8] = 0;
v13 = "robot_%02d_%02d";
if ( *(_DWORD *)(a1 + 784) != 5 )
v13 = "spider_%02d_%02d";
v14 = cocos2d::CCString::createWithFormat(v13, v2, v12);
CString = (char *)cocos2d::CCString::getCString(v14);
v16 = -1;
do
++v16;
while ( CString[v16] );
sub_1400405A0((void **)&v78.m256i_i64[1], CString, v16);
v17 = &v78.m256i_i8[8];
if ( v79.m256i_i64[0] > 0xFuLL )
v17 = (const char *)v78.m256i_i64[1];
v18 = cocos2d::CCString::createWithFormat("%s_001.png", v17);
v19 = cocos2d::CCString::getCString(v18);
v87 = 0;
v88 = 0;
v89 = 0;
v20 = -1;
do
++v20;
while ( v19[v20] );
sub_14003D230(&v87, v19, v20);
v21 = &v78.m256i_i8[8];
if ( v79.m256i_i64[0] > 0xFuLL )
v21 = (const char *)v78.m256i_i64[1];
v22 = cocos2d::CCString::createWithFormat("%s_2_001.png", v21);
v23 = cocos2d::CCString::getCString(v22);
v84 = 0;
v85 = 0;
v86 = 0;
v24 = -1;
do
++v24;
while ( v23[v24] );
sub_14003D230(&v84, v23, v24);
v25 = &v78.m256i_i8[8];
if ( v79.m256i_i64[0] > 0xFuLL )
v25 = (const char *)v78.m256i_i64[1];
v26 = cocos2d::CCString::createWithFormat("%s_glow_001.png", v25);
v27 = cocos2d::CCString::getCString(v26);
v81 = 0;
v82 = 0;
v83 = 0;
v28 = -1;
do
++v28;
while ( v27[v28] );
sub_14003D230(&v81, v27, v28);
v31 = (const char *)&v87;
if ( v89 > 0xF )
v31 = (const char *)v87;
v32 = *(_QWORD *)v11;
v33 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v30, v29);
v34 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v33, v31);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCSpriteFrame *))(v32 + 1008))(v11, v34);
v35 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 760), v9);
v38 = v35;
if ( v35 )
{
v39 = (const char *)&v84;
if ( v86 > 0xF )
v39 = (const char *)v84;
v40 = *(_QWORD *)v35;
v41 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v37, v36);
v42 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v41, v39);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCSpriteFrame *))(v40 + 1008))(v38, v42);
v43 = *(_QWORD *)v38;
v44 = *(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v11 + 320LL))(v11) + 4)
* 0.5;
v45 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v11 + 320LL))(v11);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v77, *v45 * 0.5, v44);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v43 + 184))(v38, v46);
}
v47 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 768) + 480LL))(*(_QWORD *)(a1 + 768));
v48 = cocos2d::CCArray::objectAtIndex(v47, v9);
v51 = v48;
v52 = (const char *)&v81;
if ( v83 > 0xF )
v52 = (const char *)v81;
v53 = *(_QWORD *)v48;
v54 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v50, v49);
v55 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v54, v52);
(*(void (__fastcall **)(struct cocos2d::CCObject *, struct cocos2d::CCSpriteFrame *))(v53 + 1008))(v51, v55);
if ( v11 == *(struct cocos2d::CCObject **)(a1 + 792) )
{
v56 = &v78.m256i_i8[8];
if ( v79.m256i_i64[0] > 0xFuLL )
v56 = (const char *)v78.m256i_i64[1];
v57 = cocos2d::CCString::createWithFormat("%s_extra_001.png", v56);
v58 = cocos2d::CCString::getCString(v57);
memset(&v79.m256i_u64[1], 0, 24);
v80 = 0;
v59 = -1;
do
++v59;
while ( v58[v59] );
sub_14003D230(&v79.m256i_i64[1], v58, v59);
v62 = &v79.m256i_i8[8];
if ( v80 > 0xF )
v62 = (const char *)v79.m256i_i64[1];
v63 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v61, v60);
v64 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v63, v62);
if ( v64 )
{
v65 = *(_QWORD *)(a1 + 776);
if ( v65 )
{
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(*(_QWORD *)v65 + 1008LL))(v65, v64);
}
else
{
v66 = cocos2d::CCSprite::createWithSpriteFrame(v64);
*(_QWORD *)(a1 + 776) = v66;
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 792) + 456LL))(
*(_QWORD *)(a1 + 792),
v66,
2);
}
v67 = **(_QWORD **)(a1 + 776);
v68 = *(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v11 + 320LL))(v11) + 4)
* 0.5;
v69 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v11 + 320LL))(v11);
v70 = *(_QWORD *)(a1 + 776);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v78, *v69 * 0.5, v68);
(*(void (__fastcall **)(__int64, __int64))(v67 + 184))(v70, v71);
v72 = 1;
}
else
{
v72 = 0;
}
*(_BYTE *)(a1 + 752) = v72;
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 776) + 336LL))(*(_QWORD *)(a1 + 776));
if ( v80 > 0xF )
{
v73 = (void *)v79.m256i_i64[1];
if ( v80 + 1 >= 0x1000 )
{
v73 = *(void **)(v79.m256i_i64[1] - 8);
if ( (unsigned __int64)(v79.m256i_i64[1] - (_QWORD)v73 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v73);
}
}
sub_14003D310((__int64)&v81);
sub_14003D310((__int64)&v84);
sub_14003D310((__int64)&v87);
if ( v79.m256i_i64[0] > 0xFuLL )
{
v74 = (void *)v78.m256i_i64[1];
if ( (unsigned __int64)(v79.m256i_i64[0] + 1) >= 0x1000 )
{
v74 = *(void **)(v78.m256i_i64[1] - 8);
if ( (unsigned __int64)(v78.m256i_i64[1] - (_QWORD)v74 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v74);
}
++v9;
v8 = v76;
result = cocos2d::CCArray::count(v76);
}
while ( v9 < result );
}
return result;
}