//
// GameLevelManager::clearPlatformerSaves from 0x83c964 to 0x83cce4 (896 bytes)
//
// 2 xrefs:
// > ClearPlatformerSavesPopup::FLAlert_Clicked @ 0xc90204
// > ??> @ 0xb1d48
//
// 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:55:14 +0000
//
__int64 __fastcall GameLevelManager::clearPlatformerSaves(GameLevelManager *this, int a2)
{
_QWORD *v3; // x24
__int64 v4; // x0
__int64 v5; // x0
__int64 v6; // x21
unsigned int v7; // w22
GJGameLevel *v8; // x19
unsigned __int8 v9; // w0
_BYTE *v10; // x1
__int64 v11; // x0
__int64 v12; // x0
__int64 i; // x21
GJGameLevel *v14; // x19
unsigned __int8 v15; // w0
_BYTE *v16; // x1
__int64 v17; // x0
__int64 v18; // x0
__int64 j; // x21
GJGameLevel *v20; // x19
unsigned __int8 v21; // w0
_BYTE *v22; // x1
__int64 isPlatformer; // x0
__int64 k; // x21
unsigned __int8 *v25; // x19
unsigned __int8 v26; // w0
unsigned __int8 *v27; // x1
__int64 v28; // x0
cocos2d::CCArray *v29; // x24
unsigned int v30; // w19
GJGameLevel *v31; // x0
GJGameLevel *v32; // x21
v3 = (_QWORD *)GameLevelManager::sharedState(_stack_chk_guard);
v4 = v3[95];
if ( v4 )
{
v5 = *(_QWORD *)(v4 + 56);
if ( v5 )
{
v6 = *(_QWORD *)(v5 + 288);
v7 = 0;
while ( 1 )
{
v8 = *(GJGameLevel **)(v5 + 264);
if ( !v8 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v5 + 264)) )
{
LABEL_10:
if ( !v6 )
goto LABEL_13;
goto LABEL_11;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_8;
if ( !*((_BYTE *)v8 + 912) )
goto LABEL_10;
v9 = *((_BYTE *)v8 + 1472);
v10 = (char *)v8 + 1472;
if ( (v9 & 1) != 0 )
{
LABEL_9:
if ( !*((_QWORD *)v10 + 1) )
goto LABEL_10;
goto LABEL_12;
}
LABEL_27:
if ( !(v9 >> 1) )
goto LABEL_10;
LABEL_12:
++v7;
GJGameLevel::clearPlatformerSave(v8);
if ( !v6 )
goto LABEL_13;
LABEL_11:
v5 = v6;
v6 = *(_QWORD *)(v6 + 288);
}
if ( *((_BYTE *)v8 + 912) )
goto LABEL_10;
LABEL_8:
v9 = *((_BYTE *)v8 + 1472);
v10 = (char *)v8 + 1472;
if ( (v9 & 1) != 0 )
goto LABEL_9;
goto LABEL_27;
}
}
v7 = 0;
LABEL_13:
v11 = v3[106];
if ( v11 )
{
v12 = *(_QWORD *)(v11 + 56);
if ( v12 )
{
for ( i = *(_QWORD *)(v12 + 288); ; i = *(_QWORD *)(i + 288) )
{
v14 = *(GJGameLevel **)(v12 + 264);
if ( !v14 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v12 + 264)) )
{
LABEL_22:
if ( !i )
goto LABEL_30;
goto LABEL_23;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_20;
if ( !*((_BYTE *)v14 + 912) )
goto LABEL_22;
v15 = *((_BYTE *)v14 + 1472);
v16 = (char *)v14 + 1472;
if ( (v15 & 1) != 0 )
{
LABEL_21:
if ( !*((_QWORD *)v16 + 1) )
goto LABEL_22;
goto LABEL_29;
}
LABEL_78:
if ( !(v15 >> 1) )
goto LABEL_22;
LABEL_29:
++v7;
GJGameLevel::clearPlatformerSave(v14);
if ( !i )
goto LABEL_30;
LABEL_23:
v12 = i;
}
if ( *((_BYTE *)v14 + 912) )
goto LABEL_22;
LABEL_20:
v15 = *((_BYTE *)v14 + 1472);
v16 = (char *)v14 + 1472;
if ( (v15 & 1) != 0 )
goto LABEL_21;
goto LABEL_78;
}
}
LABEL_30:
v17 = v3[117];
if ( v17 )
{
v18 = *(_QWORD *)(v17 + 56);
if ( v18 )
{
for ( j = *(_QWORD *)(v18 + 288); ; j = *(_QWORD *)(j + 288) )
{
v20 = *(GJGameLevel **)(v18 + 264);
if ( !v20 || !GJGameLevel::isPlatformer(*(GJGameLevel **)(v18 + 264)) )
{
LABEL_39:
if ( !j )
goto LABEL_42;
goto LABEL_40;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_37;
if ( !*((_BYTE *)v20 + 912) )
goto LABEL_39;
v21 = *((_BYTE *)v20 + 1472);
v22 = (char *)v20 + 1472;
if ( (v21 & 1) != 0 )
{
LABEL_38:
if ( !*((_QWORD *)v22 + 1) )
goto LABEL_39;
goto LABEL_41;
}
LABEL_73:
if ( !(v21 >> 1) )
goto LABEL_39;
LABEL_41:
++v7;
GJGameLevel::clearPlatformerSave(v20);
if ( !j )
goto LABEL_42;
LABEL_40:
v18 = j;
}
if ( *((_BYTE *)v20 + 912) )
goto LABEL_39;
LABEL_37:
v21 = *((_BYTE *)v20 + 1472);
v22 = (char *)v20 + 1472;
if ( (v21 & 1) != 0 )
goto LABEL_38;
goto LABEL_73;
}
}
LABEL_42:
isPlatformer = v3[93];
if ( isPlatformer )
{
isPlatformer = *(_QWORD *)(isPlatformer + 56);
if ( isPlatformer )
{
for ( k = *(_QWORD *)(isPlatformer + 288); ; k = *(_QWORD *)(k + 288) )
{
v25 = *(unsigned __int8 **)(isPlatformer + 264);
if ( !v25
|| (isPlatformer = GJGameLevel::isPlatformer(*(GJGameLevel **)(isPlatformer + 264)), !(_BYTE)isPlatformer) )
{
LABEL_51:
if ( !k )
goto LABEL_54;
goto LABEL_52;
}
if ( !a2 )
break;
if ( a2 != 2 )
goto LABEL_49;
isPlatformer = v25[912];
if ( !v25[912] )
goto LABEL_51;
v26 = v25[1472];
v27 = v25 + 1472;
if ( (v26 & 1) != 0 )
{
LABEL_50:
isPlatformer = *((_QWORD *)v27 + 1);
if ( !isPlatformer )
goto LABEL_51;
goto LABEL_53;
}
LABEL_68:
isPlatformer = v26 >> 1;
if ( !isPlatformer )
goto LABEL_51;
LABEL_53:
++v7;
isPlatformer = GJGameLevel::clearPlatformerSave((GJGameLevel *)v25);
if ( !k )
goto LABEL_54;
LABEL_52:
isPlatformer = k;
}
isPlatformer = v25[912];
if ( v25[912] )
goto LABEL_51;
LABEL_49:
v26 = v25[1472];
v27 = v25 + 1472;
if ( (v26 & 1) != 0 )
goto LABEL_50;
goto LABEL_68;
}
}
LABEL_54:
v28 = LocalLevelManager::sharedState((LocalLevelManager *)isPlatformer);
v29 = *(cocos2d::CCArray **)(v28 + 360);
if ( v29 )
{
v30 = 0;
if ( (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(v28 + 360)) )
{
do
{
v31 = (GJGameLevel *)cocos2d::CCArray::objectAtIndex(v29, v30);
v32 = v31;
if ( !v31 || !GJGameLevel::isPlatformer(v31) )
goto LABEL_62;
if ( a2 )
{
if ( a2 == 2 && !*((_BYTE *)v32 + 912) )
{
++v30;
continue;
}
}
else if ( *((_BYTE *)v32 + 912) )
{
goto LABEL_62;
}
if ( (*((_BYTE *)v32 + 1472) & 1) != 0 )
{
if ( *((_QWORD *)v32 + 185) )
goto LABEL_80;
}
else if ( *((_BYTE *)v32 + 1472) >> 1 )
{
LABEL_80:
++v7;
++v30;
GJGameLevel::clearPlatformerSave(v32);
continue;
}
LABEL_62:
++v30;
}
while ( v30 < (unsigned int)cocos2d::CCArray::count(v29) );
}
}
return v7;
}