//
// PlayLayer::loadFromCheckpoint from 0x4118b4 to 0x411bd2 (798 bytes)
//
// 2 xrefs:
// > PlayLayer::loadLastCheckpoint @ 0x411bf8
// > PlayLayer::resetLevel @ 0x412768
//
// 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::loadFromCheckpoint(int this, CheckpointObject *a2)
{
int v2; // r4
FMODAudioEngine *v4; // r0
FMODAudioEngine *v5; // r0
FMODAudioEngine *v6; // r0
int v7; // r0
FMODAudioEngine *v8; // r0
FMODAudioEngine *v9; // r0
float v10; // s15
int *v11; // r9
int *v12; // r8
int v13; // r7
int v14; // t1
_DWORD *v15; // r6
_DWORD *v16; // r0
int v17; // r6
int isJumpHeldForPlayer; // r0
int v19; // r6
int v20; // r0
cocos2d::CCArray *v21; // r8
int v22; // r3
unsigned int i; // r6
GradientTriggerObject *v24; // r0
int *v25; // r2
int v26; // r3
int **v27; // r2
unsigned int v28; // r5
int **v29; // r8
int j; // r9
int *v31; // r6
int *v32; // t1
int ActiveMode; // r0
cocos2d::CCDirector *updated; // r0
int v35; // r0
int Group; // r0
_DWORD *v37; // r2
GameObject **v38; // r6
GameObject **v39; // r5
GameObject *v40; // r0
GameObject *v41; // t1
FMOD::ChannelControl **v42; // r0
unsigned int v43; // [sp+10h] [bp-Ch] BYREF
v2 = this;
if ( a2 )
{
GJGameState::operator=(this + 328, (int *)a2 + 66);
v4 = *(FMODAudioEngine **)(v2 + 10712);
if ( v4 )
v4 = (FMODAudioEngine *)GJShaderState::operator=((int)v4 + 320, (int)a2 + 1344);
if ( !*(_BYTE *)(v2 + 10784) || *(_BYTE *)(v2 + 10785) )
{
if ( *(_BYTE *)(v2 + 10614) )
{
v6 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(v4);
v5 = FMODAudioEngine::pauseAllMusic(v6, 0);
}
else
{
v5 = (FMODAudioEngine *)GJBaseGameLayer::pauseAudio((GJBaseGameLayer *)v2);
}
v7 = FMODAudioEngine::sharedEngine(v5);
FMODAudioEngine::loadAudioState(v7, (int *)a2 + 494);
if ( *(_BYTE *)(v2 + 10614) )
{
v9 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(v8);
if ( !FMODAudioEngine::isAnyPersistentPlaying(v9) )
{
v42 = (FMOD::ChannelControl **)FMODAudioEngine::sharedEngine(nullptr);
FMODAudioEngine::fadeInBackgroundMusic(v42, 0.1);
}
}
v10 = *(double *)(v2 + 792);
GJBaseGameLayer::processActivatedAudioTriggers((GJBaseGameLayer *)v2, v10);
*(_BYTE *)(v2 + 12284) = 0;
*(_BYTE *)(v2 + 11570) = 1;
}
v11 = *(int **)(v2 + 10776);
v12 = *(int **)(v2 + 10772);
while ( v12 != v11 )
{
v14 = *v12++;
v13 = v14;
v43 = *(_DWORD *)(v14 + 780);
v15 = std::unordered_map::operator[]((int)a2 + 2652, &v43);
v16 = (_DWORD *)(v14 + 1660);
if ( (_DWORD *)(v14 + 1660) != v15 )
{
*(_DWORD *)(v13 + 1676) = v15[4];
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 *)v15[2],
nullptr);
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::operator=(
(_DWORD *)(v13 + 1680),
(int)(v15 + 5));
}
if ( *(_BYTE *)(v2 + 866) )
{
*(_BYTE *)(v2 + 866) = 0;
GJBaseGameLayer::toggleDualMode((GJBaseGameLayer *)v2, nullptr, 1, nullptr, 1);
}
v17 = *((_DWORD *)a2 + 573);
isJumpHeldForPlayer = PlayLayer::isJumpHeldForPlayer((PlayLayer *)v2, 1);
if ( isJumpHeldForPlayer )
LOBYTE(isJumpHeldForPlayer) = *(_BYTE *)(*((_DWORD *)a2 + 573) + 905) ^ 1;
*(_BYTE *)(v17 + 328) = isJumpHeldForPlayer;
PlayerObject::loadFromCheckpoint(*(PlayerObject **)(v2 + 2076), *((PlayerCheckpoint **)a2 + 573));
if ( *(_BYTE *)(v2 + 866) )
{
v19 = *((_DWORD *)a2 + 574);
v20 = PlayLayer::isJumpHeldForPlayer((PlayLayer *)v2, 0);
if ( v20 )
LOBYTE(v20) = *(_BYTE *)(*((_DWORD *)a2 + 574) + 905) ^ 1;
*(_BYTE *)(v19 + 328) = v20;
PlayerObject::loadFromCheckpoint(*(PlayerObject **)(v2 + 2080), *((PlayerCheckpoint **)a2 + 574));
if ( !PlayerObject::isFlying(*(PlayerObject **)(v2 + 2076)) && !*(_BYTE *)(*(_DWORD *)(v2 + 2076) + 1955) )
GJBaseGameLayer::enterDualMode((GJBaseGameLayer *)v2, *(GameObject **)(v2 + 840), 1);
}
GJEffectManager::loadFromState(*(GJEffectManager **)(v2 + 1524), (CheckpointObject *)((char *)a2 + 2348));
v21 = *((cocos2d::CCArray **)a2 + 662);
if ( v21 )
{
for ( i = 0; i < cocos2d::CCArray::count(v21); ++i )
{
v24 = (GradientTriggerObject *)cocos2d::CCArray::objectAtIndex(v21, i);
GJBaseGameLayer::triggerGradientCommand((GJBaseGameLayer *)v2, v24);
}
}
PlayLayer::processLoadedMoveActions((PlayLayer *)v2);
PlayLayer::loadDynamicSaveObjects(v2, (_DWORD *)a2 + 578);
PlayLayer::loadActiveSaveObjects(v2, (int *)a2 + 581, (int **)a2 + 584);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v2 + 692))(v2, *((unsigned __int8 *)a2 + 2300) ^ 1);
GJBaseGameLayer::togglePlayerStreakBlend((GJBaseGameLayer *)v2, *(_BYTE *)(v2 + 716), 1);
v22 = *(_DWORD *)(v2 + 11884);
if ( v22 )
{
v25 = *(int **)(v22 + 52);
v26 = *v25;
if ( *v25 )
{
v27 = (int **)v25[3];
v28 = (unsigned int)&(&v27[v26])[-1];
v29 = v27;
while ( (unsigned int)v29 <= v28 )
{
v32 = *v29++;
v31 = v32;
if ( !v32 )
break;
if ( GJEffectManager::hasBeenTriggered(*(GJEffectManager **)(v2 + 1524), v31[195], 0) )
{
GameObject::disableObject((GameObject *)v31);
if ( (*(int (__fastcall **)(int *))(*v31 + 900))(v31) == 31 )
{
GJBaseGameLayer::logPickupItem((GJBaseGameLayer *)v2, (EffectGameObject *)v31);
if ( !GJBaseGameLayer::hasUniqueCoin((GJBaseGameLayer *)v2, (EffectGameObject *)v31) )
GJBaseGameLayer::pickupItem((GJBaseGameLayer *)v2, (EffectGameObject *)v31);
}
}
}
}
}
for ( j = 0; j != 10000; ++j )
{
if ( !GJEffectManager::isGroupEnabled(*(GJEffectManager **)(v2 + 1524), j) )
{
Group = GJBaseGameLayer::getGroup((GJBaseGameLayer *)v2, j);
if ( Group )
{
v37 = *(_DWORD **)(Group + 52);
if ( *v37 )
{
v38 = (GameObject **)v37[3];
v39 = &v38[*v37] + 0x3FFFFFFF;
while ( v38 <= v39 )
{
v41 = *v38++;
v40 = v41;
if ( !v41 )
break;
GameObject::groupWasDisabled(v40);
}
}
}
}
}
ActiveMode = PlayerObject::getActiveMode(*(PlayerObject **)(v2 + 2076));
updated = (cocos2d::CCDirector *)GJBaseGameLayer::updateDualGround(
(GJBaseGameLayer *)v2,
*(PlayerObject **)(v2 + 2076),
ActiveMode,
1,
0.0);
*(_DWORD *)(v2 + 728) = *(_DWORD *)(v2 + 720);
v35 = cocos2d::CCDirector::sharedDirector(updated);
this = (*(int (__fastcall **)(int))(*(_DWORD *)v35 + 64))(v35);
*(_DWORD *)(this + 52) = *(_DWORD *)(v2 + 728);
}
return this;
}