//
// PlayLayer::storeCheckpoint from 0x140516510 to 0x140516623 (275 bytes)
//
// 6 xrefs:
// > PlayerObject::tryPlaceCheckpoint @ 0x140501e2b
// > PlayLayer::markCheckpoint @ 0x140516664
// > PlayLayer::loadPersistentCheckpoint @ 0x140518422
// > ??> @ 0x1408d7160
// > ??> @ 0x1408d7170
// > ??> @ 0x14092ad04
//
// 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 11:33:33 +0000
//
unsigned int __fastcall PlayLayer::storeCheckpoint(__int64 a1, struct cocos2d::CCObject *a2)
{
unsigned int v4; // esi
unsigned int result; // eax
_QWORD *v6; // rdi
cocos2d::CCObject *v7; // rcx
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 14904), a2);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1192LL))(a1, *((_QWORD *)a2 + 460));
if ( !*(_BYTE *)(a1 + 12670) || (v4 = 1, *(_BYTE *)(a1 + 13024)) )
v4 = 500;
for ( result = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14904));
result > v4;
result = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14904)) )
{
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 14904)) )
{
v6 = *((_QWORD **)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 14904), 0) + 460);
GJBaseGameLayer::removeObjectFromSection(a1, (__int64)v6);
v7 = (cocos2d::CCObject *)v6[94];
if ( v7 )
{
cocos2d::CCObject::release(v7);
(*(void (__fastcall **)(_QWORD))(*(_QWORD *)v6[94] + 528LL))(v6[94]);
v6[94] = 0;
}
(*(void (__fastcall **)(_QWORD *))(*v6 + 528LL))(v6);
cocos2d::CCArray::removeObjectAtIndex(*(cocos2d::CCArray **)(a1 + 14904), 0, 1);
}
}
return result;
}