//
// GJLevelList::addLevelToList from 0x140176ef0 to 0x14017707c (396 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::cellPerformedAction @ 0x1402f9a18
// > LevelListLayer::cloneList @ 0x140308361
// > ??> @ 0x1406cafa4
//
// 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
//
// Hidden C++ exception states: #wind=2
void GJLevelList::addLevelToList(GJLevelList *a1, GJGameLevel *a2)
{
std::_Vector_val>::pointer Myfirst; // rax
std::_Vector_val>::pointer Mylast; // rdx
int v6; // eax
std::_Vector_val>::pointer v7; // rdx
unsigned int v8; // ebx
_BYTE *v9; // rax
size_t v10; // r8
GJGameLevel *ListSnapshot; // rax
void *v12; // rcx
int v13; // [rsp+20h] [rbp-268h] BYREF
void *Block[2]; // [rsp+28h] [rbp-260h] BYREF
__int128 v15; // [rsp+38h] [rbp-250h]
_BYTE v16[528]; // [rsp+50h] [rbp-238h] BYREF
Myfirst = a1->m_levels._Mypair._Myval2._Myfirst;
Mylast = a1->m_levels._Mypair._Myval2._Mylast;
if ( Myfirst == Mylast )
{
LABEL_4:
v6 = a2->m_levelID.random - a2->m_levelID.seed;
v13 = v6;
v7 = a1->m_levels._Mypair._Myval2._Mylast;
if ( v7 == a1->m_levels._Mypair._Myval2._Myend )
{
sub_140063270((const void **)&a1->m_levels._Mypair._Myval2._Myfirst, v7, &v13);
}
else
{
*v7 = v6;
++a1->m_levels._Mypair._Myval2._Mylast;
}
GJLevelList::updateLevelsString(a1);
v8 = a2->m_levelID.random - a2->m_levelID.seed;
fmt::BasicWriter::BasicWriter(v16);
fmt::BasicWriter::operator<<(v16, v8);
v9 = (_BYTE *)fmt::BasicWriter::c_str(v16);
*(_OWORD *)Block = 0;
v15 = 0;
v10 = -1;
do
++v10;
while ( v9[v10] );
sub_14003A930(Block, v9, v10);
fmt::BasicWriter::~BasicWriter(v16);
ListSnapshot = GJGameLevel::getListSnapshot(a2);
cocos2d::CCDictionary::setObject(a1->m_levelsDict, ListSnapshot, Block);
if ( *((_QWORD *)&v15 + 1) > 0xFu )
{
v12 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v15 + 1) + 1LL) >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
a1->m_modified = 1;
}
else
{
while ( *Myfirst != a2->m_levelID.random - a2->m_levelID.seed )
{
if ( ++Myfirst == Mylast )
goto LABEL_4;
}
}
}