//
// GameLevelManager::updateSavedLevelList from 0x140150fc0 to 0x1401511f4 (564 bytes)
//
// 3 xrefs:
// > LevelListCell::onClick @ 0x1400c01a4
// > GameLevelManager::onGetLevelListsCompleted @ 0x140150cd8
// > ??> @ 0x1406ca860
//
// 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 GameLevelManager::updateSavedLevelList(GameLevelManager *a1, GJLevelList *a2)
{
__int64 v3; // rbx
cocos2d::CCString *v4; // rax
const char *CString; // rax
size_t v6; // r8
__int64 v7; // rbx
void *v8; // rcx
std::string *p_m_creatorName; // rdx
std::string *p_m_listName; // rdx
std::string *p_m_listDesc; // rdx
__int64 v12; // rax
void *v13; // [rsp+20h] [rbp-58h]
_BYTE v14[32]; // [rsp+28h] [rbp-50h] BYREF
void *Block[2]; // [rsp+48h] [rbp-30h] BYREF
__int64 v16; // [rsp+58h] [rbp-20h]
unsigned __int64 v17; // [rsp+60h] [rbp-18h]
v3 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v13 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v3 = qword_1406C2EC0;
}
v4 = cocos2d::CCString::createWithFormat("%i", a2->m_listID);
CString = cocos2d::CCString::getCString(v4);
*(_OWORD *)Block = 0;
v16 = 0;
v17 = 0;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003A930(Block, CString, v6);
v7 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v3 + 376), Block);
if ( v17 > 0xF )
{
v8 = Block[0];
if ( v17 + 1 >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
v16 = 0;
v17 = 15;
LOBYTE(Block[0]) = 0;
if ( v7 )
{
*(_DWORD *)(v7 + 348) = a2->m_listVersion;
*(_DWORD *)(v7 + 352) = a2->m_downloads;
*(_DWORD *)(v7 + 356) = a2->m_likes;
*(_DWORD *)(v7 + 360) = a2->m_difficulty;
*(_DWORD *)(v7 + 364) = a2->m_accountID;
*(_BYTE *)(v7 + 397) = a2->m_featured;
if ( (std::string *)(v7 + 400) != &a2->m_creatorName )
{
p_m_creatorName = &a2->m_creatorName;
if ( a2->m_creatorName.m_data.m_capacity > 0xF )
p_m_creatorName = (std::string *)a2->m_creatorName.m_data.m_bigStorage;
sub_14003CCE0((void **)(v7 + 400), p_m_creatorName, a2->m_creatorName.m_data.m_size);
}
if ( (std::string *)(v7 + 432) != &a2->m_listName )
{
p_m_listName = &a2->m_listName;
if ( a2->m_listName.m_data.m_capacity > 0xF )
p_m_listName = (std::string *)a2->m_listName.m_data.m_bigStorage;
sub_14003CCE0((void **)(v7 + 432), p_m_listName, a2->m_listName.m_data.m_size);
}
if ( (std::string *)(v7 + 528) != &a2->m_listDesc )
{
p_m_listDesc = &a2->m_listDesc;
if ( a2->m_listDesc.m_data.m_capacity > 0xF )
p_m_listDesc = (std::string *)a2->m_listDesc.m_data.m_bigStorage;
sub_14003CCE0((void **)(v7 + 528), p_m_listDesc, a2->m_listDesc.m_data.m_size);
}
*(_DWORD *)(v7 + 560) = a2->m_uploadDate;
*(_DWORD *)(v7 + 564) = a2->m_updateDate;
v12 = sub_14003BDB0((__int64)v14, (__int64)&a2->m_levelsString);
GJLevelList::parseListLevels(v7, v12);
}
}