upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/file_system.cpp
AgeCommit message (Collapse)Author
10 daysMerge pull request #688 from aslan2142/game-rmdir-create-raceaslan2142
OLD-9215: restore old upstream PR 9215 - file_system: RemoveDirectory and a create inside the folder are ordered as on the host
10 daysMerge main into t-drive-overlayJan Trencansky
docs/boot.md: main added LEONIDA_WRITE_DIR / LEONIDA_SAVE_DIR to the --overlay bullet and a new "Under Wine on Linux" section; keep both and the T: paragraph of this branch after main's sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysMerge main into RT-PROTON-STORY-LOAD (#984)Jan Trencansky
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted; this commit is the resolution only. Build and test repairs follow in their own commits. Rule of resolution: where both sides added different things, both stay; where both made the same change in two forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two changed the same code for different purposes, both purposes are kept. Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, registry.cpp): - d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and list slot 139 (#396). - Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider pc_resource_desc, S_OK for queue slots past the PC table. - Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base list proxy, its null-view slot 70 and its refusing slot 133. Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp): - Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra cases added; main's --env-slots-74 and #984's --env-slots-70. - Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy, the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases. D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h, frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp, d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp, vk_pipeline_check.cpp, vk_test_device.h): - Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's origin, so both pools run on disjoint sets of textures. - frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter. - main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4 stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980). - shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it. - Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it. Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp, runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp): - ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file. - gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries. - Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped. Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1, make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py, runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md, runtime/README.md): - Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake. - rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped. - shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags. - shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants. One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
11 daysMerge main into OLD-8161, T: overlay folder per process (#684)Jan Trencansky
Conflict in docs/boot.md, the --overlay switch: main now says the overlay defaults to <game-dir>\overlay and the package is never written; this branch adds the per-process T: folder inside the overlay. Kept main's sentence and appended the T: text after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 days[integration] Linux/Proton and native Windows: boot through the story load ↵Moriz82
(RT-PROTON-STORY-LOAD) One squashed commit of a fork that was developed on a Linux/Proton machine and tested on two native Windows machines. On all of them the retail 1.0.2.1 package now launches, shows its launch movie, first-run pages and landing prompt, runs the story load to its end with the loading slideshow drawing its artwork, and enters the world phase. A first world frame is not verified yet. docs/linux_proton.md has the setup, a healthy boot's timeline, the machines and where it stops. Runtime: frames in the title's own window; DirectStorage pinned reads, page-list scatter/gather, BCPack and unshuffle with a locally generated predictor file; pooled, device-local and deferred image backing for streamed and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table that degrades instead of refusing a submission; a descriptor hash finalizer (off until a library carries it); directly indexed heap offsets for compute dispatches and VS/PS/GS draws; title buffer windows outside a fragmented arena; opt-in device-local copies of streamed buffer views; write-fault retries under the tracker lock, shared trackers and write-watched title memory for native Windows; device-loss, compute-input and memory probes. Translator: loop bounds at structured exits, the eight FidelityFX programs that use a packed-dot form the disassembler skips, buffer bounds modes per view kind, a compaction option, the hash finalizer option. Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows boot script, the paired compute translation script. No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted by people on the machines named in docs/linux_proton.md. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
11 daysfile_system: a GAME: name inside a missing folder fails with ↵Maxime Mansiet
ERROR_PATH_NOT_FOUND, as on the host Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
11 daysfile_system: RemoveDirectory and a create inside the folder are ordered as ↵Jan Trencansky
on the host Restores old upstream PR 9215 in ItsNotRexed/Leonida (closed unmerged when that repository went private), ported onto the current main: the write-open keeps main's long-path disk_path() for its overlay path, and the new race test sits after main's tests that recreate a removed package folder. A GAME: write-open checked that its folder exists, mirrored it into the overlay and then opened the file, and RemoveDirectory checked that the folder was empty and wrote its marker, neither under a lock. A remove that ran between the open's check and its host CreateFile succeeded on an empty folder, and the open then made the folder and the file again: both calls succeeded and the removed folder was back. CreateDirectory of a folder inside it had the same gap. On Windows one of the two fails: the create with ERROR_PATH_NOT_FOUND or the remove with ERROR_DIR_NOT_EMPTY. A striped lock keyed by the folder's upper-cased name (64 namespace-scope std::mutex, no function-local static): write_target holds the lock of the folder it opens in from the parent check until the Target is gone, after the host CreateFile/CreateFile2; CreateDirectory holds the parent's from its check to the host call; RemoveDirectory holds the folder's from its view to the marker. Reads take no lock. file_system_test races the two calls on two threads, 2,000 rounds each for a creating CreateFileW (CREATE_NEW, CREATE_ALWAYS, OPEN_ALWAYS) and for CreateDirectoryW, and checks that they never both succeed, that the loser fails with the host's error and that a removed folder stays removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysfile_system: reserve T:'s folder with a create-only call, never reuse oneJan Trencansky
Xiiano's review of old upstream PR 8161: the folder name (start time to the millisecond plus process id) is not guaranteed unique, and earlier runs' folders are kept, so a reused id in the same millisecond would land in a stale folder and bring ERROR_FILE_EXISTS back. Under Wine every fresh run gets the same small ids (both run_tiny_game_dir runs here were pid 32). rt::fs::reserve_unique_dir(base, stem) makes base\stem with CreateDirectoryW and takes success as ownership; on ERROR_ALREADY_EXISTS it tries stem-2, stem-3, ... up to 1000 names, and fails with the Win32 error otherwise. T:'s folder is reserved once per overlay under a mutex (the first T: call or rt::fs::scratch_dir(), which the startup line calls), so concurrent first calls share it. A failed reservation is printed once and T: paths fail with ERROR_INVALID_NAME. rt::fs::scratch_stem() gives the first name tried. file_system_test: with stem and stem-2 taken, reserve_unique_dir makes stem-3, new and empty, then stem-4; a file with the next name counts as taken; max_tries names taken fail with ERROR_ALREADY_EXISTS; a missing base is made. T: with folders of this process's own stem and stem-2 already kept takes stem-3 and CREATE_NEW succeeds; eight threads making their first T: call at once reserve one folder. The second-process test stays. Restored from old upstream PR 8161 and ported onto the new main: the base folder and every candidate go through main's win32_io_path, like the other creates in file_system.cpp, so a long overlay root keeps working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysfile_system: T: is a folder of each process's own in the overlayJan Trencansky
T:\ mapped to <overlay>\.gta6rt-temp, one folder shared by every run and kept between runs. The title makes its crash dump and crash log there with CREATE_NEW, and a name an earlier run (or a second process) had left failed with ERROR_FILE_EXISTS (80), so no report landed (old upstream issue 7913, measured by Spacecer2 under Wine 11.22). T:\ now names <overlay>\.gta6rt-temp\<YYYYMMDD-HHMMSS-mmm>-pid<id>, the process's start time in UTC and its id, made on the first T: call. The start time keeps a reused process id (Wine hands each fresh prefix the same small ids) out of an old run's folder. T:\.. cannot climb into the shared folder, T:\ itself still cannot be removed or moved, and earlier runs' folders are kept so their crash files can be read. GAME: and G: are unchanged. rt::fs::scratch_dir() returns the folder, and the startup line names it: "console paths: GAME: -> ..., writes -> ..., T: -> ...". The two CMake checks of that line (run_tiny_game_console_paths, run_tiny_game_dir) and the synthetic test of the first now expect the T: part. file_system_test: a CREATE_NEW of a name earlier runs left in .gta6rt-temp succeeds and lands in the process's own folder; the folder is stable for the process; a second process (the test started again) creating the same name on the same overlay succeeds in a folder of its own; GAME: reads and writes are unchanged. On main these fail with ERROR_FILE_EXISTS (80), in this process and in the second one. Restored from old upstream PR 8161 and ported onto the new main: the folder is made through main's win32_io_path, so long overlay roots keep working, and the scratch-folder check of the write-open path is kept. Main's long-overlay T: check now finds scratch.bin in the process's own folder below .gta6rt-temp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysfs, dstorage: a ReadFile into first-touch title memory commits the pages and ↵Tyrannys
reads again (RT-READFILE-NOACCESS) xmem maps the title's physical pages as views of a reserve-only section and commits each page in a vectored handler when user-mode code first faults on it. A kernel write raises no such fault: ReadFile into a page nobody touched yet fails with ERROR_NOACCESS (998). The retail title's file reader treats any error but 6, 0x26 and 0x57 as transient and calls Sleep(1) and ReadFile again forever, so the boot never leaves its first frame loop; DirectStorage reads into the same memory came back as E_DSTORAGE_ACCESS_VIOLATION and the title stopped on an int3. The ReadFile import of the file shims, and DirectStorage's read_file_range, now read one byte of every page of the destination from user mode on ERROR_NOACCESS (the handler commits them) and read again once. file_system_test checks it on a reserve-only section with a first-touch handler: the host ReadFile fails with ERROR_NOACCESS, the shimmed one reads every byte. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge remote-tracking branch 'origin/pr/8953'ItsNotRexed
12 daysMerge PR #9567ItsNotRexed
12 daysfile_system: roll back directory when marker deletion failstedin7
12 daysfile_system: check CopyFile2 cancellation before preparing destinationtedin7
12 daysfile_system: clear marker when recreating directorytedin7
12 daysPreserve trailing-dot DOS file search patterns on long pathsgabrielsteglich
12 daysOpen long backing paths for guest file shimsgabrielsteglich
12 daysfile_system: CopyFile2 falls back to CopyFileExW on Wine 9 (RT-237) (#3655)agulerman
Squash-merged after diff review of PR #3655
12 daysStartup trace: name failed guest file opens, and LEONIDA_SKIP_INT3 to follow ↵quackottu
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
12 daysfile_system test: run to its summary under Wine (RT-451) (#6313)cynbun
Squash-merged after review of PR #6313 - file_system test: run to its summary under Wine (RT-451)
12 daysruntime: reject deleting read-only package files (#5946)Hiiva
Squash-merged after review of PR #5946 - BUILD-1899: Respect read-only attributes when deleting package files
12 daysMerge pull request #4512 from sh1shu1ItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #4328 from Maxime MansietItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #4327 from Maxime MansietItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #3955 from ezbyDevItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #3655 from ClaudeItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysMerge pull request #3651 from kotorvrItsNotRexed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysxgameruntime: keep persistent local storage out of GAME:\Maxime Mansiet
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
12 daysMerge remote-tracking branch 'origin/main' into triage-r43ItsNotRexed
# Conflicts: # docs/runtime_imports.md # runtime/CMakeLists.txt # runtime/shims/xgameruntime.cpp # runtime/test/xmem_test.cpp # tools/rdna2spirv.py
12 daysfile_system: refuse the overlay's reserved folders as explicit GAME: paths ↵sh1shu1
(RT-294) internal_dir() hid .gta6rt-deleted, .gta6rt-temp and .gta6rt-copy from GAME:\ listings only; parse_console() still accepted them as the first component of a GAME: or G: path, so a title could list deletion markers and write into the runtime's scratch folder. parse_console() now refuses a reserved first component after normalisation, which every caller already answers with ERROR_INVALID_NAME, the same as climbing out of the root. T: is unaffected: its scratch component is pushed by the parser, not read from the title's path. The probes of the previous commit pass. 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
12 daysfile_system: only a T: path names the T:\ root, so GAME:\.gta6rt-temp is not ↵Maxime Mansiet
refused as one Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
13 daysfile_system: T:\ is a root: always a folder, never removed or movedMaxime Mansiet
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
13 daysfile_system: a missing kRemovedDirMarker is not a marker error (RT-257)ezbyDev
Review on #3955 (@pedro470): a delete one folder down leaves a marker folder without kRemovedDirMarker, and is_regular_file() on the missing sentinel returned false with an error code set. collect() took that for an unreadable marker and asked deleted() about every package entry: 16,000 files after GAME:\d\nested\gone.txt was deleted listed in 1,391 ms instead of 27 ms. The sentinel is now checked with status(): regular means the folder was removed, not_found is the ordinary "holds nested markers" answer, and only another error falls back to deleted(). Same entries either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysfile_system: collect falls back to deleted() and dedupes by _wcsicmp (RT-257)ezbyDev
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>
13 daysfile_system: read the folder's deletion markers once, also when it has some ↵ezbyDev
(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>
13 daysfile_system: list a GAME: folder in linear time (RT-257)ezbyDev
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>
13 daysfile_system: T: keeps creating its parent folders, as merged with RT-218kotorvr
main's G:/T: drives (4c52ce27) made a T: create build its parent folders and pinned that in file_system_test. The folder-exists rule of this branch now applies to the package view (GAME:, G:) only, so that merged behaviour stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 daysfile_system: a listing directly below a file is ERROR_DIRECTORY, as on the hostkotorvr
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>
13 daysfile_system: a folder has to exist in the title's view; same-name moves succeedkotorvr
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>
13 daysMerge pull request #3655 from ClaudeItsNotRexed
13 daysMerge pull request #3602 from kotorvrItsNotRexed
13 daysSeven fixes from an outside contributor (sent as patches, applied without ↵ItsNotRexed
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>
13 daysfile_system: CopyFile2 checks its parameter block before the destinationClaude
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
13 daysfile_system: CopyFile2 falls back to CopyFileExW where the host has noneClaude
The shim's CopyFile2 called ::CopyFile2 directly. Wine 9's kernel32 and kernelbase don't export it, so Wine binds that import to a stub that aborts the process: under Wine 9 (or a Proton built on it), a title that calls CopyFile2 is killed. The file_system test shows it: it aborts at its CopyFile2 check and runs into ctest's timeout. The host's CopyFile2 is now looked up with GetProcAddress (kernelbase, then kernel32) and used where it exists, so Windows behaves as before. Where it doesn't, the copy goes through CopyFileExW: the flags both calls define and the cancel flag are passed on, the CopyFile2-only hints are dropped, and a COPYFILE2 progress routine is not called. pe_loader.cpp and loader_tls_test.cpp already avoid CopyFile2 for the same reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
13 daysfile_system: a MAXIMUM_ALLOWED open is a write-open, so it cannot write the ↵kotorvr
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>
13 daysfile_system: copy-up through a staging name, one at a timeairp1ane
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>
13 daysMerge pull request #2122 from jaybeebabageyusItsNotRexed
13 daysruntime: shim CreateFile2 and FindFirstFileExA/W for GAME: paths and overlayjaybeebabageyus
13 daysgta6rt: GAME: paths for folders, moves, copies and attributes (RT-97 follow-up)RaveN499
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>
13 daysfix(file_system): check is_regular_file for deletion markers so nested ↵totonii
deletes do not hide parent directories
13 daysgta6rt: a failed write-open no longer revives a deleted GAME: name (RT-97)HQasper
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.
13 daysgta6rt: map GAME: console paths, and send writes to an overlay (RT-97)HQasper
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>