upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/file_system_test.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 16:55:46 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 16:55:46 -0500
commit4c52ce27a6cf4af2bbf07a343ede39c5f1572b8d (patch)
tree434bb716af27e048d3279b48dacff23ed82e071d /runtime/test/file_system_test.cpp
parentdac28e6b19c3f70ccd157d60d2e44f4f3f52995a (diff)
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>
Diffstat (limited to 'runtime/test/file_system_test.cpp')
-rw-r--r--runtime/test/file_system_test.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/runtime/test/file_system_test.cpp b/runtime/test/file_system_test.cpp
index d584e5948..f51dd32e0 100644
--- a/runtime/test/file_system_test.cpp
+++ b/runtime/test/file_system_test.cpp
@@ -642,6 +642,62 @@ int main() {
642 "the copy staging folder is hidden from a GAME: listing"); 642 "the copy staging folder is hidden from a GAME: listing");
643 } 643 }
644 644
645 // RT-218: "G:\" is the package and "T:\" a writable scratch folder in the overlay, as in the other console layers.
646 // A host path under the configured folders stays a host path, and a path that climbs out of the drive is refused.
647 {
648 write_path(package / "drives" / "sub" / "probe.txt", "probe");
649 HANDLE h = create_w(L"G:\\drives\\sub\\probe.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
650 check(h != INVALID_HANDLE_VALUE && read_handle(h) == "probe", "CreateFileW opens G:\\drives\\sub\\probe.txt from the package");
651 if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h);
652 h = create_w(L"g:/drives/sub/probe.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
653 check(h != INVALID_HANDLE_VALUE, "the drive letter is case-insensitive and accepts forward slashes");
654 if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h);
655 check(attributes_w(L"G:\\data\\sub") != INVALID_FILE_ATTRIBUTES, "GetFileAttributesW stats a G: folder");
656
657 SetLastError(0);
658 check(create_w(L"G:\\..\\x.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr) ==
659 INVALID_HANDLE_VALUE &&
660 GetLastError() == ERROR_INVALID_NAME,
661 "G:\\.. is refused with ERROR_INVALID_NAME");
662
663 h = create_w(L"T:\\cache\\scratch.bin", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr);
664 check(h != INVALID_HANDLE_VALUE, "CreateFileW creates a file on T: (parent folders and all)");
665 if (h != INVALID_HANDLE_VALUE) {
666 DWORD written = 0;
667 ::WriteFile(h, "scratch", 7, &written, nullptr);
668 ::CloseHandle(h);
669 }
670 check(read_path(overlay / ".gta6rt-temp" / "cache" / "scratch.bin") == "scratch",
671 "a T: file lands in the overlay's scratch folder");
672 check(!std::filesystem::exists(package / "cache" / "scratch.bin") && !std::filesystem::exists(package / ".gta6rt-temp"),
673 "and the package is untouched");
674 h = create_w(L"t:/cache/scratch.bin", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);
675 check(h != INVALID_HANDLE_VALUE && read_handle(h) == "scratch", "the T: file reads back");
676 if (h != INVALID_HANDLE_VALUE) ::CloseHandle(h);
677 check(attributes_w(L"GAME:\\cache\\scratch.bin") == INVALID_FILE_ATTRIBUTES,
678 "T: is its own drive: GAME: does not see the scratch file");
679 check(!contains(list(first_w, next_w, find_close, L"GAME:\\*"), L".gta6rt-temp"),
680 "a listing of GAME:\\ does not show the scratch folder");
681 SetLastError(0);
682 check(create_w(L"T:\\..\\data\\hello.txt", GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr) ==
683 INVALID_HANDLE_VALUE &&
684 GetLastError() == ERROR_INVALID_NAME,
685 "T:\\.. cannot climb out of the scratch folder into the package");
686
687 // A package that itself sits on drive G: is reached by host paths, which must stay host paths.
688 rt::fs::configure(L"G:\\leonida_missing_package", L"G:\\leonida_missing_overlay");
689 SetLastError(0);
690 check(attributes_w(L"G:\\leonida_missing_package\\data.txt") == INVALID_FILE_ATTRIBUTES &&
691 GetLastError() != ERROR_INVALID_NAME,
692 "a path under a configured G: game folder is a host path");
693 // No roots configured: nothing to map G: and T: onto, so they are host paths.
694 rt::fs::configure({}, {});
695 SetLastError(0);
696 check(attributes_w(L"T:\\x") == INVALID_FILE_ATTRIBUTES && GetLastError() != ERROR_INVALID_NAME,
697 "without configured folders G: and T: stay host drives");
698 rt::fs::configure(package, overlay);
699 }
700
645 std::filesystem::remove_all(root); 701 std::filesystem::remove_all(root);
646 std::printf("%d check(s), %d failure(s)\n", g_checks, g_failures); 702 std::printf("%d check(s), %d failure(s)\n", g_checks, g_failures);
647 return g_failures == 0 ? 0 : 1; 703 return g_failures == 0 ? 0 : 1;