// // PlayLayer::resetLevel from 0x412240 to 0x412c4a (2570 bytes) // // 0 xrefs: // // 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:38 +0000 // int __fastcall PlayLayer::resetLevel(PlayLayer *this) { double v1; // d5 PlayLayer *v2; // r4 int v3; // r3 int v4; // r5 int v5; // r1 int v6; // r3 FMOD::ChannelControl **v7; // r0 FMODAudioEngine *v8; // r0 FMODAudioEngine *v9; // r0 __int64 *v10; // r7 unsigned __int64 v11; // r2 int v12; // r3 float v13; // r1 void (__fastcall *v14)(int, struct timeval *); // r11 double v15; // d7 double v16; // d6 unsigned int v17; // r9 int *v18; // r5 int v19; // r2 double v20; // d7 _DWORD *v21; // r3 bool v22; // cc int v23; // s12 double v24; // d7 _DWORD *v25; // r3 bool v26; // cc int v27; // s14 int v28; // r3 int v29; // r2 float v30; // s20 float v31; // s20 int v32; // r2 CheckpointObject *LastCheckpoint; // r5 int *v34; // r7 int v35; // r3 GJBaseGameLayer *v36; // r0 LevelSettingsObject *v37; // r1 int v38; // r9 const cocos2d::CCPoint *v39; // r0 int v40; // r9 const cocos2d::CCPoint *v41; // r1 GameObject *v42; // r9 const cocos2d::CCPoint *v43; // r0 GameObject *v44; // r9 const cocos2d::CCPoint *v45; // r0 StartPosObject *v46; // r1 void (__fastcall *v47)(PlayLayer *); // r3 time_t *v48; // r7 GameManager *v49; // r0 char v50; // r0 unsigned __int8 *updated; // r0 GameStatsManager *v52; // r0 _DWORD *v53; // r7 int v54; // r9 int v55; // s15 GameManager *refreshed; // r0 _BYTE *v57; // r3 int v58; // r7 UILayer *v59; // r0 char isJumpButtonPressed; // r0 char v61; // r0 char v62; // r0 int v63; // r3 int result; // r0 float v65; // r1 int *v66; // r2 int v67; // r3 cocos2d::CCNode **v68; // r2 unsigned int v69; // r8 cocos2d::CCNode **v70; // r9 cocos2d::CCNode *v71; // r0 cocos2d::CCNode *v72; // t1 cocos2d::CCSequence *v73; // r0 cocos2d::CCSequence *v74; // r7 cocos2d::CCFiniteTimeAction *v75; // r0 cocos2d::CCAction *v76; // r0 GameManager *v77; // r0 int IntGameVariable; // r0 GJGameLevel *v79; // r10 int v80; // r9 time_t v81; // r0 int v82; // [sp+1Ch] [bp-38h] float v83[2]; // [sp+24h] [bp-30h] BYREF float v84[2]; // [sp+2Ch] [bp-28h] BYREF unsigned __int8 v85[12]; // [sp+34h] [bp-20h] BYREF struct timeval tv; // [sp+40h] [bp-14h] BYREF int v87; // [sp+48h] [bp-Ch] v2 = this; v3 = *((_DWORD *)this + 353); v4 = *((unsigned __int8 *)this + 12032); if ( *((_BYTE *)this + 12032) ) { if ( !v3 && !*((_DWORD *)this + 354) ) this = (PlayLayer *)PlayLayer::dtRebuildLiveMarkers(this); } else { if ( v3 ) { (*(void (__fastcall **)(_DWORD))(*(_DWORD *)v3 + 260))(*((_DWORD *)this + 353)); *((_DWORD *)v2 + 353) = v4; } this = *((PlayLayer **)v2 + 354); if ( this ) { this = (PlayLayer *)(*(int (__fastcall **)(PlayLayer *))(*(_DWORD *)this + 260))(this); *((_DWORD *)v2 + 354) = 0; } } if ( *((_BYTE *)v2 + 10837) || !*((_BYTE *)v2 + 10614) && !*((_BYTE *)v2 + 10784) ) { v5 = *((unsigned __int8 *)v2 + 1434); v6 = *((unsigned __int8 *)v2 + 11797); if ( *((_BYTE *)v2 + 11797) ) v6 = v5 ^ 1; *((_BYTE *)v2 + 11797) = v5; if ( v6 ) PlayLayer::toggleIgnoreDamage(v2, 0); *((_BYTE *)v2 + 11798) = *((float *)v2 + 2787) != 1.0; this = (PlayLayer *)PlayLayer::updateTestModeLabel(v2); } if ( !*((_BYTE *)v2 + 10837) ) { v7 = (FMOD::ChannelControl **)FMODAudioEngine::sharedEngine(this); v8 = (FMODAudioEngine *)FMODAudioEngine::stopAllEffects(v7); if ( !*((_BYTE *)v2 + 10784) || *((_BYTE *)v2 + 10785) ) { if ( *((_BYTE *)v2 + 10614) ) { v9 = (FMODAudioEngine *)FMODAudioEngine::sharedEngine(v8); FMODAudioEngine::pauseAllMusic(v9, 0); } else { GJBaseGameLayer::pauseAudio(v2); } } } GJBaseGameLayer::preResumeGame(v2); dwTickStartp = clock(); GJBaseGameLayer::resetLevelVariables(v2); GJBaseGameLayer::clearHitboxTrail(v2); if ( (*((_BYTE *)v2 + 11590) || *((_BYTE *)v2 + 11592)) && !PlayLayer::shouldDebugDraw(v2) ) PlayLayer::toggleDebugDraw((cocos2d::CCDrawNode **)v2); *((_DWORD *)v2 + 202) = 0; *((_DWORD *)v2 + 204) = 0; *((_DWORD *)v2 + 2749) = 0; *((_BYTE *)v2 + 10717) = 1; *((_BYTE *)v2 + 1438) = 0; v10 = (__int64 *)((char *)v2 + 10968); *((_DWORD *)v2 + 3070) = 0; *((_BYTE *)v2 + 12276) = 0; *((_DWORD *)v2 + 2748) = 0; *((_DWORD *)v2 + 2740) = 0; if ( !*((_BYTE *)v2 + 10728) || (v11 = *((_QWORD *)v2 + 1373)) == 0 ) { gettimeofday(&tv, nullptr); v11 = tv.tv_sec * tv.tv_usec; } *v10 = v11; GameToolbox::fast_srand(*v10, v11); *((_DWORD *)v2 + 2730) = 0; *((_BYTE *)v2 + 11706) = 0; *((_DWORD *)v2 + 2925) = 0; UILayer::toggleMenuVisibility(*((UILayer **)v2 + 2810), 1); *((_BYTE *)v2 + 12098) = 0; *((_BYTE *)v2 + 12097) = 0; *((_BYTE *)v2 + 11272) = 0; v12 = *((_DWORD *)v2 + 2708); if ( v12 ) { *((_BYTE *)v2 + 11836) = 0; *(_BYTE *)(v12 + 1172) = 0; *(_BYTE *)(*((_DWORD *)v2 + 2708) + 1173) = 0; (*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)v2 + 2708) + 64))(*((_DWORD *)v2 + 2708), 1065353216); v13 = *((float *)v2 + 2960); *((float *)v2 + 2706) = v13; v82 = *((_DWORD *)v2 + 2708); v14 = *(void (__fastcall **)(int, struct timeval *))(*(_DWORD *)v82 + 684); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&tv, v13, 225.0); v14(v82, &tv); GJBaseGameLayer::reorderObjectSection(v2, *((GameObject **)v2 + 2708)); (*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)v2 + 2708) + 656))(*((_DWORD *)v2 + 2708), 1); } *((_BYTE *)v2 + 12104) = 0; *((_DWORD *)v2 + 3027) = 0; *((_DWORD *)v2 + 3028) = 0; *((_BYTE *)v2 + 12116) = 0; *((_BYTE *)v2 + 12088) = 0; std::string::assign((int *)v2 + 2736, (char *)&unk_B6B226); *((_DWORD *)v2 + 3050) = 0; *((_DWORD *)v2 + 2983) = 0; UILayer::enableMenu(*((UILayer **)v2 + 2810)); GJBaseGameLayer::resetActiveEnterEffects(v2); v15 = *((double *)v2 + 1520); v16 = *((double *)v2 + 1521); if ( v15 > v16 ) *((double *)v2 + 1521) = v15; *((_DWORD *)v2 + 2646) = 0; v17 = 0; *((_QWORD *)v2 + 1520) = 0; *((_QWORD *)v2 + 1499) = 0; *((_QWORD *)v2 + 1523) = 0; *((_QWORD *)v2 + 1524) = 0; (*(void (__fastcall **)(PlayLayer *, _DWORD))(*(_DWORD *)v2 + 644))(v2, 0); while ( v17 < cocos2d::CCArray::count(*((cocos2d::CCArray **)v2 + 522)) ) { v18 = (int *)cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)v2 + 522), v17); (*(void (__fastcall **)(float *, int *))(*v18 + 680))(v83, v18); (*(void (__fastcall **)(int *))(*v18 + 644))(v18); v19 = v18[132]; if ( v19 >= 0 ) { v20 = *((double *)v18 + 101); if ( v20 <= 0.0 ) { v23 = 0; } else { v21 = (_DWORD *)((char *)v2 + 11424); v22 = v20 < 10000000.0; LODWORD(v16) = v20 >= 10000000.0 ? 1259902592 : *v21; if ( v20 >= 10000000.0 ) HIDWORD(v20) = *v21; else v16 = *(float *)&v16; if ( v22 ) v16 = v20 * v16; else *(float *)&v16 = *((float *)&v20 + 1) * *(float *)&v16; v23 = v22 ? (int)v16 : (int)*(float *)&v16; } v24 = *((double *)v18 + 102); if ( v24 <= 0.0 ) { v27 = 0; } else { v25 = (_DWORD *)((char *)v2 + 11428); v26 = v24 < 10000000.0; if ( v24 >= 10000000.0 ) LODWORD(v24) = *v25; else LODWORD(v1) = *v25; if ( v26 ) v1 = *(float *)&v1; else HIDWORD(v24) = 1259902592; if ( v26 ) v24 = v24 * v1; else *(float *)&v24 = *(float *)&v24 * *((float *)&v24 + 1); v27 = v26 ? (int)v24 : (int)*(float *)&v24; } if ( v23 != v19 || v27 != v18[133] ) { GJBaseGameLayer::reorderObjectSection(v2, (GameObject *)v18); v28 = v18[132]; if ( v28 > *((_DWORD *)v2 + 2650) || v28 < *((_DWORD *)v2 + 2649) || (v29 = v18[133], v29 > *((_DWORD *)v2 + 2652)) || v29 < *((_DWORD *)v2 + 2651) ) { (*(void (__fastcall **)(int *, int))(*v18 + 656))(v18, 1); } } } v30 = v83[0]; (*(void (__fastcall **)(float *, int *))(*v18 + 680))(v84, v18); if ( v30 != v84[0] || (v31 = v83[1], (*(void (__fastcall **)(struct timeval *, int *))(*v18 + 680))(&tv, v18), v31 != *(float *)&tv.tv_usec) ) { v32 = *v18; *((_BYTE *)v18 + 708) = 1; (*(void (__fastcall **)(int *, int))(v32 + 888))(v18, 1); (*(void (__fastcall **)(int *, int))(*v18 + 896))(v18, 1); } ++v17; } AudioEffectsLayer::resetAudioVars(*((AudioEffectsLayer **)v2 + 2725)); PlayLayer::loadDefaultColors(v2); LastCheckpoint = PlayLayer::loadLastCheckpoint((cocos2d::CCArray **)v2); if ( !*((_BYTE *)v2 + 10728) ) { GJEffectManager::getPersistentStateString((GJEffectManager *)v85); std::string::operator=((unsigned __int8 *)v2 + 11108, v85); std::string::~string((int)v85); } GJEffectManager::resetUsedItemState(*((GJEffectManager **)v2 + 381)); if ( LastCheckpoint ) { *((_BYTE *)v2 + 10881) = 0; if ( !*((_BYTE *)v2 + 10728) ) GJBaseGameLayer::resetRecord(v2, *((_DWORD *)v2 + 205), 0); } else { *((_QWORD *)v2 + 1407) = 0; *((_DWORD *)v2 + 2816) = 0; *((_DWORD *)v2 + 2817) = 0; GJBaseGameLayer::resetRecord(v2, 0, 0); *((_QWORD *)v2 + 1372) = *v10; } v34 = *((int **)v2 + 2680); if ( v34 ) { v34 = (int *)cocos2d::CCDictionary::objectForKey(*((cocos2d::CCDictionary **)v2 + 2961), v34[195]); if ( LastCheckpoint ) goto LABEL_91; v35 = *((_DWORD *)v2 + 2680); if ( v35 ) { v36 = v2; if ( v34 ) { PlayLayer::loadFromCheckpoint((int)v2, (CheckpointObject *)v34); goto LABEL_91; } v37 = *(LevelSettingsObject **)(v35 + 1648); goto LABEL_90; } } else { if ( LastCheckpoint ) goto LABEL_91; v34 = nullptr; } v37 = *((LevelSettingsObject **)v2 + 521); v36 = v2; LABEL_90: GJBaseGameLayer::setupLevelStart(v36, v37); LABEL_91: v38 = *((_DWORD *)v2 + 519); v39 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v38 + 96))(v38); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&tv, v39); cocos2d::CCPoint::operator=(v38 + 2112, &tv); v40 = *((_DWORD *)v2 + 520); if ( *((_BYTE *)v2 + 866) ) { v41 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(_DWORD))(*(_DWORD *)v40 + 96))(*((_DWORD *)v2 + 520)); } else { (*(void (__fastcall **)(_DWORD, void *))(*(_DWORD *)v40 + 92))(*((_DWORD *)v2 + 520), &unk_D2B6F8); v40 = *((_DWORD *)v2 + 520); v41 = (const cocos2d::CCPoint *)&unk_D2B6F8; } cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&tv, v41); cocos2d::CCPoint::operator=(v40 + 2112, &tv); if ( !LastCheckpoint ) { v42 = *((GameObject **)v2 + 519); v43 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)v42 + 96))(v42); GameObject::setLastPosition(v42, v43); v44 = *((GameObject **)v2 + 520); v45 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)v44 + 96))(v44); GameObject::setLastPosition(v44, v45); v46 = *((StartPosObject **)v2 + 2680); if ( v46 ) { if ( !v34 ) GJBaseGameLayer::loadStartPosObject(v2, v46); } } GJBaseGameLayer::updatePlayerCollisionBlocks(v2); if ( !*((_BYTE *)v2 + 10838) ) { PlayerObject::playSpawnEffect(*((PlayerObject **)v2 + 519)); if ( *((_BYTE *)v2 + 866) ) PlayerObject::playSpawnEffect(*((PlayerObject **)v2 + 520)); } GJBaseGameLayer::stopCameraShake(v2); if ( *((_DWORD *)v2 + 2680) ) { if ( !LastCheckpoint ) goto LABEL_108; } else if ( !LastCheckpoint ) { *((_BYTE *)v2 + 1439) = 1; GJBaseGameLayer::checkSpawnObjects(v2); goto LABEL_108; } if ( *((int *)LastCheckpoint + 577) > 0 ) { v47 = *(void (__fastcall **)(PlayLayer *))(*(_DWORD *)v2 + 628); tv.tv_sec = 0; tv.tv_usec = 0; v87 = 0; v47(v2); std::__vector_base::~__vector_base((char **)&tv); } GJBaseGameLayer::gameEventTriggered(v2, 64, 0, 0); LABEL_108: GJBaseGameLayer::updateProximityVolumeEffects(v2); GJBaseGameLayer::updateLevelColors(v2); GJBaseGameLayer::updateCamera(v2, 0.0); (*(void (__fastcall **)(PlayLayer *, _DWORD))(*(_DWORD *)v2 + 596))(v2, 0); GJBaseGameLayer::updateGradientLayers(v2); GJBaseGameLayer::updateShaderLayer(v2, 0.0); v48 = (time_t *)*((unsigned __int8 *)v2 + 11804); if ( !*((_BYTE *)v2 + 11804) ) { if ( *((_DWORD *)v2 + 352) ) { v49 = (GameManager *)PlayLayer::tracksPercent(v2); if ( v49 ) { *((_BYTE *)v2 + 11804) = 1; v77 = (GameManager *)GameManager::sharedState(v49); IntGameVariable = GameManager::getIntGameVariable(v77, "0198"); v79 = *((GJGameLevel **)v2 + 352); if ( IntGameVariable <= 0 ) v80 = 30; else v80 = IntGameVariable; v81 = time(v48); GJGameLevel::rollSession(v79, v81, 60 * v80); *((_DWORD *)v2 + 2996) = GJGameLevel::getSessionBest(*((GJGameLevel **)v2 + 352)); } } } if ( *((_DWORD *)v2 + 352) ) *((_DWORD *)v2 + 2950) = PlayLayer::getCurrentPercentInt(v2); if ( PlayerObject::buttonDown(*((_DWORD *)v2 + 519), 1) || PlayerObject::buttonDown(*((_DWORD *)v2 + 519), 2) || PlayerObject::buttonDown(*((_DWORD *)v2 + 519), 3) || PlayerObject::buttonDown(*((_DWORD *)v2 + 520), 1) || PlayerObject::buttonDown(*((_DWORD *)v2 + 520), 2) ) { v50 = 1; } else { v50 = PlayerObject::buttonDown(*((_DWORD *)v2 + 520), 3); } *((_BYTE *)v2 + 1424) = v50; updated = (unsigned __int8 *)PlayLayer::updateAttempts(v2); if ( !LastCheckpoint ) { *((_DWORD *)v2 + 2783) = *((_DWORD *)v2 + 2647); updated = std::string::operator=((unsigned __int8 *)v2 + 11120, (unsigned __int8 *)v2 + 11108); } v52 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)updated); GameStatsManager::incrementStat(v52, (const char *)&a1i2r3e45s789g[2]); v53 = *((_DWORD **)v2 + 352); v54 = v53[155] - v53[156] + 1; v53[157] = v54; v55 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0); v53[156] = v55; v53[155] = v55 + v54; if ( *((_BYTE *)v2 + 10784) ) ++*(_DWORD *)(*((_DWORD *)v2 + 352) + 1184); PlayLayer::updateProgressbar(v2); refreshed = (GameManager *)GJBaseGameLayer::refreshCounterLabels(v2); v57 = (char *)v2 + 10880; v58 = *((unsigned __int8 *)v2 + 10880); if ( *((_BYTE *)v2 + 10614) ) *v57 = 0; if ( *v57 && !LastCheckpoint && !*((_DWORD *)v2 + 2680) ) PlayLayer::startMusic((cocos2d::CCDictionary **)v2); if ( *(_BYTE *)(GameManager::sharedState(refreshed) + 723) && !*((_BYTE *)v2 + 10784) && !*((_BYTE *)v2 + 10836) ) PlayLayer::tryStartRecord(v2); GJBaseGameLayer::removeReleasedButtons(v2); v59 = *((UILayer **)v2 + 2810); if ( *(_BYTE *)(*((_DWORD *)v2 + 521) + 280) ) { isJumpButtonPressed = UILayer::isJumpButtonPressed(v59, 1); GJBaseGameLayer::queueButton(v2, 1, isJumpButtonPressed, 0, 0.0); v61 = UILayer::isJumpButtonPressed(*((UILayer **)v2 + 2810), 0); GJBaseGameLayer::queueButton(v2, 1, v61, 1, 0.0); } else { v62 = UILayer::isJumpButtonPressed(v59); GJBaseGameLayer::queueButton(v2, 1, v62, 0, 0.0); } if ( !*((_BYTE *)v2 + 10784) && !*((_BYTE *)v2 + 11797) ) *((_BYTE *)v2 + 11708) = 0; *((_BYTE *)v2 + 10837) = 0; *((_BYTE *)v2 + 10829) = 0; GJBaseGameLayer::syncBGTextures(v2); dwTickEndp = clock(); dwDurationp = dwTickEndp - dwTickStartp; v63 = *((_DWORD *)v2 + 617); if ( v63 ) { v66 = *(int **)(v63 + 52); v67 = *v66; if ( *v66 ) { v68 = (cocos2d::CCNode **)v66[3]; v69 = (unsigned int)(&v68[v67] + 0x3FFFFFFF); v70 = v68; while ( (unsigned int)v70 <= v69 ) { v72 = *v70++; v71 = v72; if ( !v72 ) break; cocos2d::CCNode::qsortAllChildrenWithIndex(v71); } } } result = GJBaseGameLayer::sortSectionVector(v2); if ( *((_BYTE *)v2 + 10614) && (v58 || *((_BYTE *)v2 + 11788)) ) { *((_BYTE *)v2 + 11788) = 0; if ( LastCheckpoint ) { *((_BYTE *)v2 + 10880) = 1; } else { v73 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create((cocos2d::CCDelayTime *)0x3E4CCCCD, v65); tv.tv_usec = 0; tv.tv_sec = (__time_t)PlayLayer::startGameDelayed; v74 = v73; v75 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(v2, PlayLayer::startGameDelayed, 0); v76 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v74, v75, 0); result = cocos2d::CCNode::runAction(v2, v76); } } *((_BYTE *)v2 + 1439) = 0; *((_BYTE *)v2 + 11570) = 1; if ( LastCheckpoint ) { cocos2d::CCPoint::operator=((char *)v2 + 996, (char *)LastCheckpoint + 932); cocos2d::CCPoint::operator=((char *)v2 + 952, (char *)LastCheckpoint + 888); return cocos2d::CCPoint::operator=((char *)v2 + 368, (char *)LastCheckpoint + 304); } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source