diff options
| author | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-24 11:42:12 -0600 |
|---|---|---|
| committer | Moriz82 <72836413+Moriz82@users.noreply.github.com> | 2026-11-24 11:42:12 -0600 |
| commit | 273b3bdf9d6e736442ad584ad464df6e86ee928b (patch) | |
| tree | 3886a0af7c74ffa7d9415d662d8dc0fb708f1c08 /runtime/shims/file_system.cpp | |
| parent | ece4ba5b31ebc6f345c8e29eae1261f2f780057a (diff) | |
[integration] Linux/Proton and native Windows: boot through the story load (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>
Diffstat (limited to 'runtime/shims/file_system.cpp')
| -rw-r--r-- | runtime/shims/file_system.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/runtime/shims/file_system.cpp b/runtime/shims/file_system.cpp index 720c106f3..0b08c7bb4 100644 --- a/runtime/shims/file_system.cpp +++ b/runtime/shims/file_system.cpp | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include "file_system.h" | 41 | #include "file_system.h" |
| 42 | #include "shims.h" | 42 | #include "shims.h" |
| 43 | #include "startup_trace.h" | 43 | #include "startup_trace.h" |
| 44 | #include "../src/title_page_watch.h" | ||
| 44 | 45 | ||
| 45 | namespace rt::fs { | 46 | namespace rt::fs { |
| 46 | namespace { | 47 | namespace { |
| @@ -701,6 +702,24 @@ void note_open_failure(const char* api, LPCWSTR name, DWORD error, const void* c | |||
| 701 | rt::startup_trace::quote(rt::startup_trace::where(reinterpret_cast<uint64_t>(caller)))); | 702 | rt::startup_trace::quote(rt::startup_trace::where(reinterpret_cast<uint64_t>(caller)))); |
| 702 | } | 703 | } |
| 703 | 704 | ||
| 705 | // LOCAL DIAGNOSTIC: gta6rt --trace FILE also records the first 600 successful opens ("file_open": path, access, | ||
| 706 | // caller), so the startup trace shows which file the title was working on when it stopped making progress. | ||
| 707 | void note_open(const char* api, LPCWSTR name, DWORD access, const void* caller) { | ||
| 708 | if (!rt::startup_trace::enabled()) return; | ||
| 709 | static std::atomic<int> left{600}; | ||
| 710 | if (left.fetch_sub(1, std::memory_order_relaxed) <= 0) return; | ||
| 711 | std::string utf8; | ||
| 712 | if (const int n = WideCharToMultiByte(CP_UTF8, 0, name, -1, nullptr, 0, nullptr, nullptr); n > 1) { | ||
| 713 | utf8.resize(static_cast<size_t>(n) - 1); | ||
| 714 | WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8.data(), n, nullptr, nullptr); | ||
| 715 | } | ||
| 716 | rt::startup_trace::event( | ||
| 717 | "file_open", | ||
| 718 | std::string("\"api\":\"") + api + "\",\"path\":" + rt::startup_trace::quote(utf8) + ",\"access\":" + | ||
| 719 | std::to_string(access) + ",\"caller\":" + | ||
| 720 | rt::startup_trace::quote(rt::startup_trace::where(reinterpret_cast<uint64_t>(caller)))); | ||
| 721 | } | ||
| 722 | |||
| 704 | HANDLE WINAPI create_file_w(LPCWSTR name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attributes, | 723 | HANDLE WINAPI create_file_w(LPCWSTR name, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES attributes, |
| 705 | DWORD disposition, DWORD flags, HANDLE template_file) { | 724 | DWORD disposition, DWORD flags, HANDLE template_file) { |
| 706 | if (!name) { | 725 | if (!name) { |
| @@ -718,6 +737,8 @@ HANDLE WINAPI create_file_w(LPCWSTR name, DWORD access, DWORD share, LPSECURITY_ | |||
| 718 | const DWORD error = GetLastError(); | 737 | const DWORD error = GetLastError(); |
| 719 | note_open_failure("CreateFileW", name, error, _ReturnAddress()); | 738 | note_open_failure("CreateFileW", name, error, _ReturnAddress()); |
| 720 | SetLastError(error); | 739 | SetLastError(error); |
| 740 | } else { | ||
| 741 | note_open("CreateFileW", name, access, _ReturnAddress()); | ||
| 721 | } | 742 | } |
| 722 | return h; | 743 | return h; |
| 723 | } | 744 | } |
| @@ -749,6 +770,8 @@ HANDLE WINAPI create_file2(LPCWSTR name, DWORD access, DWORD share, DWORD dispos | |||
| 749 | const DWORD error = GetLastError(); | 770 | const DWORD error = GetLastError(); |
| 750 | note_open_failure("CreateFile2", name, error, _ReturnAddress()); | 771 | note_open_failure("CreateFile2", name, error, _ReturnAddress()); |
| 751 | SetLastError(error); | 772 | SetLastError(error); |
| 773 | } else { | ||
| 774 | note_open("CreateFile2", name, access, _ReturnAddress()); | ||
| 752 | } | 775 | } |
| 753 | return h; | 776 | return h; |
| 754 | } | 777 | } |
| @@ -1398,9 +1421,24 @@ BOOL WINAPI set_file_attributes_a(LPCSTR name, DWORD attributes) { | |||
| 1398 | namespace { | 1421 | namespace { |
| 1399 | using namespace rt::fs; | 1422 | using namespace rt::fs; |
| 1400 | 1423 | ||
| 1424 | // Reads into title memory. The D3D12 layer keeps some of the title's pages read-only between submissions to see | ||
| 1425 | // which ones the title writes (slot-133 shadow buffers); the kernel fails a read into such a page with | ||
| 1426 | // ERROR_NOACCESS instead of faulting, so the destination is pinned and opened first (title_page_watch.h). | ||
| 1427 | BOOL WINAPI read_file(HANDLE file, LPVOID buffer, DWORD bytes, LPDWORD read, LPOVERLAPPED overlapped) { | ||
| 1428 | return leonida::kernel_writes::read_file(file, buffer, bytes, read, overlapped); | ||
| 1429 | } | ||
| 1430 | BOOL WINAPI read_file_ex(HANDLE file, LPVOID buffer, DWORD bytes, LPOVERLAPPED overlapped, | ||
| 1431 | LPOVERLAPPED_COMPLETION_ROUTINE routine) { | ||
| 1432 | return leonida::kernel_writes::read_file_ex(file, buffer, bytes, overlapped, routine); | ||
| 1433 | } | ||
| 1434 | BOOL WINAPI read_file_scatter(HANDLE file, FILE_SEGMENT_ELEMENT segments[], DWORD bytes, LPDWORD reserved, | ||
| 1435 | LPOVERLAPPED overlapped) { | ||
| 1436 | return leonida::kernel_writes::read_file_scatter(file, segments, bytes, reserved, overlapped); | ||
| 1437 | } | ||
| 1438 | |||
| 1401 | // CreateFile, the FindFirstFile family, the attribute queries and DeleteFile arrive through kernel32/kernelbase | 1439 | // CreateFile, the FindFirstFile family, the attribute queries and DeleteFile arrive through kernel32/kernelbase |
| 1402 | // imports and through the api sets a GDK title is linked against (file-l1-1-0 for the find and attribute calls, | 1440 | // imports and through the api sets a GDK title is linked against (file-l1-1-0 for the find and attribute calls, |
| 1403 | // file-l1-2-0 and file-l2-1-0 for CreateFile). | 1441 | // file-l1-2-0 and file-l2-1-0 for CreateFile; ReadFile and its variants are in file-l1-1-0). |
| 1404 | #define FILE_API(dll) \ | 1442 | #define FILE_API(dll) \ |
| 1405 | {dll, "CreateFileA", reinterpret_cast<void*>(&create_file_a)}, \ | 1443 | {dll, "CreateFileA", reinterpret_cast<void*>(&create_file_a)}, \ |
| 1406 | {dll, "CreateFileW", reinterpret_cast<void*>(&create_file_w)}, \ | 1444 | {dll, "CreateFileW", reinterpret_cast<void*>(&create_file_w)}, \ |
| @@ -1434,7 +1472,10 @@ using namespace rt::fs; | |||
| 1434 | {dll, "CopyFileExW", reinterpret_cast<void*>(©_file_ex_w)}, \ | 1472 | {dll, "CopyFileExW", reinterpret_cast<void*>(©_file_ex_w)}, \ |
| 1435 | {dll, "CopyFile2", reinterpret_cast<void*>(©_file2)}, \ | 1473 | {dll, "CopyFile2", reinterpret_cast<void*>(©_file2)}, \ |
| 1436 | {dll, "SetFileAttributesA", reinterpret_cast<void*>(&set_file_attributes_a)}, \ | 1474 | {dll, "SetFileAttributesA", reinterpret_cast<void*>(&set_file_attributes_a)}, \ |
| 1437 | {dll, "SetFileAttributesW", reinterpret_cast<void*>(&set_file_attributes_w)} | 1475 | {dll, "SetFileAttributesW", reinterpret_cast<void*>(&set_file_attributes_w)}, \ |
| 1476 | {dll, "ReadFile", reinterpret_cast<void*>(&read_file)}, \ | ||
| 1477 | {dll, "ReadFileEx", reinterpret_cast<void*>(&read_file_ex)}, \ | ||
| 1478 | {dll, "ReadFileScatter", reinterpret_cast<void*>(&read_file_scatter)} | ||
| 1438 | } // namespace | 1479 | } // namespace |
| 1439 | 1480 | ||
| 1440 | SHIM_TABLE(file_system, | 1481 | SHIM_TABLE(file_system, |