//
// GameLevelManager::onGetLevelSaveDataCompleted from 0x10052bcb0 to 0x10052bf49 (665 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051fe38
//
// This function is hookable on this platform (idp: pc, 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:31:48 +0000
//
void __fastcall GameLevelManager::onGetLevelSaveDataCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3)
{
__int64 v3; // rdx
unsigned __int8 v4; // r14
unsigned __int64 v5; // r15
char *v6; // r13
char *v7; // rdi
unsigned __int64 v8; // rbx
unsigned __int64 v9; // rax
size_t v10; // rdx
size_t v11; // rax
size_t v12; // r15
char *v13; // r14
size_t v14; // rbx
__int64 v15; // r14
unsigned int i; // r15d
__int64 v17; // rax
unsigned int v18; // r12d
__int64 v19; // rax
int v20; // r13d
__int64 v21; // rdi
__int64 SavedLevel; // rax
_DWORD *v23; // r12
float v24; // xmm0_4
_BOOL4 v25; // ebx
float v26; // xmm0_4
std::string v27; // [rsp+8h] [rbp-68h] BYREF
__int64 v28; // [rsp+20h] [rbp-50h]
char *__s; // [rsp+28h] [rbp-48h]
_QWORD __s2[2]; // [rsp+30h] [rbp-40h] BYREF
void *v31; // [rsp+40h] [rbp-30h]
v28 = a1;
if ( (*(_BYTE *)a3 & 1) != 0 )
v3 = *(_QWORD *)(a3 + 16);
else
v3 = a3 + 1;
GameLevelManager::removeDLFromActive(v28, v3);
*(_WORD *)((char *)__s2 + 1) = 12589;
BYTE3(__s2[0]) = 0;
v4 = *a2;
v5 = *a2 >> 1;
v6 = *((char **)a2 + 2);
v7 = v6;
__s = (char *)(a2 + 1);
if ( (v4 & 1) == 0 )
v7 = (char *)(a2 + 1);
v8 = *((_QWORD *)a2 + 1);
v9 = v8;
if ( (v4 & 1) == 0 )
v9 = v5;
v10 = 2;
if ( v9 < 2 )
v10 = v9;
if ( ((v9 == 2) & (memcmp(v7, (char *)__s2 + 1, v10) == 0)) == 0 )
{
if ( (v4 & 1) != 0 )
{
if ( strlen(v6) < 0x29 )
return;
v5 = v8;
__s = v6;
if ( v8 > 0x13 )
{
LABEL_15:
v11 = v5 - 40;
v12 = v5 - 20;
if ( v12 >= v11 )
v12 = v11;
v13 = (char *)__s2 + 1;
if ( v12 >= 0x17 )
{
v14 = 26;
if ( (v12 | 7) != 0x17 )
v14 = (v12 | 7) + 1;
v13 = (char *)operator new(v14);
v31 = v13;
__s2[0] = v14 + 1;
__s2[1] = v12;
}
else
{
LOBYTE(__s2[0]) = 2 * v12;
if ( !v12 )
{
LABEL_27:
v13[v12] = 0;
cocos2d::ZipUtils::decompressString(&v27, (char *)__s2, 0, 11);
v15 = sub_10053FBE0(&v27, ",");
for ( i = 1; i < (unsigned int)sub_1007FEF90(v15); i += 2 )
{
v17 = cocos2d::CCArray::stringAtIndex(v15, i - 1);
v18 = cocos2d::CCString::intValue(v17);
v19 = cocos2d::CCArray::stringAtIndex(v15, i);
v20 = cocos2d::CCString::intValue(v19);
if ( (unsigned int)(v20 - 1) <= 9 )
{
v21 = v28;
SavedLevel = GameLevelManager::getSavedLevel(v28, v18);
v23 = (_DWORD *)SavedLevel;
if ( SavedLevel )
{
*(_DWORD *)(SavedLevel + 956) = v20;
v24 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v23[238] = (int)v24;
v23[237] = v20 + (int)v24;
v25 = v20 == 10;
v23[235] = v25;
v26 = (float)((float)rand() * 4.6566129e-10) * 1000.0;
v23[234] = (int)v26;
v23[233] = (int)v26 + v25;
GameLevelManager::verifyLevelState(v21, v23);
GameLevelManager::updateLevelRewards(v21, v23);
}
}
}
if ( (*(_BYTE *)&v27.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v27.__r_.__value_.__l.__data_);
if ( (__s2[0] & 1) != 0 )
operator delete(v31);
return;
}
}
memmove(v13, __s + 20, v12);
goto LABEL_27;
}
}
else
{
if ( strlen(__s) < 0x29 )
return;
if ( v4 >= 0x28u )
goto LABEL_15;
}
sub_100056810();
}
}