//
// CCAnimatedSprite::loadType from 0x140043cd0 to 0x140044667 (2455 bytes)
//
// 4 xrefs:
// > CCAnimatedSprite::initWithType @ 0x140043c9e
// > GJRobotSprite::init @ 0x1403acab4
// > AnimatedGameObject::init @ 0x1406449d8
// > ??> @ 0x14090f740
//
// 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:25:30 +0000
//
// Hidden C++ exception states: #wind=7
void __fastcall CCAnimatedSprite::loadType(_QWORD *a1, _BYTE *a2, struct cocos2d::CCTexture2D *a3, unsigned __int8 a4)
{
size_t v6; // r14
size_t v7; // r8
void **v8; // rdx
char *v9; // rdi
const void *v10; // rcx
size_t v11; // r12
size_t v12; // r8
size_t v13; // r13
__int64 v14; // rdx
int v15; // ebx
char *v16; // rax
__int64 v17; // rcx
__int64 v18; // rcx
cocos2d::CCDictionary **v19; // rbx
__int64 v20; // rcx
__int64 v21; // rcx
__int64 v22; // rax
__int64 Definition; // r12
cocos2d::CCString *v24; // rbx
const char *CString; // rax
size_t v26; // r8
void **v27; // rbx
cocos2d::CCTextureCache *v28; // rax
void *v29; // r8
cocos2d::CCString *v30; // rdi
void *v31; // r8
cocos2d::CCString *v32; // rbx
void *v33; // r8
bool v34; // di
bool v35; // r13
cocos2d::CCString *v36; // rax
char *v37; // rax
size_t v38; // r8
void *v39; // rcx
const struct cocos2d::CCRect *v40; // rax
struct cocos2d::CCSprite *v41; // rax
__int64 v42; // rdi
float v43; // xmm6_4
float *v44; // rax
__int64 v45; // rbx
__int64 v46; // rax
cocos2d::CCString *v47; // rax
const char *v48; // rbx
void *v49; // r8
char *v50; // rdi
__int64 v51; // rdi
float v52; // xmm6_4
float *v53; // rax
__int64 v54; // rbx
__int64 v55; // rax
size_t v56; // r8
char *v57; // rbx
__int64 v58; // rax
__int64 v59; // rdx
__int64 v60; // rcx
__int64 v61; // rcx
_QWORD *v62; // rdx
void *Buf2[2]; // [rsp+48h] [rbp-69h] BYREF
size_t Size; // [rsp+58h] [rbp-59h]
unsigned __int64 v67; // [rsp+60h] [rbp-51h]
void *v68[2]; // [rsp+68h] [rbp-49h] BYREF
__int64 v69; // [rsp+78h] [rbp-39h]
unsigned __int64 v70; // [rsp+80h] [rbp-31h]
void *Block[2]; // [rsp+88h] [rbp-29h] BYREF
__int64 v72; // [rsp+98h] [rbp-19h]
unsigned __int64 v73; // [rsp+A0h] [rbp-11h]
*(_OWORD *)Buf2 = 0;
Size = 0;
v67 = 0;
v6 = -1;
v7 = -1;
do
++v7;
while ( a2[v7] );
sub_14003D230(Buf2, a2, v7);
v8 = Buf2;
v9 = (char *)Buf2[0];
if ( v67 > 0xF )
v8 = (void **)Buf2[0];
v10 = a1 + 75;
if ( a1[78] > 0xFu )
v10 = (const void *)a1[75];
v11 = a1[77];
v12 = v11;
v13 = Size;
if ( Size < v11 )
v12 = Size;
v15 = memcmp(v10, v8, v12);
if ( !v15 )
{
if ( v11 >= v13 )
v15 = v11 > v13;
else
v15 = -1;
}
if ( v67 > 0xF )
{
v16 = v9;
if ( v67 + 1 >= 0x1000 )
{
v9 = *((char **)v9 - 1);
if ( (unsigned __int64)(v16 - v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
if ( v15 )
{
v17 = a1[86];
if ( v17 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 728LL))(v17);
v18 = a1[85];
if ( v18 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v18 + 728LL))(v18);
v19 = (cocos2d::CCDictionary **)a1[83];
if ( v19 )
{
cocos2d::CCDictionary::removeAllObjects(v19[50]);
cocos2d::CCObject::release((cocos2d::CCObject *)v19);
}
v20 = a1[85];
if ( v20 )
{
LOBYTE(v14) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v20 + 520LL))(v20, v14);
}
v21 = a1[86];
if ( v21 )
{
LOBYTE(v14) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 520LL))(v21, v14);
}
*((_DWORD *)a1 + 174) = 0;
a1[83] = 0;
a1[85] = 0;
a1[86] = 0;
a1[84] = 0;
v22 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v22, a2);
if ( !a3 )
{
Size = 11;
v67 = 15;
Buf2[0] = (void *)0x6853657469727073LL;
Buf2[1] = (void *)7628133;
v24 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, Buf2);
sub_14003D310((__int64)Buf2);
CString = cocos2d::CCString::getCString(v24);
*(_OWORD *)Block = 0;
v72 = 0;
v73 = 0;
v26 = -1;
do
++v26;
while ( CString[v26] );
sub_14003D230(Block, CString, v26);
sub_140044D80(Block, ".png", 4u);
v27 = Block;
if ( v73 > 0xF )
v27 = (void **)Block[0];
v28 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
a3 = cocos2d::CCTextureCache::addImage(v28, (const char *)v27, 0);
if ( v73 > 0xF )
{
v29 = Block[0];
if ( v73 + 1 >= 0x1000 )
{
v29 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v29 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v29);
}
v72 = 0;
v73 = 15;
LOBYTE(Block[0]) = 0;
}
*(_OWORD *)v68 = 0;
v69 = 6;
v70 = 15;
strcpy((char *)v68, "useFBF");
v30 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, v68);
if ( v70 > 0xF )
{
v31 = v68[0];
if ( v70 + 1 >= 0x1000 )
{
v31 = *((void **)v68[0] - 1);
if ( (unsigned __int64)((char *)v68[0] - (char *)v31 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v31);
}
v69 = 0;
v70 = 15;
LOBYTE(v68[0]) = 0;
*(_OWORD *)Buf2 = 0;
Size = 5;
v67 = 15;
strcpy((char *)Buf2, "usePA");
v32 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, Buf2);
if ( v67 > 0xF )
{
v33 = Buf2[0];
if ( v67 + 1 >= 0x1000 )
{
v33 = *((void **)Buf2[0] - 1);
if ( (unsigned __int64)((char *)Buf2[0] - (char *)v33 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v33);
}
Size = 0;
v67 = 15;
LOBYTE(Buf2[0]) = 0;
v34 = v30 && cocos2d::CCString::boolValue(v30);
v35 = v32 && cocos2d::CCString::boolValue(v32);
*(_OWORD *)Buf2 = 0;
Size = 0;
v67 = 0;
Buf2[0] = sub_14003D460(0x20u);
Size = 16;
v67 = 31;
strcpy((char *)Buf2[0], "defaultAnimation");
v36 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, Buf2);
v37 = (char *)cocos2d::CCString::getCString(v36);
v38 = -1;
do
++v38;
while ( v37[v38] );
sub_1400405A0((void **)a1 + 88, v37, v38);
if ( v67 > 0xF )
{
v39 = Buf2[0];
if ( v67 + 1 >= 0x1000 )
{
v39 = *((void **)Buf2[0] - 1);
if ( (unsigned __int64)((char *)Buf2[0] - (char *)v39 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v39);
}
if ( v34 )
{
v40 = (const struct cocos2d::CCRect *)cocos2d::CCRect::CCRect((cocos2d::CCRect *)v68, 0.0, 0.0, 0.0, 0.0);
v41 = cocos2d::CCSprite::createWithTexture(a3, v40);
a1[85] = v41;
v42 = *(_QWORD *)v41;
v43 = *(float *)((*(__int64 (__fastcall **)(_QWORD *))(*a1 + 320LL))(a1) + 4) * 0.5;
v44 = (float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 320LL))(a1);
v45 = a1[85];
v46 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, *v44 * 0.5, v43);
(*(void (__fastcall **)(__int64, __int64))(v42 + 184))(v45, v46);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 464LL))(a1, a1[85]);
a1[84] = a1[85];
}
if ( v35 )
{
Buf2[1] = nullptr;
Size = 8;
v67 = 15;
Buf2[0] = (void *)0x637365446D696E61LL;
v47 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(Definition, Buf2);
v48 = cocos2d::CCString::getCString(v47);
if ( v67 > 0xF )
{
v49 = Buf2[0];
if ( v67 + 1 >= 0x1000 )
{
v49 = *((void **)Buf2[0] - 1);
if ( (unsigned __int64)((char *)Buf2[0] - (char *)v49 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v49);
}
Size = 0;
v67 = 15;
LOBYTE(Buf2[0]) = 0;
v50 = (char *)operator new(0x280u);
v68[0] = v50;
cocos2d::CCSprite::CCSprite((cocos2d::CCSprite *)v50);
*(_QWORD *)v50 = &CCPartAnimSprite::`vftable';
*((_QWORD *)v50 + 40) = &CCPartAnimSprite::`vftable';
*((_QWORD *)v50 + 43) = &CCPartAnimSprite::`vftable';
*((_QWORD *)v50 + 75) = 0;
*((_QWORD *)v50 + 76) = 0;
v50[616] = 0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)(v50 + 620));
*((_QWORD *)v50 + 79) = 0;
if ( (unsigned __int8)CCPartAnimSprite::initWithAnimDesc(v50, v48, a3, a4) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v50);
}
else
{
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v50 + 8LL))(v50, 1);
v50 = nullptr;
}
a1[86] = v50;
v51 = *(_QWORD *)v50;
v52 = *(float *)((*(__int64 (__fastcall **)(_QWORD *))(*a1 + 320LL))(a1) + 4) * 0.5;
v53 = (float *)(*(__int64 (__fastcall **)(_QWORD *))(*a1 + 320LL))(a1);
v54 = a1[86];
v55 = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, *v53 * 0.5, v52);
(*(void (__fastcall **)(__int64, __int64))(v51 + 184))(v54, v55);
(*(void (__fastcall **)(_QWORD *, _QWORD))(*a1 + 464LL))(a1, a1[86]);
a1[84] = a1[86];
}
*((_DWORD *)a1 + 174) = 0;
*(_OWORD *)Buf2 = 0;
Size = 0;
v67 = 0;
v56 = -1;
do
++v56;
while ( a2[v56] );
sub_14003D230(Buf2, a2, v56);
v68[0] = Buf2;
v57 = (char *)operator new(0x1D8u);
cocos2d::CCNode::CCNode((cocos2d::CCNode *)v57);
*(_QWORD *)v57 = &SpriteAnimationManager::`vftable';
*((_QWORD *)v57 + 40) = 0;
*((_QWORD *)v57 + 41) = 0;
*((_QWORD *)v57 + 42) = 0;
*((_QWORD *)v57 + 43) = 0;
*((_OWORD *)v57 + 22) = 0;
*((_QWORD *)v57 + 46) = 0;
*((_QWORD *)v57 + 47) = 15;
v57[352] = 0;
*((_QWORD *)v57 + 50) = 0;
*(_OWORD *)(v57 + 408) = 0;
*((_QWORD *)v57 + 53) = 0;
*((_QWORD *)v57 + 54) = 15;
v57[408] = 0;
*(_OWORD *)(v57 + 440) = 0;
*((_QWORD *)v57 + 57) = 0;
*((_QWORD *)v57 + 58) = 15;
v57[440] = 0;
v58 = sub_14003F4F0((__int64)Block, (__int64)Buf2);
if ( (unsigned __int8)SpriteAnimationManager::initWithOwner(v57, a1, v58) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v57);
}
else
{
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v57 + 8LL))(v57, 1);
v57 = nullptr;
}
sub_14003D310((__int64)Buf2);
a1[83] = v57;
cocos2d::CCObject::retain((cocos2d::CCObject *)v57);
v60 = a1[86];
if ( v60 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v60 + 336LL))(v60, 0);
v61 = a1[85];
if ( v61 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v61 + 336LL))(v61, 0);
LOBYTE(v59) = 1;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 336LL))(a1, v59);
v62 = a1 + 88;
if ( a1[91] > 0xFu )
v62 = (_QWORD *)*v62;
*(_OWORD *)Buf2 = 0;
Size = 0;
v67 = 0;
do
++v6;
while ( *((_BYTE *)v62 + v6) );
sub_14003D230(Buf2, v62, v6);
SpriteAnimationManager::runAnimation(a1[83], Buf2);
}
}