The frame loop's globals: lag counts, the CPU load display and the VBlank flags. More...
Go to the source code of this file.
Variables | |
| u8 | gFrameRenderPending |
| Set by WaitFrames once it has built a frame's OAM list; the VBlank handler then copies the list, the BG scroll and the queued register writes, and clears it. | |
| volatile u8 | gCpuLoadDisplayEnabled |
| Debug: WaitFrames measures the CPU load into gCpuLoadPeak when set. | |
| u8 | gOamCopyEnabled |
| The VBlank handler copies the OAM list only while it is set; scenes clear it to keep their own sprites on screen. | |
| u16 | gLagFrameCount |
| VBlanks since WaitFrames last started a frame: 1 when the frame took one. | |
| volatile u16 | gLagFramesShown |
| gLagFrameCount as the last frame left it; the text typing paces itself by it. | |
| volatile u16 | gVBlankDone |
| Bit 0 is set by the VBlank handler; WaitFrames clears it and halts until it is set again. | |
| u32 | gCpuLoadTimer |
| Frames gCpuLoadPeak is still held. | |
| u32 | gCpuLoadPeak |
| The highest CPU load in the last 30 frames: the scanline the frame's work ended on, plus 256 for each frame it overran. | |
| volatile u32 | gFrameCount |
| Frames WaitFrames has finished. | |
| u32 | gFrameTick |
| Counted up by every VBlank. | |
| void(*) | gVBlankHook (void) |
| Run once by the next VBlank handler, which clears it first. | |
| volatile u8 | gSleepDisabled |
| Nonzero: WaitFrames counts no idle time and ignores sleep requests. | |
| volatile u8 | gIdleSleepEnabled |
| Sleep after three idle minutes. | |
| volatile u8 | gSleepRequested |
| 1: sleep this frame; more: count down to it. | |
| u8 | gDebugMode |
| Debug builds: Start+Select pauses the frame loop. | |
| u8 | gDebugPaused |
| The debug pause is on. | |
| u8 | gResetRequested |
| Set by the keypad interrupt; WaitFrames performs the soft reset. | |
| volatile u16 | gIdleFrames |
| Frames since a key was last held. | |
| volatile u16 | gSleepComboFrames |
| Frames L and R have been held together; three seconds request sleep. | |
| u32 | gCartridgeResetMarker |
| Written by the soft reset just before it restarts the cartridge, and cleared by System_Initialize; nothing else reads it. | |
| u32 | gPlayTimeFrames |
| The play time clock, in frames. | |
| u32 | gSavedStackSize |
| Bytes of the caller's stack WaitFrames has copied into gSavedStack, or 0. | |
| u8 | gSavedStack [] |
| The caller's stack below the frame-wait stack top, while WaitFrames runs. | |
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
WaitFrames (runtime/frame.c) and the VBlank handler share these cells. Several are volatile, a device: each tag names the function that differs without it.
Definition in file frame.h.
|
extern |
Set by WaitFrames once it has built a frame's OAM list; the VBlank handler then copies the list, the BG scroll and the queued register writes, and clears it.
Referenced by System_VBlankHandler(), and WaitFrames().
|
extern |
Debug: WaitFrames measures the CPU load into gCpuLoadPeak when set.
Referenced by Battle_RunEncounter(), DisplayScroll_RunSlideshow(), System_Initialize(), Title_ShowIntro(), and WaitFrames().
|
extern |
The VBlank handler copies the OAM list only while it is set; scenes clear it to keep their own sprites on screen.
Referenced by DisplayScroll_RunSlideshow(), LuckyDice_Run(), ReelGame_Run(), System_Initialize(), System_VBlankHandler(), Title_ShowAnimatedSplash(), Title_ShowIntro(), Title_ShowSplashScreen(), and TolbiSpring_Initialize().
|
extern |
VBlanks since WaitFrames last started a frame: 1 when the frame took one.
Referenced by System_VBlankHandler(), and WaitFrames().
|
extern |
gLagFrameCount as the last frame left it; the text typing paces itself by it.
Referenced by UiWork_StepChannelScript(), and WaitFrames().
|
extern |
Bit 0 is set by the VBlank handler; WaitFrames clears it and halts until it is set again.
Referenced by System_VBlankHandler().
|
extern |
Frames gCpuLoadPeak is still held.
Referenced by WaitFrames().
|
extern |
The highest CPU load in the last 30 frames: the scanline the frame's work ended on, plus 256 for each frame it overran.
Referenced by WaitFrames().
|
extern |
Frames WaitFrames has finished.
Referenced by AffineEffect_UpdateFrame(), AltinPeak_FlickerStatue(), AltinPeak_SparkleIce(), AltinPeak_SpawnDebris(), AltinPeak_SpawnSpray(), Animation_ApplyChildPalette(), Battle_SelectAbility(), BattleEffect_InitializeSharedScene(), BattleEvent_Playback(), BattleFx_FlickerObjectAndTick(), BattleFx_RunSparkEmitter(), BattleFx_SteerLiftedTarget(), BattleFx_SteerPushedTarget(), BattleFx_UpdateOrbitingParticleMain(), BattleFx_UpdateRadialLaunch(), BattleMenu_RunActionSelection(), BattlePresentation_WaitForAdvance(), BattlePresentation_WaitForPromptAt(), BattleTarget_RunSelection(), Beast_SpawnSpray(), Colosso_DrawGauge(), CrossboneIslePillarRooms_SpawnFrostParticle(), CrossboneIslePillarRooms_SpawnThawParticle(), CrossboneIslePillarRooms_SpawnUnusedLeaderParticle(), Debug_RunPaletteEditor(), DisplayTransition_UpdateFromCentre(), DisplayTransition_UpdateScanlineTable(), Effect_PlayStepSound(), EquipmentMenu_UpdateCompatibilityIndicators(), Event_MeetFlint(), Event_SearchStatue(), Event_StepOnEastWallSwitch(), Event_StepOnWallSwitch(), Event_StepOnWestWallSwitch(), FieldEffect_UpdateSparkles(), FieldFx_BlinkAvoidCaster(), FieldFx_CycleObjectValueByCounter(), FieldMotes_Update(), FuchinTemple_AlternateLessonChildEffect(), FuchinTemple_SpawnGrottoEntryParticle(), GomaCavePillar_SpawnStumpDust(), HeatGauge_CountStep(), HeatGauge_Draw(), Imil_SpawnAmbientEffects(), Imil_SwayAndSpark(), ImilFuchinFalls_BlowCaveMouthDust(), ItemList_SelectEntry(), ItemMenu_RunList(), Kalay_UpdateTunnelEmitters(), Kolima_FlickerCurseDust(), Kolima_SetProtectiveFieldHeight(), Kolima_SpawnCurseSparkle(), Kolima_UpdateCurseDust(), KolimaForestBridge_FlickerBarriers(), KolimaForestBridge_SpawnCurseSparkle(), KolimaForestTree_SpawnRejectionSpark(), Leader_SpraySand(), Link_DrawShiftedTilePair(), Lunpa_KickUpLeaderDust(), LunpaFortress_UpdateHallGuardDetection(), LunpaFortress_UpdateOuterGuardDetection(), LunpaFortress_UpdatePairedGuardDetection(), Map_InitializePerspectiveScene(), Map_UpdateWorldMapMarkers(), MapAnimation_ApplyAffineFrame(), Menu_RunCommandRow(), MercuryLighthouse_CyclePalette(), MercuryLighthouse_FollowLeader(), MercuryLighthouse_RideLift(), MercuryLighthouse_RotatePaletteRange(), MercuryLighthouse_TrailSparks(), MercuryLighthouseAerie_FlickerBeacon(), ObjectGroup_ApplyIndexedChildValue(), ObjectGroup_ApplyRandomChildValues(), Palette_UpdatePulseBrightness(), RunSceneTransitionEffect(), Sanctum_UpdateHealerAfterimage(), SceneEffect_SpawnParticleEveryFourthFrame(), SceneEffect_SpawnRandomEveryFourFrames(), Ship_UpdateSwell(), SlideDownDune(), SolSanctumEruption_CycleActorPalette(), SolSanctumEruption_FlashMaterializingActor(), SolSanctumEruption_FlickerFirstCollapseTiles(), SolSanctumEruption_FlickerSecondCollapseTiles(), SolSanctumEruption_StepEmbers(), Storm_SetActorFrameMode(), SuhallaDesert_ChaseLeader(), SuhallaDesert_PulseRevealPalette(), SuhallaDesert_UpdateCaptureTimer(), SummonMenu_SelectSummon(), Title_ShowAnimatedSplash(), Title_UpdateSpriteReveal(), Transform_UpdateVertices(), TretPalette_UpdateSceneTint(), TretTreeBranch_UpdateBg3ScrollSplit(), TunnelRuins_SplashDousedPillar(), Ui_RunOwnerStatusScreen(), Vale_CycleActorPalette(), Vale_CycleActorPaletteAndSpawnEffects(), Vale_FlashActorAndSpawnEffects(), ValeBabi_CyclePaletteAndSpawnPair(), ValeBabi_CyclePaletteOnOddFrames(), ValeBabi_FlashPaletteAndSpawnPair(), ValeHome_CyclePsynergyPalette(), ValeHome_CyclePsynergyPaletteAndSpawnEffects(), ValeHome_FlashPsynergyPalette(), ValeInteriors_SpawnDriftingSprite(), ValeStorm_CycleObjectPalettes(), ValeStorm_CyclePaletteAndSpawnEffects(), ValeStorm_FlashBoulderSceneAnimationEntries(), ValeStorm_FlashPaletteAndSpawnEffects(), ValeStorm_FlickerGlowOffset(), ValeStorm_UpdatePulsingGlow(), VaultCave_RunRumble(), VenusLighthouse_EmitGateParticles(), VenusLighthouse_EmitPassageSparkTrail(), VenusLighthouse_EmitRisingParticles(), VenusLighthouse_PulseChildEffect(), VenusLighthouse_SpawnRandomParticles(), VenusLighthouse_StepActorWithDust(), VenusLighthouse_UpdateRisingSpray(), VenusLighthouseAerie_CycleActorPalette(), VenusLighthouseAerie_FlashActorPalette(), VenusLighthouseAerie_SpawnSideOrbitParticles(), VenusLighthouseAerie_SpawnUpperOrbitParticles(), VenusLighthouseAerie_UpdateBeaconRise(), VenusLighthouseAerie_UpdateBeamActors(), WaitFrames(), WorldMap_BeginStillView(), WorldMap_BlinkActorSprite(), WorldMap_CycleActorPalettes(), WorldMap_JitterTransitionCamera(), WorldMap_PulseOrbAndSpawnSparks(), WorldMap_SpawnActorEightPuff(), WorldMap_UpdateAirborneTravelTimer(), WorldMap_UpdateBlinkingLinkedEffects(), WorldMap_UpdateBobbingMarker(), WorldMap_UpdateCyclingLinkedEffects(), WorldMap_UpdateTransitionBlend(), WorldMap_UpdateTransitionEffect(), WorldMap_UpdateView(), and Xian_SpawnTrainingParticles().
|
extern |
Counted up by every VBlank.
Referenced by AltmillerCave_UpdateWallFragment(), BattleEffect_UpdatePhasedRadialParticle(), BattleEvent_Playback(), BattleFx_SetObjectAlternatingWords(), BattleFx_UpdateRadialSpread(), DisplayScroll_StepPositionEveryFourFrames(), DisplayScroll_UpdateObjects(), Map_BuildProbeRing(), NameEntry_EditOwnerName(), PaletteGlow_UpdateSine(), RenderOutput_BobPair(), Sanctum_ChooseRestartOption(), SelectionScreen_Draw(), SelectionScreen_DrawArrow(), System_VBlankHandler(), Ui_ApplyTableScaleToObject(), and UiWork_AnimateSpriteSlots().
|
extern |
Run once by the next VBlank handler, which clears it first.
Referenced by Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), System_VBlankHandler(), and WorldMap_BeginStillView().
|
extern |
Nonzero: WaitFrames counts no idle time and ignores sleep requests.
Referenced by Menu_RunWorkspaceOptions(), SaveMenu_Run(), System_Initialize(), and WaitFrames().
|
extern |
Sleep after three idle minutes.
Referenced by DisplayScroll_RunSlideshow(), GameState_InitDefaults(), LinkLobby_RunRoundResult(), Menu_RunWorkspaceOptions(), SaveMenu_Run(), SaveState_BuildSummaryHeader(), SaveState_LoadRecordIntoWork(), and WaitFrames().
|
extern |
1: sleep this frame; more: count down to it.
Referenced by Menu_RunWorkspaceResultLoop(), and WaitFrames().
|
extern |
Debug builds: Start+Select pauses the frame loop.
Referenced by Battle_CollectPartyCommands(), Event_UpdateDebugSkip(), Field_RunScene(), FieldObject_UpdatePlayerControl(), Game_ResetForNewGame(), Menu_RunWorkspaceSelectionLoop(), Object_MoveOnWorldMap(), Runtime_GetBuildStampTime(), SaveMenu_Run(), System_Initialize(), SystemMenu_Open(), Ui_RunIconMonitor(), WaitFrames(), and WorldMap_UpdateLocationContacts().
|
extern |
The debug pause is on.
Referenced by ReelGame_RunFrame(), Title_UpdateIntroSprites(), and WaitFrames().
|
extern |
Set by the keypad interrupt; WaitFrames performs the soft reset.
Referenced by Input_HandleKeyInterrupt(), and WaitFrames().
|
extern |
Frames since a key was last held.
Referenced by GameState_InitDefaults(), SaveState_LoadRecordIntoWork(), and WaitFrames().
|
extern |
Frames L and R have been held together; three seconds request sleep.
Referenced by WaitFrames().
|
extern |
Written by the soft reset just before it restarts the cartridge, and cleared by System_Initialize; nothing else reads it.
Referenced by Runtime_GetRemainingIwram(), System_Initialize(), and System_SoftReset().
|
extern |
The play time clock, in frames.
Referenced by GameState_InitDefaults(), SaveState_BuildSummaryHeader(), SaveState_LoadRecordIntoWork(), and WaitFrames().
|
extern |
Bytes of the caller's stack WaitFrames has copied into gSavedStack, or 0.
Referenced by WaitFrames().
|
extern |
The caller's stack below the frame-wait stack top, while WaitFrames runs.
Referenced by WaitFrames().