Survival entry fade (decompile notes)¶
This page documents the menu → Survival fade behavior using the static decompile as the authoritative source. The goal is to mirror the original pipeline and identify any missing runtime triggers before changing the rewrite behavior.
Fullscreen fade overlay (render order)¶
The classic renderer applies a fullscreen black overlay using screen_fade_alpha
(DAT_00487264) after the world render and before UI elements:
gameplay_render_world(0x00405960) drawsgrim_draw_fullscreen_color(0,0,0,screen_fade_alpha)after projectiles/bonuses.game_update_generic_menu(0x00406af0) draws the same fullscreen color after the menu/world pass and beforeui_elements_update_and_render.
This ordering matches the observed effect: ground can dim while UI panels slide out, because the UI is rendered after the fade overlay.
Fade update rates (authoritative)¶
The main update loop updates screen_fade_alpha every frame:
if (screen_fade_ramp_flag == 0) {
screen_fade_alpha -= frame_dt * 2.0;
} else {
screen_fade_alpha += frame_dt * 10.0;
}
screen_fade_alpha = clamp(screen_fade_alpha, 0.0, 1.0);
Decompile reference: crimsonland.exe_decompiled.c around the screen_fade_alpha update
block (see ~0x0040c4b7 region and the DAT_0048702c checks).
Implication: fade-to-black is very fast (~0.1s at 60fps), while fade-from-black is slower (~0.5s at 60fps).
Trigger observations (static)¶
Static references to screen_fade_ramp_flag (DAT_0048702c):
- Set to
0ongame_state_set(9)(Survival/Rush/Quests gameplay entry). - No obvious write of
screen_fade_ramp_flag = 1on the Survival start path was found in the current decompile dump.
Runtime evidence (confirmed)¶
Runtime trace (2026-01-30): analysis/frida/raw/screen_fade_trace.jsonl
captured with scripts/frida/screen_fade_trace.js (raw logs are ignored in git).
Reduced summary: analysis/frida/screen_fade_trace_summary.json (generated by
uv run scripts/screen_fade_trace_reduce.py).
Observed behavior when starting Survival from the Play Game menu:
- When the menu requests gameplay (
game_state_pending = 9),screen_fade_ramp_flagflips0 → 1atts=1769544752317andscreen_fade_alpharamps0 → 1byts=1769544752421(~104ms, fade-to-black). - On gameplay entry,
screen_fade_ramp_flagflips1 → 0atts=1769544752619whilescreen_fade_alphais still1.0, thenscreen_fade_alpharamps1 → 0byts=1769544753120(~501ms, fade-from-black). - The renderer uses
grim_draw_fullscreen_color(0,0,0,alpha)with the samealpha.
Rewrite alignment¶
To match the original timing (fast fade-to-black during menu close, then fade-from-black on gameplay entry), the rewrite does:
- On menu close for gameplay actions: set
screen_fade_alpha = 0.0andscreen_fade_ramp = True. - On gameplay open: if
screen_fade_rampis stillTrue, clampscreen_fade_alpha = 1.0and then setscreen_fade_ramp = Falseso the fade-from-black begins immediately.
Reproduce / recapture¶
Capture a runtime trace when selecting Survival from the Play Game menu:
This writes screen_fade_trace.jsonl into the Frida share directory (default C:\share\frida).
Import it into the repo with: