//
// GameLevelManager::onGetLevelSaveDataCompleted from 0x10008ecfc to 0x10008eee0 (484 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10008937c
//
// 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
//
void __fastcall GameLevelManager::onGetLevelSaveDataCompleted(GameLevelManager *a1, __int64 a2, const char *a3)
{
bool v5; // w0
bool v6; // w21
__int64 v7; // x21
cocos2d::CCArray *v8; // x20
unsigned int i; // w21
cocos2d::CCString *v10; // x0
int v11; // w22
cocos2d::CCString *v12; // x0
int v13; // w23
GJGameLevel *SavedLevel; // x0
GJGameLevel *v15; // x22
float v16; // s0
_BOOL4 v17; // w23
GameLevelManager *v18; // x0
float v19; // s0
GameLevelManager *v20; // x0
void *v21[2]; // [xsp+0h] [xbp-60h] BYREF
char v22; // [xsp+17h] [xbp-49h]
std::string __p; // [xsp+18h] [xbp-48h] BYREF
if ( a3[23] < 0 )
a3 = *(const char **)a3;
GameLevelManager::removeDLFromActive(a1, a3);
sub_100009900(&__p, "-1");
v5 = sub_1000045BC((_QWORD *)a2, &__p);
v6 = v5;
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
{
operator delete(__p.__r_.__value_.__l.__data_);
if ( v6 )
return;
}
else if ( v5 )
{
return;
}
v7 = *(char *)(a2 + 23);
if ( v7 < 0 )
{
if ( strlen(*(const char **)a2) < 0x29 )
return;
v7 = *(_QWORD *)(a2 + 8);
}
else if ( strlen((const char *)a2) < 0x29 )
{
return;
}
std::string::basic_string(&__p, (const std::string *)a2, 0x14u, v7 - 40, (std::allocator *)v21);
cocos2d::ZipUtils::decompressString(v21, &__p, 0, 11);
v8 = (cocos2d::CCArray *)sub_100093338(v21, ",");
for ( i = 1; i < (unsigned int)sub_10024A36C(v8); i += 2 )
{
v10 = cocos2d::CCArray::stringAtIndex(v8, i - 1);
v11 = cocos2d::CCString::intValue(v10);
v12 = cocos2d::CCArray::stringAtIndex(v8, i);
v13 = cocos2d::CCString::intValue(v12);
if ( (unsigned int)(v13 - 1) <= 9 )
{
SavedLevel = GameLevelManager::getSavedLevel(a1, v11);
v15 = SavedLevel;
if ( SavedLevel )
{
SavedLevel->m_stars.value = v13;
v16 = vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0;
v15->m_stars.seed = (int)v16;
v15->m_stars.random = v13 + (int)v16;
v17 = v13 == 10;
v15->m_demon.value = v17;
v18 = (GameLevelManager *)rand();
v19 = vcvts_n_f32_s32((unsigned int)v18, 0x1Fu) * 1000.0;
v15->m_demon.seed = (int)v19;
v15->m_demon.random = (int)v19 + v17;
GameLevelManager::verifyLevelState(v18, v15);
GameLevelManager::updateLevelRewards(v20, v15);
}
}
}
if ( v22 < 0 )
operator delete(v21[0]);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
}