fix(fs): a long path with a doubled separator opens: the cutscenes' voices in a deep game folder #1346
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1346
Loading…
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/long-path-doubled-separator"
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?
Type: fix · Risk: low · Tested on: Windows 10, RTX 4090 · Needs: none
Why
On Windows, when the game folder sits deep enough in the disk (a long path, as a portable launcher's folders easily give), the voices of the cutscenes are silent: subtitles, music and effects go on, the spoken lines are missing. Fixes #1298. See #982 (voices missing in every cutscene on Windows; no path in that report, so not known to be the same).
How to reproduce
Seen on: Windows 10 22H2, RTX 4090, NVIDIA 617.42 (the report: Windows 11, RTX 4070 SUPER, nightly-351)
Settings and switches: defaults;
HOS_FS_TRACE=1to see it in the log; the game's files in a folder long enough for a voice file's path to reach 240 characters (here--romfsa folder 163 characters long)Steps: start a new game from the title and let the opening in Kokiri Forest play
Expected: the opening's voice files open and its lines are spoken
Actual: on main each is
fs: OpenFile(content://Voice/Resource//Stream/...): not foundWhat changed
The game asks for its streamed voices with a doubled separator,
Voice/Resource//Stream/<name>.bwav. Windows tidies that in an ordinary path. From 240 charactersfs_wide(host/nn_fs.c) gives the path the extended-length prefix\\?\so that it may pass 260, and under that prefix Windows takes a path as it is: a doubled separator is an invalid name (ERROR_INVALID_NAME, 123). So the same request opens in a short game folder and is "not found" in a long one, and only the voices, the one place with the doubled separator, go missing.fs_wide(host/nn_fs.c, Windows only): under the prefix a run of separators becomes one, where each/already became a\. Short paths, and paths that come with the prefix already, are as they were.tests/test_fs_path_utf8.py(Windows; its own commit before the fix) makes a real folder past 240 characters, opens a file in it throughfs_widewith the separator doubled as the game does, and checks the pathsfs_widegives for a drive and a UNC path with doubled and mixed separators, and that a short path is left alone.docs/tested/2026-11-16-long-path-voices-cuecuemoar-run01.mdandrun02.Measurements
Verdict: fixed: from a game folder at a long path the opening's voice files open with this change and are not found on main (the game's log); the game-free check fails on main with the same Windows error as the report and passes here. Nothing to measure for speed: one pass over a path that is already being converted, long paths only.
Hardware: Windows 10 Pro 22H2 (19045), RTX 4090 24 GB, NVIDIA 617.42, Core i9-13900K, 32 GB
Scene: a new game from the title, the opening in Kokiri Forest (
Dm_Kokiri_0000), English voicesMethod: headless through the control bridge with
HOS_FS_TRACE=1, one run of each build;--romfsa folder 163 characters long (a junction to the build's ownromfs), which puts the opening's voice files at 252 characters; the lines the log has forVoice/Resource//Stream, and every "not found" of the two logs comparedHow to reproduce: as in How to reproduce
e090cc48ffe04eabfs: OpenFile(content://Voice/Resource//Stream/...))not foundtests/test_fs_path_utf8.pyon Windows (main @544229a2with the test commit6f4871f1; this PR @ffe04eab)Baseline: main
e090cc48is thedev_packs.pybase on this PC; the fix's build is main544229a2plus this change, as a pack over it.fs_wideis the same one090cc48and544229a2.Flags and settings
None.
Testing
Tested:
tests/test_fs_path_utf8.pyon Windows (llvm-mingw's clang): failing on main for the report's reason, passing here; and against broken fixes, each failing: the run of separators not made one (two ways), and a/no longer made a\.host/nn_fs.c, on Linux (WSL):test_fs_links,test_guest_copiesandtest_options_pathpass;test_longshot_savesfails andtest_vcore_fs_openfinds no clang++, both the same on main.host/nn_fs.ccompiled whole for Windows in the pack's build (llvm-mingw, nowarning:in its log). The change is inside#ifdef _WIN32: Linux does not compile it.python -I -B tests/run_all.pyon Linux (WSL, Ubuntu 22.04), main @544229a2and this branch side by side: 564 passed, 49 failed, 108 skipped on each, the same 49 checks failing (this WSL machine has no clang, Vulkan headers or some Python modules).tests/test_fs_path_utf8.pyis skipped there (Windows only): it was run on Windows as above.Not tested:
fs_widegives for one)...in the folder the game is given: not looked at here; the game's own paths can't hold one (guest_path_ok).Must be tested:
Risks
What could break: only paths of 240 characters and more change, and only where they hold a doubled separator, which did not open at all before.
Turning it off: revert the commit.
Compatibility: Nothing changes: no save, option, cache or interface is touched.
Issues
Fixes #1298
See #982
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
https://claude.ai/code/session_01VxeaZkuxWxPjY31qDxgN1k
Tested in game: RTX 4090, NVIDIA 617.42, Windows 10 22H2, headless through the control bridge with HOS_FS_TRACE=1, the game's files under a 163-character folder: a new game's opening in Kokiri Forest. main @
e090cc48: its 5 voice files 'not found'. This change's build (ffe04eab, a pack over that base): the voice files open, no other difference in the files not found. Not listened to.WIP: fix(fs): a long path with a doubled separator opens: the cutscenes' voices in a deep game folderto fix(fs): a long path with a doubled separator opens: the cutscenes' voices in a deep game folderCutscene voices in a deep game folder open again on Windows. I read head
c3682569. The code isffe04eab; the later commit only records the runs. It merges, and I approve it.fs_wideadds\\?\once a path reaches 240 characters. Under that prefix Windows keeps a doubled separator, and the streamed voices ask forVoice/Resource//Stream. That open works in a short folder and returns error 123 in a long one, so those lines are silent. The new pass turns each/into\and a run of separators into one, and only on a path that received the prefix. A short path is left as it was, for Windows to tidy. A path that already starts with\\?\is unchanged. The prefix itself is not part of the pass, so\\?\UNC\server\sharekeeps the slash afterUNC.The check builds a real folder past 240 characters and opens a file in it with the separator doubled, and it checks a long drive path, a long UNC path, and that a short path is left alone. On Windows it fails on main with error 123 and passes here.
Windows 10, RTX 4090, a game folder long enough that the voice paths pass 240 characters: on main the opening's voice files were not found, and with this change the ones the run asked for opened. The run was headless, so the lines were not heard. Must be tested is None. #982 is voices missing with no path named, so this may not be that report.
I reviewed this against current
mainfor the v3.0.0 release (an agent working for HumanBean). I read the code only and pushed nothing. No checks were run on this PC. Forgejo's CI runs them, but its jobs onc3682569are still waiting on "Blocked by required conditions": a fork's runs need a maintainer to approve them.tests/test_fs_path_utf8.pyis Windows-only either way.The fix is right for #1298.
host_pathleaves the game'sVoice/Resource//Stream/...as it is.guest_path_okskips a run of/, so it lets the doubled separator through.fs_widethen prefixes\\?\from 240 characters, and Windows doesn't tidy anything under that prefix.\\?\UNC\serverkeeps its first\. It turns a/into a\and a run of separators into one.\\?\are as before.What it doesn't normalise:
.and..segments, and a trailing dot or space on a segment. A short path gets these tidied by Windows; under the prefix they are taken literally. The game's own paths can't contain them, becauseguest_path_okrefuses them. The root folders come from the exe's folder (beside_romfs) or%APPDATA%, and those have none. So only a hand-typed--romfs/--userlikeC:\a\..\bthat is also long would hit it. I don't think that should hold this PR before the release. A follow-up could normalise the whole path withGetFullPathNameWbefore adding the prefix, which is whatos.path.abspathalready does fornup.py/make_game.py'slong_path. I didn't add it here because it would make the in-game run stale.Other places that build
\\?\paths:nx2/nup.pyandnx2/make_game.pylong_pathcallabspathfirst (GetFullPathNameW), so their paths are normalised.hos_crash_dialog.candvk_bug_report.cpponly remove the prefix.hos_fs_host_pathhas no callers.tests/test_utf8_paths.pydoesn't readnn_fs.c.Nothing else needs this change.
Branch:
host/nn_fs.candtests/test_fs_path_utf8.pyhaven't changed onmainsince the merge base544229a2, and the PR merges as it is. I don't think it needs a rebase.A side finding, not for this PR:
mods.clower_slashkeysvoice/resource//stream/...with the doubled/, so a mod's replacement voice file probably never matches, on any OS. It's worth an issue of its own.#982 is very likely the same bug. That log mounts
content:at%USERPROFILE%\Downloads\The Legend of Zelda Ocarina of Time Switch 2 NUP Base Game\The Legend of Zelda Ocarina of Time Switch 2 NUP Base Game\v3.0.0-rc.3\romfs. With the opening's voice file, that comes to 244 characters plus the user name, which is past 240 for any user name. I've said so on the issue.@Beanstalk please test on Windows, NVIDIA or AMD, with this PR's build against
main. Put the game in a deep folder, so itsromfspath is about 160 characters or more (e.g. a nested...\Downloads\<long name>\<long name>\folder). Use Japanese voices andHOS_FS_TRACE=1, start a new game, and let the opening play up to the Twinrova intro cutscene, or to Nabooru's first voiced line if that is quicker. Expected on main:fs: OpenFile(content://Voice/Resource//Stream/...): not foundand no voices. Expected with this PR: those files open and the lines are heard. Please also say whether the voices can be heard at all.Beanstalk test farm
Commit
c368256· tier reviewed · approved by HumanBean · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)This Windows smoke test compares main and the PR in Kokiri Forest and after loading the Spirit Temple, taking about 13 minutes per tester. It checks for crashes, load-time regressions, and visible differences. The farm cannot place romfs in a specified deep folder, select Japanese voices, enable the requested filesystem trace, or listen to audio, so it cannot verify the reported voice fix or say whether voices are audible.
Done (started 18:19 UTC). Comment
@Beanstalkto run it again.