//
// LocalLevelManager::didEncodeForSave from 0x913fe8 to 0x914270 (648 bytes)
//
// 2 xrefs:
// > ??> @ 0xd78d8
// > ??> @ 0x1467430
//
// 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:57:18 +0000
//
__int64 __fastcall LocalLevelManager::didEncodeForSave(LocalLevelManager *this)
{
void **v2; // x20
void **v3; // x0
char v4; // w0
__int64 v5; // x0
__int64 v6; // x1
__int64 v7; // x1
GameToolbox *v8; // x0
__int64 v9; // x1
int v10; // w20
__int64 v11; // x1
char *v13; // x1
size_t v14; // x2
__int64 *v15; // x0
__int64 v16; // x3
void *v17[3]; // [xsp+48h] [xbp+48h] BYREF
__int64 v18; // [xsp+60h] [xbp+60h] BYREF
__int64 v19; // [xsp+68h] [xbp+68h]
__int64 v20; // [xsp+70h] [xbp+70h]
_BYTE v21[16]; // [xsp+78h] [xbp+78h] BYREF
void *v22; // [xsp+88h] [xbp+88h]
__int64 v23; // [xsp+90h] [xbp+90h] BYREF
__int64 v24; // [xsp+98h] [xbp+98h]
__int64 v25; // [xsp+A0h] [xbp+A0h]
GameLevelManager::sharedState(_stack_chk_guard);
GameLevelManager::collectPlatformerJournalKeys(v17, 1u);
v2 = *((void ***)this + 55);
if ( v2 )
{
v3 = *((void ***)this + 56);
if ( v2 != v3 )
{
do
{
*((_QWORD *)this + 56) = v3 - 4;
if ( (*(_BYTE *)(v3 - 4) & 1) != 0 )
operator delete(*(v3 - 2));
v3 = *((void ***)this + 56);
}
while ( v2 != v3 );
v3 = *((void ***)this + 55);
}
operator delete(v3);
}
*((void **)this + 55) = v17[0];
*((void **)this + 56) = v17[1];
*((void **)this + 57) = v17[2];
std::mutex::lock((LocalLevelManager *)((char *)this + 464));
if ( *((_BYTE *)this + 576) )
{
v18 = 0;
v19 = 0;
v20 = 0;
std::string::__init(&v18, &byte_11B8890, 0);
}
else
{
v4 = *((_BYTE *)this + 504);
v18 = 0;
v19 = 0;
v20 = 0;
if ( (v4 & 1) != 0 )
{
std::string::__init(&v18, *((void **)this + 65), *((_QWORD *)this + 64));
}
else
{
v5 = *((_QWORD *)this + 63);
v6 = *((_QWORD *)this + 64);
v20 = *((_QWORD *)this + 65);
v18 = v5;
v19 = v6;
}
}
if ( (*((_BYTE *)this + 528) & 1) != 0 )
{
**((_BYTE **)this + 68) = 0;
*((_QWORD *)this + 67) = 0;
}
else
{
*((_BYTE *)this + 529) = 0;
*((_BYTE *)this + 528) = 0;
}
std::string::reserve((__int64 *)this + 66, 0);
*((_QWORD *)this + 68) = v20;
v7 = v19;
*((_QWORD *)this + 66) = v18;
*((_QWORD *)this + 67) = v7;
v8 = (GameToolbox *)*((unsigned __int8 *)this + 528);
v9 = (unsigned __int8)v8 >> 1;
if ( ((unsigned __int8)v8 & 1) != 0 )
v9 = *((_QWORD *)this + 67);
if ( v9 )
{
GameToolbox::getSaveDirectory(v8, (__int64)v21);
if ( (*((_BYTE *)this + 528) & 1) != 0 )
{
v13 = *((char **)this + 68);
v14 = *((_QWORD *)this + 67);
}
else
{
v13 = (char *)this + 529;
v14 = *((_BYTE *)this + 528) >> 1;
}
v15 = (__int64 *)std::string::append((__int64)v21, v13, v14);
v16 = v15[1];
v23 = *v15;
v24 = v16;
v10 = 1;
v25 = v15[2];
*v15 = 0;
v15[1] = 0;
v15[2] = 0;
}
else
{
v23 = 0;
v24 = 0;
v25 = 0;
std::string::__init(&v23, &byte_11B8890, 0);
v10 = 0;
}
if ( (*((_BYTE *)this + 552) & 1) != 0 )
{
**((_BYTE **)this + 71) = 0;
*((_QWORD *)this + 70) = 0;
}
else
{
*((_BYTE *)this + 553) = 0;
*((_BYTE *)this + 552) = 0;
}
std::string::reserve((__int64 *)this + 69, 0);
*((_QWORD *)this + 71) = v25;
v11 = v24;
*((_QWORD *)this + 69) = v23;
*((_QWORD *)this + 70) = v11;
if ( v10 && (v21[0] & 1) != 0 )
operator delete(v22);
std::mutex::unlock((LocalLevelManager *)((char *)this + 464));
return _stack_chk_guard;
}