HLE: PlayStation button prompts from the user's copy, served at read time with opt-in VICTORY_FILE_PATCH #3399
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3399"
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 anoyarou on 2026-11-26T22:18:40Z.
Summary
The Xbox build ships only Xbox button art. This adds a way to get PlayStation prompts without storing anything of the title in the repository. It covers the glyph part of #187; the SDL3 backend and controller detection in that issue are not part of this PR.
There are two commits, and the first is useful without the second:
VICTORY_FILE_PATCHserves byte ranges of the title's files from other files at read time. Nothing on disk changes. A list names, per line,<file name> <offset> <BLAKE3 of the original range> <file with the new bytes>. A range is patched only when the opened file's name matches and its bytes there still hash as listed, so another version of the game is left alone. The patches are loaded when the file is opened and applied inread_into, so every DirectStorage read of the file gets them.victory glyphsbuilds the patches from the user's own copy and writes the list into the cache folder:--xelu): the Xbox controller on the controls screen becomes a DualSense, from Xelu's PS5 line art, which the user downloads.How it works
Endtag), and its zlib stream keeps the original stream's exact length. The game reads exactly that many bytes. The stream is zopfli for the start of the data, then stored blocks to fill the rest (victory_formats::zlib_exact, which has its own small inflater to find where the last block starts).victory_formats::bc7), tiled 64 KiBDwith the existingtexture::Layout. The menu draws the texture at about 0.75 of its width, so the picture is drawn wider to come out in proportion.victory_formats::{swf, zlib_exact, bc7},victory_game::{prompt_glyphs, settings_diagram},apps/victory/src/glyphs.rs, anddocs/playstation-prompts.md.Assets and licences
ensure_outside_repo).cargo xtask policypasses.prompt_glyphs.rs. I treated it like a name we look up, as with hooks. Please say if you would rather not have it under the asset policy; finding the movie by its structure instead is possible.zopfli(Apache-2.0, pure Rust) andpng(MIT/Apache-2.0, pure Rust).Testing
swf: shapes written and read back, shapes replaced, everything else byte for byte.zlib_exact: our inflater reading zopfli and stored output, streams hitting exact lengths.bc7: mode-6 round trips.prompt_glyphs: a movie shaped like the title's, rebuilt.settings_diagram: proportions, logo removal, finding and packing the stream.file_patch: reads across and inside a range, a name that does not match, a hash that does not match, a bad line.dstoragetests pass, the existing ones included.main:read_intoinstead of the fork's read path, andminiz_oxideinstead ofzlib-rs.Limits
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:21:31Z.
Windows 11 — this one cannot be built in my environment, and I'd rather report that than a result:
cargo test -p victory-hlestops before compiling: the PR adds new crates.io dependencies (flate2,crc32fast, andfdeflate/zopflithrough it), and this machine cannot fetch crates (schannel: AcquireCredentialsHandle failed: SEC_E_NO_CREDENTIALS). The error isfailed to get \zopfli` as a dependency of package `victory-formats` … download failed`.If you can build it where crates are reachable, the useful check would be
cargo test -p victory-hle -p victory-formatsplus thepatches_serve_their_range_when_the_file_matchespath with a synthetic archive. AI-assisted.Imported from Marvisak/VIctory. Originally posted by anoyarou on 2026-11-27T00:16:00Z.
Thanks for taking the time to try this on Windows 11, and for reporting the blocker instead of a guess.
The
SEC_E_NO_CREDENTIALSerror happens while crates are downloaded over TLS, before anything compiles. The only new direct dependencies arezopfliandpng;flate2,crc32fastandfdeflatecome in throughpng. All of them are pure Rust, so once crates.io can be reached, the build shouldn't need anything else.About the test data: the tests don't need a copy of the title. They all run on data the tests generate themselves:
swf,zlib_exactandbc7build their input in memory.prompt_glyphsandsettings_diagrambuild a small movie and texture shaped like the title's.patches_serve_their_range_when_the_file_matcheswrites its owndata.rpf, replacement bytes and patch list to a temp folder, then reads them back.Only the
victory glyphscommand itself reads the user's copy, and no test uses that path.To check this, I ran the tests again with no game data reachable: an empty environment, and for Wine a brand-new prefix.
cargo test -p victory-formats: 51 passed, 5 ignored. The ignored ones were already there before this PR: two benchmarks and three BCPack/XMA tests that need reference files outside the repository.cargo test -p victory-game: 18 passed (prompt_glyphs,settings_diagram).victory-hle, cross-built withcargo xwin test --target x86_64-pc-windows-msvcand run under Wine (not on a Windows host): 149 passed, 4 failed. All 17dstoragetests passed,patches_serve_their_range_when_the_file_matchesincluded. The 4 failures are in files this PR doesn't touch, and the same 4 fail the same way onmainwithout the PR, so they look like Wine differences:lifecycle::tests::a_title_window_is_shown_through_a_stand_in_that_always_answerslifecycle::tests::showing_a_title_window_shows_its_stand_innet::tests::only_loopback_is_reachablexgamesave::tests::a_kept_blob_past_the_link_limit_is_copiedvictory-hleintegration tests (fidelityfx,no_dll_planting) passed.So on a machine that can reach crates.io,
cargo test -p victory-formats -p victory-game -p victory-hleshould be a complete check. I haven't run it on a Windows host yet, so a result from there would be very welcome, especially for those 4 tests.Imported from Marvisak/VIctory. Originally posted by urattems on 2026-11-30T10:19:10Z.
Tested on Windows 11 (RTX 5070, driver 621.14): the build works and the prompts show in game.
file_patchtest passes, and so do thevictory-formatsandvictory-gamesuites. The new crates.io dependencies download without problems here.victory glyphsworks first time. Run with no arguments against my own dump (title 1.0.2.1), it wrotepatches.txtand thedata.rpfrange at0x117d7000(9644 bytes).file patch: applies to this file path="…data.rpf" offset=293433344 len=9644. The start screen and in-game hints show PlayStation symbols (△ ✕ ◯ ▢, L2/R2) instead of Xbox letters. I've played several sessions with it on and seen no crashes or slowdowns from it.I also cherry-picked the three commits onto a downstream NVIDIA fork. Only
dstorage.rsconflicted: the fork'sFilestruct has extra fields, and thepatchesfield slots in next to them. Themodlines inlib.rsandCargo.lockalso overlapped, and taking both sides fixed it.Thanks for this. It makes a big difference with a DualSense.
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.