//
// GameLevelManager::prunePlatformerJournalKeys from 0x82fed8 to 0x8300a4 (460 bytes)
//
// 3 xrefs:
// > GameManager::saveFinished @ 0x71497c
// > LocalLevelManager::saveFinished @ 0x9142d0
// > ??> @ 0x957b8
//
// 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:08 +0000
//
__int64 __fastcall GameLevelManager::prunePlatformerJournalKeys(__int64 a1, __int64 *a2)
{
__int64 result; // x0
std::mutex *v4; // x24
DS_Dictionary *v5; // x22
__int64 v6; // x0
__int64 v7; // x20
__int64 v8; // x2
__int64 v9; // x19
const char *v10; // x1
int IntegerForKey; // w25
const char *v12; // x1
char *v13; // x0
char *v14; // x2
result = a2[1];
if ( *a2 == result )
return result;
v4 = (std::mutex *)qword_155C990;
std::mutex::lock((std::mutex *)qword_155C990);
v5 = (DS_Dictionary *)operator new(0xF0u);
DS_Dictionary::DS_Dictionary(v5);
if ( (unsigned __int8)sub_82FA7C((__int64)v5) )
{
v6 = *a2;
v7 = 0;
if ( !((a2[1] - *a2) >> 5) )
{
LABEL_14:
sub_82F964(v5);
goto LABEL_15;
}
while ( 1 )
{
v9 = 32 * v7;
v10 = (const char *)(v6 + 32 * v7 + 1);
if ( (*(_BYTE *)(v6 + 32 * v7) & 1) != 0 )
v10 = *(const char **)(v6 + 32 * v7 + 16);
if ( (unsigned __int8)DS_Dictionary::stepIntoSubDictWithKey(v5, v10) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v5, "sq");
DS_Dictionary::stepOutOfSubDict(v5);
v6 = *a2;
v8 = *a2 + v9;
if ( IntegerForKey == *(_DWORD *)(v8 + 24) )
goto LABEL_11;
LABEL_6:
if ( ++v7 >= (unsigned __int64)((a2[1] - v6) >> 5) )
goto LABEL_14;
}
else
{
v6 = *a2;
v8 = *a2 + v9;
if ( *(_DWORD *)(v8 + 24) != -1 )
goto LABEL_6;
LABEL_11:
v12 = (const char *)(v8 + 1);
if ( (*(_BYTE *)(v6 + 32 * v7) & 1) != 0 )
v12 = *(const char **)(v8 + 16);
DS_Dictionary::removeKey(v5, v12);
v6 = *a2;
if ( ++v7 >= (unsigned __int64)((a2[1] - *a2) >> 5) )
goto LABEL_14;
}
}
}
LABEL_15:
v13 = *((char **)v5 + 26);
if ( v13 )
{
v14 = *((char **)v5 + 27);
if ( v13 != v14 )
*((_QWORD *)v5 + 27) = &v14[8 * ~((unsigned __int64)(v14 - 8 - v13) >> 3)];
operator delete(v13);
}
pugi::xml_document::~xml_document(v5);
operator delete(v5);
return std::mutex::unlock(v4);
}