//
// PlayLayer::writePersistentSave from 0x407764 to 0x40792a (454 bytes)
//
// 5 xrefs:
// > PlayLayer::removeAllCheckpoints @ 0x407938
// > PlayLayer::togglePracticeMode @ 0x407972
// > PlayLayer::onQuit @ 0x407ac0
// > GameManager::encodeDataTo @ 0x41dbae
// > LocalLevelManager::encodeDataTo @ 0x542444
//
// 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:47:29 +0000
//
GameManager *__fastcall PlayLayer::writePersistentSave(GameManager *this)
{
GameManager *v1; // r4
GameManager *v2; // r0
int v3; // r5
int v4; // r5
int v5; // r0
int v6; // r1
int v7; // r2
int v8; // r5
int v9; // r0
int v10; // r1
int v11; // r2
_BYTE v12[12]; // [sp+8h] [bp-2Ch] BYREF
int v13; // [sp+14h] [bp-20h] BYREF
int v14; // [sp+18h] [bp-1Ch]
int v15; // [sp+1Ch] [bp-18h]
int v16; // [sp+20h] [bp-14h] BYREF
int v17; // [sp+24h] [bp-10h]
int v18; // [sp+28h] [bp-Ch]
v1 = this;
if ( *((_BYTE *)this + 10614) )
{
if ( !*((_BYTE *)this + 10784) && !*((_BYTE *)this + 10836) )
{
v2 = (GameManager *)GameManager::sharedState(this);
this = (GameManager *)GameManager::getGameVariable(v2, "0192");
if ( !this || *(_BYTE *)(*((_DWORD *)v1 + 352) + 1180) )
{
v3 = *((_DWORD *)v1 + 2948);
if ( v3 )
{
*(_DWORD *)(v3 + 2676) = *((_DWORD *)v1 + 2647);
*(_QWORD *)(v3 + 2680) = *((_QWORD *)v1 + 1520);
*(_QWORD *)(v3 + 2688) = *((_QWORD *)v1 + 1521);
*(_DWORD *)(v3 + 2696) = *((_DWORD *)v1 + 2646);
*(_QWORD *)(v3 + 2704) = *((_QWORD *)v1 + 1407);
*(_DWORD *)(v3 + 2712) = *((_DWORD *)v1 + 2816);
*(_DWORD *)(v3 + 2716) = *((_DWORD *)v1 + 2817);
*(_DWORD *)(v3 + 2720) = *((_DWORD *)v1 + 3021);
GJEffectManager::getPersistentState(*((_DWORD *)v1 + 381), v3 + 2724, v3 + 2744, v3 + 2764);
serializeCheckpoint((CheckpointObject *)v12);
v4 = *((_DWORD *)v1 + 352);
cocos2d::ZipUtils::compressString(&v13, v12, 0, -1, 11);
if ( (*(_BYTE *)(v4 + 1148) & 1) != 0 )
{
**(_BYTE **)(v4 + 1156) = 0;
*(_DWORD *)(v4 + 1152) = 0;
}
else
{
*(_BYTE *)(v4 + 1149) = 0;
*(_BYTE *)(v4 + 1148) = 0;
}
std::string::reserve((int *)(v4 + 1148), 0);
v5 = v13;
v6 = v14;
v7 = v15;
v13 = 0;
v14 = 0;
v15 = 0;
*(_DWORD *)(v4 + 1148) = v5;
*(_DWORD *)(v4 + 1152) = v6;
*(_DWORD *)(v4 + 1156) = v7;
std::string::~string((int)&v13);
*(_DWORD *)(*((_DWORD *)v1 + 352) + 1172) = *(_DWORD *)(*((_DWORD *)v1 + 352) + 612);
*(_DWORD *)(*((_DWORD *)v1 + 352) + 1176) = 4;
v8 = *((_DWORD *)v1 + 352);
GJBaseGameLayer::getRecordString((GJBaseGameLayer *)&v16, (bool)v1);
if ( (*(_BYTE *)(v8 + 1160) & 1) != 0 )
{
**(_BYTE **)(v8 + 1168) = 0;
*(_DWORD *)(v8 + 1164) = 0;
}
else
{
*(_BYTE *)(v8 + 1161) = 0;
*(_BYTE *)(v8 + 1160) = 0;
}
std::string::reserve((int *)(v8 + 1160), 0);
v9 = v16;
v10 = v17;
v11 = v18;
v16 = 0;
v17 = 0;
v18 = 0;
*(_DWORD *)(v8 + 1160) = v9;
*(_DWORD *)(v8 + 1164) = v10;
*(_DWORD *)(v8 + 1168) = v11;
std::string::~string((int)&v16);
return (GameManager *)std::string::~string((int)v12);
}
}
}
}
return this;
}