//
// GJLevelList::addLevelToList from 0x4d8cdc to 0x4d8d92 (182 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::cellPerformedAction @ 0x49a48c
// > GJLevelList::duplicateListLevels @ 0x4d8dc0
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:50:54 +0000
//
int __fastcall GJLevelList::addLevelToList(GJLevelList *this, GJGameLevel *a2)
{
int result; // r0
_DWORD *i; // r3
_DWORD *v6; // r6
int v7; // r2
int v8; // r1
int v9; // r2
unsigned int v10; // r1
int v11; // r9
int *ListSnapshot; // r8
int v13; // [sp+4h] [bp-18h] BYREF
_BYTE v14[12]; // [sp+8h] [bp-14h] BYREF
result = *((_DWORD *)this + 67);
for ( i = *((_DWORD **)this + 66); ; ++i )
{
v6 = i;
v7 = *((_DWORD *)a2 + 67);
v8 = *((_DWORD *)a2 + 68);
if ( i == (_DWORD *)result )
break;
if ( *v6 == v7 - v8 )
return result;
}
v9 = v7 - v8;
v10 = *((_DWORD *)this + 68);
v13 = v9;
if ( (unsigned int)i >= v10 )
{
std::vector::__push_back_slow_path((_DWORD *)this + 66, &v13);
}
else
{
if ( i )
*i = v9;
*((_DWORD *)this + 67) += 4;
}
GJLevelList::updateLevelsString(this);
v11 = *((_DWORD *)this + 101);
ListSnapshot = GJGameLevel::getListSnapshot(a2);
GameToolbox::intToString((GameToolbox *)v14, *((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68));
cocos2d::CCDictionary::setObject(v11, (cocos2d::CCObject *)ListSnapshot);
result = std::string::~string((int)v14);
*((_BYTE *)this + 331) = 1;
return result;
}