2 Commits
Author SHA1 Message Date
Wellington Dias 1d51343ac1 Build and run the runtime natively on Linux.
Shared runtime code now goes through runtime/platform/platform.h, implemented by platform/win32.c and a new
platform/linux.c: futex locks, a userfaultfd and PAGEMAP_SCAN write watch, signal-based async preemption, our own
fiber switch, and a SIGSEGV handler for the thaw and crash hooks. The window, input, menu and software keyboard get
SDL3 back ends beside the Win32 ones, with the swapchain (gfx_present.c) and input merging (input.c) shared. SHA-256
replaces BCrypt, ELF builds get their own override sections, and the build tools gain Linux branches.

On Linux the selftest and the gfx-abi, astc, nvn and window probes pass. probe-vkmem still fails: imported guest
memory cannot be write-watched on Linux, which the shadow buffers in vk_memory.c will address.
2026-10-29 16:56:56 -03:00
Valiantsin DzerakhandClaude Opus 5.5 1f4c6fcdb5 Decode the game's zstd frames with the host's libzstd: the patch set zstd (TOTK_ZSTD_NATIVE, on by default) sends the calls of ZSTD_decompressMultiFrame and ZSTD_decompress_usingDDict in main to runtime/ov_zstd.c, which makes host dictionaries from the guest DDicts, gives the virtual core up for inputs of 64 KiB and more, and leaves in-place decodes and every error to the guest decoder
The lifted decoder ran its copy loops as chains of small functions. On the island and fight routes TOTK_ZSTD_CHECK=1 decoded every call both ways with no difference; the host took 0.72 s where the guest decoder took 1.99 s. Load time and fps on an RX 9070 and a 7900X did not change: the gain is CPU time on the loading threads, for machines with fewer cores. The caller at main+0x547a04 stays on the guest decoder: it resets a static DCtx with which the game's zstd rejects some frames libzstd decodes, and the game relies on that result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 18:27:12 +03:00