//
// GameManager::addDuplicateLastFrame from 0x1002505d0 to 0x1002508ae (734 bytes)
//
// 0 xrefs:
//
// 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 12:27:24 +0000
//
void __fastcall GameManager::addDuplicateLastFrame(__int64 a1, unsigned int a2)
{
__int64 v4; // rdi
__int64 v5; // r14
__int64 v6; // rax
__int64 v7; // rdx
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
const char *v11; // rsi
__int64 v12; // rax
const char *CString; // r15
const char *v14; // rdi
size_t v15; // rax
__int64 v16; // rdx
size_t v17; // r12
char *v18; // rbx
__int64 v19; // r13
size_t v20; // r14
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
const char *v24; // r13
size_t v25; // rax
size_t v26; // r12
char *v27; // r15
unsigned int v28; // ebx
char v29; // r14
__int64 v30; // r15
size_t v31; // rbx
char v32; // r13
__int64 v33; // r12
_DWORD *v34; // r15
__int64 v35; // [rsp+8h] [rbp-B8h]
__int128 v36; // [rsp+10h] [rbp-B0h] BYREF
void *v37; // [rsp+20h] [rbp-A0h]
__int128 v38; // [rsp+30h] [rbp-90h] BYREF
void *__p; // [rsp+40h] [rbp-80h]
__int64 v40; // [rsp+50h] [rbp-70h]
__int64 v41; // [rsp+58h] [rbp-68h]
unsigned int v42; // [rsp+60h] [rbp-60h]
unsigned int v43; // [rsp+64h] [rbp-5Ch]
__int128 __dst; // [rsp+68h] [rbp-58h] BYREF
void *v45; // [rsp+78h] [rbp-48h]
__int128 v46; // [rsp+80h] [rbp-40h] BYREF
void *v47; // [rsp+90h] [rbp-30h]
v4 = *(_QWORD *)(a1 + 400);
v5 = (int)a2;
v6 = cocos2d::CCDictionary::objectForKey_1(v4);
v40 = a1;
if ( v6 )
v8 = *(unsigned int *)(v6 + 56);
else
v8 = 1;
GameManager::sharedState(v4, (int)a2, v7);
v10 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(v9 + 376));
v11 = (const char *)(unsigned int)(v8 - 1);
v42 = v8 - 1;
v12 = cocos2d::CCArray::stringAtIndex(v10, v11);
CString = (const char *)cocos2d::CCString::getCString(v12);
v14 = CString;
v15 = strlen(CString);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v17 = v15;
v41 = v8;
v43 = a2;
if ( v15 >= 0x17 )
{
v19 = v5;
v20 = 26;
if ( (v15 | 7) != 0x17 )
v20 = (v15 | 7) + 1;
v18 = (char *)operator new(v20);
v45 = v18;
*(_QWORD *)&__dst = v20 + 1;
v5 = v19;
*((_QWORD *)&__dst + 1) = v17;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v15;
v18 = (char *)&__dst + 1;
if ( v15 )
{
LABEL_11:
v14 = v18;
v11 = CString;
memmove(v18, CString, v17);
}
v18[v17] = 0;
GameManager::sharedState(v14, v11, v16);
v22 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(v21 + 384));
v23 = cocos2d::CCArray::stringAtIndex(v22, v42);
v24 = (const char *)cocos2d::CCString::getCString(v23);
v25 = strlen(v24);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v26 = v25;
v35 = v5;
if ( v25 >= 0x17 )
{
v31 = 26;
if ( (v25 | 7) != 0x17 )
v31 = (v25 | 7) + 1;
v27 = (char *)operator new(v31);
v47 = v27;
*(_QWORD *)&v46 = v31 | 1;
*((_QWORD *)&v46 + 1) = v26;
v28 = v41;
LABEL_20:
memmove(v27, v24, v26);
v27[v26] = 0;
v29 = __dst & 1;
if ( (__dst & 1) == 0 )
goto LABEL_16;
goto LABEL_21;
}
LOBYTE(v46) = 2 * v25;
v27 = (char *)&v46 + 1;
v28 = v41;
if ( v25 )
goto LABEL_20;
BYTE1(v46) = 0;
v29 = __dst & 1;
if ( (__dst & 1) == 0 )
{
LABEL_16:
v37 = v45;
v36 = __dst;
v30 = v40;
goto LABEL_22;
}
LABEL_21:
sub_10001AD30(&v36, v45, *((unsigned __int64 *)&__dst + 1));
v30 = v40;
LABEL_22:
v32 = v46 & 1;
if ( (v46 & 1) != 0 )
{
sub_10001AD30(&v38, v47, *((unsigned __int64 *)&v46 + 1));
}
else
{
__p = v47;
v38 = v46;
}
GameManager::addCustomAnimationFrame(v30, v43, v28, (unsigned __int8 *)&v36, (unsigned __int8 *)&v38);
if ( (v38 & 1) != 0 )
operator delete(__p);
if ( (v36 & 1) != 0 )
operator delete(v37);
v33 = *(_QWORD *)(v30 + 400);
v34 = operator new(0x40u);
cocos2d::CCObject::CCObject(v34);
*(_QWORD *)v34 = off_100ABB920;
v34[14] = v28 + 1;
cocos2d::CCObject::autorelease(v34);
cocos2d::CCDictionary::setObject_1(v33, v34, v35);
if ( v32 )
operator delete(v47);
if ( v29 )
operator delete(v45);
}