Give CPU-visible pools shadow storage on Linux, so the game renders and plays.

On Linux, write-protecting memory the GPU imported costs milliseconds per submit and the import's pinning clears the
write watch, so each CPU-visible pool gets a host-visible copy instead: the pages the CPU wrote since the last sync go in
right before each submit (skipping bytes the GPU still has to write back), and the replay's GPU writes are copied back
into guest memory at their fence (vk_gpu_written). In 1.2.1 play it costs about 0.2 ms a frame. TOTK_SHADOW=1 turns it
on under Windows too.

Also: build_game.py fetches the VMA header the Windows release pins when the system has none; plat_localtime and
plat_gmtime reject the times Windows rejects; the SDL text entry honours TOTK_SWKBD_TEST=cancel; probe-vkmem follows
the replay's protocol for GPU writes and syncs.
This commit is contained in:
Wellington Dias committed 2026-10-29 17:29:31 -03:00
1 parent 1d51343ac1
commit 5a84b19476
10 files changed
+279 -21

No files matched your search

+6 -2
View File
@@ -1248,14 +1248,18 @@ void plat_local_time(struct tm *out) {
localtime_r(&t, out);
}
// The range of the Windows CRT's localtime_s and gmtime_s (1970 to 3000), which glibc exceeds: the game's time
// service reports times outside it as invalid on both hosts.
#define PLAT_TIME_MAX 32535215999ll
int plat_localtime(int64_t unix_s, struct tm *out) {
time_t t = (time_t)unix_s;
return localtime_r(&t, out) != NULL;
return unix_s >= 0 && unix_s <= PLAT_TIME_MAX && localtime_r(&t, out) != NULL;
}
int plat_gmtime(int64_t unix_s, struct tm *out) {
time_t t = (time_t)unix_s;
return gmtime_r(&t, out) != NULL;
return unix_s >= 0 && unix_s <= PLAT_TIME_MAX && gmtime_r(&t, out) != NULL;
}
long plat_tz_west(void) {