31 Commits
Author SHA1 Message Date
agulerman 26fdf4170b file_system: CopyFile2 falls back to CopyFileExW on Wine 9 (RT-237) (#3655)
Squash-merged after diff review of PR #3655
2026-11-23 10:04:42 -06:00
Geremy Cambus 87c6c2b261 file_system_test: a refused delete keeps the host's attributes, not the ones set (#6861)
Squash-merged after diff review of PR #6861 - file_system_test: a refused delete keeps the host's attributes, not the ones set
2026-11-23 09:52:38 -06:00
quackottu b4adb75081 Startup trace: name failed guest file opens, and LEONIDA_SKIP_INT3 to follow a boot past soft asserts (#6937)
Squash-merged after diff review of PR #6937 - Startup trace: name failed guest file opens, and LEONIDA_SKIP_INT3 to follow a boot past soft asserts
2026-11-23 09:35:20 -06:00
cynbun 6d55b156e3 file_system test: run to its summary under Wine (RT-451) (#6313)
Squash-merged after review of PR #6313 - file_system test: run to its summary under Wine (RT-451)
2026-11-23 08:15:23 -06:00
Hiiva d582abc17f runtime: reject deleting read-only package files (#5946)
Squash-merged after review of PR #5946 - BUILD-1899: Respect read-only attributes when deleting package files
2026-11-23 08:07:54 -06:00
ItsNotRexedandClaude Opus 5.5 3c4974392b Merge pull request #4512 from sh1shu1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:26 -05:00
ItsNotRexedandClaude Opus 5.5 2800fa3bc6 Merge pull request #4328 from Maxime Mansiet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:36 -05:00
ItsNotRexedandClaude Opus 5.5 aa19ee37cf Merge pull request #3955 from ezbyDev
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:53 -05:00
ItsNotRexedandClaude Opus 5.5 9180103a7d Merge pull request #3655 from Claude
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:08 -05:00
ItsNotRexedandClaude Opus 5.5 0c1437dfd9 Merge pull request #3651 from kotorvr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:07 -05:00
ItsNotRexed be8570ace1 Merge remote-tracking branch 'origin/main' into triage-r43
# Conflicts:
#	docs/runtime_imports.md
#	runtime/CMakeLists.txt
#	runtime/shims/xgameruntime.cpp
#	runtime/test/xmem_test.cpp
#	tools/rdna2spirv.py
2026-11-22 22:12:50 -05:00
sh1shu1andClaude Fable 5.1 39d748f250 file_system_test: probes for explicit GAME: paths into the overlay's reserved folders (RT-294)
The overlay's .gta6rt-deleted, .gta6rt-temp and .gta6rt-copy folders are hidden from GAME:\ listings but an explicit
GAME:\.gta6rt-*\... path still reaches them. These probes open, stat, list, create, mkdir and delete through such
paths in the spellings parse_console() normalises (case, forward slashes, ".", ".." and the G: alias), expect
ERROR_INVALID_NAME and no side effect, and keep T:\ and an ordinary dotted name working. They fail on main.

AI-assisted (Claude Code, Claude Fable 5.1).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDgoLQVYG7p8mvxkwBroVz
2026-11-23 02:43:40 +01:00
Maxime Mansiet 844e650bfa file_system: only a T: path names the T:\ root, so GAME:\.gta6rt-temp is not refused as one
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
2026-11-23 02:22:26 +01:00
Maxime Mansiet 2036d725c5 file_system: T:\ is a root: always a folder, never removed or moved
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
2026-11-23 01:42:59 +01:00
ezbyDevandClaude Opus 5.5 c49b5ec65f file_system: collect falls back to deleted() and dedupes by _wcsicmp (RT-257)
Review on #3955 (@pedro470), both reproduced here:

- A marker folder that cannot be listed (FILE_LIST_DIRECTORY denied, the
  markers still reachable by path) read as "no markers", so a deleted
  package file came back in the listing. Only ERROR_FILE_NOT_FOUND or
  ERROR_PATH_NOT_FOUND now means nothing is deleted; any other failure,
  an incomplete FindNextFileW scan or a marker that cannot be checked
  sends each entry through deleted().
- A _wcslwr_s key is not _wcsicmp in every locale: under .UTF-8 it folds
  U+00C9 and U+00E9, which _wcsicmp keeps apart, so a package entry was
  dropped. The names seen are now a std::set ordered by _wcsicmp, so two
  names are one entry exactly when same_name says so. Same timing.

Tests: the listing-denied marker folder (through the ACL API, restored
after), and a .UTF-8 merged listing checked against _wcsicmp itself. The
previous head fails both; each single fix removed fails its own check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:31:35 +01:00
ezbyDevandClaude Opus 5.5 0f3d467f0a file_system: read the folder's deletion markers once, also when it has some (RT-257)
Review on #3955 (@Parakeet-Wheat, @shdann): the fast path only held while
the folder had no marker folder. One DeleteFileW creates it, and every
package entry was probed with deleted() again: 1,073 ms for 16,000 files
after two deletes, against 27 ms now.

collect() lists the marker folder once and keeps the deleted names in a
set, with deleted()'s rule: a marker file, or a marker folder holding
kRemovedDirMarker. The lookup folds ASCII letters only, which is exactly
the file system's case-insensitive compare when both names are ASCII. A
non-ASCII entry, or a marker that is not plain ASCII or is a reparse
point, still goes through deleted(), so the file system's Unicode case
rule decides (deleting éclair.txt hides the package's Éclair.txt, as on
main).

Tests: a delete under another ASCII case in a 300-file folder hides only
that file; the Éclair case above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:16:25 +01:00
ezbyDevandClaude Opus 5.5 8518626c1b file_system: list a GAME: folder in linear time (RT-257)
collect() probed the overlay for a deletion marker twice per package entry
(two is_regular_file calls), also when the folder has no marker folder at
all, and de-duplicated names by comparing each one with every name kept so
far. Listing 16,000 package files took 3.7 s against 9 ms on the host.

Every marker for an entry of the listed folder lives inside that folder's
marker folder, so probe it once and skip the per-entry checks when it is
missing. Keep the names seen in an unordered_set, folded with _wcslwr_s,
which follows the same locale rule as the _wcsicmp that same_name uses.

Tests: names that differ only in case are one entry with the overlay's
spelling, and a 300-file folder without a marker folder lists every file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:40:31 +01:00
kotorvrandClaude Fable 5.2 f46e90310d file_system: a listing directly below a file is ERROR_DIRECTORY, as on the host
collect answered ERROR_PATH_NOT_FOUND for any folder that is not one in the title's
view. The host tells a missing folder (3) from a file in the folder's place (267);
view() already knows which. Reported in review by shdann, with the host table.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:05:06 +00:00
kotorvrandClaude Fable 5.2 95f023f62b file_system: a folder has to exist in the title's view; same-name moves succeed
Three places where the shim disagreed with the host about GAME: paths:

- write_target created the parent folders before checking anything. A failed
  OPEN_EXISTING left the missing folders behind, and a create succeeded in a
  folder that was never made, below a package file (which then read as a folder)
  and inside a folder the title had removed. The parent now has to be a folder in
  the title's view, as CreateDirectory, MoveFile and CopyFile already require;
  otherwise ERROR_PATH_NOT_FOUND and nothing is created.
- FindFirstFile inside a removed package folder returned "." and "..", and inside
  a folder that never existed reported ERROR_FILE_NOT_FOUND. Both are now
  ERROR_PATH_NOT_FOUND.
- MoveFile onto the same name, or to the same name in another case, failed with
  ERROR_ALREADY_EXISTS. The first now succeeds and changes nothing; the second
  renames the overlay entry (a package file gets an overlay copy under the new
  spelling; a package folder is refused like any other move of one).

Two existing checks encoded the old answers and are changed: the test that made
GAME:\save\slot1.bin without making GAME:\save first, and the one that expected
ERROR_FILE_NOT_FOUND for a listing inside a missing folder.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 22:05:06 +00:00
ItsNotRexed edbaf7c585 Merge pull request #3602 from kotorvr 2026-11-22 17:02:56 -05:00
ItsNotRexedandClaude Opus 5.5 4c52ce27a6 Seven fixes from an outside contributor (sent as patches, applied without the author's name)
- rdna2spirv: declare each packed vertex input register once; a register whose elements disagree on the component
  type is refused (SHADER-644).
- runtime: a title's VirtualAlloc drops the console's MEM_GRAPHICS / MEM_TITLE type bits the host rejects (RT-217).
- runtime: XPersistentLocalStorageImpl is served from <overlay>\persistent with the package's 2048 MB quota
  (RT-219; layout from the public docs, not measured in a caller).
- runtime: G:\ names the package and T:\ a scratch folder in the overlay; paths under the configured folders and
  every path with no folders configured stay host paths (RT-218).
- winhttp_offline: header blocks and timeouts the host WinHTTP rejects are rejected the same way.
- cfg_structure.run: a limit of zero or less runs no blocks.
- shader_meta: an s_movk_i32 with a register operand and a float immediate beyond float32 are left unknown instead
  of raising.

Each comes with a test that fails on the old code. Conflicts with main resolved here (internal_dir() hides T:'s
folder; both file_system_test blocks kept).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:55:46 -05:00
Claude c0b821cda7 file_system: CopyFile2 checks its parameter block before the destination
Review on #3655 (kacper-serewis, daemosofchaos, on Windows 11):

- A parameter block shorter than COPYFILE2_EXTENDED_PARAMETERS (dwSize
  0, 4, 31) made the fallback copy and return S_OK, where the host's
  CopyFile2 returns E_INVALIDARG and writes nothing. Both paths now
  check it first, before copy_paths prepares the destination.
- The fallback silently dropped COPY_FILE_SKIP_ALTERNATE_STREAMS and
  copied the stream. Its flags are now sorted: passed on (the ones both
  calls define), dropped (requests that leave the contents as
  CopyFileExW writes them: no offload, compressed traffic, sparse copy,
  ...), or refused with ERROR_NOT_SUPPORTED before anything is written
  (SKIP_ALTERNATE_STREAMS, DIRECTORY, OPEN_AND_COPY_REPARSE_POINT,
  IGNORE_SOURCE_ENCRYPTION, unknown bits, a longer V2 block).
- A cancel flag already set is answered by the fallback itself, since
  Wine 9's CopyFileExW doesn't read it.

rt::fs::force_copy_file2_fallback lets the test run the fallback on
Windows, where the host has CopyFile2 (Maraco91 noted it couldn't be
reached there). file_system_test runs its CopyFile2 checks both ways:
no block, short blocks, fail-if-exists with a hint flag, a set cancel
flag, and in the fallback the refused flags and block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
2026-11-22 21:54:00 +00:00
kotorvrandClaude Fable 5.2 75f1351a07 file_system_test: the MAXIMUM_ALLOWED write is shorter than the file
A two-byte write leaves the rest of the file to compare, so the test also shows the
overlay copy began as the package file's bytes (suggested in review).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 21:19:55 +00:00
kotorvrandClaude Fable 5.2 0977b5dc7e file_system: a MAXIMUM_ALLOWED open is a write-open, so it cannot write the package
writes() did not count MAXIMUM_ALLOWED as write access. CreateFileW/A and CreateFile2
then opened the package file itself, and a WriteFile through the handle changed the
package, which docs/runtime_imports.md says is never written. Such an open now gets
the overlay copy like any other write-open.

file_system_test: the three entry points, with the package bytes and the overlay
copy checked after a write; a plain read still makes no overlay copy.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:48:04 +00:00
airp1aneandClaude Opus 5.5 fc1e0058e0 file_system: copy-up through a staging name, one at a time
A write-open of a package file copied it straight to its overlay name with
no lock. A process killed mid-copy left a truncated file there that every
later read preferred over the package; two threads write-opening the same
package file both copied, and the second copy_file failed on the taken name,
so that open failed.

write_target now copies into <overlay>\.gta6rt-copy under a private name and
renames it into place, under a mutex that only copy-ups take. Listings hide
the staging folder like .gta6rt-deleted. Without the mutex, copy-then-rename
alone still failed about 2 in 100 runs: a losing rename onto the existing
name briefly holds it, and the winner's open got ERROR_SHARING_VIOLATION.

file_system_test: two threads write-open one 256 KiB package file, 50 rounds;
both opens succeed and the overlay copy matches (fails 3 of 3 runs on the
old code, passes 200 of 200 with this); no staging file is left; a crash
leftover is hidden from a GAME: listing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:15:36 -05:00
ItsNotRexed 7360583abd Merge pull request #2122 from jaybeebabageyus 2026-11-22 11:41:59 -05:00
jaybeebabageyus 403d59060e runtime: shim CreateFile2 and FindFirstFileExA/W for GAME: paths and overlay 2026-11-22 17:01:52 +01:00
RaveN499andClaude Opus 5.5 c9fbc9d07e gta6rt: GAME: paths for folders, moves, copies and attributes (RT-97 follow-up)
The calls docs/runtime_imports.md listed as not mapped now follow the RT-97
rules, under kernel32, kernelbase and the api-ms-win-core-file-* sets:

- CreateDirectory/CreateDirectoryEx make the folder in the overlay; a name the
  title can already see, package-only folders included, is ERROR_ALREADY_EXISTS.
- RemoveDirectory needs the folder empty in the title's view. An overlay folder
  is removed; a package folder is hidden by a .gta6rt-dir marker file inside its
  marker folder and stays on disk (deleted() now also checks that file, on top
  of the regular-file rule from 3f26a95a).
- MoveFile/MoveFileEx write the destination in the overlay; a moved package file
  is copied there and its old name deleted by a marker. MOVEFILE_WRITE_THROUGH
  flushes that copy and the marker before returning (review on #1742). Package
  folders are not moved (ERROR_ACCESS_DENIED), GAME: <-> host is
  ERROR_NOT_SAME_DEVICE and MOVEFILE_DELAY_UNTIL_REBOOT is ERROR_INVALID_PARAMETER.
- CopyFile/CopyFileEx/CopyFile2 read like a read and write a GAME: destination
  in the overlay; fail-if-exists counts names only the package has.
- SetFileAttributes sets the overlay copy (copy-up or folder mirror first).

file_system: 123/123 checks. No game files.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:42:08 +03:00
totonii 3f26a95a10 fix(file_system): check is_regular_file for deletion markers so nested deletes do not hide parent directories 2026-11-22 10:41:32 -03:00
HQasper c5fb25f734 gta6rt: a failed write-open no longer revives a deleted GAME: name (RT-97)
write_target cleared the delete marker before the host CreateFileW ran, and copied a package file up
without looking at the marker, so a write-open of a deleted name could make it readable again: an
OPEN_EXISTING open succeeded on the copy-up, and one that failed left the marker gone with the package
file visible behind it.

The marker is now never removed, and a tombstoned name is never copied up. Reads and listings prefer an
overlay copy, so a re-created file is visible without clearing anything, while an open that keeps the
contents (OPEN_EXISTING, TRUNCATE_EXISTING) fails with ERROR_FILE_NOT_FOUND and leaves the name deleted.
file_system asserts that sequence: the failed write-open, no overlay copy, and the name still gone.

Review pass over the rest of the shim: Target loses the two fields nothing read, FindFirstFile no longer
parses its pattern twice, collect drops its unreachable non-console branch, and the enumeration states are
unique_ptr entries looked up under the lock instead of raw pointers handed out of it.
2026-11-22 13:29:20 +01:00
HQasper a98f9925b0 gta6rt: map GAME: console paths, and send writes to an overlay (RT-97)
A mapped title names its files on the console's drives, but nothing mapped them: the file calls went
straight to the host and --game-dir was only used to find modules, so the first file a title opens at boot
would fail. New shims for CreateFile*, FindFirstFile*/FindNextFile*/FindClose, GetFileAttributes*/
GetFileAttributesEx* and DeleteFile* (kernel32, kernelbase and the api-ms-win-core-file sets) map a GAME:
path under --game-dir, and send every open that can write and every delete to --overlay (default
<game-dir>\overlay), which reads and listings prefer. A write-open copies the package file into the overlay
first, so OPEN_EXISTING keeps its bytes, and a delete of a package file leaves a marker instead of removing
it, so the package is never modified. A path that climbs above GAME: with ".." or names another drive is
refused with ERROR_INVALID_NAME. A path without the prefix is still a host path.

The prefixes and the overlay come from ivall/xcl (GPL-2.0-only), as facts only, no code.

file_system ctest: 43 checks over folders in %TEMP%, covering mapping and case, copy-up and read
preference, a new file in folders the package lacks, delete and re-create, the merged listing, host-path
passthrough, the escape refusal and the narrow variants.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 13:11:57 +01:00