//
// PlayLayer::loadPersistentCheckpoint from 0x10008be10 to 0x10008c017 (519 bytes)
//
// 3 xrefs:
// > EditLevelLayer::playStep3 @ 0x1001e0768
// > sub_1001E09D0 @ 0x1001e0bcf
// > LevelInfoLayer::loadLevelStep @ 0x1002b1029
//
// 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::loadPersistentCheckpoint(__int64 a1)
{
__int64 v2; // r14
_DWORD *v3; // r15
__int64 v4; // rdi
int v5; // esi
__int64 v6; // rax
__int64 CString; // rax
__int64 v8; // rsi
unsigned int v9; // eax
char v10; // [rsp+0h] [rbp-60h]
std::string v11; // [rsp+8h] [rbp-58h] BYREF
_BYTE v12[8]; // [rsp+20h] [rbp-40h] BYREF
std::string v13; // [rsp+28h] [rbp-38h] BYREF
v2 = CheckpointObject::create();
cocos2d::ZipUtils::decompressString(&v11);
deserializeCheckpoint(v2, &v11, a1);
v3 = (_DWORD *)GameObject::createWithFrame("checkpoint_01_001.png");
v3[257] = 44;
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v3 + 1264LL))(v3);
sub_1002782D0(v12, *(_QWORD *)(v2 + 3120) + 316LL);
(*(void (__fastcall **)(_DWORD *, _BYTE *))(*(_QWORD *)v3 + 1368LL))(v3, v12);
sub_1005DDE40(v2, v3);
PlayLayer::storeCheckpoint(a1, v2);
if ( *(_QWORD *)(a1 + 14176) != v2 )
{
cocos2d::CCObject::retain(v2);
v4 = *(_QWORD *)(a1 + 14176);
if ( v4 )
cocos2d::CCObject::release(v4);
*(_QWORD *)(a1 + 14176) = v2;
}
GameObject::makeInvisible(v3);
sub_1002D6D20(*(_QWORD *)(a1 + 2152), v2 + 3928, v2 + 3968, v2 + 4008);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1608LL))(a1);
*(_BYTE *)(a1 + 12619) = 1;
v5 = *(_DWORD *)(v2 + 3876);
if ( v5 > 0 )
{
*(_DWORD *)(a1 + 12212) = v5;
*(_OWORD *)(a1 + 14704) = *(_OWORD *)(v2 + 3880);
*(_DWORD *)(a1 + 12208) = *(_DWORD *)(v2 + 3896);
*(_QWORD *)(a1 + 13320) = *(_QWORD *)(v2 + 3904);
*(_QWORD *)(a1 + 13328) = *(_QWORD *)(v2 + 3912);
*(_DWORD *)(a1 + 14624) = *(_DWORD *)(v2 + 3920);
v6 = sub_10088E820("Attempt %i", v10);
CString = cocos2d::CCString::getCString(v6);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 14328) + 928LL))(*(_QWORD *)(a1 + 14328), CString);
}
v8 = *(_QWORD *)(a1 + 1936);
v9 = *(unsigned __int8 *)(v8 + 1496);
if ( (v9 & 1) != 0 )
{
if ( !*(_QWORD *)(v8 + 1504) )
goto LABEL_13;
}
else if ( !(v9 >> 1) )
{
goto LABEL_13;
}
cocos2d::ZipUtils::decompressString(&v13);
GJBaseGameLayer::restoreRecording(a1, &v13);
if ( (*(_BYTE *)&v13.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v13.__r_.__value_.__l.__data_);
LABEL_13:
*(_BYTE *)(a1 + 14173) = 1;
if ( (*(_BYTE *)&v11.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v11.__r_.__value_.__l.__data_);
}