//
// GameLevelManager::writePlatformerSaveJournal from 0x4cae58 to 0x4cb060 (520 bytes)
//
// 1 xrefs:
// > PlayLayer::onQuit @ 0x407b5c
//
// 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:37 +0000
//
void __fastcall GameLevelManager::writePlatformerSaveJournal(GameLevelManager *this, GJGameLevel *a2)
{
int v3; // r8
int v4; // r3
std::mutex *v6; // r10
DS_Dictionary *v7; // r4
char *v8; // r1
char *v9; // r1
int v10; // r0
char *v11[2]; // [sp+4h] [bp-1Ch] BYREF
char *v12; // [sp+Ch] [bp-14h]
int v13[3]; // [sp+10h] [bp-10h] BYREF
if ( a2 )
{
v3 = *((_DWORD *)a2 + 238);
if ( v3 == 2 || v3 == 3 && *((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68) > 0 )
{
v4 = *((unsigned __int8 *)a2 + 1148);
if ( (v4 & 1) != 0 ? *((_DWORD *)a2 + 288) : v4 >> 1 )
{
v6 = (std::mutex *)dword_D2BB34;
std::mutex::lock((std::mutex *)dword_D2BB34);
v7 = (DS_Dictionary *)operator new(0xD8u);
DS_Dictionary::DS_Dictionary(v7);
if ( !sub_4B5ADC(v7) )
{
DS_Dictionary::~DS_Dictionary(v7);
operator delete(v7);
v7 = (DS_Dictionary *)operator new(0xD8u);
DS_Dictionary::DS_Dictionary(v7);
}
sub_4CA99C(v11, (int)a2);
if ( ((int)v11[0] & 1) != 0 )
v8 = v12;
else
v8 = (char *)v11 + 1;
DS_Dictionary::removeKey(v7, v8);
if ( ((int)v11[0] & 1) != 0 )
v9 = v12;
else
v9 = (char *)v11 + 1;
DS_Dictionary::setSubDictForKey(v7, v9, 0, 1);
DS_Dictionary::setIntegerForKey(v7, "t", v3);
DS_Dictionary::setIntegerForKey(v7, "id", *((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68));
DS_Dictionary::setIntegerForKey(v7, "did", *((_DWORD *)a2 + 186) - *((_DWORD *)a2 + 187));
DS_Dictionary::setBoolForKey(v7, (const char *)&a1i2r3e45s789g[12], *((_BYTE *)a2 + 477));
if ( v3 == 2 )
{
GJGameLevel::generateAutoSaveUID((GJGameLevel *)v13, (int)a2);
}
else
{
memset(v13, 0, sizeof(v13));
std::string::__init(v13, &unk_B6B226, 0);
}
DS_Dictionary::setStringForKey(v7, "uid", v13);
std::string::~string((int)v13);
DS_Dictionary::setStringForKey(v7, "cs", (char *)a2 + 1148);
DS_Dictionary::setIntegerForKey(v7, "cv", *((_DWORD *)a2 + 293));
DS_Dictionary::setIntegerForKey(v7, "fv", *((_DWORD *)a2 + 294));
DS_Dictionary::setStringForKey(v7, "rs", (char *)a2 + 1160);
DS_Dictionary::setBoolForKey(v7, "ps", *((_BYTE *)a2 + 1180));
DS_Dictionary::setIntegerForKey(v7, "sq", ++dword_D2BB3C);
v10 = sub_4A9938((GJAccountManager *)v11);
DS_Dictionary::setIntegerForKey(v7, "ow", v10);
DS_Dictionary::stepOutOfSubDict(v7);
sub_4B5A60();
DS_Dictionary::~DS_Dictionary(v7);
operator delete(v7);
std::string::~string((int)v11);
std::mutex::unlock(v6);
}
}
}
}