//
// GameLevelManager::markLevelAsDownloaded from 0x140153690 to 0x1401537aa (282 bytes)
//
// 3 xrefs:
// > GameLevelManager::processOnDownloadLevelCompleted @ 0x140153486
// > LevelListLayer::loadLevelsFinished @ 0x14030698e
// > ??> @ 0x1406ca8a8
//
// 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::markLevelAsDownloaded(GameLevelManager *a1, int a2)
{
cocos2d::CCString *v4; // rax
const char *CString; // rax
size_t v6; // r8
void *v7; // rcx
void *Block[2]; // [rsp+20h] [rbp-38h] BYREF
__int128 v9; // [rsp+30h] [rbp-28h]
if ( cocos2d::CCDictionary::count(a1->m_downloadedLevels) >= 0x64 )
{
cocos2d::CCDictionary::getFirstKey(a1->m_downloadedLevels, Block);
cocos2d::CCDictionary::removeObjectForKey(a1->m_downloadedLevels, Block);
sub_14003A830((__int64)Block);
}
v4 = cocos2d::CCString::createWithFormat("%i", a2);
CString = cocos2d::CCString::getCString(v4);
*(_OWORD *)Block = 0;
v9 = 0;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003A930(Block, CString, v6);
cocos2d::CCDictionary::setObject(a1->m_downloadedLevels, a1->m_trueString, Block);
if ( *((_QWORD *)&v9 + 1) > 0xFu )
{
v7 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v9 + 1) + 1LL) >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
}