Game: recover SGD5 records from unparsed databases alongside intact ones #3047
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:23:38Z.
Problem
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)Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T05:25:53Z.
Review: APPROVED
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.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:29Z.
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
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:11:58Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T19:31:53Z.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.