//
// PlayLayer::createCheckpoint from 0x411c00 to 0x411e76 (630 bytes)
//
// 3 xrefs:
// > PlayLayer::markCheckpoint @ 0x411e92
// > PlayLayer::startMusic @ 0x41216e
// > PlayerObject::tryPlaceCheckpoint @ 0x4397f4
//
// 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:37 +0000
//
int __fastcall PlayLayer::createCheckpoint(PlayLayer *this)
{
int v2; // r4
cocos2d::CCObject *v3; // r0
PlayerCheckpoint *v4; // r5
cocos2d::CCObject *v5; // r0
PlayerCheckpoint *v6; // r0
cocos2d::CCObject *v7; // r0
PlayerCheckpoint *v8; // r5
cocos2d::CCObject *v9; // r0
FMODAudioEngine *v10; // r0
int v11; // r1
int *v12; // r0
int *v13; // r8
int v14; // r7
int v15; // t1
_DWORD *v16; // r0
_DWORD *v17; // r10
int LastCheckpoint; // r0
const char *v19; // r1
int v20; // r3
int v21; // r3
int v22; // r8
cocos2d::CCArray *v23; // r7
_DWORD *v24; // r0
cocos2d::CCObject *v25; // r10
cocos2d::CCArray *v26; // r0
int v27; // r2
cocos2d::CCObject *v28; // r0
GameObject *v29; // r0
GameObject *v30; // r7
int isFlipping; // r0
int v32; // r1
void (__fastcall *v33)(GameObject *, char **); // r8
const cocos2d::CCPoint *v34; // r1
int *v36; // [sp+4h] [bp-138h]
char *v37[75]; // [sp+8h] [bp-134h] BYREF
v2 = CheckpointObject::create(this);
v3 = (cocos2d::CCObject *)PlayerCheckpoint::create((PlayerCheckpoint *)v2);
v4 = v3;
if ( *(cocos2d::CCObject **)(v2 + 2292) != v3 )
{
if ( v3 )
cocos2d::CCObject::retain(v3);
v5 = *(cocos2d::CCObject **)(v2 + 2292);
if ( v5 )
cocos2d::CCObject::release(v5);
*(_DWORD *)(v2 + 2292) = v4;
}
v6 = (PlayerCheckpoint *)PlayerObject::saveToCheckpoint(*((PlayerObject **)this + 519), v4);
if ( *((_BYTE *)this + 866) )
{
v7 = (cocos2d::CCObject *)PlayerCheckpoint::create(v6);
v8 = v7;
if ( *(cocos2d::CCObject **)(v2 + 2296) != v7 )
{
if ( v7 )
cocos2d::CCObject::retain(v7);
v9 = *(cocos2d::CCObject **)(v2 + 2296);
if ( v9 )
cocos2d::CCObject::release(v9);
*(_DWORD *)(v2 + 2296) = v8;
}
PlayerObject::saveToCheckpoint(*((PlayerObject **)this + 520), v8);
}
v10 = (FMODAudioEngine *)GJGameState::operator=(v2 + 264, (int *)this + 82);
*(_DWORD *)(v2 + 2672) = *((_DWORD *)this + 202);
v11 = *((_DWORD *)this + 2678);
if ( v11 )
v10 = (FMODAudioEngine *)GJShaderState::operator=(v2 + 1344, v11 + 320);
v12 = (int *)FMODAudioEngine::sharedEngine(v10);
FMODAudioEngine::saveAudioState(v12, v2 + 1976);
v36 = *((int **)this + 2694);
v13 = *((int **)this + 2693);
while ( v13 != v36 )
{
v15 = *v13++;
v14 = v15;
v37[0] = *(char **)(v15 + 780);
v16 = std::unordered_map::operator[](v2 + 2652, (unsigned int *)v37);
v17 = v16;
if ( v16 != (_DWORD *)(v15 + 1660) )
{
v16[4] = *(_DWORD *)(v14 + 1676);
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__assign_multi,void *> *>>(
v16,
*(_DWORD **)(v14 + 1668),
nullptr);
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::operator=(
v17 + 5,
v14 + 1680);
}
*(_BYTE *)(v2 + 2300) = *(_BYTE *)(*((_DWORD *)this + 615) + 349) ^ 1;
memset(v37, 0, sizeof(v37));
v37[10] = (char *)1065353216;
v37[15] = (char *)1065353216;
v37[20] = (char *)1065353216;
v37[21] = (char *)&v37[22];
v37[28] = (char *)1065353216;
v37[45] = (char *)1065353216;
v37[50] = (char *)1065353216;
v37[58] = (char *)1065353216;
v37[63] = (char *)1065353216;
v37[68] = (char *)1065353216;
v37[73] = (char *)1065353216;
EffectManagerState::operator=((char **)(v2 + 2348), v37);
EffectManagerState::~EffectManagerState((EffectManagerState *)v37);
LastCheckpoint = PlayLayer::getLastCheckpoint((cocos2d::CCArray **)this);
if ( LastCheckpoint )
std::vector::reserve(
(void **)(v2 + 2348),
-252645135 * ((*(_DWORD *)(LastCheckpoint + 2352) - *(_DWORD *)(LastCheckpoint + 2348)) >> 2),
*(_DWORD *)(LastCheckpoint + 2348),
(*(_DWORD *)(LastCheckpoint + 2352) - *(_DWORD *)(LastCheckpoint + 2348)) >> 2);
GJEffectManager::saveToState(*((GJEffectManager **)this + 381), (EffectManagerState *)(v2 + 2348));
v20 = *((_DWORD *)this + 2676);
if ( v20 )
{
v21 = *(_DWORD *)(v20 + 52);
v22 = v21 ? *(_DWORD *)(v21 + 272) : 0;
v23 = nullptr;
while ( v21 )
{
v24 = *(_DWORD **)(v21 + 260);
v25 = (cocos2d::CCObject *)v24[119];
v26 = (cocos2d::CCArray *)(*(int (__fastcall **)(_DWORD *))(*v24 + 256))(v24);
if ( v26 && v25 )
{
if ( !v23 )
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
cocos2d::CCArray::addObject(v23, v25);
}
if ( v22 )
v27 = *(_DWORD *)(v22 + 272);
else
v27 = 0;
v21 = v22;
v22 = v27;
}
if ( v23 && *(cocos2d::CCArray **)(v2 + 2648) != v23 )
{
cocos2d::CCObject::retain(v23);
v28 = *(cocos2d::CCObject **)(v2 + 2648);
if ( v28 )
cocos2d::CCObject::release(v28);
*(_DWORD *)(v2 + 2648) = v23;
}
}
v29 = (GameObject *)GameObject::createWithFrame((GameObject *)"checkpoint_01_001.png", v19);
*((_DWORD *)v29 + 223) = 44;
v30 = v29;
(*(void (__fastcall **)(GameObject *))(*(_DWORD *)v29 + 632))(v29);
isFlipping = GJBaseGameLayer::isFlipping(this);
v32 = *((_DWORD *)this + 519);
v33 = *(void (__fastcall **)(GameObject *, char **))(*(_DWORD *)v30 + 684);
if ( isFlipping )
v34 = (const cocos2d::CCPoint *)(v32 + 2112);
else
v34 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)v32 + 96))(*((_DWORD *)this + 519));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v34);
v33(v30, v37);
CheckpointObject::setObject((CheckpointObject *)v2, v30);
PlayLayer::saveDynamicSaveObjects((int)this, (int *)(v2 + 2312));
PlayLayer::saveActiveSaveObjects(this, (int *)(v2 + 2324), (_DWORD *)(v2 + 2336));
return v2;
}