feat(game): retain load progress milestones

This commit is contained in:
2026-07-18 12:46:00 +04:00
parent b744a9d880
commit a3b19b4349
2 changed files with 30 additions and 1 deletions
+24 -1
View File
@@ -473,7 +473,13 @@ fn prepare_load_progress_path(path: &std::path::Path) -> Result<(), String> {
} }
fn write_load_progress(path: &std::path::Path, phase: MissionLoadPhase) -> Result<(), String> { fn write_load_progress(path: &std::path::Path, phase: MissionLoadPhase) -> Result<(), String> {
std::fs::write(path, format!("{phase:?}\n")).map_err(|err| format!("{}: {err}", path.display())) use std::io::Write;
let mut file = std::fs::OpenOptions::new()
.append(true)
.open(path)
.map_err(|err| format!("{}: {err}", path.display()))?;
writeln!(file, "{phase:?}").map_err(|err| format!("{}: {err}", path.display()))
} }
fn run_static_vulkan_mode( fn run_static_vulkan_mode(
@@ -1049,6 +1055,23 @@ mod tests {
); );
} }
#[test]
fn load_progress_retains_prior_milestones() -> Result<(), String> {
let path =
std::env::temp_dir().join(format!("fparkan-game-progress-{}.txt", std::process::id()));
prepare_load_progress_path(&path)?;
write_load_progress(&path, MissionLoadPhase::GraphVisualMaterials)?;
write_load_progress(&path, MissionLoadPhase::GraphVisualMaterialRequests(64))?;
let progress = std::fs::read_to_string(&path).map_err(|err| err.to_string())?;
std::fs::remove_file(&path).map_err(|err| err.to_string())?;
assert_eq!(
progress,
"Starting\nGraphVisualMaterials\nGraphVisualMaterialRequests(64)\n"
);
Ok(())
}
#[test] #[test]
fn static_preview_component_merge_offsets_indices_and_remaps_local_selectors( fn static_preview_component_merge_offsets_indices_and_remaps_local_selectors(
) -> Result<(), String> { ) -> Result<(), String> {
+6
View File
@@ -1126,6 +1126,12 @@ termination. It does not preserve the simultaneous TEXM count, so it neither
identifies a slow individual material nor attributes time to MAT0 parsing; the identifies a slow individual material nor attributes time to MAT0 parsing; the
next profiler revision needs one cumulative snapshot of all classes. next profiler revision needs one cumulative snapshot of all classes.
`fparkan-game --load-progress` now initializes its file with `Starting` and
appends each later mission-load event instead of replacing the prior line. A
bounded probe can therefore retain both MAT0 and TEXM request milestones even
when a later event is last. The behavior is diagnostic persistence only: it
does not alter graph traversal, resource validation, or rendering.
Mission loading now raises the decoded-payload cache entry budget from 64 to Mission loading now raises the decoded-payload cache entry budget from 64 to
256 while retaining its 64 MiB byte budget. This avoids premature entry-count 256 while retaining its 64 MiB byte budget. This avoids premature entry-count
eviction during resource-rich loads without making memory unbounded. The same eviction during resource-rich loads without making memory unbounded. The same