//
// PlayLayer::writePersistentSave from 0x10008b870 to 0x10008ba2e (446 bytes)
//
// 5 xrefs:
// > PlayLayer::onQuit @ 0x100080449
// > PlayLayer::removeAllCheckpoints @ 0x10008b819
// > PlayLayer::togglePracticeMode @ 0x10008c583
// > GameManager::encodeDataTo @ 0x100375371
// > LocalLevelManager::encodeDataTo @ 0x1006cadd8
//
// 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 12:20:06 +0000
//
void __fastcall PlayLayer::writePersistentSave(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rax
__int64 v4; // rbx
__int64 v5; // rsi
__int64 v6; // rax
std::string *v7; // rbx
_DWORD *v8; // rax
__int64 v9; // rax
std::string *v10; // rbx
_BYTE v11[16]; // [rsp+8h] [rbp-48h] BYREF
void *__p; // [rsp+18h] [rbp-38h]
std::string v13; // [rsp+20h] [rbp-30h] BYREF
if ( *(_BYTE *)(a1 + 12238) == 1 && !*(_BYTE *)(a1 + 12544) && !*(_BYTE *)(a1 + 12616) )
{
GameManager::sharedState(a1, a2, a3);
if ( !(unsigned __int8)GameManager::getGameVariable(v3, "0192") || *(_BYTE *)(*(_QWORD *)(a1 + 1936) + 1528LL) == 1 )
{
v4 = *(_QWORD *)(a1 + 14176);
if ( v4 )
{
*(_DWORD *)(v4 + 3876) = *(_DWORD *)(a1 + 12212);
*(_OWORD *)(v4 + 3880) = *(_OWORD *)(a1 + 14704);
*(_DWORD *)(v4 + 3896) = *(_DWORD *)(a1 + 12208);
*(_QWORD *)(v4 + 3904) = *(_QWORD *)(a1 + 13320);
*(_QWORD *)(v4 + 3912) = *(_QWORD *)(a1 + 13328);
*(_DWORD *)(v4 + 3920) = *(_DWORD *)(a1 + 14624);
sub_1002D69C0(*(_QWORD *)(a1 + 2152), v4 + 3928, v4 + 3968, v4 + 4008);
serializeCheckpoint(v11, v4);
cocos2d::ZipUtils::compressString(&v13);
v5 = a1;
v6 = *(_QWORD *)(a1 + 1936);
v7 = (std::string *)(v6 + 1472);
if ( (*(_BYTE *)(v6 + 1472) & 1) != 0 )
{
operator delete(*(void **)(v6 + 1488));
v5 = a1;
}
*v7 = v13;
v8 = *(_DWORD **)(v5 + 1936);
v8[380] = v8[197];
v8[381] = 4;
GJBaseGameLayer::getRecordString(&v13, v5, 1);
v9 = *(_QWORD *)(a1 + 1936);
v10 = (std::string *)(v9 + 1496);
if ( (*(_BYTE *)(v9 + 1496) & 1) != 0 )
operator delete(*(void **)(v9 + 1512));
*v10 = v13;
if ( (v11[0] & 1) != 0 )
operator delete(__p);
}
}
}
}