//
// GameManager::addDuplicateLastFrame from 0x100266590 to 0x10026686e (734 bytes)
//
// 0 xrefs:
//
// 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
//
void __fastcall GameManager::addDuplicateLastFrame(GameManager *a1, int a2)
{
double v2; // xmm0_8
intptr_t v3; // r14
cocos2d::CCObject *v4; // rax
__int64 v5; // rbx
GameManager *v6; // rax
cocos2d::CCArray *v7; // rax
cocos2d::CCString *v8; // rax
const char *CString; // r15
size_t v10; // rax
size_t v11; // r12
char *v12; // rbx
size_t v13; // r14
GameManager *v14; // rax
cocos2d::CCArray *v15; // rax
cocos2d::CCString *v16; // rax
const char *v17; // r13
size_t v18; // rax
size_t v19; // r12
char *v20; // r15
unsigned int v21; // ebx
char v22; // r14
__int64 v23; // r15
size_t v24; // rbx
char v25; // r13
cocos2d::CCDictionary *v26; // r12
cocos2d::CCObject *v27; // r15
intptr_t v28; // [rsp+8h] [rbp-B8h]
__int128 v29; // [rsp+10h] [rbp-B0h] BYREF
void *v30; // [rsp+20h] [rbp-A0h]
__int128 v31; // [rsp+30h] [rbp-90h] BYREF
void *__p; // [rsp+40h] [rbp-80h]
GameManager *v33; // [rsp+50h] [rbp-70h]
__int64 v34; // [rsp+58h] [rbp-68h]
unsigned int v35; // [rsp+60h] [rbp-60h]
unsigned int v36; // [rsp+64h] [rbp-5Ch]
__int128 __dst; // [rsp+68h] [rbp-58h] BYREF
void *v38; // [rsp+78h] [rbp-48h]
__int128 v39; // [rsp+80h] [rbp-40h] BYREF
void *v40; // [rsp+90h] [rbp-30h]
v3 = a2;
v4 = cocos2d::CCDictionary::objectForKey(a1->m_framesForAnimation, a2);
v33 = a1;
if ( v4 )
v5 = LODWORD(v4[1].__vftable);
else
v5 = 1;
v6 = GameManager::sharedState();
v7 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v6->m_mainFramesForAnimation, a2);
v35 = v5 - 1;
v8 = cocos2d::CCArray::stringAtIndex(v7, (int)v5 - 1);
CString = cocos2d::CCString::getCString(v8);
v10 = strlen(CString);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v11 = v10;
v34 = v5;
v36 = a2;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
v38 = v12;
*(_QWORD *)&__dst = v13 + 1;
v3 = a2;
*((_QWORD *)&__dst + 1) = v11;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
LABEL_11:
memmove(v12, CString, v11);
v12[v11] = 0;
v14 = GameManager::sharedState();
v15 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v14->m_detailFramesForAnimation, v3);
v16 = cocos2d::CCArray::stringAtIndex(v15, v35);
v17 = cocos2d::CCString::getCString(v16);
v18 = strlen(v17);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v2);
v19 = v18;
v28 = v3;
if ( v18 >= 0x17 )
{
v24 = 26;
if ( (v18 | 7) != 0x17 )
v24 = (v18 | 7) + 1;
v20 = (char *)operator new(v24);
v40 = v20;
*(_QWORD *)&v39 = v24 | 1;
*((_QWORD *)&v39 + 1) = v19;
v21 = v34;
LABEL_20:
memmove(v20, v17, v19);
v20[v19] = 0;
v22 = __dst & 1;
if ( (__dst & 1) == 0 )
goto LABEL_16;
goto LABEL_21;
}
LOBYTE(v39) = 2 * v18;
v20 = (char *)&v39 + 1;
v21 = v34;
if ( v18 )
goto LABEL_20;
BYTE1(v39) = 0;
v22 = __dst & 1;
if ( (__dst & 1) == 0 )
{
LABEL_16:
v30 = v38;
v2 = *(double *)&__dst;
v29 = __dst;
v23 = (__int64)v33;
goto LABEL_22;
}
LABEL_21:
sub_100006B70(&v29, v38, *((unsigned __int64 *)&__dst + 1), v2);
v23 = (__int64)v33;
LABEL_22:
v25 = v39 & 1;
if ( (v39 & 1) != 0 )
{
sub_100006B70(&v31, v40, *((unsigned __int64 *)&v39 + 1), v2);
}
else
{
__p = v40;
v31 = v39;
}
GameManager::addCustomAnimationFrame(v23, v36, v21, (unsigned __int8 *)&v29, (unsigned __int8 *)&v31);
if ( (v31 & 1) != 0 )
operator delete(__p);
if ( (v29 & 1) != 0 )
operator delete(v30);
v26 = *(cocos2d::CCDictionary **)(v23 + 376);
v27 = (cocos2d::CCObject *)operator new(0x40u);
cocos2d::CCObject::CCObject(v27);
v27->__vftable = (cocos2d::CCObject_vtbl *)off_1008B8348;
LODWORD(v27[1].__vftable) = v21 + 1;
cocos2d::CCObject::autorelease(v27);
cocos2d::CCDictionary::setObject(v26, v27, v28);
if ( v25 )
operator delete(v40);
if ( v22 )
operator delete(v38);
}