Alchemy
Loading...
Searching...
No Matches

frame.h File Reference

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.

Detailed Description

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.

Variable Documentation

◆ gFrameRenderPending

u8 gFrameRenderPending
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().

◆ gCpuLoadDisplayEnabled

volatile u8 gCpuLoadDisplayEnabled
extern

Debug: WaitFrames measures the CPU load into gCpuLoadPeak when set.

Referenced by Battle_RunEncounter(), DisplayScroll_RunSlideshow(), System_Initialize(), Title_ShowIntro(), and WaitFrames().

◆ gOamCopyEnabled

u8 gOamCopyEnabled
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().

◆ gLagFrameCount

u16 gLagFrameCount
extern

VBlanks since WaitFrames last started a frame: 1 when the frame took one.

Referenced by System_VBlankHandler(), and WaitFrames().

◆ gLagFramesShown

volatile u16 gLagFramesShown
extern

gLagFrameCount as the last frame left it; the text typing paces itself by it.

Referenced by UiWork_StepChannelScript(), and WaitFrames().

◆ gVBlankDone

volatile u16 gVBlankDone
extern

Bit 0 is set by the VBlank handler; WaitFrames clears it and halts until it is set again.

Referenced by System_VBlankHandler().

◆ gCpuLoadTimer

u32 gCpuLoadTimer
extern

Frames gCpuLoadPeak is still held.

Referenced by WaitFrames().

◆ gCpuLoadPeak

u32 gCpuLoadPeak
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().

◆ gFrameCount

volatile u32 gFrameCount
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().

◆ gFrameTick

◆ gVBlankHook

void(*) gVBlankHook(void) ( void )
extern

Run once by the next VBlank handler, which clears it first.

Referenced by Map_LoadAreaGraphics(), Map_LoadDefaultCellsAndUpdateBlock(), System_VBlankHandler(), and WorldMap_BeginStillView().

◆ gSleepDisabled

volatile u8 gSleepDisabled
extern

Nonzero: WaitFrames counts no idle time and ignores sleep requests.

Referenced by Menu_RunWorkspaceOptions(), SaveMenu_Run(), System_Initialize(), and WaitFrames().

◆ gIdleSleepEnabled

◆ gSleepRequested

volatile u8 gSleepRequested
extern

1: sleep this frame; more: count down to it.

Referenced by Menu_RunWorkspaceResultLoop(), and WaitFrames().

◆ gDebugMode

◆ gDebugPaused

u8 gDebugPaused
extern

The debug pause is on.

Referenced by ReelGame_RunFrame(), Title_UpdateIntroSprites(), and WaitFrames().

◆ gResetRequested

u8 gResetRequested
extern

Set by the keypad interrupt; WaitFrames performs the soft reset.

Referenced by Input_HandleKeyInterrupt(), and WaitFrames().

◆ gIdleFrames

volatile u16 gIdleFrames
extern

Frames since a key was last held.

Referenced by GameState_InitDefaults(), SaveState_LoadRecordIntoWork(), and WaitFrames().

◆ gSleepComboFrames

volatile u16 gSleepComboFrames
extern

Frames L and R have been held together; three seconds request sleep.

Referenced by WaitFrames().

◆ gCartridgeResetMarker

u32 gCartridgeResetMarker
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().

◆ gPlayTimeFrames

u32 gPlayTimeFrames
extern

◆ gSavedStackSize

u32 gSavedStackSize
extern

Bytes of the caller's stack WaitFrames has copied into gSavedStack, or 0.

Referenced by WaitFrames().

◆ gSavedStack

u8 gSavedStack[]
extern

The caller's stack below the frame-wait stack top, while WaitFrames runs.

Referenced by WaitFrames().