mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:58:38 +00:00
After the merge the tree held this branch's older states of files main maintains. Run against main's code, tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have been built from two generations of its sources. So that the merge cannot break what main builds and tests: - runtime/ is main's, file for file (68 files only this branch had are not carried over); - every file under tools/, tests/ and docs/ that both sides have is main's (80 files); - ten translator tests only this branch has, which test rules main's translator does not have, and their fixtures are left out. What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1, play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia. Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own. Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the branch's), CI. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
50 lines
3.1 KiB
C++
50 lines
3.1 KiB
C++
// Console (GDK) file paths for a mapped title.
|
|
//
|
|
// A title's file API sees the console's drives: "GAME:\\data\\shaders\\x.sps" is a file inside the installed game
|
|
// folder. ivall/xcl (GPL-2.0-only; facts only here) documents for Xbox Series GDK titles that GAME: names the game
|
|
// folder and that writes go to a writable overlay rather than to the package, which is read-only. gta6rt does the
|
|
// same:
|
|
// GAME:<rest> a read opens the overlay copy when one exists, else <game dir>\<rest>;
|
|
// an open that can write opens <overlay dir>\<rest>, copying the package file there first when the
|
|
// disposition keeps its contents, so the package is never modified;
|
|
// a delete leaves a marker in the overlay instead of removing a package file.
|
|
// anything else is a host path and is passed through unchanged.
|
|
// A GAME: path that climbs above the root with ".." or names another drive is refused with ERROR_INVALID_NAME.
|
|
//
|
|
// The shims that use this live in file_system.cpp: CreateFile*, FindFirstFile*/FindNextFile*/FindClose,
|
|
// GetFileAttributes*/GetFileAttributesEx*, DeleteFile*, CreateDirectory*/RemoveDirectory*, MoveFile*/MoveFileEx*,
|
|
// CopyFile*/CopyFileEx*/CopyFile2 and SetFileAttributes* (the rules for each are in docs/runtime_imports.md).
|
|
#pragma once
|
|
|
|
#include <filesystem>
|
|
|
|
namespace rt::fs {
|
|
|
|
inline constexpr wchar_t kPersistentStorageDir[] = L".gta6rt-persistent";
|
|
|
|
// Sets the roots. main.cpp calls this once, before anything is mapped; the test calls it per case. The overlay is
|
|
// created on the first write, not here.
|
|
void configure(const std::filesystem::path& game_dir, const std::filesystem::path& overlay_dir);
|
|
|
|
std::filesystem::path game_dir();
|
|
std::filesystem::path overlay_dir();
|
|
// The folder "T:\" names in this process: <overlay dir>\.gta6rt-temp\<stem>, or <stem>-2, -3, ... when that name was
|
|
// taken (scratch_stem(), reserve_unique_dir). Reserved on the first T: call or the first call of this function for the
|
|
// overlay and kept for the rest of the process; empty while no overlay is configured or when no folder could be made.
|
|
std::filesystem::path scratch_dir();
|
|
// The first name tried for that folder: the process's start time (UTC) and id, "YYYYMMDD-HHMMSS-mmm-pid<id>".
|
|
std::wstring scratch_stem();
|
|
|
|
// Makes a new folder base\stem, or base\stem-2 ... base\stem-<max_tries> when the names before it exist, each with a
|
|
// create-only CreateDirectoryW, so the folder returned did not exist before and no other process got it. Makes `base`
|
|
// first. Returns an empty path, with the Win32 error in `error`, when every name was taken (ERROR_ALREADY_EXISTS) or
|
|
// a create failed for another reason.
|
|
std::filesystem::path reserve_unique_dir(const std::filesystem::path& base, const std::wstring& stem,
|
|
unsigned long& error, unsigned max_tries = 1000);
|
|
|
|
// For tests: true makes the CopyFile2 shim use its CopyFileExW fallback even where the host has CopyFile2, so the
|
|
// path Wine 9 takes can be checked on Windows. Off by default; main.cpp never sets it.
|
|
void force_copy_file2_fallback(bool force);
|
|
|
|
} // namespace rt::fs
|