//
// GameLevelManager::prunePlatformerJournalKeys from 0x140223eb0 to 0x14022404b (411 bytes)
//
// 3 xrefs:
// > GameManager::saveFinished @ 0x140286995
// > LocalLevelManager::saveFinished @ 0x14046dff6
// > ??> @ 0x14091bcbc
//
// 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 11:28:25 +0000
//
// Hidden C++ exception states: #wind=2
int __fastcall GameLevelManager::prunePlatformerJournalKeys(__int64 a1, __int64 *a2)
{
__int64 v3; // rax
_Mtx_t v4; // rbp
DS_Dictionary *v5; // rbx
unsigned __int64 v6; // r15
__int64 v7; // r8
__int64 v8; // r14
int IntegerForKey; // edi
const char *v10; // rdx
const char *v11; // rdx
DS_Dictionary *v13; // [rsp+58h] [rbp+10h]
v3 = a2[1];
if ( *a2 != v3 )
{
v4 = qword_14090A8C8;
if ( Mtx_lock(qword_14090A8C8) )
{
std::_Throw_Cpp_error(5);
__debugbreak();
}
if ( *((_DWORD *)v4 + 19) == 0x7FFFFFFF )
{
*((_DWORD *)v4 + 19) = 2147483646;
std::_Throw_Cpp_error(6);
}
v13 = (DS_Dictionary *)operator new(0xF0u);
v5 = DS_Dictionary::DS_Dictionary(v13);
if ( sub_140222A60((__int64)v5) )
{
v6 = 0;
v7 = *a2;
if ( (a2[1] - *a2) / 40 )
{
v8 = 0;
do
{
IntegerForKey = -1;
v10 = (const char *)(v8 + v7);
if ( *(_QWORD *)(v8 + v7 + 24) > 0xFu )
v10 = *(const char **)v10;
if ( DS_Dictionary::stepIntoSubDictWithKey(v5, v10) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v5, "sq");
DS_Dictionary::stepOutOfSubDict(v5);
}
v11 = (const char *)(v8 + *a2);
if ( IntegerForKey == *((_DWORD *)v11 + 8) )
{
if ( *((_QWORD *)v11 + 3) > 0xFu )
v11 = *(const char **)v11;
DS_Dictionary::removeKey(v5, v11);
}
++v6;
v8 += 40;
v7 = *a2;
}
while ( v6 < (a2[1] - *a2) / 40 );
}
sub_140222B40((__int64)v5);
}
if ( v5 )
{
DS_Dictionary::~DS_Dictionary(v5);
j_j_free(v5);
}
LODWORD(v3) = Mtx_unlock(v4);
}
return v3;
}