//
// PlayLayer::writePersistentSave from 0x70322c to 0x70342c (512 bytes)
//
// 6 xrefs:
// > PlayLayer::removeAllCheckpoints @ 0x70343c
// > PlayLayer::togglePracticeMode @ 0x7034f0
// > PlayLayer::onQuit @ 0x703670
// > GameManager::encodeDataTo @ 0x72a048
// > LocalLevelManager::encodeDataTo @ 0x910654
// > ??> @ 0x97738
//
// 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:52:04 +0000
//
__int64 __fastcall PlayLayer::writePersistentSave(PlayLayer *this)
{
GameManager *v3; // x0
GameManager *v4; // x0
__int64 v5; // x21
__int64 v6; // x23
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x21
__int64 v10; // x2
__int64 v11; // x3
char v12; // w0
__int64 v13[3]; // [xsp+40h] [xbp+40h] BYREF
__int64 v14[3]; // [xsp+58h] [xbp+58h] BYREF
__int64 v15[3]; // [xsp+70h] [xbp+70h] BYREF
if ( *((_BYTE *)this + 12238) )
{
if ( !*((_BYTE *)this + 12544) )
{
v3 = (GameManager *)*((unsigned __int8 *)this + 12616);
if ( !*((_BYTE *)this + 12616) )
{
v4 = (GameManager *)GameManager::sharedState(v3);
if ( !(unsigned __int8)GameManager::getGameVariable(v4, "0192") || *(_BYTE *)(*((_QWORD *)this + 242) + 1528LL) )
{
v5 = *((_QWORD *)this + 1772);
if ( v5 )
{
*(_DWORD *)(v5 + 3876) = *((_DWORD *)this + 3053);
*(_QWORD *)(v5 + 3880) = *((_QWORD *)this + 1838);
*(_QWORD *)(v5 + 3888) = *((_QWORD *)this + 1839);
*(_DWORD *)(v5 + 3896) = *((_DWORD *)this + 3052);
*(_QWORD *)(v5 + 3904) = *((_QWORD *)this + 1665);
*(_DWORD *)(v5 + 3912) = *((_DWORD *)this + 3332);
*(_DWORD *)(v5 + 3916) = *((_DWORD *)this + 3333);
*(_DWORD *)(v5 + 3920) = *((_DWORD *)this + 3656);
GJEffectManager::getPersistentState(*((_QWORD *)this + 269), v5 + 3928, v5 + 3968, v5 + 4008);
serializeCheckpoint(v13, (CheckpointObject *)v5);
v6 = *((_QWORD *)this + 242);
cocos2d::ZipUtils::compressString(v14, (int)v13, 0, -1);
if ( (*(_BYTE *)(v6 + 1472) & 1) != 0 )
{
**(_BYTE **)(v6 + 1488) = 0;
*(_QWORD *)(v6 + 1480) = 0;
}
else
{
*(_BYTE *)(v6 + 1473) = 0;
*(_BYTE *)(v6 + 1472) = 0;
}
std::string::reserve((__int64 *)(v6 + 1472), 0);
v7 = v14[0];
v8 = v14[1];
*(_QWORD *)(v6 + 1488) = v14[2];
*(_QWORD *)(v6 + 1472) = v7;
*(_QWORD *)(v6 + 1480) = v8;
*(_DWORD *)(*((_QWORD *)this + 242) + 1520LL) = *(_DWORD *)(*((_QWORD *)this + 242) + 788LL);
*(_DWORD *)(*((_QWORD *)this + 242) + 1524LL) = 4;
v9 = *((_QWORD *)this + 242);
GJBaseGameLayer::getRecordString(v15, this, 1);
if ( (*(_BYTE *)(v9 + 1496) & 1) != 0 )
{
**(_BYTE **)(v9 + 1512) = 0;
*(_QWORD *)(v9 + 1504) = 0;
}
else
{
*(_BYTE *)(v9 + 1497) = 0;
*(_BYTE *)(v9 + 1496) = 0;
}
std::string::reserve((__int64 *)(v9 + 1496), 0);
v10 = v15[0];
v11 = v15[1];
v12 = v13[0];
*(_QWORD *)(v9 + 1512) = v15[2];
*(_QWORD *)(v9 + 1496) = v10;
*(_QWORD *)(v9 + 1504) = v11;
if ( (v12 & 1) != 0 )
operator delete((void *)v13[2]);
}
}
}
}
}
return _stack_chk_guard;
}