//
// GameLevelManager::replayPlatformerSaveJournal from 0x4cfac8 to 0x4cfdf8 (816 bytes)
//
// 1 xrefs:
// > AppDelegate::loadingIsFinished @ 0x3f6e40
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:50:45 +0000
//
int __fastcall GameLevelManager::replayPlatformerSaveJournal(GameLevelManager *this)
{
std::mutex *v2; // r11
DS_Dictionary *v3; // r4
char *v4; // r6
const char *v5; // r1
int v6; // r5
int IntegerForKey; // r0
int v8; // r5
int v9; // r5
LocalLevelManager *StringForKey; // r0
_DWORD *SavedLevel; // r5
unsigned int i; // r8
const char *v14; // r8
const char *v15; // r1
int SavedGauntletLevel; // r0
int v17; // r3
int v18; // r1
int v19; // r2
int *v20; // r6
char *j; // r5
const char *v23; // r1
cocos2d::CCArray *v24; // [sp+4h] [bp-70h]
char *v25; // [sp+8h] [bp-6Ch]
_BOOL4 v26; // [sp+2Ch] [bp-48h]
int *v27; // [sp+30h] [bp-44h] BYREF
int *v28; // [sp+34h] [bp-40h]
int *v29; // [sp+38h] [bp-3Ch]
_DWORD v30[3]; // [sp+3Ch] [bp-38h] BYREF
unsigned __int8 v31[4]; // [sp+48h] [bp-2Ch] BYREF
int v32; // [sp+4Ch] [bp-28h]
unsigned __int8 v33[12]; // [sp+54h] [bp-20h] BYREF
int v34; // [sp+60h] [bp-14h] BYREF
int v35; // [sp+64h] [bp-10h]
int v36; // [sp+68h] [bp-Ch]
v2 = (std::mutex *)dword_D2BB34;
std::mutex::lock((std::mutex *)dword_D2BB34);
v3 = (DS_Dictionary *)operator new(0xD8u);
DS_Dictionary::DS_Dictionary(v3);
if ( !sub_4B5ADC(v3) )
{
DS_Dictionary::~DS_Dictionary(v3);
operator delete(v3);
return std::mutex::unlock(v2);
}
v27 = nullptr;
v28 = nullptr;
v29 = nullptr;
DS_Dictionary::getAllKeys((DS_Dictionary *)v30);
v4 = (char *)v30[0];
v25 = (char *)v30[1];
while ( v4 != v25 )
{
if ( (*v4 & 1) != 0 )
v5 = *((const char **)v4 + 2);
else
v5 = v4 + 1;
if ( DS_Dictionary::stepIntoSubDictWithKey(v3, v5) )
{
v6 = dword_D2BB3C;
if ( v6 >= DS_Dictionary::getIntegerForKey(v3, "sq") )
IntegerForKey = dword_D2BB3C;
else
IntegerForKey = DS_Dictionary::getIntegerForKey(v3, "sq");
dword_D2BB3C = IntegerForKey;
v8 = DS_Dictionary::getIntegerForKey(v3, "ow");
if ( v8 == sub_4A9938((GJAccountManager *)v4) )
{
v9 = DS_Dictionary::getIntegerForKey(v3, "t");
DS_Dictionary::getStringForKey((DS_Dictionary *)v31, (const char *)v3);
if ( v9 == 2 )
{
StringForKey = (LocalLevelManager *)DS_Dictionary::getStringForKey((DS_Dictionary *)&v34, (const char *)v3);
v24 = *(cocos2d::CCArray **)(LocalLevelManager::sharedState(StringForKey) + 284);
if ( v24 )
{
if ( (v34 & 1) != 0 ? v35 : (int)(unsigned __int8)v34 >> 1 )
{
for ( i = 0; i < cocos2d::CCArray::count(v24); ++i )
{
SavedLevel = (_DWORD *)cocos2d::CCArray::objectAtIndex(v24, i);
GJGameLevel::generateAutoSaveUID((GJGameLevel *)v33, (int)SavedLevel);
v26 = sub_4A9CC4(v33, (unsigned __int8 *)&v34);
std::string::~string((int)v33);
if ( v26 )
goto LABEL_29;
}
}
}
SavedLevel = nullptr;
LABEL_29:
std::string::~string((int)&v34);
LABEL_40:
if ( SavedLevel )
goto LABEL_41;
goto LABEL_49;
}
v14 = (const char *)DS_Dictionary::getIntegerForKey(v3, "id");
v15 = (const char *)DS_Dictionary::getIntegerForKey(v3, "did");
if ( (int)v15 <= 0 )
{
if ( DS_Dictionary::getBoolForKey(v3, (const char *)&a1i2r3e45s789g[12]) )
{
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(this, v14);
goto LABEL_36;
}
}
else
{
SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(this, v15);
LABEL_36:
SavedLevel = (_DWORD *)SavedGauntletLevel;
if ( SavedGauntletLevel )
goto LABEL_41;
}
SavedLevel = (_DWORD *)GameLevelManager::getSavedLevel(this, v14);
if ( !SavedLevel )
{
SavedLevel = GameLevelManager::getSavedDailyLevelFromLevelID(this, (int)v14);
if ( !SavedLevel )
{
SavedLevel = (_DWORD *)GameLevelManager::getSavedGauntletLevel(this, v14);
goto LABEL_40;
}
}
LABEL_41:
if ( (v31[0] & 1) != 0 )
v17 = v32;
else
v17 = (int)v31[0] >> 1;
if ( v17 )
{
std::string::operator=((unsigned __int8 *)SavedLevel + 1148, v31);
SavedLevel[293] = DS_Dictionary::getIntegerForKey(v3, "cv");
SavedLevel[294] = DS_Dictionary::getIntegerForKey(v3, "fv");
DS_Dictionary::getStringForKey((DS_Dictionary *)&v34, (const char *)v3);
if ( (SavedLevel[290] & 1) != 0 )
{
*(_BYTE *)SavedLevel[292] = 0;
SavedLevel[291] = 0;
}
else
{
*((_BYTE *)SavedLevel + 1161) = 0;
*((_BYTE *)SavedLevel + 1160) = 0;
}
std::string::reserve(SavedLevel + 290, 0);
v18 = v35;
v19 = v36;
SavedLevel[290] = v34;
SavedLevel[291] = v18;
SavedLevel[292] = v19;
v34 = 0;
v35 = 0;
v36 = 0;
std::string::~string((int)&v34);
*((_BYTE *)SavedLevel + 1180) = DS_Dictionary::getBoolForKey(v3, "ps");
}
LABEL_49:
DS_Dictionary::stepOutOfSubDict(v3);
std::string::~string((int)v31);
goto LABEL_50;
}
DS_Dictionary::stepOutOfSubDict(v3);
if ( v28 == v29 )
{
std::vector::__push_back_slow_path((int *)&v27, (int)v4);
}
else
{
if ( v28 )
std::string::basic_string(v28, (int)v4);
v28 += 3;
}
}
LABEL_50:
v4 += 12;
}
v20 = v28;
if ( v27 != v28 )
{
for ( j = (char *)v27 + 1; ; j += 12 )
{
v23 = (*(j - 1) & 1) != 0 ? *(const char **)(j + 7) : j;
DS_Dictionary::removeKey(v3, v23);
if ( v20 == (int *)(j + 11) )
break;
}
sub_4B5A60();
}
DS_Dictionary::~DS_Dictionary(v3);
operator delete(v3);
std::__vector_base::~__vector_base((int)v30);
std::__vector_base::~__vector_base((int)&v27);
return std::mutex::unlock(v2);
}