//
// GameLevelManager::onGetLevelSaveDataCompleted from 0x811760 to 0x8119e0 (640 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x85c17c
// > ??> @ 0xddcb0
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 12:54:50 +0000
//
__int64 __fastcall GameLevelManager::onGetLevelSaveDataCompleted(GameLevelManager *this, __int64 a2, char *a3)
{
const char *v5; // x3
_BOOL4 v6; // w21
unsigned __int8 v7; // w21
__int64 v8; // x3
cocos2d::CCArray *v9; // x21
unsigned int v10; // w19
cocos2d::CCString *v11; // x0
unsigned int v12; // w22
cocos2d::CCString *v13; // x0
int v14; // w20
__int64 SavedLevel; // x0
GJGameLevel *v17; // x22
int v18; // w0
_BOOL4 v19; // w25
int v20; // w0
int v21; // w20
__int64 v22[3]; // [xsp+68h] [xbp+68h] BYREF
__int64 v23[2]; // [xsp+80h] [xbp+80h] BYREF
void *v24; // [xsp+90h] [xbp+90h]
v5 = a3 + 1;
if ( (*a3 & 1) != 0 )
v5 = *((const char **)a3 + 2);
GameLevelManager::removeDLFromActive(this, v5);
v23[0] = 0;
v23[1] = 0;
v24 = nullptr;
std::string::__init(v23, &word_117CE08, 2u);
v6 = sub_7FEA60(a2, (__int64)v23);
if ( (v23[0] & 1) != 0 )
operator delete(v24);
if ( !v6 )
{
v7 = *(_BYTE *)a2;
if ( (*(_BYTE *)a2 & 1) != 0 )
{
if ( strlen(*(const char **)(a2 + 16)) <= 0x28 )
return _stack_chk_guard;
v8 = *(_QWORD *)(a2 + 8);
}
else
{
if ( strlen((const char *)(a2 + 1)) <= 0x28 )
return _stack_chk_guard;
v8 = v7 >> 1;
}
std::string::basic_string(v22, a2, 0x14u, v8 - 40);
cocos2d::ZipUtils::decompressString(v23, v22, 0, 11);
v9 = sub_80CFCC((unsigned __int8 *)v23, &byte_1169BE0);
v10 = 0;
while ( (unsigned int)cocos2d::CCArray::count(v9) > v10 + 1 )
{
v11 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, v10);
v12 = cocos2d::CCString::intValue(v11);
v13 = (cocos2d::CCString *)cocos2d::CCArray::stringAtIndex(v9, v10 + 1);
v14 = cocos2d::CCString::intValue(v13);
if ( (unsigned int)(v14 - 1) <= 9
&& (SavedLevel = GameLevelManager::getSavedLevel(this, (const char *)v12),
(v17 = (GJGameLevel *)SavedLevel) != nullptr) )
{
*(_DWORD *)(SavedLevel + 956) = v14;
v18 = rand();
v19 = v14 == 10;
*((_DWORD *)v17 + 235) = v19;
v20 = (int)(float)((float)((float)v18 * 4.6566e-10) * 1000.0);
*((_DWORD *)v17 + 238) = v20;
*((_DWORD *)v17 + 237) = v14 + v20;
v21 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*((_DWORD *)v17 + 234) = v21;
*((_DWORD *)v17 + 233) = v19 + v21;
GameLevelManager::verifyLevelState(this, v17);
GameLevelManager::updateLevelRewards(this, v17);
v10 += 2;
}
else
{
v10 += 2;
}
}
if ( (v23[0] & 1) != 0 )
operator delete(v24);
if ( (v22[0] & 1) != 0 )
operator delete((void *)v22[2]);
}
return _stack_chk_guard;
}