Game: recover SGD5 records from unparsed databases alongside intact ones #3049
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3049
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3049"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@fuzeofficlal on GitHub · 2026-11-26 05:23 UTC · original
fuzeofficlal:fix/game-sgd5-mixed-fallback→main· +80 −9 · 1 files · 1 commits · openProblem
crates/victory-game/src/sgd5.rs::recordscurrently gates marker-based record recovery ondbs.is_empty(). When an archive contains multiple SGD5 databases and at least one parses cleanly while a sibling failsparse()(e.g. a damaged or unrecognized effect table after intact shader records),dbsis non-empty and every recoverable shader record in the unparsed sibling is silently omitted—even though scanning that database alone recovers them via marker fallback.Fix
scan_databases(file)to return(Vec<Database>, bool)indicating whether anySGD5magic failedparse().!unparsed) or when none parse (dbs.is_empty()).MARKERoccurrences strictly outside parsed[db.start..db.end)spans (viapartition_pointover the sorted non-overlapping spans) and merge records by file offset so every record is returned once in file order.Verification
cargo test --locked -p victory-game(16 passed, includingintact_database_does_not_suppress_fallback_for_damaged_siblingtesting both good-then-bad and bad-then-good archive orders)cargo test --locked -p victory(18 passed)cargo clippy --locked -p victory-game -p victory --all-targets -- -D warningscargo xtask policy(191 files ok)@Marvisak on GitHub · 2026-11-26 06:17 UTC · original
Automated triage for the maintainers.
Verdict: merge candidate. In
crates/victory-game/src/sgd5.rs,recordsonmainuses the marker fallback only when no database parses. In an archive where one database parses and a sibling does not, the sibling's records are therefore dropped.scan_databasesnow also reports whether anySGD5magic failed to parse. If so, markers outside the parsed[start, end)spans are recovered and merged by file offset.I checked the following:
db.end, so thepartition_pointlookup is valid.offset, so sorting by offset cannot interleave them wrongly.databases()behaves as before.The only caller is the
victoryCLI's shader source listing (apps/victory/src/shader.rs), so the impact is limited to that tool. The new test covers both orders of a good and a damaged database.CI:
checkpassing.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-26 05:25 UTC · original · approved these changes
Verified:
scan_databasesreports whether any magic failed to parse;recordskeeps the all-or-nothing fallback but on a mixed archive unions table records with marker records outside intact spans, deduplicated viacovered(partition_point is correct on the parser's non-overlapping file-ordered spans) and re-sorted by offset. The test's corrupted sibling in both orders + the name/offset assertions discriminate the fix.@Dukestar69 on GitHub · 2026-11-26 09:11 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory-game -- --test-threads=1: 16/16 passed (includingsgd5::tests::intact_database_does_not_suppress_fallback_for_damaged_sibling).cargo clippy -p victory-game --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly ensures intact sibling databases do not suppress marker fallback recovery for damaged SGD5 databases.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@futurepro62 on GitHub · 2026-11-26 19:31 UTC · original
NVIDIA full-suite run, to go with the reports above by Dukestar69, since none of them names a GPU run. Tested exact head
98d2d1e(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.intact_database_does_not_suppress_fallback_for_damaged_sibling.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.