//
// sub_4C60B4 from 0x4c60b4 to 0x4c6280 (460 bytes)
//
// 2 xrefs:
// > GameLevelManager::clearPlatformerSaveJournal @ 0x4c62b2
// > GameLevelManager::removePlatformerSaveJournalEntry @ 0x4cabd0
//
// 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:31 +0000
//
int __fastcall sub_4C60B4(int a1, unsigned __int8 *a2)
{
std::mutex *v4; // r7
DS_Dictionary *v5; // r4
int i; // r5
int v7; // r2
char *v8; // r0
int v9; // r3
int v10; // r6
size_t v11; // r2
int v12; // r1
int v13; // r3
unsigned __int8 *v14; // r1
char *v15; // r0
unsigned __int8 *v16; // r2
_BOOL4 v17; // r0
int v18; // t1
const char *v19; // r1
int IntegerForKey; // r6
int *v21; // r6
char *j; // r5
const char *v24; // r1
int v25; // [sp+0h] [bp-34h]
int *v26; // [sp+14h] [bp-20h] BYREF
int *v27; // [sp+18h] [bp-1Ch]
int *v28; // [sp+1Ch] [bp-18h]
_DWORD v29[3]; // [sp+20h] [bp-14h] BYREF
v4 = (std::mutex *)dword_D2BB34;
std::mutex::lock((std::mutex *)dword_D2BB34);
v5 = (DS_Dictionary *)operator new(0xD8u);
DS_Dictionary::DS_Dictionary(v5);
if ( !sub_4B5ADC(v5) )
{
DS_Dictionary::~DS_Dictionary(v5);
operator delete(v5);
return std::mutex::unlock(v4);
}
v26 = nullptr;
v27 = nullptr;
v28 = nullptr;
DS_Dictionary::getAllKeys((DS_Dictionary *)v29);
v25 = v29[1];
for ( i = v29[0] + 1; i - 1 != v25; i += 12 )
{
if ( a1 )
{
if ( a1 != 3 )
{
if ( (*(_BYTE *)(i - 1) & 1) != 0 )
v19 = *(const char **)(i + 7);
else
v19 = (const char *)i;
if ( DS_Dictionary::stepIntoSubDictWithKey(v5, v19) )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(v5, "t");
DS_Dictionary::stepOutOfSubDict(v5);
}
else
{
IntegerForKey = 0;
}
v17 = IntegerForKey == 2;
if ( a1 != 2 )
v17 = IntegerForKey != 2;
LABEL_36:
if ( !v17 )
continue;
goto LABEL_6;
}
v7 = *(unsigned __int8 *)(i - 1);
v8 = (char *)i;
v9 = *a2;
v10 = v7 & 1;
if ( (v7 & 1) != 0 )
v11 = *(_DWORD *)(i + 3);
else
v11 = v7 >> 1;
v12 = v9 & 1;
if ( (v9 & 1) != 0 )
v13 = *((_DWORD *)a2 + 1);
else
v13 = v9 >> 1;
if ( v11 != v13 )
continue;
if ( v10 )
v8 = *(char **)(i + 7);
if ( v12 )
v14 = *((unsigned __int8 **)a2 + 2);
else
v14 = a2 + 1;
if ( v10 )
{
v17 = std::char_traits::compare(v8, v14, v11) == 0;
goto LABEL_36;
}
v15 = v8 - 1;
v16 = &v14[v11];
while ( v14 != v16 )
{
v18 = (unsigned __int8)*++v15;
if ( v18 != *v14 )
goto LABEL_41;
++v14;
}
}
LABEL_6:
if ( v27 == v28 )
{
std::vector::__push_back_slow_path((int *)&v26, i - 1);
}
else
{
if ( v27 )
std::string::basic_string(v27, i - 1);
v27 += 3;
}
LABEL_41:
;
}
v21 = v27;
if ( v26 != v27 )
{
for ( j = (char *)v26 + 1; ; j += 12 )
{
v24 = (*(j - 1) & 1) != 0 ? *(const char **)(j + 7) : j;
DS_Dictionary::removeKey(v5, v24);
if ( v21 == (int *)(j + 11) )
break;
}
sub_4B5A60();
}
DS_Dictionary::~DS_Dictionary(v5);
operator delete(v5);
std::__vector_base::~__vector_base((int)v29);
std::__vector_base::~__vector_base((int)&v26);
return std::mutex::unlock(v4);
}