//
// GJLevelList::addLevelToList from 0x8576e8 to 0x857844 (348 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::cellPerformedAction @ 0x7e6754
// > GJLevelList::duplicateListLevels @ 0x85787c
// > ??> @ 0xd1680
//
// This function is hookable on this platform (idp: arm, 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:55:30 +0000
//
__int64 __fastcall GJLevelList::addLevelToList(GJLevelList *this, GJGameLevel *a2)
{
int *v4; // x0
int *v5; // x2
int v6; // w3
int *i; // x0
int v8; // t1
unsigned __int64 v9; // x0
__int64 v10; // x23
cocos2d::CCObject *ListSnapshot; // [xsp+40h] [xbp+40h]
int v13; // [xsp+5Ch] [xbp+5Ch] BYREF
unsigned __int64 v14[3]; // [xsp+60h] [xbp+60h] BYREF
v4 = *((int **)this + 40);
v5 = *((int **)this + 41);
if ( v4 == v5 )
{
v6 = *((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83);
}
else
{
v6 = *((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83);
if ( *v4 == v6 )
return _stack_chk_guard;
for ( i = v4 + 1; v5 != i; ++i )
{
v8 = *i;
if ( v8 == v6 )
return _stack_chk_guard;
}
}
v9 = *((_QWORD *)this + 42);
v13 = v6;
if ( (unsigned __int64)v5 >= v9 )
{
std::vector::__push_back_slow_path((void **)this + 40, &v13);
}
else
{
if ( v5 )
{
*v5 = v6;
v5 = *((int **)this + 41);
}
*((_QWORD *)this + 41) = v5 + 1;
}
GJLevelList::updateLevelsString(this);
v10 = *((_QWORD *)this + 67);
ListSnapshot = (cocos2d::CCObject *)GJGameLevel::getListSnapshot(a2);
GameToolbox::intToString(v14, (GameToolbox *)(unsigned int)(*((_DWORD *)a2 + 82) - *((_DWORD *)a2 + 83)));
cocos2d::CCDictionary::setObject(v10, ListSnapshot);
if ( (v14[0] & 1) != 0 )
operator delete((void *)v14[2]);
*((_BYTE *)this + 399) = 1;
return _stack_chk_guard;
}