XGameSave: a container's last-modified time stops changing after its first save #1041

Open
opened 2026-11-26 04:41:32 +00:00 by github-bot · 0 comments
Owner

@⁠Conrage on GitHub · 2026-11-24 10:48 UTC · original

each_container reports lastModifiedTime as the container folder's own modified time:

github.com/ivall/xcl@6efdabc/crates/xcl/src/hle/xgameruntime/gamesave.rs (L340-L344)

A folder's modified time changes only when an entry directly inside it is created, renamed or removed. The container folder holds just b\ and display, and blob writes and deletes happen inside b\ (apply, L564-L590). So:

  • the first update creates b\ and the time changes;
  • every later update with a null display name (XGameSaveCreateUpdate(c, nullptr, …), which the module's own tests use) only changes b\, so the container's time stays at the first save;
  • an update with a display name rewrites display in the container folder, so the time does change then.

Titles show this time in their load/save menus and use it to pick the newest slot ("continue"). Under XCL, a slot saved again later can look older than one saved once.

Repro (folder behaviour, any OS): make c\b\, set both folders' times to the past, write c\b\tmp and rename it to c\b\blob: c\b\ gets the current time, c\ keeps the old one. NTFS updates a folder's last-write time the same way.

Expected: lastModifiedTime is the time of the container's last submitted update.

Suggested fix: take the newest modified time of b\, display and the blob files, or touch the container folder at the end of apply.

Not tested: found by reading the code; the folder behaviour was checked on Linux, not run on Windows or with a title.

AI use: found, checked and written up by Claude Code (Claude Opus 5.5) at my request.

**@⁠Conrage** on GitHub · 2026-11-24 10:48 UTC · [original](https://github.com/xcl-dev/xcl/issues/1041) `each_container` reports `lastModifiedTime` as the container folder's own modified time: https://github.com/ivall/xcl/blob/6efdabc/crates/xcl/src/hle/xgameruntime/gamesave.rs#L340-L344 A folder's modified time changes only when an entry directly inside it is created, renamed or removed. The container folder holds just `b\` and `display`, and blob writes and deletes happen inside `b\` (`apply`, L564-L590). So: - the first update creates `b\` and the time changes; - every later update with a null display name (`XGameSaveCreateUpdate(c, nullptr, …)`, which the module's own tests use) only changes `b\`, so the container's time stays at the first save; - an update with a display name rewrites `display` in the container folder, so the time does change then. Titles show this time in their load/save menus and use it to pick the newest slot ("continue"). Under XCL, a slot saved again later can look older than one saved once. **Repro (folder behaviour, any OS):** make `c\b\`, set both folders' times to the past, write `c\b\tmp` and rename it to `c\b\blob`: `c\b\` gets the current time, `c\` keeps the old one. NTFS updates a folder's last-write time the same way. **Expected:** `lastModifiedTime` is the time of the container's last submitted update. **Suggested fix:** take the newest modified time of `b\`, `display` and the blob files, or touch the container folder at the end of `apply`. **Not tested:** found by reading the code; the folder behaviour was checked on Linux, not run on Windows or with a title. **AI use:** found, checked and written up by Claude Code (Claude Opus 5.5) at my request.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:32 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.