XSystem storage: a save folder that cannot be read reports 0 used and the full quota free, and every space query re-walks the whole folder #30
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#30
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@itsonewi on GitHub · 2026-11-25 23:52 UTC · original
XSystem's storage space has one reading that can be wrong in the dangerous direction (0 used, full quota free) and one cost that is paid on every query.1. A storage folder that cannot be read reports "nothing used"
crates/victory-hle/src/modules/storage.rs:90-102:and
space()at:129-140turns that into what the title sees:So a missing folder, a folder the process cannot enumerate (permissions, an AV scanner holding it, a removed drive letter), or a subdirectory that cannot be walked all report
used = 0,total_free = quota.prompt_for_space(:150-157) then grants any request, and the title writes until the host disk is full — with no log line anywhere saying the accounting failed. The unusable case and the empty case are the same value.A wrong reading in the other direction is safe (
freesaturates at 0), so the only failure is the one that lets a title write into a full disk believing it has the whole quota.Fix: keep "cannot read" distinct — return the HRESULT (
E_FAIL) or count the unreadable entries as the quota's worth of used, and log once with the path and error.2. Every query walks the whole save folder
space()is called byspace_info(slot 0x28,:142-144) and byprompt_for_space(:150), and the file's own comment (:29-30) says the title "calls 0x20 (path) and 0x28 (space) with the same arguments", i.e. repeated calls are the expected use. Every one of them stats every file under the storage folder, recursively, on the title's own thread.A save folder of a few thousand entries turns a cheap status query into thousands of
FindFirstFile/GetFileAttributescalls. The used total only changes through our own file functions (files.rsalready interceptsCreateFileW/CreateFileA/CreateFile2and the write/close paths), so it can be kept as a running total and refreshed when the folder is created or when a handle closes, instead of recounted per query.Not checked
Source reading at
0a43566. I did not run the title and did not measure the walk; the number of entries in the title's storage folder is not known to me, so the cost is stated from the code shape, not from a measurement.AI use
AI-assisted review (source reading). No build, no run, no game files.
@avatarmanz on GitHub · 2026-11-26 08:19 UTC · original
Fixed by #123, now in main (
0ce46d5a).