//
// GameLevelManager::encodeDataTo from 0x14014af00 to 0x14014b19a (666 bytes)
//
// 2 xrefs:
// > GameManager::encodeDataTo @ 0x1401893fd
// > ??> @ 0x1406ca770
//
// 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=1
void GameLevelManager::encodeDataTo(GameLevelManager *a1, DS_Dictionary *a2)
{
__int64 v4; // rcx
cocos2d::CCArray *v5; // rbp
cocos2d::CCDictionary *m_favoriteLists; // rdx
cocos2d::CCDictElement *m_pElements; // rdx
cocos2d::CCDictElement *i; // rbx
__int64 v9; // rax
void *v10; // [rsp+30h] [rbp+8h]
DS_Dictionary::setDictForKey(a2, "GLM_01", a1->m_mainLevels);
GameLevelManager::limitSavedLevels(a1);
GameLevelManager::purgeUnusedLevels(a1);
GameLevelManager::updateLevelOrders(a1);
GameLevelManager::updateLevelOrders(a1);
DS_Dictionary::setDictForKey(a2, "GLM_03", a1->m_onlineLevels);
GameLevelManager::cleanupDailyLevels(a1);
DS_Dictionary::setDictForKey(a2, "GLM_10", a1->m_dailyLevels);
DS_Dictionary::setIntegerForKey(a2, "GLM_11", a1->m_activeDailyID);
DS_Dictionary::setIntegerForKey(a2, "GLM_17", a1->m_activeWeeklyID);
DS_Dictionary::setIntegerForKey(a2, "GLM_23", a1->m_activeEventID);
DS_Dictionary::setDictForKey(a2, "GLM_16", a1->m_gauntletLevels);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
m_favoriteLists = a1->m_favoriteLists;
if ( m_favoriteLists )
{
m_pElements = m_favoriteLists->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
cocos2d::CCArray::addObject(v5, m_pElements->m_pObject);
m_pElements = i;
if ( !i )
break;
}
}
}
DS_Dictionary::setArrayForKey(a2, "GLM_22", v5);
DS_Dictionary::setBoolMapForKey(a2, "GLM_09", &a1->m_availableFilters);
v9 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v10 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v9 = qword_1406C2ED8;
}
if ( !*(_BYTE *)(v9 + 354) )
{
DS_Dictionary::setDictForKey(a2, "GLM_07", a1->m_downloadedLevels);
DS_Dictionary::setDictForKey(a2, "GLM_14", a1->m_reportedLevels);
}
DS_Dictionary::setDictForKey(a2, "GLM_12", a1->m_likedLevels);
DS_Dictionary::setDictForKey(a2, "GLM_13", a1->m_ratedLevels);
DS_Dictionary::setDictForKey(a2, "GLM_15", a1->m_ratedDemons);
DS_Dictionary::setDictForKey(a2, "GLM_06", a1->m_followedCreators);
DS_Dictionary::setDictForKey(a2, "GLM_08", a1->m_searchFilters);
DS_Dictionary::setDictForKey(a2, "GLM_18", a1->m_onlineFolders);
DS_Dictionary::setDictForKey(a2, "GLM_19", a1->m_localLevelsFolders);
DS_Dictionary::setArrayForKey(a2, "GLM_20", a1->m_smartTemplates);
}