DualSense: PS5 controller icon support #406
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!406
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-406"
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?
@jyksityisyys on GitHub · 2026-12-04 00:40 UTC · original
jyksityisyys:dualsense-icons→main· +1027 −20 · 7 files · 3 commits · openSummary
Adds optional PlayStation button prompts and a DualSense controller picture to
the Xbox build, gated behind the existing DualSense setting:
Without the path, the Xbox assets are untouched.
Changes
dualsense_icons.rsloads and validates the converted assets, then replacesthe inflated Xbox movie in place.
dstorage.rsredirectsplatform.ttpfto the converted picture and appliesthe movie substitution after inflate.
tools/dualsense-icons.pybuilds the folder from your own copies:Xbox defaults to
GAMEfromrun.conf; pass--xbox-dumpif it liveselsewhere. Output defaults to
local/dualsense-icons.README.md,docs/SETTINGS.md,docs/CONTROLS.md,run.conf.default, and newdocs/DUALSENSE-ICONS.md.Conversion
byte-for-byte.
the original
RDS5chunk layout.Validation
Notes
local/and are not committed.@Kal0s-design on GitHub · 2026-12-04 07:33 UTC · original
Tested
013da4bnatively on Windows (MSVC, not Wine), using only synthetic files and no game data.At this head the victory-hle lib test target doesn't build, so none of the crate's tests can run. In
leaves_other_assets_alone,let icons = icons(...)at dualsense_icons.rs:200 shadows theicons()helper, and the call at line 207 then fails with E0618 (expected function, foundIcons). The lib itself builds fine. Renaming the local fixes it. With only that rename,cargo test -p victory-hle --lib -- --test-threads=2gives 164 passed and 1 ignored. The merge base1152b9cgives 160 passed and 1 ignored, so the difference is just the 4 new tests.Everything else I checked looks fine. Reading
open_file, the redirected file becomes a raw handle only on success (dstorage.rs:140), and the onlyfrom_raw_handleis at dstorage.rs:174. A failed open falls back to the oldfiles::CreateFileWpath, so I don't see a double close or a leak. With the vars unset, withVICTORY_DUALSENSEset to "0" or "true", or with no icons path,load()returned None, so nothing changes for anyone else. A native folder worked with both slash styles andplatform.ttpfwas redirected. A missingZ:/...folder only logs a warning and keeps the Xbox assets.replace_gfxdidn't panic on 0 to 7 byte buffers, a header-only buffer or an oversized replacement, and it left the buffer untouched when it refused.There are two small nits. First,
is_moviepanics on an empty name becausewindows(0)panics (dualsense_icons.rs:80). Today it's only called with the constant, so you can't hit it. Second,replace_gfxchecks and writes the fullout.len(), but the closure still returns inflate'swritten(dstorage.rs:1385). On the copy path onlydata[..n]reaches the title (dstorage.rs:1629), so a converted movie longer thanwrittenwould get cut off there. Returningout.len()after a substitution would avoid that.AI-assisted: yes
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
One must-fix, in
is_movie(crates/victory-hle/src/modules/dualsense_icons.rs:77-81): it accepts any buffer that starts withGFX*and containsplatform_xbsx.input_iconsanywhere, andreplace_gfxonly refuses when the destination is smaller (:51-63) — a bigger destination is overwritten and zero-filled pastself.gfx.len(). Your own tool's comment says that string is also part of the UI movie (tools/dualsense-icons.py:28-30), so if the UI movie is inflated through this pool the whole interface is replaced by the 28 KiB icon movie, with oneinfo!to show for it. Bound it: reject destinations over a few hundred KiB before matching, and/or require the name NUL-terminated or present in the export table. The real movie is 28,148 bytes, so any of those keeps it working.Worth checking while you are there:
fillprints the once-only "the converted movie is larger than the title's slot; keeping the Xbox icons" warning (:51-59) even though the slot is fine — misleading, sinceinto_pagescan callfillwith a slice (dstorage.rs:1598-1600).tools/dualsense-icons.py:262heads the TTPF section "Xbox RDS5 with a stored (uncompressed) chunk" while:386-389requires zlib and writeszlib.compress(...); one of the two is wrong.:189-192raisesStopIterationinstead ofdie(...)when the export tag is missing.Please also say whether you saw the icons on screen and on which build — the feature depends on the movie arriving as one zlib request starting at the slot's first byte.
@jyksityisyys on GitHub · 2026-12-05 01:48 UTC · original
#406: Thanks for this. Looked into these issues and the tests now pass.
The E0618 is fixed: the test helper is now make_icons(), with its call sites updated, so the victory-hle lib test target builds again.
is_movie now rejects an empty name (!name.is_empty()), with a regression test, so windows(0) is unreachable.
After a substitution, the dstorage closure now returns out.len() instead of inflate's written, so the copy path receives the whole padded converted movie.
#406: Thanks all four are addressed.
is_movie: bounded before the name scan. is_xbox_movie now rejects anything
over 512 KiB (MAX_MOVIE_BYTES, about 18x the real 28 KiB movie), with a
regression test that a large buffer containing platform_xbsx.input_icons is
not matched. I used the size bound rather than NUL termination because the
name is not NUL-terminated in the assets (117 occurrences, none terminated);
parsing the export table would be a much larger change for the same
protection.
Partial-page warning: I traced the fill path. into_pages passes
window.bytes(), and page_window only returns when one contiguous run covers
the requested range, setting PageWindow.len to that full range;
lazy::linear likewise requires n == len. So fill always receives the
request's full destination_size, never a sub-slice. I still reworded the
message from "the title's slot" to "this request's destination" and updated
docs/DUALSENSE-ICONS.md, since a request can be a fragment of a larger asset.
TTPF header: fixed — it now says "zlib-compressed chunk". The code was
already right (zlib.compress(..., 9) and codec 8).
StopIteration: fixed — a missing export tag now reports "the Xbox/PlayStation
movie has no export table" through die(...), instead of raising
StopIteration.
On screen: yes, the PlayStation button prompts and the DualSense controller
picture are visible and render as expected on the current branch build. The log
shows a single 28,129-byte substitution, consistent with the movie arriving as
one zlib request at the slot's first byte.
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.