//
// GameLevelManager::replayPlatformerSaveJournal from 0x844f44 to 0x845590 (1612 bytes)
//
// 2 xrefs:
// > AppDelegate::loadingIsFinished @ 0x6e6b94
// > ??> @ 0xd90a8
//
// 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:20 +0000
//
__int64 __fastcall GameLevelManager::replayPlatformerSaveJournal(GameLevelManager *this)
{
DS_Dictionary *v1; // x20
char *v2; // x0
char *v3; // x2
char *v5; // x22
char *v6; // x19
const char *v7; // x1
int IntegerForKey; // w0
int v9; // w3
int v10; // w21
char *v11; // x0
char *v12; // x21
char *v13; // x19
const char *v14; // x1
char *v15; // x0
char *v16; // x2
char *v17; // x19
char *v18; // x0
char *v19; // x19
char *v20; // x0
int v21; // w21
unsigned int v22; // w21
int v23; // w0
__int64 SavedGauntletLevel; // x0
__int64 SavedLevel; // x24
size_t v26; // x0
char *v27; // x1
size_t v28; // x2
_BYTE *v29; // x21
__int64 v30; // x3
LocalLevelManager *StringForKey; // x0
cocos2d::CCArray *v32; // x26
unsigned int i; // w21
_BOOL4 v34; // w1
std::mutex *v36; // [xsp+70h] [xbp+70h]
_BOOL4 v37; // [xsp+78h] [xbp+78h]
void *v38; // [xsp+90h] [xbp+90h] BYREF
char *v39; // [xsp+98h] [xbp+98h]
char *v40; // [xsp+A0h] [xbp+A0h]
void *v41; // [xsp+A8h] [xbp+A8h] BYREF
char *v42; // [xsp+B0h] [xbp+B0h]
__int64 v43; // [xsp+C0h] [xbp+C0h] BYREF
size_t v44; // [xsp+C8h] [xbp+C8h]
void *v45; // [xsp+D0h] [xbp+D0h]
__int64 v46[3]; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v47; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v48; // [xsp+F8h] [xbp+F8h]
void *v49; // [xsp+100h] [xbp+100h]
v36 = (std::mutex *)qword_155C990;
std::mutex::lock((std::mutex *)qword_155C990);
v1 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v1);
if ( !(unsigned __int8)sub_82FA7C((__int64)v1) )
{
v2 = *((char **)v1 + 26);
if ( v2 )
{
v3 = *((char **)v1 + 27);
if ( v2 != v3 )
*((_QWORD *)v1 + 27) = &v3[8 * ~((unsigned __int64)(v3 - 8 - v2) >> 3)];
operator delete(v2);
}
pugi::xml_document::~xml_document(v1);
operator delete(v1);
std::mutex::unlock(v36);
return _stack_chk_guard;
}
v38 = nullptr;
v39 = nullptr;
v40 = nullptr;
DS_Dictionary::getAllKeys((__int64 *)&v41, v1);
v5 = v42;
v6 = (char *)v41;
if ( v41 != v42 )
{
while ( 1 )
{
v7 = v6 + 1;
if ( (*v6 & 1) != 0 )
v7 = *((const char **)v6 + 2);
if ( !(unsigned __int8)DS_Dictionary::stepIntoSubDictWithKey(v1, v7) )
goto LABEL_10;
IntegerForKey = DS_Dictionary::getIntegerForKey(v1, "sq");
v9 = dword_155C998;
if ( IntegerForKey > dword_155C998 )
v9 = DS_Dictionary::getIntegerForKey(v1, "sq");
dword_155C998 = v9;
v10 = DS_Dictionary::getIntegerForKey(v1, "ow");
if ( v10 == (unsigned int)sub_7FE4F8((GJAccountManager *)v6) )
break;
DS_Dictionary::stepOutOfSubDict(v1);
v11 = v39;
if ( v39 == v40 )
{
std::vector::__push_back_slow_path((__int64 *)&v38, v6);
LABEL_10:
v6 += 24;
if ( v5 == v6 )
goto LABEL_21;
}
else
{
if ( v39 )
{
std::string::basic_string((unsigned __int64)v39, v6);
v11 = v39;
}
v6 += 24;
v39 = v11 + 24;
if ( v5 == v6 )
goto LABEL_21;
}
}
v21 = DS_Dictionary::getIntegerForKey(v1, "t");
DS_Dictionary::getStringForKey(&v43, v1, "cs");
if ( v21 != 2 )
{
v22 = DS_Dictionary::getIntegerForKey(v1, "id");
v23 = DS_Dictionary::getIntegerForKey(v1, "did");
if ( v23 <= 0 )
{
if ( !(unsigned __int8)DS_Dictionary::getBoolForKey(v1, "g") )
{
LABEL_69:
SavedLevel = GameLevelManager::getSavedLevel(this, (const char *)v22);
if ( SavedLevel )
goto LABEL_45;
SavedLevel = GameLevelManager::getSavedDailyLevelFromLevelID(this, v22);
if ( SavedLevel )
goto LABEL_45;
SavedLevel = GameLevelManager::getSavedGauntletLevel(this, (const char *)v22);
if ( SavedLevel )
goto LABEL_45;
goto LABEL_55;
}
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(this, (const char *)v22);
}
else
{
SavedGauntletLevel = GameLevelManager::getSavedDailyLevel(this, (const char *)(unsigned int)v23);
}
SavedLevel = SavedGauntletLevel;
if ( SavedGauntletLevel )
{
LABEL_45:
v26 = (unsigned __int8)v43 >> 1;
if ( (v43 & 1) != 0 )
v26 = v44;
if ( v26 )
{
if ( (__int64 *)(SavedLevel + 1472) != &v43 )
{
if ( (v43 & 1) != 0 )
{
v27 = (char *)v45;
v28 = v44;
}
else
{
v28 = (unsigned __int8)v43 >> 1;
v27 = (char *)&v43 + 1;
}
std::string::assign((__int64 *)(SavedLevel + 1472), v27, v28);
}
*(_DWORD *)(SavedLevel + 1520) = DS_Dictionary::getIntegerForKey(v1, "cv");
*(_DWORD *)(SavedLevel + 1524) = DS_Dictionary::getIntegerForKey(v1, "fv");
v29 = (_BYTE *)(SavedLevel + 1496);
DS_Dictionary::getStringForKey(&v47, v1, "rs");
if ( (*(_BYTE *)(SavedLevel + 1496) & 1) != 0 )
{
**(_BYTE **)(SavedLevel + 1512) = 0;
*(_QWORD *)(SavedLevel + 1504) = 0;
}
else
{
*(_BYTE *)(SavedLevel + 1497) = 0;
*v29 = 0;
}
std::string::reserve((__int64 *)(SavedLevel + 1496), 0);
v30 = v48;
*(_QWORD *)v29 = v47;
*(_QWORD *)(SavedLevel + 1504) = v30;
*(_QWORD *)(SavedLevel + 1512) = v49;
*(_BYTE *)(SavedLevel + 1528) = DS_Dictionary::getBoolForKey(v1, "ps");
}
goto LABEL_55;
}
goto LABEL_69;
}
StringForKey = (LocalLevelManager *)DS_Dictionary::getStringForKey(&v47, v1, "uid");
v32 = *(cocos2d::CCArray **)(LocalLevelManager::sharedState(StringForKey) + 360);
if ( v32 )
{
if ( (v47 & 1) != 0 )
{
SavedLevel = 0;
if ( !v48 )
goto LABEL_74;
}
else if ( !((int)(unsigned __int8)v47 >> 1) )
{
goto LABEL_55;
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v32); ++i )
{
SavedLevel = cocos2d::CCArray::objectAtIndex(v32, i);
GJGameLevel::generateAutoSaveUID(v46, (GJGameLevel *)SavedLevel);
v34 = sub_7FEA60((__int64)v46, (__int64)&v47);
if ( (v46[0] & 1) != 0 )
{
v37 = v34;
operator delete((void *)v46[2]);
v34 = v37;
}
if ( v34 )
goto LABEL_78;
}
}
SavedLevel = 0;
LABEL_78:
if ( (v47 & 1) == 0 )
{
if ( SavedLevel )
goto LABEL_45;
goto LABEL_55;
}
LABEL_74:
operator delete(v49);
if ( SavedLevel )
goto LABEL_45;
LABEL_55:
DS_Dictionary::stepOutOfSubDict(v1);
if ( (v43 & 1) != 0 )
operator delete(v45);
goto LABEL_10;
}
LABEL_21:
v12 = v39;
v13 = (char *)v38;
if ( v38 != v39 )
{
do
{
v14 = v13 + 1;
if ( (*v13 & 1) != 0 )
v14 = *((const char **)v13 + 2);
DS_Dictionary::removeKey(v1, v14);
v13 += 24;
}
while ( v12 != v13 );
sub_82F964(v1);
}
v15 = *((char **)v1 + 26);
if ( v15 )
{
v16 = *((char **)v1 + 27);
if ( v15 != v16 )
*((_QWORD *)v1 + 27) = &v16[8 * ~((unsigned __int64)(v16 - 8 - v15) >> 3)];
operator delete(v15);
}
pugi::xml_document::~xml_document(v1);
operator delete(v1);
v17 = (char *)v41;
if ( v41 )
{
v18 = v42;
if ( v41 != v42 )
{
do
{
v42 = v18 - 24;
std::string::~string((__int64)(v18 - 24));
v18 = v42;
}
while ( v17 != v42 );
v18 = (char *)v41;
}
operator delete(v18);
}
v19 = (char *)v38;
if ( v38 )
{
v20 = v39;
if ( v38 != v39 )
{
do
{
v39 = v20 - 24;
std::string::~string((__int64)(v20 - 24));
v20 = v39;
}
while ( v19 != v39 );
v20 = (char *)v38;
}
operator delete(v20);
}
std::mutex::unlock(v36);
return _stack_chk_guard;
}