//
// GameLevelManager::collectPlatformerJournalKeys from 0x140223c50 to 0x140223eab (603 bytes)
//
// 3 xrefs:
// > GameManager::didEncodeForSave @ 0x1402868ea
// > LocalLevelManager::didEncodeForSave @ 0x14046b8b2
// > ??> @ 0x14091bcb0
//
// 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=5
_QWORD *__fastcall GameLevelManager::collectPlatformerJournalKeys(__int64 a1, _QWORD *a2, unsigned __int8 a3)
{
int v3; // ebp
int v5; // r15d
_Mtx_t v6; // r13
DS_Dictionary *v7; // rsi
const char *v8; // rbx
const char *v9; // r12
int IntegerForKey; // r14d
int v11; // ebp
const char *v12; // rdx
__int64 v13; // rdx
DS_Dictionary *v15; // [rsp+28h] [rbp-90h]
int v16; // [rsp+28h] [rbp-90h]
const char *v17; // [rsp+30h] [rbp-88h] BYREF
const char *v18; // [rsp+38h] [rbp-80h]
_QWORD *v19; // [rsp+48h] [rbp-70h]
_Mtx_t v20; // [rsp+50h] [rbp-68h]
__int128 v21; // [rsp+58h] [rbp-60h] BYREF
__int128 v22; // [rsp+68h] [rbp-50h]
int v23; // [rsp+78h] [rbp-40h]
v3 = a3;
v19 = a2;
v5 = 1;
v6 = qword_14090A8C8;
v20 = qword_14090A8C8;
if ( Mtx_lock(qword_14090A8C8) )
{
std::_Throw_Cpp_error(5);
__debugbreak();
}
if ( *((_DWORD *)v6 + 19) == 0x7FFFFFFF )
{
*((_DWORD *)v6 + 19) = 2147483646;
std::_Throw_Cpp_error(6);
}
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v15 = (DS_Dictionary *)operator new(0xF0u);
v7 = DS_Dictionary::DS_Dictionary(v15);
if ( sub_140222A60((__int64)v7) )
{
DS_Dictionary::getAllKeys(v7, &v17);
v8 = v17;
v9 = v18;
if ( v17 != v18 )
{
v16 = v3;
do
{
IntegerForKey = 0;
v11 = 0;
v12 = v8;
if ( *((_QWORD *)v8 + 3) > 0xFu )
v12 = *(const char **)v8;
if ( DS_Dictionary::stepIntoSubDictWithKey(v7, v12) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v7, "t");
v11 = DS_Dictionary::getIntegerForKey(v7, "sq");
DS_Dictionary::stepOutOfSubDict(v7);
}
if ( (IntegerForKey == 2) == v16 )
{
sub_14003F4F0((__int64)&v21, (__int64)v8);
v23 = v11;
v5 |= 2u;
v13 = a2[1];
if ( v13 == a2[2] )
{
sub_140275070(a2, v13, &v21);
}
else
{
*(_OWORD *)v13 = v21;
*(_OWORD *)(v13 + 16) = v22;
*(_QWORD *)&v22 = 0;
*((_QWORD *)&v22 + 1) = 15;
LOBYTE(v21) = 0;
*(_DWORD *)(v13 + 32) = v11;
a2[1] += 40LL;
}
sub_14003D310((__int64)&v21);
}
v8 += 32;
}
while ( v8 != v9 );
}
if ( v7 )
{
DS_Dictionary::~DS_Dictionary(v7);
j_j_free(v7);
}
sub_1400760C0((__int64 *)&v17);
}
else if ( v7 )
{
DS_Dictionary::~DS_Dictionary(v7);
j_j_free(v7);
}
Mtx_unlock(v6);
return a2;
}