From da5ff872d65430cbb54c2bb9bc83dcf12630e5d4 Mon Sep 17 00:00:00 2001 From: renerocksai Date: Fri, 9 Oct 2026 16:28:38 +0200 Subject: [PATCH 01/10] Port Rayslides to Zig 0.17 and fix Retina capture --- .gitattributes | 1 + .github/install-zig.py | 50 +++++ .github/setup-python-env.py | 13 ++ .github/workflows/verify.yml | 85 ++++++++ .github/zig-release.json | 32 +++ .zig-version | 1 + README.md | 13 +- build.zig | 77 ++++++-- build.zig.zon | 7 +- docs/REFERENCE.md | 2 +- docs/ZIG_0_17_MIGRATION.md | 137 +++++++++++++ docs/getting-started.html | 2 +- src/file_browser.zig | 14 +- src/fonts.zig | 10 +- src/goto_slide.zig | 6 +- src/main.zig | 259 +++++++++++------------- src/nvim/grid.zig | 4 +- src/nvim/mpack.zig | 22 +-- src/nvim/mpack_bindings.h | 18 ++ src/nvim/session_probe.zig | 2 +- src/nvim_editor.zig | 14 +- src/parser.zig | 6 +- src/presenter.zig | 6 +- src/presenter_network.h | 3 + src/qrcode.zig | 4 +- src/renderer.zig | 55 +++--- src/source_editor.zig | 8 +- src/studio.zig | 367 ++++++++++++++--------------------- src/studio_motion.zig | 10 +- src/studio_prompt.zig | 2 +- src/texturecache.zig | 6 +- tools/zig_port_smoke.py | 93 +++++++++ 32 files changed, 841 insertions(+), 488 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/install-zig.py create mode 100644 .github/setup-python-env.py create mode 100644 .github/workflows/verify.yml create mode 100644 .github/zig-release.json create mode 100644 .zig-version create mode 100644 docs/ZIG_0_17_MIGRATION.md create mode 100644 src/nvim/mpack_bindings.h create mode 100644 src/presenter_network.h create mode 100644 tools/zig_port_smoke.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/install-zig.py b/.github/install-zig.py new file mode 100644 index 0000000..b5734f7 --- /dev/null +++ b/.github/install-zig.py @@ -0,0 +1,50 @@ +"""Install the exact, checksum-verified release used by this repository's CI.""" + +import hashlib +import json +import os +import platform +import subprocess +import tarfile +import urllib.request +import zipfile +from pathlib import Path + + +def main(): + root = Path(__file__).resolve().parent.parent + version = (root / '.zig-version').read_text().strip() + metadata = json.loads((root / '.github/zig-release.json').read_text()) + if version != '0.17.0' or metadata['version'] != version: + raise RuntimeError('Expected exact Zig 0.17.0') + architecture = {'x86_64': 'x86_64', 'AMD64': 'x86_64', + 'arm64': 'aarch64', 'aarch64': 'aarch64'}[platform.machine()] + system = {'Linux': 'linux', 'Darwin': 'macos', 'Windows': 'windows'}[platform.system()] + artifact = metadata['artifacts'][f'{architecture}-{system}'] + if not artifact['tarball'].startswith('https://ziglang.org/download/0.17.0/'): + raise RuntimeError('Expected an official release archive') + directory = Path(os.environ['RUNNER_TEMP']) / 'rayslides-zig' + directory.mkdir() + archive = directory / ('zig.zip' if system == 'windows' else 'zig.tar.xz') + with urllib.request.urlopen(artifact['tarball'], timeout=180) as response: + archive.write_bytes(response.read()) + if hashlib.sha256(archive.read_bytes()).hexdigest() != artifact['shasum']: + raise RuntimeError('Zig archive checksum mismatch') + if system == 'windows': + with zipfile.ZipFile(archive) as package: + package.extractall(directory) + compiler, = directory.glob('*/zig.exe') + else: + with tarfile.open(archive) as package: + package.extractall(directory, filter='data') + compiler, = directory.glob('*/zig') + actual = subprocess.check_output([str(compiler), 'version'], text=True).strip() + if actual != version: + raise RuntimeError(f'Expected {version}, downloaded {actual}') + with open(os.environ['GITHUB_PATH'], 'a', encoding='utf-8') as output: + output.write(str(compiler.parent) + '\n') + print(f'Installed Zig {actual} for {architecture}-{system}') + + +if __name__ == '__main__': + main() diff --git a/.github/setup-python-env.py b/.github/setup-python-env.py new file mode 100644 index 0000000..5281b00 --- /dev/null +++ b/.github/setup-python-env.py @@ -0,0 +1,13 @@ +"""Keep the baseline harness dependencies in a runner-local virtualenv.""" +import os +import subprocess +import venv +from pathlib import Path + +root = Path(os.environ['RUNNER_TEMP']) / 'rayslides-python' +venv.EnvBuilder(with_pip=True).create(root) +binary_dir = root / ('Scripts' if os.name == 'nt' else 'bin') +python = binary_dir / ('python.exe' if os.name == 'nt' else 'python') +subprocess.run([str(python), '-m', 'pip', 'install', 'Pillow==12.3.0'], check=True) +with open(os.environ['GITHUB_PATH'], 'a', encoding='utf-8') as output: + output.write(str(binary_dir) + '\n') diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml new file mode 100644 index 0000000..71cc53c --- /dev/null +++ b/.github/workflows/verify.yml @@ -0,0 +1,85 @@ +name: Native correctness + +on: + push: + pull_request: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: rayslides-verify-${{ github.ref }} + cancel-in-progress: true + +jobs: + verify: + name: Native ${{ matrix.os }} / ${{ matrix.optimize }} + strategy: + fail-fast: false + max-parallel: 3 + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + optimize: [debug, safe] + runs-on: ${{ matrix.os }} + timeout-minutes: 40 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install exact checksum-verified Zig + run: python .github/install-zig.py + - name: Install isolated Python harness dependencies + run: python .github/setup-python-env.py + - name: Install Linux graphics and editor dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libasound2-dev xvfb neovim + - name: Install macOS editor + if: runner.os == 'macOS' + run: brew install neovim + - name: Record native environment + shell: bash + run: | + mkdir -p "$RUNNER_TEMP/rayslides-ci" + { git rev-parse HEAD; zig version; python --version; } > "$RUNNER_TEMP/rayslides-ci/environment.log" + python -c 'import platform; print(platform.platform()); print(platform.machine())' >> "$RUNNER_TEMP/rayslides-ci/environment.log" + - name: Build and verify built-in editor + shell: bash + run: | + set -euo pipefail + zig build verify -Doptimize=${{ matrix.optimize }} -Dneovim=false -j2 --summary all 2>&1 | tee "$RUNNER_TEMP/rayslides-ci/default.log" + - name: CLI smoke + shell: bash + run: python tools/zig_port_smoke.py --binary zig-out/bin/rayslides${{ runner.os == 'Windows' && '.exe' || '' }} --output "$RUNNER_TEMP/rayslides-ci/cli" --cli-only + - name: Build and verify embedded editor + if: runner.os != 'Windows' + shell: bash + run: | + set -euo pipefail + zig build verify neovim-probe neovim-runtime-test -Doptimize=${{ matrix.optimize }} -Dneovim=true -j2 --summary all 2>&1 | tee "$RUNNER_TEMP/rayslides-ci/neovim.log" + - name: Linux no-display startup behavior + if: runner.os == 'Linux' && matrix.optimize == 'safe' + shell: bash + run: python tools/zig_port_smoke.py --binary zig-out/bin/rayslides --output "$RUNNER_TEMP/rayslides-ci/no-display" --no-display + - name: Linux software-rendered framebuffer smoke + if: runner.os == 'Linux' && matrix.optimize == 'safe' + shell: bash + env: + LIBGL_ALWAYS_SOFTWARE: '1' + run: xvfb-run -a python tools/zig_port_smoke.py --binary zig-out/bin/rayslides --output "$RUNNER_TEMP/rayslides-ci/render" --neovim + - name: Build macOS application bundle + if: runner.os == 'macOS' && matrix.optimize == 'safe' + shell: bash + run: | + set -euo pipefail + zig build macos-app -Doptimize=safe -Dneovim=true -j2 --summary all 2>&1 | tee "$RUNNER_TEMP/rayslides-ci/package.log" + test -f zig-out/Rayslides.app/Contents/MacOS/rayslides + - name: Upload native verification evidence + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: rayslides-${{ matrix.os }}-${{ matrix.optimize }}-${{ github.run_id }}-${{ github.run_attempt }} + path: ${{ runner.temp }}/rayslides-ci + if-no-files-found: warn + retention-days: 14 diff --git a/.github/zig-release.json b/.github/zig-release.json new file mode 100644 index 0000000..917433a --- /dev/null +++ b/.github/zig-release.json @@ -0,0 +1,32 @@ +{ + "artifacts": { + "aarch64-linux": { + "shasum": "9e8d11661d4ae3bd57702a3832781e23ad151dde5798e16a5ccd503f65234ff8", + "size": "52877280", + "tarball": "https://ziglang.org/download/0.17.0/zig-aarch64-linux-0.17.0.tar.xz" + }, + "aarch64-macos": { + "shasum": "b607e9b9234790a008116ae5bdb71c6243b84b9fb42a53a9e70fde41c06c536a", + "size": "53985220", + "tarball": "https://ziglang.org/download/0.17.0/zig-aarch64-macos-0.17.0.tar.xz" + }, + "x86_64-linux": { + "shasum": "1cbe9df9f27e6b78d14ccbca43b6703a404ef79ef1c463de901d7f088d4e2026", + "size": "57332648", + "tarball": "https://ziglang.org/download/0.17.0/zig-x86_64-linux-0.17.0.tar.xz" + }, + "x86_64-macos": { + "shasum": "4f9a1c5269aa17ebda5e6d3c2b89d6cbf36f7d2b22a0306e9ab98f25f95529c6", + "size": "59317572", + "tarball": "https://ziglang.org/download/0.17.0/zig-x86_64-macos-0.17.0.tar.xz" + }, + "x86_64-windows": { + "shasum": "b5663f69581dcf391293fbf16c06cb80d81d806545ce618b4d0bab7f0eb8c428", + "size": "100268137", + "tarball": "https://ziglang.org/download/0.17.0/zig-x86_64-windows-0.17.0.zip" + } + }, + "signature_verification": "Ed25519 prehashed minisign archive and trusted-comment signatures verified against the official download-page public key", + "signing_key": "RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U", + "version": "0.17.0" +} diff --git a/.zig-version b/.zig-version new file mode 100644 index 0000000..c5523bd --- /dev/null +++ b/.zig-version @@ -0,0 +1 @@ +0.17.0 diff --git a/README.md b/README.md index 85b49a8..f7f93c5 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ With Rayslides, you can: ## Get started -Rayslides requires Zig 0.16.x. The minimum version is Zig 0.16.0. +Rayslides requires exact Zig 0.17.0 (see `.zig-version`). ```sh zig build -Doptimize=ReleaseSafe @@ -73,6 +73,16 @@ Blockers make either command exit nonzero. The portable command refuses an existing destination, rewrites copied asset references under `assets/`, then re-opens and preflights the copy before it succeeds. +The correctness harness needs Python 3 and Pillow (`python3 -m pip install Pillow`). +Run correctness checks in both modes. Repeat with `-Dneovim=true` to qualify +its optional C bindings, protocol, and editor modules: + +```sh +zig build verify -Doptimize=debug +zig build verify -Doptimize=safe +zig build -Dneovim=true neovim-probe neovim-runtime-test +``` + During development, use `zig build run -- talk.sld`. On macOS, `zig build -Doptimize=ReleaseSafe macos-app` also creates `zig-out/Rayslides.app`. @@ -175,6 +185,7 @@ every mode above `640x480`. ## Project status +- [Read the Zig 0.17 migration evidence and platform limits](docs/ZIG_0_17_MIGRATION.md) - [Read the unreleased four-topic release notes](RELEASE_NOTES.md) - [Follow the active product roadmap](ROADMAP.md) diff --git a/build.zig b/build.zig index 14faaf7..2b2afa6 100644 --- a/build.zig +++ b/build.zig @@ -2,6 +2,27 @@ const std = @import("std"); const builtin = @import("builtin"); const build_zon = @embedFile("build.zig.zon"); +comptime { + if (builtin.zig_version.order(.{ .major = 0, .minor = 17, .patch = 0 }) != .eq) + @compileError("Rayslides requires exact Zig 0.17.0 (see .zig-version)"); +} + +fn addCBinding( + b: *std.Build, + module: *std.Build.Module, + name: []const u8, + header: []const u8, + target: std.Build.ResolvedTarget, + optimize: std.builtin.Optimize, +) void { + const translated = b.addTranslateC(.{ + .root_source_file = b.path(header), + .target = target, + .optimize = optimize, + }); + module.addImport(name, translated.createModule()); +} + const default_target: std.Target.Query = switch (builtin.os.tag) { // Native Zig otherwise records the exact host macOS version as the // deployment floor. Keep local CLI builds and the non-notarized .app @@ -76,7 +97,7 @@ fn dirExists(b: *std.Build, path: []const u8) bool { return true; } -pub fn build(b: *std.Build) void { +pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{ .default_target = default_target }); const optimize = b.standardOptimizeOption(.{}); @@ -119,9 +140,17 @@ pub fn build(b: *std.Build) void { .link_libc = if (enable_neovim) true else null, }); if (enable_neovim) { - if (b.lazyDependency("mpack", .{})) |mpack_dep| { + { + const mpack_dep = try b.dependencyLazy("mpack", .{}); neovim_mpack_license_path = mpack_dep.path("LICENSE"); neovim_mod.addIncludePath(mpack_dep.path("src/mpack")); + const mpack_bindings = b.addTranslateC(.{ + .root_source_file = b.path("src/nvim/mpack_bindings.h"), + .target = target, + .optimize = optimize, + }); + mpack_bindings.addIncludePath(mpack_dep.path("src/mpack")); + neovim_mod.addImport("mpack_c", mpack_bindings.createModule()); neovim_mod.addCMacro("MPACK_EXTENSIONS", "1"); neovim_mod.addCSourceFiles(.{ .root = mpack_dep.path("src/mpack"), @@ -136,18 +165,25 @@ pub fn build(b: *std.Build) void { .flags = &.{"-std=c99"}, }); } - if (b.lazyDependency("jetbrains_mono", .{})) |font_dep| { + { + const font_dep = try b.dependencyLazy("jetbrains_mono", .{}); neovim_font_path = font_dep.path("fonts/ttf/JetBrainsMono-Regular.ttf"); neovim_font_license_path = font_dep.path("OFL.txt"); } } - build_options.addOption( - []const u8, - "neovim_font_development_path", - if (neovim_font_path) |path| path.getPath(b) else "", - ); + if (neovim_font_path) |path| { + build_options.addOptionPath("neovim_font_development_path", path); + } else { + build_options.addOption([]const u8, "neovim_font_development_path", ""); + } exe_mod.addImport("neovim", neovim_mod); + addCBinding(b, exe_mod, "pdfgen_c", "src/pdf/pdfgen.h", target, optimize); + addCBinding(b, exe_mod, "qrcodegen_c", "src/qr/qrcodegen.h", target, optimize); + addCBinding(b, exe_mod, "svg_rasterizer_c", "src/svg_rasterizer.h", target, optimize); + if (target.result.os.tag != .windows) { + addCBinding(b, exe_mod, "network_c", "src/presenter_network.h", target, optimize); + } exe_mod.addCSourceFile(.{ .file = b.path("src/pdf/pdfgen.c") }); exe_mod.addIncludePath(b.path("src/pdf")); exe_mod.addCSourceFile(.{ .file = b.path("src/qr/qrcodegen.c") }); @@ -184,11 +220,14 @@ pub fn build(b: *std.Build) void { .use_lld = if (native_linux) false else null, }); - const raylib_dep = b.dependency("raylib_zig", .{ + const raylib_dep = try b.dependencyLazy("raylib_zig", .{ .target = target, .optimize = optimize, }); + // raylib-zig can need a transitive lazy SDK dependency before exporting + // modules. Let the build runner fetch it and retry configuration first. + if (b.graph.needed_lazy_dependencies.count() != 0) return error.LazyDependencyNeeded; const raylib = raylib_dep.module("raylib"); // main raylib module const raygui = raylib_dep.module("raygui"); // raygui module const raylib_artifact = raylib_dep.artifact("raylib"); // raylib C library @@ -234,9 +273,7 @@ pub fn build(b: *std.Build) void { run_cmd.step.dependOn(b.getInstallStep()); - if (b.args) |args| { - run_cmd.addArgs(args); - } + run_cmd.addPassthruArgs(); const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); @@ -294,13 +331,13 @@ pub fn build(b: *std.Build) void { const baseline_check_cmd = b.addSystemCommand(&.{ "python3", "tools/studio_baseline.py", "check", "--binary" }); baseline_check_cmd.addArtifactArg(exe); - if (b.args) |args| baseline_check_cmd.addArgs(args); + baseline_check_cmd.addPassthruArgs(); const baseline_check_step = b.step("studio-baselines", "Capture and compare opt-in Studio visual/performance baselines"); baseline_check_step.dependOn(&baseline_check_cmd.step); const baseline_update_cmd = b.addSystemCommand(&.{ "python3", "tools/studio_baseline.py", "update", "--binary" }); baseline_update_cmd.addArtifactArg(exe); - if (b.args) |args| baseline_update_cmd.addArgs(args); + baseline_update_cmd.addPassthruArgs(); const baseline_update_step = b.step("studio-baselines-update", "Capture and replace Studio visual/performance baselines"); baseline_update_step.dependOn(&baseline_update_cmd.step); @@ -313,7 +350,7 @@ pub fn build(b: *std.Build) void { "--binary", }); neovim_baseline_check_cmd.addArtifactArg(exe); - if (b.args) |args| neovim_baseline_check_cmd.addArgs(args); + neovim_baseline_check_cmd.addPassthruArgs(); const neovim_baseline_check_step = b.step( "neovim-baselines", "Capture and compare the embedded Neovim overlay baselines", @@ -328,7 +365,7 @@ pub fn build(b: *std.Build) void { "--binary", }); neovim_baseline_update_cmd.addArtifactArg(exe); - if (b.args) |args| neovim_baseline_update_cmd.addArgs(args); + neovim_baseline_update_cmd.addPassthruArgs(); const neovim_baseline_update_step = b.step( "neovim-baselines-update", "Capture and replace the embedded Neovim overlay baselines", @@ -340,6 +377,12 @@ pub fn build(b: *std.Build) void { release_confidence_step.dependOn(test_step); release_confidence_step.dependOn(baseline_self_test_step); + const verify_step = b.step("verify", "Build the application and run correctness and harness tests"); + verify_step.dependOn(b.getInstallStep()); + verify_step.dependOn(release_confidence_step); + const fmt_check = b.addFmt(.{ .paths = b.pathList(&.{ "build.zig", "build.zig.zon", "src" }), .check = true }); + verify_step.dependOn(&fmt_check.step); + const macos_release_qa_step = b.step("macos-release-qa", "Run automated macOS Studio baseline gates; see docs/MACOS_RELEASE_QA.md"); macos_release_qa_step.dependOn(baseline_check_step); @@ -349,7 +392,7 @@ pub fn build(b: *std.Build) void { package_cmd.addArg("--binary"); package_cmd.addArtifactArg(exe); package_cmd.addArg("--output"); - const packaged_app = package_cmd.addOutputDirectoryArg("Rayslides.app"); + const packaged_app = package_cmd.addOutputDirectoryArg2("Rayslides.app", .{ .make_absolute = true }); package_cmd.addArgs(&.{ "--version", packageVersion(), "--icon" }); package_cmd.addFileArg(b.path("src/assets/rayslides-app-icon.png")); if (enable_neovim) { diff --git a/build.zig.zon b/build.zig.zon index 7442c56..b62fd4b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,7 +5,7 @@ .fingerprint = 0x54ef4b120b46ce3c, // Changing this has security and trust implications. - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0", .dependencies = .{ .mpack = .{ @@ -19,12 +19,13 @@ .lazy = true, }, .raylib_zig = .{ - .url = "git+https://github.com/raylib-zig/raylib-zig?ref=devel#8758f4cd3a5ae0df6941c4715257223d34c5ad3e", - .hash = "raylib_zig-6.0.0-KE8RECZ8BQDm-txuospkpZHbJ6DNpacUF7D88RWQ_qAe", + .url = "git+https://github.com/raylib-zig/raylib-zig?ref=devel#50d450099da664bedd7dcc6ed40204ab0bb861a5", + .hash = "raylib_zig-6.0.0-KE8REDSmBQAbyUv_Fh71wgvhQSP2zsmVxtPRLzCgIXWK", }, }, .paths = .{ + ".zig-version", "build.zig", "build.zig.zon", "src", diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 49d4db2..9d8a31e 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -1608,7 +1608,7 @@ Bullet list: # Building it -Requires Zig 0.16.x (minimum 0.16.0). Just `zig build`; see +Requires exact Zig 0.17.0 (see `.zig-version`). Just `zig build`; see [`build.zig.zon`](../build.zig.zon) for the minimum required Zig version. ```console diff --git a/docs/ZIG_0_17_MIGRATION.md b/docs/ZIG_0_17_MIGRATION.md new file mode 100644 index 0000000..29e2986 --- /dev/null +++ b/docs/ZIG_0_17_MIGRATION.md @@ -0,0 +1,137 @@ +# Zig 0.17.0 migration evidence + +Rayslides now requires exact Zig 0.17.0 and consumes the official immutable +raylib-zig 0.17 port. The complete application, built-in editor, optional embedded +Neovim editor, and macOS packaging compile with safety checks enabled. Native +macOS test, Neovim protocol, and actual application framebuffer gates pass. +The Retina startup fix restores correct Studio and editor geometry. Framebuffer +qualification remains separate from compilation and headless protocol evidence. + +## Source graph and representation audit + +The application baseline is `630948d4bce9139679832a95dbdc229b597d51a1`. +The new raylib-zig pin is +[`50d450099da664bedd7dcc6ed40204ab0bb861a5`](https://github.com/raylib-zig/raylib-zig/commit/50d450099da664bedd7dcc6ed40204ab0bb861a5), +with package hash `raylib_zig-6.0.0-KE8REDSmBQAbyUv_Fh71wgvhQSP2zsmVxtPRLzCgIXWK`. +Its C implementation identifies itself as raylib 6.1-dev, although its Zig +package version remains 6.0.0. It pins raylib +`2dee47282ae75d241759cc35f22e4768dcd092be` and raygui +`9cb5cfa73290ba920d071f57c1d06a4daee22f52`. +The existing MPack 1.1.1 and JetBrains Mono 2.304 commits and hashes are retained. +No upstream dependency source is patched by this application. + +The exact compiler source defines the port; the +[wiki migration guide](https://github.com/technologylab-ai/zigllmwiki/blob/main/docs/zig-0.16-to-0.17-migration.md) +provides pinned guidance and representation checks. + +- Five removed `@cImport` sites become target-specific `b.addTranslateC` modules. + The MPack binding-only pragma workaround is preserved in a C header; its + separately compiled C implementation keeps normal compiler macros. +- Enum reflection uses names, preserving the original enum values with + `@field`. Enum counts still size the same indexed storage. +- Array repetition becomes typed `@splat`. The repeated speaker-notes fixture + remains a borrowed byte slice over arrays of `u8`, without inter-element + padding or an unintended sentinel contract. +- Removed allocation and formatting helpers retain their explicit zero + sentinel using `dupeSentinel` and `std.mem.printSentinel`. +- The renderer's scalar float cast retains IEEE-754 value bits. A literal + `1.0 -> 0x3f800000` / `-0.0 -> 0x80000000` oracle checks its fingerprint path. + The signed scalar MessagePack cast retains two's-complement byte meaning; + the existing RPC test checks independently specified compact integer bytes. +- The new raygui message box returns an activation result separately from the + selected button. Only `Result.pressed` dismisses it; accepting every + non-negative result would silently dismiss a still-open dialog. +- Passthrough arguments, lazy font-path options, transitive lazy SDK handling, + and generated package output paths use the 0.17 build contracts. + +## Native macOS correctness + +Development checks ran on 2026-10-09 on Apple M3 Max / aarch64, macOS 26.6.2 +(build 25G83), with the checksum-verified official aarch64-macos Zig 0.17.0 +archive. The macOS deployment floor remains 13.0; that floor is compile/link +metadata, not runtime evidence for macOS 13. Neovim is 0.12.5. The Python harness +uses an isolated Python 3.12 environment with Pillow 12.3.0. + +The host reservation followed the wiki's cooperative protocol: pre-existing +process inspection, atomic acquisition of `/tmp/zig-http-measurement.lock`, +unique owner metadata, and retention through workload and child cleanup. +No benchmark or throughput comparison ran. Builds used `-j2`; correctness used +Debug and Safe, and all attempted graphics captures used Safe. The existing +opt-in baseline harness also checks its historical capture-timing thresholds; +that check is not an application performance claim. + +| Gate | Observed result | +| --- | --- | +| Complete application + built-in editor, Debug/Safe | 631 application tests and 1 stub test pass | +| Complete application + embedded editor, Debug/Safe | 631 application tests and 23 editor tests pass | +| Live Neovim embed/session probes, Debug/Safe | Grid rendering protocol, edits, quit/apply fidelity, child failure and host reaping pass | +| Neovim syntax runtime | 26 real decks pass | +| Studio baseline harness | Comparator/schema self-test passes | +| CLI | Real executable version/help exit successfully | +| macOS app bundles | Built-in and embedded editor packages build with Safe | +| Actual application framebuffers | Hidden 900×506 Studio and Neovim captures pass nonblank, 4-slide render-state, and clean-exit checks; actual Safe bundle passes too | +| Historical compact visual reference | Capture succeeds; pixel comparison fails (details below), references retained | + +Run the local correctness matrix with the exact compiler and Python Pillow on +`PATH`: + +```sh +zig build verify -Doptimize=debug -Dneovim=false -j2 --summary all +zig build verify -Doptimize=safe -Dneovim=false -j2 --summary all +zig build verify neovim-probe neovim-runtime-test -Doptimize=debug -Dneovim=true -j2 --summary all +zig build verify neovim-probe neovim-runtime-test macos-app -Doptimize=safe -Dneovim=true -j2 --summary all +``` + +## Graphics and startup boundaries + +The Mac console was locked (`CGSSessionScreenIsLocked=Yes`). GLFW excludes +sleeping displays. The first 0.17 capture could not find a primary monitor and +aborted when application code called a window operation after failed startup. +A matched Safe build of the exact application baseline with exact Zig 0.16.0 +also failed display initialization, then crashed during old cleanup. +The port returns an ordinary `WindowInitializationFailed` error before those +window operations and cleanup become eligible. + +A scoped `caffeinate -du` made display initialization succeed for both versions, +but hidden and visible capture attempts still produced blank framebuffers in +the locked session. LaunchServices did not produce a successful capture either. +The user then unlocked the Mac; the session flag was rechecked before testing. +Both the unmodified 0.16 baseline and the initial port still showed broken +geometry/readback. Those first failures are retained; no oracle was weakened. +They identify a baseline application problem, rather than proving a new +compiler or dependency regression. + +Source inspection also found that diagnostics read the back buffer after +`EndDrawing` had swapped it; the buffer contents are then undefined. The port +flushes and copies the completed framebuffer before the swap, retains that +owned CPU image through the unchanged post-edit readiness gate, and releases it +on skips, errors, and exit. Source edits and resource rebuilds remain outside +the acquired draw frame. This change alone did not restore Mac capture. + +The application also left `FLAG_WINDOW_HIGHDPI` disabled while resizing Cocoa +windows. Independent Safe probes verified literal red/white pixels and coherent +logical/render dimensions for both high- and low-DPI windows; the basic C ABI, +color and image-return paths work. Enabling `window_highdpi` on macOS makes +raylib keep Retina logical coordinates and backing framebuffer pixels coherent +through the application's resize path. This restores the complete Studio +geometry and nonblank capture. The actual application and its Safe bundle now +pass 900×506 Studio and real embedded-Neovim framebuffer checks on the Apple M3 +Max GPU, with clean exit. The screenshot is normalized from Retina backing +pixels to the requested logical dimensions. + +The existing `compact-properties` reference comparison remains a failed, +separately scoped gate: mean channel delta 2.082, RMS 9.557, and 5.32% changed +pixels (3% limit). The current frame includes the Notes toolbar control absent +from that older reference and uses Retina rasterization. The complete geometry +was visually inspected, but the references and thresholds were not changed. +Passing nonblank/current-frame checks does not claim a pixel match to that +historical image. Full historical visual-suite requalification remains pending. + +The native CI matrix builds and tests Debug/Safe on Linux, macOS, and Windows, +with the optional editor on Linux/macOS. Its Safe Linux Xvfb gate exercises a +real Mesa software-rendered application framebuffer and the Neovim overlay, +with a separate no-display startup gate. Hosted evidence is recorded separately +when those runs finish. Cross-compilation is not used as runtime evidence. +Camera capture, audio/video hardware, and physical multi-monitor handoff have +not been newly qualified here. The native Mac framebuffer result covers the +named generated Studio/editor scenes, not every application UI state. diff --git a/docs/getting-started.html b/docs/getting-started.html index 3390be8..78858d7 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -38,7 +38,7 @@

Create your first deck.

Build the command-line program or the macOS app. Open Studio. Choose a starter, then save the source file.

Build Rayslides

-

Rayslides requires Zig 0.16.x. The minimum supported version is Zig 0.16.0.

+

Rayslides requires exact Zig 0.17.0 (see .zig-version).

# Build an optimized executable.
 zig build -Doptimize=ReleaseSafe
 
diff --git a/src/file_browser.zig b/src/file_browser.zig
index 5a3b91e..5d9e2d3 100644
--- a/src/file_browser.zig
+++ b/src/file_browser.zig
@@ -87,7 +87,7 @@ const Entry = struct {
 /// Single-line editable text used for the location field and the type-ahead
 /// filter. Codepoint-aware so Backspace never leaves half a UTF-8 sequence.
 const TextField = struct {
-    buffer: [max_field_bytes + 1]u8 = [_]u8{0} ** (max_field_bytes + 1),
+    buffer: [max_field_bytes + 1]u8 = @splat(0),
     len: usize = 0,
     cursor: usize = 0,
 
@@ -173,8 +173,8 @@ pub const Browser = struct {
     last_click_time: f64 = -1,
     last_click_row: ?usize = null,
     /// Session memory so a second Browse reopens where the first one ended.
-    remembered: [@typeInfo(Purpose).@"enum".fields.len][max_path_bytes]u8 = undefined,
-    remembered_len: [@typeInfo(Purpose).@"enum".fields.len]usize = [_]usize{0} ** @typeInfo(Purpose).@"enum".fields.len,
+    remembered: [@typeInfo(Purpose).@"enum".field_names.len][max_path_bytes]u8 = undefined,
+    remembered_len: [@typeInfo(Purpose).@"enum".field_names.len]usize = @splat(0),
 
     /// Opens the chooser in the remembered directory for this purpose, else in
     /// `initial_directory`, else in the process working directory. Missing
@@ -191,7 +191,7 @@ pub const Browser = struct {
         self.selected = null;
         self.scroll_row = 0;
 
-        const slot = @intFromEnum(purpose);
+        const slot = @backingInt(purpose);
         if (self.remembered_len[slot] > 0 and self.navigateTo(self.remembered[slot][0..self.remembered_len[slot]])) return;
         if (initial_directory.len > 0 and self.navigateTo(initial_directory)) return;
         var cwd_buffer: [max_path_bytes]u8 = undefined;
@@ -239,7 +239,7 @@ pub const Browser = struct {
         self.scroll_row = 0;
         self.last_click_row = null;
         self.applyFilters();
-        const slot = @intFromEnum(self.purpose);
+        const slot = @backingInt(self.purpose);
         @memcpy(self.remembered[slot][0..canonical_len], canonical_buffer[0..canonical_len]);
         self.remembered_len[slot] = canonical_len;
         return true;
@@ -720,11 +720,11 @@ pub const Browser = struct {
             rl.drawTextEx(ui_font, message, .{ .x = panel.x + 24, .y = footer_y }, 16, 0, theme.warning);
         } else if (self.filter.len > 0) {
             var filter_buffer: [96]u8 = undefined;
-            const shown = std.fmt.bufPrintZ(&filter_buffer, "Filter: {s}  ·  Esc clears", .{fitTail(self.filter.text(), 64)}) catch "Filter";
+            const shown = std.mem.printSentinel(&filter_buffer, "Filter: {s}  ·  Esc clears", .{fitTail(self.filter.text(), 64)}, 0) catch "Filter";
             rl.drawTextEx(ui_font, shown, .{ .x = panel.x + 24, .y = footer_y }, 16, 0, theme.accent_bright);
         } else {
             var count_buffer: [64]u8 = undefined;
-            const count = std.fmt.bufPrintZ(&count_buffer, "{d} item{s}", .{ self.visible_count, if (self.visible_count == 1) "" else "s" }) catch "";
+            const count = std.mem.printSentinel(&count_buffer, "{d} item{s}", .{ self.visible_count, if (self.visible_count == 1) "" else "s" }, 0) catch "";
             rl.drawTextEx(ui_font, count, .{ .x = panel.x + 24, .y = footer_y }, 16, 0, theme.text_muted);
         }
     }
diff --git a/src/fonts.zig b/src/fonts.zig
index e553525..aff3bb3 100644
--- a/src/fonts.zig
+++ b/src/fonts.zig
@@ -292,7 +292,7 @@ pub const AvailableFonts = struct {
         var temp_buf: [std.fs.max_path_bytes]u8 = undefined;
         if (fontConfig.normal) |fontfile| {
             const realpath = try pathRelativeTo(fontfile.ttf_filn, slideshow_filp);
-            const path = try std.fmt.bufPrintZ(&temp_buf, "{s}", .{realpath});
+            const path = try std.mem.printSentinel(&temp_buf, "{s}", .{realpath}, 0);
             const replacement = try loadSdfFontFile(path, fontConfig.opts.fontSize, fontConfig.opts.fontChars);
             rl.unloadFont(self.normal);
             self.normal = replacement;
@@ -301,7 +301,7 @@ pub const AvailableFonts = struct {
 
         if (fontConfig.bold) |fontfile| {
             const realpath = try pathRelativeTo(fontfile.ttf_filn, slideshow_filp);
-            const path = try std.fmt.bufPrintZ(&temp_buf, "{s}", .{realpath});
+            const path = try std.mem.printSentinel(&temp_buf, "{s}", .{realpath}, 0);
             const replacement = try loadSdfFontFile(path, fontConfig.opts.fontSize, fontConfig.opts.fontChars);
             rl.unloadFont(self.bold);
             self.bold = replacement;
@@ -309,7 +309,7 @@ pub const AvailableFonts = struct {
 
         if (fontConfig.italic) |fontfile| {
             const realpath = try pathRelativeTo(fontfile.ttf_filn, slideshow_filp);
-            const path = try std.fmt.bufPrintZ(&temp_buf, "{s}", .{realpath});
+            const path = try std.mem.printSentinel(&temp_buf, "{s}", .{realpath}, 0);
             const replacement = try loadSdfFontFile(path, fontConfig.opts.fontSize, fontConfig.opts.fontChars);
             rl.unloadFont(self.italic);
             self.italic = replacement;
@@ -317,7 +317,7 @@ pub const AvailableFonts = struct {
 
         if (fontConfig.bolditalic) |fontfile| {
             const realpath = try pathRelativeTo(fontfile.ttf_filn, slideshow_filp);
-            const path = try std.fmt.bufPrintZ(&temp_buf, "{s}", .{realpath});
+            const path = try std.mem.printSentinel(&temp_buf, "{s}", .{realpath}, 0);
             const replacement = try loadSdfFontFile(path, fontConfig.opts.fontSize, fontConfig.opts.fontChars);
             rl.unloadFont(self.bolditalic);
             self.bolditalic = replacement;
@@ -325,7 +325,7 @@ pub const AvailableFonts = struct {
 
         if (fontConfig.zig) |fontfile| {
             const realpath = try pathRelativeTo(fontfile.ttf_filn, slideshow_filp);
-            const path = try std.fmt.bufPrintZ(&temp_buf, "{s}", .{realpath});
+            const path = try std.mem.printSentinel(&temp_buf, "{s}", .{realpath}, 0);
             const replacement = try loadSdfFontFile(path, fontConfig.opts.fontSize, fontConfig.opts.fontChars);
             rl.unloadFont(self.zig);
             self.zig = replacement;
diff --git a/src/goto_slide.zig b/src/goto_slide.zig
index f8647e6..8af967a 100644
--- a/src/goto_slide.zig
+++ b/src/goto_slide.zig
@@ -196,7 +196,7 @@ pub const Picker = struct {
         }, value_size, if (shown.len > 0) theme.text else theme.text_muted);
 
         var count_buffer: [48]u8 = undefined;
-        const count_text = std.fmt.bufPrintZ(&count_buffer, "/ {d}", .{slide_count}) catch "/ ?";
+        const count_text = std.mem.printSentinel(&count_buffer, "/ {d}", .{slide_count}, 0) catch "/ ?";
         const count_width = measureText(font, count_text, heading_size);
         drawText(font, count_text, .{
             .x = placement.input.x + placement.input.width - count_width,
@@ -227,9 +227,9 @@ pub const Picker = struct {
 
         var status_buffer: [96]u8 = undefined;
         const status: [:0]const u8 = switch (shown.failure) {
-            .none => std.fmt.bufPrintZ(&status_buffer, "Current slide {d}", .{current_slide + 1}) catch "Current slide",
+            .none => std.mem.printSentinel(&status_buffer, "Current slide {d}", .{current_slide + 1}, 0) catch "Current slide",
             .empty => "Enter a slide number",
-            .out_of_bounds => std.fmt.bufPrintZ(&status_buffer, "Choose a slide from 1 to {d}", .{slide_count}) catch "Slide is out of range",
+            .out_of_bounds => std.mem.printSentinel(&status_buffer, "Choose a slide from 1 to {d}", .{slide_count}, 0) catch "Slide is out of range",
         };
         drawText(font, status, .{
             .x = placement.footer.x,
diff --git a/src/main.zig b/src/main.zig
index 9efdcc9..7cad5a0 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -3,9 +3,7 @@ const builtin = @import("builtin");
 const build_options = @import("build_options");
 const rl = @import("raylib");
 const rg = @import("raygui");
-const c = @cImport({
-    @cInclude("pdfgen.h");
-});
+const c = @import("pdfgen_c");
 
 const fonts = @import("fonts.zig");
 const parser = @import("parser.zig");
@@ -1306,7 +1304,7 @@ fn syncWindowTitle(dirty: bool) void {
     const title: [:0]const u8 = if (name.len == 0)
         "Rayslides"
     else
-        std.fmt.bufPrintZ(&buffer, "{s}{s} - Rayslides", .{ name, if (dirty) " *" else "" }) catch "Rayslides";
+        std.mem.printSentinel(&buffer, "{s}{s} - Rayslides", .{ name, if (dirty) " *" else "" }, 0) catch "Rayslides";
     if (cache.primed and std.mem.eql(u8, cache.last[0..cache.last_len], title)) return;
     @memcpy(cache.last[0..title.len], title);
     cache.last_len = title.len;
@@ -1723,21 +1721,17 @@ fn drawPresenterPairingOverlay(
         }
 
         var address_buffer: [320:0]u8 = @splat(0);
-        const address = std.fmt.bufPrintZ(&address_buffer, "Local address: {s}", .{runtime.base_url.slice()}) catch "Local address is too long";
+        const address = std.mem.printSentinel(&address_buffer, "Local address: {s}", .{runtime.base_url.slice()}, 0) catch "Local address is too long";
         const address_y = @min(screen_height - presenterOverlayPx(150, scale), top + rendered_side + presenterOverlayPx(14, scale));
         drawCenteredPresenterText(font, address, address_y, 22 * scale, .{ .r = 223, .g = 233, .b = 244, .a = 255 }, screen_width);
 
         var network_buffer: [192:0]u8 = @splat(0);
-        const network_label = std.fmt.bufPrintZ(
-            &network_buffer,
-            "{s} · {s} · address {d}/{d}",
-            .{
-                network.selected.interface_name.slice(),
-                network.selected.kind.label(),
-                network.selected_index + 1,
-                @max(@as(usize, 1), network.discovery.len),
-            },
-        ) catch "Network details unavailable";
+        const network_label = std.mem.printSentinel(&network_buffer, "{s} · {s} · address {d}/{d}", .{
+            network.selected.interface_name.slice(),
+            network.selected.kind.label(),
+            network.selected_index + 1,
+            @max(@as(usize, 1), network.discovery.len),
+        }, 0) catch "Network details unavailable";
         drawCenteredPresenterText(
             font,
             network_label,
@@ -1747,11 +1741,7 @@ fn drawPresenterPairingOverlay(
             screen_width,
         );
         var guidance_buffer: [192:0]u8 = @splat(0);
-        const guidance = std.fmt.bufPrintZ(
-            &guidance_buffer,
-            "{s}",
-            .{network.selected.kind.guidance()},
-        ) catch "Verify that the phone can reach this address";
+        const guidance = std.mem.printSentinel(&guidance_buffer, "{s}", .{network.selected.kind.guidance()}, 0) catch "Verify that the phone can reach this address";
         drawCenteredPresenterText(
             font,
             guidance,
@@ -1925,7 +1915,7 @@ fn drawDisplayPickerOverlay(
 
     var title_buffer: [96:0]u8 = @splat(0);
     const title: [:0]const u8 = if (picker.identified_monitor) |monitor|
-        std.fmt.bufPrintZ(&title_buffer, "DISPLAY {d} IDENTIFIED HERE", .{monitor + 1}) catch "IDENTIFY PRESENTATION DISPLAY"
+        std.mem.printSentinel(&title_buffer, "DISPLAY {d} IDENTIFIED HERE", .{monitor + 1}, 0) catch "IDENTIFY PRESENTATION DISPLAY"
     else
         "CHOOSE PRESENTATION DISPLAY";
     drawCenteredPresenterText(font, title, presenterOverlayPx(20, scale), 34 * scale, .{ .r = 97, .g = 218, .b = 251, .a = 255 }, screen_width);
@@ -1974,11 +1964,7 @@ fn drawDisplayPickerOverlay(
         );
 
         var name_buffer: [256:0]u8 = @splat(0);
-        const name = std.fmt.bufPrintZ(
-            &name_buffer,
-            "{s}  DISPLAY {d} · {s}",
-            .{ if (candidate) ">" else " ", monitor + 1, rl.getMonitorName(monitor) },
-        ) catch "Display name unavailable";
+        const name = std.mem.printSentinel(&name_buffer, "{s}  DISPLAY {d} · {s}", .{ if (candidate) ">" else " ", monitor + 1, rl.getMonitorName(monitor) }, 0) catch "Display name unavailable";
         rl.drawTextEx(
             font,
             name,
@@ -1990,19 +1976,15 @@ fn drawDisplayPickerOverlay(
 
         const position = rl.getMonitorPosition(monitor);
         var detail_buffer: [256:0]u8 = @splat(0);
-        const detail = std.fmt.bufPrintZ(
-            &detail_buffer,
-            "{d} × {d} · {d} Hz · position {d}, {d}{s}{s}",
-            .{
-                rl.getMonitorWidth(monitor),
-                rl.getMonitorHeight(monitor),
-                rl.getMonitorRefreshRate(monitor),
-                @as(i32, @intFromFloat(position.x)),
-                @as(i32, @intFromFloat(position.y)),
-                if (confirmed) " · SELECTED" else "",
-                if (window_here) " · WINDOW HERE" else "",
-            },
-        ) catch "Display details unavailable";
+        const detail = std.mem.printSentinel(&detail_buffer, "{d} × {d} · {d} Hz · position {d}, {d}{s}{s}", .{
+            rl.getMonitorWidth(monitor),
+            rl.getMonitorHeight(monitor),
+            rl.getMonitorRefreshRate(monitor),
+            @as(i32, @intFromFloat(position.x)),
+            @as(i32, @intFromFloat(position.y)),
+            if (confirmed) " · SELECTED" else "",
+            if (window_here) " · WINDOW HERE" else "",
+        }, 0) catch "Display details unavailable";
         rl.drawTextEx(
             font,
             detail,
@@ -2017,11 +1999,7 @@ fn drawDisplayPickerOverlay(
     const page: [:0]const u8 = if (count == 1)
         "One active display detected"
     else
-        std.fmt.bufPrintZ(
-            &page_buffer,
-            "Display {d} of {d} selected",
-            .{ picker.candidate_monitor + 1, count },
-        ) catch "Display selection";
+        std.mem.printSentinel(&page_buffer, "Display {d} of {d} selected", .{ picker.candidate_monitor + 1, count }, 0) catch "Display selection";
     drawCenteredPresenterText(
         font,
         page,
@@ -2186,22 +2164,18 @@ fn drawShowtimeOverlay(
 
     var title_buffer: [160:0]u8 = @splat(0);
     const title: [:0]const u8 = if (report.ready())
-        std.fmt.bufPrintZ(&title_buffer, "READY FOR SHOW  ·  {d} SLIDES  ·  {d} SCENES", .{ report.summary.slides, report.summary.scenes }) catch "SHOWTIME PREFLIGHT"
+        std.mem.printSentinel(&title_buffer, "READY FOR SHOW  ·  {d} SLIDES  ·  {d} SCENES", .{ report.summary.slides, report.summary.scenes }, 0) catch "SHOWTIME PREFLIGHT"
     else
-        std.fmt.bufPrintZ(&title_buffer, "SHOWTIME  ·  {d} BLOCKERS  ·  {d} WARNINGS", .{ report.summary.errors, report.summary.warnings }) catch "SHOWTIME PREFLIGHT";
+        std.mem.printSentinel(&title_buffer, "SHOWTIME  ·  {d} BLOCKERS  ·  {d} WARNINGS", .{ report.summary.errors, report.summary.warnings }, 0) catch "SHOWTIME PREFLIGHT";
     rl.drawTextEx(font, title, .{ .x = layout.panel.x + 20 * scale, .y = layout.panel.y + 15 * scale }, 28 * scale, 0, if (report.ready()) .{ .r = 130, .g = 230, .b = 174, .a = 255 } else .{ .r = 255, .g = 181, .b = 71, .a = 255 });
     rl.drawTextEx(font, "Exact parser + renderer + venue state · no playback, history, selection, or source mutation", .{ .x = layout.panel.x + 20 * scale, .y = layout.panel.y + 48 * scale }, 15 * scale, 0, .{ .r = 151, .g = 170, .b = 193, .a = 255 });
 
     rl.drawRectangleRounded(layout.summary, 0.10, 8, .{ .r = 14, .g = 28, .b = 47, .a = 255 });
     var summary_buffer: [384:0]u8 = @splat(0);
-    const summary_text = std.fmt.bufPrintZ(
-        &summary_buffer,
-        "DECK {d} slides / {d} endpoints     RENDER {d} fragments     ASSETS {d}     DEFINITIONS {d}",
-        .{ report.summary.slides, report.summary.reveal_endpoints, report.summary.render_fragments, report.summary.assets, report.summary.reusable_definitions },
-    ) catch "Showtime summary";
+    const summary_text = std.mem.printSentinel(&summary_buffer, "DECK {d} slides / {d} endpoints     RENDER {d} fragments     ASSETS {d}     DEFINITIONS {d}", .{ report.summary.slides, report.summary.reveal_endpoints, report.summary.render_fragments, report.summary.assets, report.summary.reusable_definitions }, 0) catch "Showtime summary";
     rl.drawTextEx(font, summary_text, .{ .x = layout.summary.x + 16 * scale, .y = layout.summary.y + 12 * scale }, 18 * scale, 0, .{ .r = 232, .g = 241, .b = 250, .a = 255 });
     var counts_buffer: [256:0]u8 = @splat(0);
-    const counts = std.fmt.bufPrintZ(&counts_buffer, "{d} errors   ·   {d} warnings   ·   {d} notes{s}", .{ report.summary.errors, report.summary.warnings, report.summary.info, if (report.truncated) "   ·   result limit reached" else "" }) catch "Readiness counts";
+    const counts = std.mem.printSentinel(&counts_buffer, "{d} errors   ·   {d} warnings   ·   {d} notes{s}", .{ report.summary.errors, report.summary.warnings, report.summary.info, if (report.truncated) "   ·   result limit reached" else "" }, 0) catch "Readiness counts";
     rl.drawTextEx(font, counts, .{ .x = layout.summary.x + 16 * scale, .y = layout.summary.y + 39 * scale }, 15 * scale, 0, if (report.summary.errors > 0) showtimeSeverityColor(.error_) else if (report.summary.warnings > 0) showtimeSeverityColor(.warning) else .{ .r = 130, .g = 230, .b = 174, .a = 255 });
 
     if (report.findings.items.len == 0) {
@@ -2217,21 +2191,21 @@ fn drawShowtimeOverlay(
             rl.drawRectangle(@intFromFloat(row.x), @intFromFloat(row.y), @max(@as(i32, 3), @as(i32, @intFromFloat(5 * scale))), @intFromFloat(row.height), showtimeSeverityColor(finding.severity));
             var location_buffer: [64:0]u8 = @splat(0);
             const location: [:0]const u8 = if (finding.slide_index) |slide_index|
-                std.fmt.bufPrintZ(&location_buffer, "  ·  slide {d}", .{slide_index + 1}) catch ""
+                std.mem.printSentinel(&location_buffer, "  ·  slide {d}", .{slide_index + 1}, 0) catch ""
             else if (finding.source_line) |line|
-                std.fmt.bufPrintZ(&location_buffer, "  ·  line {d}", .{line}) catch ""
+                std.mem.printSentinel(&location_buffer, "  ·  line {d}", .{line}, 0) catch ""
             else
                 "";
             var row_title_buffer: [512:0]u8 = @splat(0);
-            const row_title = std.fmt.bufPrintZ(&row_title_buffer, "{s}  {s}{s}{s}", .{
+            const row_title = std.mem.printSentinel(&row_title_buffer, "{s}  {s}{s}{s}", .{
                 @tagName(finding.category),
                 finding.title,
                 location,
                 if (finding.morph_state != null) "  ·  morph" else "",
-            }) catch "Showtime finding";
+            }, 0) catch "Showtime finding";
             rl.drawTextEx(font, row_title, .{ .x = row.x + 17 * scale, .y = row.y + 9 * scale }, 18 * scale, 0, .{ .r = 238, .g = 246, .b = 255, .a = 255 });
             var detail_buffer: [640:0]u8 = @splat(0);
-            const detail = std.fmt.bufPrintZ(&detail_buffer, "{s}", .{finding.detail}) catch "See source for details";
+            const detail = std.mem.printSentinel(&detail_buffer, "{s}", .{finding.detail}, 0) catch "See source for details";
             rl.drawTextEx(font, detail, .{ .x = row.x + 17 * scale, .y = row.y + 37 * scale }, 14 * scale, 0, .{ .r = 151, .g = 170, .b = 193, .a = 255 });
         }
     }
@@ -2240,7 +2214,7 @@ fn drawShowtimeOverlay(
     const page = if (report.findings.items.len == 0)
         "R rerun  ·  P portable folder  ·  Esc close"
     else
-        std.fmt.bufPrintZ(&page_buffer, "↑/↓ review  ·  Enter open slide/source  ·  R rerun  ·  P portable folder  ·  Esc close   ({d}/{d})", .{ overlay.selected + 1, report.findings.items.len }) catch "Showtime controls";
+        std.mem.printSentinel(&page_buffer, "↑/↓ review  ·  Enter open slide/source  ·  R rerun  ·  P portable folder  ·  Esc close   ({d}/{d})", .{ overlay.selected + 1, report.findings.items.len }, 0) catch "Showtime controls";
     rl.drawTextEx(font, page, .{ .x = layout.footer.x, .y = layout.footer.y + 10 * scale }, 15 * scale, 0, .{ .r = 139, .g = 158, .b = 179, .a = 255 });
 }
 
@@ -2383,7 +2357,7 @@ const ExportController = struct {
         defer self.gpa.free(pdf_name);
 
         var info: c.pdf_info = .{};
-        _ = try std.fmt.bufPrintZ(&info.producer, "{s}", .{"rayslides"});
+        _ = try std.mem.printSentinel(&info.producer, "{s}", .{"rayslides"}, 0);
 
         if (c.pdf_create(1920, 1080, &info)) |pdf| {
             defer c.pdf_destroy(pdf);
@@ -2966,47 +2940,35 @@ const FrameDiagnostics = struct {
         var frame_buffer: [192]u8 = undefined;
         var graph_buffer: [192]u8 = undefined;
         var input_buffer: [192]u8 = undefined;
-        const frame_text = std.fmt.bufPrintZ(
-            &frame_buffer,
-            "FRAME {d:.1} ms   PEAK {d:.1} ms   SLOW {d}/s   {s}",
-            .{ self.latest_frame_ms, self.sampled_peak_ms, self.sampled_slow_frames, if (beast_mode) "UNCAPPED" else "VSYNC" },
-        ) catch return;
-        const graph_text = std.fmt.bufPrintZ(
-            &graph_buffer,
-            "REBUILD {d:.1} ms   {s} {d}/{d}   F/P/N {d}/{d}/{d}   ARENA {d:.1} KiB",
-            .{
-                self.last_pre_render_ms,
-                @tagName(self.last_rebuild_mode),
-                self.last_rebuilt_slide_count,
-                self.last_rebuild_total_slide_count,
-                self.full_rebuild_count,
-                self.partial_rebuild_count,
-                self.unchanged_rebuild_count,
-                @as(f64, @floatFromInt(self.slideshow_arena_bytes)) / 1024.0,
-            },
-        ) catch return;
+        const frame_text = std.mem.printSentinel(&frame_buffer, "FRAME {d:.1} ms   PEAK {d:.1} ms   SLOW {d}/s   {s}", .{ self.latest_frame_ms, self.sampled_peak_ms, self.sampled_slow_frames, if (beast_mode) "UNCAPPED" else "VSYNC" }, 0) catch return;
+        const graph_text = std.mem.printSentinel(&graph_buffer, "REBUILD {d:.1} ms   {s} {d}/{d}   F/P/N {d}/{d}/{d}   ARENA {d:.1} KiB", .{
+            self.last_pre_render_ms,
+            @tagName(self.last_rebuild_mode),
+            self.last_rebuilt_slide_count,
+            self.last_rebuild_total_slide_count,
+            self.full_rebuild_count,
+            self.partial_rebuild_count,
+            self.unchanged_rebuild_count,
+            @as(f64, @floatFromInt(self.slideshow_arena_bytes)) / 1024.0,
+        }, 0) catch return;
         const mouse = rl.getMousePosition();
-        const input_text = std.fmt.bufPrintZ(
-            &input_buffer,
-            "STUDIO {d:.2} ms   CACHE {d}/{d}/{d}/{d}{s}   GALLERY {d}/{d}   DECK {d}   ITEMS {d}/{d}   MOUSE {d:.0}, {d:.0}   WINDOW {d} x {d}",
-            .{
-                self.last_studio_prepare_ms,
-                self.studio_document_cache_builds,
-                self.studio_scene_cache_builds,
-                self.studio_composition_cache_builds,
-                self.studio_gallery_cache_builds,
-                if (self.studio_cache_rebuilt) "*" else "",
-                self.studio_gallery_projected_count,
-                self.studio_gallery_placeholder_count,
-                self.studio_slide_count,
-                self.studio_item_count,
-                self.studio_render_fragment_count,
-                mouse.x,
-                mouse.y,
-                rl.getScreenWidth(),
-                rl.getScreenHeight(),
-            },
-        ) catch return;
+        const input_text = std.mem.printSentinel(&input_buffer, "STUDIO {d:.2} ms   CACHE {d}/{d}/{d}/{d}{s}   GALLERY {d}/{d}   DECK {d}   ITEMS {d}/{d}   MOUSE {d:.0}, {d:.0}   WINDOW {d} x {d}", .{
+            self.last_studio_prepare_ms,
+            self.studio_document_cache_builds,
+            self.studio_scene_cache_builds,
+            self.studio_composition_cache_builds,
+            self.studio_gallery_cache_builds,
+            if (self.studio_cache_rebuilt) "*" else "",
+            self.studio_gallery_projected_count,
+            self.studio_gallery_placeholder_count,
+            self.studio_slide_count,
+            self.studio_item_count,
+            self.studio_render_fragment_count,
+            mouse.x,
+            mouse.y,
+            rl.getScreenWidth(),
+            rl.getScreenHeight(),
+        }, 0) catch return;
         switch (placement) {
             .hidden => return,
             .overlay => |origin| {
@@ -3033,46 +2995,34 @@ const FrameDiagnostics = struct {
                 const compact_frame = if (roomy)
                     frame_text
                 else
-                    std.fmt.bufPrintZ(
-                        &compact_frame_buffer,
-                        "FRAME {d:.1}   PEAK {d:.1}   SLOW {d}/s",
-                        .{ self.latest_frame_ms, self.sampled_peak_ms, self.sampled_slow_frames },
-                    ) catch return;
+                    std.mem.printSentinel(&compact_frame_buffer, "FRAME {d:.1}   PEAK {d:.1}   SLOW {d}/s", .{ self.latest_frame_ms, self.sampled_peak_ms, self.sampled_slow_frames }, 0) catch return;
                 const compact_graph = if (roomy)
-                    std.fmt.bufPrintZ(
-                        &compact_graph_buffer,
-                        "BUILD {d:.1} ms {s} {d}/{d}   PREP {d:.2} ms   CACHE {d}/{d}/{d}/{d}{s}   GAL {d}/{d}   DECK {d}   ITEMS {d}/{d}",
-                        .{
-                            self.last_pre_render_ms,
-                            @tagName(self.last_rebuild_mode),
-                            self.last_rebuilt_slide_count,
-                            self.last_rebuild_total_slide_count,
-                            self.last_studio_prepare_ms,
-                            self.studio_document_cache_builds,
-                            self.studio_scene_cache_builds,
-                            self.studio_composition_cache_builds,
-                            self.studio_gallery_cache_builds,
-                            if (self.studio_cache_rebuilt) "*" else "",
-                            self.studio_gallery_projected_count,
-                            self.studio_gallery_placeholder_count,
-                            self.studio_slide_count,
-                            self.studio_item_count,
-                            self.studio_render_fragment_count,
-                        },
-                    ) catch return
+                    std.mem.printSentinel(&compact_graph_buffer, "BUILD {d:.1} ms {s} {d}/{d}   PREP {d:.2} ms   CACHE {d}/{d}/{d}/{d}{s}   GAL {d}/{d}   DECK {d}   ITEMS {d}/{d}", .{
+                        self.last_pre_render_ms,
+                        @tagName(self.last_rebuild_mode),
+                        self.last_rebuilt_slide_count,
+                        self.last_rebuild_total_slide_count,
+                        self.last_studio_prepare_ms,
+                        self.studio_document_cache_builds,
+                        self.studio_scene_cache_builds,
+                        self.studio_composition_cache_builds,
+                        self.studio_gallery_cache_builds,
+                        if (self.studio_cache_rebuilt) "*" else "",
+                        self.studio_gallery_projected_count,
+                        self.studio_gallery_placeholder_count,
+                        self.studio_slide_count,
+                        self.studio_item_count,
+                        self.studio_render_fragment_count,
+                    }, 0) catch return
                 else
-                    std.fmt.bufPrintZ(
-                        &compact_graph_buffer,
-                        "{s} {d}/{d}   {d:.0} ms   #{d}   {s}",
-                        .{
-                            @tagName(self.last_rebuild_mode),
-                            self.last_rebuilt_slide_count,
-                            self.last_rebuild_total_slide_count,
-                            self.last_pre_render_ms,
-                            self.pre_render_count,
-                            if (beast_mode) "UNCAPPED" else "VSYNC",
-                        },
-                    ) catch return;
+                    std.mem.printSentinel(&compact_graph_buffer, "{s} {d}/{d}   {d:.0} ms   #{d}   {s}", .{
+                        @tagName(self.last_rebuild_mode),
+                        self.last_rebuilt_slide_count,
+                        self.last_rebuild_total_slide_count,
+                        self.last_pre_render_ms,
+                        self.pre_render_count,
+                        if (beast_mode) "UNCAPPED" else "VSYNC",
+                    }, 0) catch return;
                 rl.drawRectangleRec(panel, .{ .r = 5, .g = 11, .b = 22, .a = 235 });
                 rl.drawRectangleLinesEx(panel, @max(@as(f32, 1), scale), .{ .r = 119, .g = 226, .b = 255, .a = 185 });
                 rl.drawRectangleRec(.{ .x = panel.x, .y = panel.y, .width = 3 * scale, .height = panel.height }, .{ .r = 239, .g = 69, .b = 154, .a = 255 });
@@ -3123,11 +3073,9 @@ fn validDiagnosticScenarioName(name: []const u8) bool {
     return true;
 }
 
-fn captureDiagnosticScreenshot(path: []const u8, logical_size: ?WindowDimensions) !WindowDimensions {
+fn writeDiagnosticScreenshot(image: *rl.Image, path: []const u8, logical_size: ?WindowDimensions) !WindowDimensions {
     var path_buffer: [std.fs.max_path_bytes]u8 = undefined;
-    const sentinel_path = try std.fmt.bufPrintZ(&path_buffer, "{s}", .{path});
-    var image = try rl.loadImageFromScreen();
-    defer rl.unloadImage(image);
+    const sentinel_path = try std.mem.printSentinel(&path_buffer, "{s}", .{path}, 0);
     if (logical_size) |size| {
         if (image.width != size.width or image.height != size.height) image.resize(size.width, size.height);
     }
@@ -3652,10 +3600,16 @@ pub fn main(init: std.process.Init) anyerror!void {
     MacOpenDocuments.install();
     rl.setConfigFlags(.{
         .window_resizable = true,
+        // Cocoa drawable pixels and logical window coordinates must stay
+        // coherent when a Retina framebuffer is resized.
+        .window_highdpi = builtin.os.tag == .macos,
         .vsync_hint = true,
         .window_hidden = diagnostics_hidden or showtime_report_path != null or portable_show_path != null,
     });
     rl.initWindow(screenWidth, screenHeight, "rayslides");
+    // Failed display initialization is an ordinary startup error. GLFW window
+    // operations and CloseWindow both require a successfully created window.
+    if (!rl.isWindowReady()) return error.WindowInitializationFailed;
     rl.setWindowMinSize(900, 506);
     if (starts_in_studio or diagnostics_presentation_capture) {
         const monitor = rl.getCurrentMonitor();
@@ -3871,7 +3825,7 @@ pub fn main(init: std.process.Init) anyerror!void {
         var spec_it = std.mem.splitScalar(u8, spec, ':');
         pill_shot_at = std.fmt.parseFloat(f64, spec_it.next() orelse "") catch null;
         if (spec_it.rest().len > 0) {
-            pill_shot_path = std.fmt.bufPrintZ(&pill_shot_path_buffer, "{s}", .{spec_it.rest()}) catch pill_shot_path;
+            pill_shot_path = std.mem.printSentinel(&pill_shot_path_buffer, "{s}", .{spec_it.rest()}, 0) catch pill_shot_path;
         }
         if (pill_shot_at == null) log.err("RAYSLIDES_PILL_SHOT wants SECONDS[:PATH], got {s}", .{spec});
     }
@@ -5869,6 +5823,8 @@ pub fn main(init: std.process.Init) anyerror!void {
         // ready prevents a partially held back buffer from presenting as a
         // redraw flash on macOS.
         var video_overlay_consumed_click = false;
+        var diagnostics_frame_image: ?rl.Image = null;
+        defer if (diagnostics_frame_image) |image| rl.unloadImage(image);
         {
             // Chrome motion ticks once per frame regardless of which surface
             // owns input, so a closing palette keeps folding while a prompt
@@ -6012,7 +5968,10 @@ pub fn main(init: std.process.Init) anyerror!void {
             if (beast_mode) rl.drawFPS(20, 20);
 
             if (export_controller.final_messagebox_message) |msg| {
-                if (rg.messageBox(.{ .x = @floatFromInt(@divTrunc(screenWidth - 400, 2)), .y = 300, .width = 400, .height = 100 }, "Slideshow Export", msg, "OK") >= 0) {
+                // raygui now reports activation separately from its button index.
+                // Dismiss only an actual close/OK press; RESULT_NONE is zero.
+                var active_button: i32 = -1;
+                if (rg.messageBox(.{ .x = @floatFromInt(@divTrunc(screenWidth - 400, 2)), .y = 300, .width = 400, .height = 100 }, "Slideshow Export", msg, "OK", &active_button) == @backingInt(rg.Result.pressed)) {
                     gpa.free(msg);
                     export_controller.final_messagebox_message = null;
                 }
@@ -6082,6 +6041,15 @@ pub fn main(init: std.process.Init) anyerror!void {
             } else if (embedded_editor.hasAfterimage()) {
                 embedded_editor.releaseAfterimage();
             }
+            if (diagnostics_capture_path != null and !diagnostics_capture_complete and
+                diagnostics_capture_stable_frames >= diagnostics_capture_settle_frames -| 1)
+            {
+                // EndDrawing swaps the back buffer; its pixels are then undefined.
+                // Read this completed draw before that swap, and retain the owned
+                // CPU image until the post-edit readiness gate below accepts it.
+                rl.gl.rlDrawRenderBatchActive();
+                diagnostics_frame_image = try rl.loadImageFromScreen();
+            }
         }
         if (screenshot_poster_render_pending) {
             screenshot_poster_render_pending = false;
@@ -6338,7 +6306,10 @@ pub fn main(init: std.process.Init) anyerror!void {
                     diagnostics_capture_stable_frames = 0;
                 }
                 if (diagnostics_capture_stable_frames >= diagnostics_capture_settle_frames) {
-                    const capture_size = try captureDiagnosticScreenshot(capture_path, diagnostics_window_size);
+                    const capture_size = if (diagnostics_frame_image) |*image|
+                        try writeDiagnosticScreenshot(image, capture_path, diagnostics_window_size)
+                    else
+                        return error.DiagnosticFramebufferNotCaptured;
                     if (diagnostics_report_path) |report_path| {
                         try writeDiagnosticCaptureReport(
                             io,
diff --git a/src/nvim/grid.zig b/src/nvim/grid.zig
index 417caff..3398d8c 100644
--- a/src/nvim/grid.zig
+++ b/src/nvim/grid.zig
@@ -52,7 +52,7 @@ pub const CursorStyle = struct {
 };
 
 pub const Cell = struct {
-    bytes: [max_cell_text_bytes]u8 = [_]u8{0} ** max_cell_text_bytes,
+    bytes: [max_cell_text_bytes]u8 = @splat(0),
     len: u8 = 1,
     highlight_id: u64 = 0,
     replaced_oversized_text: bool = false,
@@ -100,7 +100,7 @@ pub const Model = struct {
     cursor_col: usize = 0,
     cursor_visible: bool = true,
     cursor_style: CursorStyle = .{},
-    mode_name: [32]u8 = [_]u8{0} ** 32,
+    mode_name: [32]u8 = @splat(0),
     mode_name_len: u8 = 0,
     mode_styles: std.ArrayList(CursorStyle) = .empty,
     mouse_enabled: bool = false,
diff --git a/src/nvim/mpack.zig b/src/nvim/mpack.zig
index 86dd4a8..4bd2992 100644
--- a/src/nvim/mpack.zig
+++ b/src/nvim/mpack.zig
@@ -1,26 +1,6 @@
 const std = @import("std");
 
-pub const c = @cImport({
-    // Zig's translate-c currently tokenizes MPack's GCC `_Pragma` warning
-    // wrapper as declarations. The compiled C sources still see Clang's
-    // normal predefined macros; only the generated binding skips that wrapper.
-    // Preload MPack's standard headers while the normal compiler macros are
-    // present so undefining them below cannot perturb glibc's type choices.
-    @cInclude("stddef.h");
-    @cInclude("stdint.h");
-    @cInclude("stdbool.h");
-    @cInclude("inttypes.h");
-    @cInclude("limits.h");
-    @cInclude("string.h");
-    @cInclude("stdlib.h");
-    @cInclude("stdio.h");
-    @cInclude("errno.h");
-    @cInclude("stdarg.h");
-    @cUndef("__GNUC__");
-    @cUndef("__GNUC_MINOR__");
-    @cDefine("MPACK_EXTENSIONS", "1");
-    @cInclude("mpack.h");
-});
+pub const c = @import("mpack_c");
 
 test "pinned MPack C implementation is linked with extension support" {
     try std.testing.expectEqual(@as(c_int, 1), c.MPACK_EXTENSIONS);
diff --git a/src/nvim/mpack_bindings.h b/src/nvim/mpack_bindings.h
new file mode 100644
index 0000000..abf1781
--- /dev/null
+++ b/src/nvim/mpack_bindings.h
@@ -0,0 +1,18 @@
+// Preserve the binding-only workaround used by the Zig 0.16 @cImport.
+// MPack's GCC _Pragma warning wrapper is not a declaration. Preload its
+// standard headers before hiding those macros so libc type selection stays
+// unchanged. The separately compiled C implementation keeps normal macros.
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#undef __GNUC__
+#undef __GNUC_MINOR__
+#define MPACK_EXTENSIONS 1
+#include 
diff --git a/src/nvim/session_probe.zig b/src/nvim/session_probe.zig
index 46d910c..4efcf26 100644
--- a/src/nvim/session_probe.zig
+++ b/src/nvim/session_probe.zig
@@ -363,7 +363,7 @@ fn runHostShutdownProbe(io: std.Io, allocator: std.mem.Allocator, executable: []
 }
 
 fn processExists(process_id: std.process.Child.Id) !bool {
-    std.posix.kill(process_id, @enumFromInt(0)) catch |err| switch (err) {
+    std.posix.kill(process_id, @fromBackingInt(@intCast(0))) catch |err| switch (err) {
         error.ProcessNotFound => return false,
         error.PermissionDenied => return true,
         else => return err,
diff --git a/src/nvim_editor.zig b/src/nvim_editor.zig
index 6ec6d1a..87ebf6d 100644
--- a/src/nvim_editor.zig
+++ b/src/nvim_editor.zig
@@ -153,11 +153,7 @@ const EnabledController = struct {
                 "../share/rayslides/fonts/JetBrainsMono-Regular.ttf",
                 "../Resources/fonts/JetBrainsMono-Regular.ttf",
             }) |relative| {
-                const candidate = std.fmt.bufPrintZ(
-                    &candidate_buffer,
-                    "{s}/{s}",
-                    .{ executable_dir[0..executable_dir_len], relative },
-                ) catch continue;
+                const candidate = std.mem.printSentinel(&candidate_buffer, "{s}/{s}", .{ executable_dir[0..executable_dir_len], relative }, 0) catch continue;
                 if (loadEditorFont(candidate, editor_fontchars, font_load_size)) |loaded| {
                     font = loaded;
                     owns_font = true;
@@ -314,11 +310,7 @@ const EnabledController = struct {
                 ".local/share/mise/shims/nvim",
                 ".asdf/shims/nvim",
             }, 0..) |relative, index| {
-                const candidate = std.fmt.bufPrintZ(
-                    &home_candidate_buffers[index],
-                    "{s}/{s}",
-                    .{ home, relative },
-                ) catch continue;
+                const candidate = std.mem.printSentinel(&home_candidate_buffers[index], "{s}/{s}", .{ home, relative }, 0) catch continue;
                 candidates[candidate_count] = candidate;
                 candidate_count += 1;
             }
@@ -734,7 +726,7 @@ const EnabledController = struct {
         if (!ctrl and !alt and !super) return;
         var index: usize = 0;
         while (index < 26) : (index += 1) {
-            const key: rl.KeyboardKey = @enumFromInt(@intFromEnum(rl.KeyboardKey.a) + @as(c_int, @intCast(index)));
+            const key: rl.KeyboardKey = @fromBackingInt(@intCast(@backingInt(rl.KeyboardKey.a) + @as(c_int, @intCast(index))));
             if (!keyTriggered(key)) continue;
             var name = [_]u8{0};
             name[0] = @as(u8, 'a') + @as(u8, @intCast(index));
diff --git a/src/parser.zig b/src/parser.zig
index c954d92..7fd3f7e 100644
--- a/src/parser.zig
+++ b/src/parser.zig
@@ -47,9 +47,9 @@ pub const ParserErrorContext = struct {
             return txt.ptr;
         }
         if (self.message) |msg| {
-            self.formatted = try std.fmt.allocPrintZ(allocator, "line {d}: {s} ({s})", .{ self.line_number, self.parser_error, msg });
+            self.formatted = try std.fmt.allocPrintSentinel(allocator, "line {d}: {s} ({s})", .{ self.line_number, self.parser_error, msg }, 0);
         } else {
-            self.formatted = try std.fmt.allocPrintZ(allocator, "line {d}: {s}", .{ self.line_number, self.parser_error });
+            self.formatted = try std.fmt.allocPrintSentinel(allocator, "line {d}: {s}", .{ self.line_number, self.parser_error }, 0);
         }
 
         return self.formatted.?.ptr;
@@ -509,7 +509,7 @@ pub fn constructSlidesFromBuf(input: []const u8, slideshow: *slides.SlideShow, a
     var context: *ParserContext = try ParserContext.new(allocator);
     context.slideshow = slideshow;
 
-    context.input = try allocator.dupeZ(u8, input);
+    context.input = try allocator.dupeSentinel(u8, input, 0);
     log.info("input len: {d}, context.input len: {d}", .{ input.len, context.input.len });
     // log.info("input is: {s}", .{context.input});
 
diff --git a/src/presenter.zig b/src/presenter.zig
index f49e2e2..8785087 100644
--- a/src/presenter.zig
+++ b/src/presenter.zig
@@ -2,11 +2,7 @@ const std = @import("std");
 const builtin = @import("builtin");
 const slides = @import("slides.zig");
 
-const network_c = if (builtin.os.tag == .windows) struct {} else @cImport({
-    @cInclude("ifaddrs.h");
-    @cInclude("net/if.h");
-    @cInclude("netinet/in.h");
-});
+const network_c = if (builtin.os.tag == .windows) struct {} else @import("network_c");
 
 const WindowsNetwork = struct {
     const windows = std.os.windows;
diff --git a/src/presenter_network.h b/src/presenter_network.h
new file mode 100644
index 0000000..b0cb00c
--- /dev/null
+++ b/src/presenter_network.h
@@ -0,0 +1,3 @@
+#include 
+#include 
+#include 
diff --git a/src/qrcode.zig b/src/qrcode.zig
index 61138f1..43ead61 100644
--- a/src/qrcode.zig
+++ b/src/qrcode.zig
@@ -1,8 +1,6 @@
 const std = @import("std");
 
-const c = @cImport({
-    @cInclude("qrcodegen.h");
-});
+const c = @import("qrcodegen_c");
 
 pub const Code = struct {
     temp: [c.qrcodegen_BUFFER_LEN_MAX]u8 = @splat(0),
diff --git a/src/renderer.zig b/src/renderer.zig
index bc0deda..26e878b 100644
--- a/src/renderer.zig
+++ b/src/renderer.zig
@@ -202,6 +202,7 @@ const RenderFingerprinter = struct {
     }
 
     fn addF32(self: *RenderFingerprinter, value: f32) void {
+        // Scalar IEEE-754 value bits; no array lanes or memory-byte conversion.
         self.addScalar(@as(u32, @bitCast(value)));
     }
 
@@ -235,8 +236,8 @@ const RenderFingerprinter = struct {
     fn addItemAnimation(self: *RenderFingerprinter, value: ?animation.ItemSpec) void {
         self.addBool(value != null);
         if (value) |spec| {
-            self.addScalar(@as(u8, @intFromEnum(spec.effect)));
-            self.addScalar(@as(u8, @intFromEnum(spec.by)));
+            self.addScalar(@as(u8, @backingInt(spec.effect)));
+            self.addScalar(@as(u8, @backingInt(spec.by)));
             self.addOptionalF32(spec.after);
             self.addF32(spec.duration);
         }
@@ -245,7 +246,7 @@ const RenderFingerprinter = struct {
     fn addMorphSpec(self: *RenderFingerprinter, spec: animation.MorphSpec) void {
         self.addOptionalF32(spec.after);
         self.addF32(spec.duration);
-        self.addScalar(@as(u8, @intFromEnum(spec.easing)));
+        self.addScalar(@as(u8, @backingInt(spec.easing)));
     }
 
     fn addTextShadow(self: *RenderFingerprinter, value: ?slides.TextShadow) void {
@@ -260,7 +261,7 @@ const RenderFingerprinter = struct {
     fn addCrowd(self: *RenderFingerprinter, value: ?slides.CrowdSpec) void {
         self.addBool(value != null);
         if (value) |crowd| {
-            self.addScalar(@as(u8, @intFromEnum(crowd.kind)));
+            self.addScalar(@as(u8, @backingInt(crowd.kind)));
             self.addString(crowd.id);
             self.addString(crowd.prompt);
             self.addScalar(crowd.choices.len);
@@ -271,15 +272,15 @@ const RenderFingerprinter = struct {
 
     fn addItem(self: *RenderFingerprinter, item: slides.SlideItem) void {
         self.addScalar(item.identity);
-        self.addScalar(@as(u8, @intFromEnum(item.kind)));
+        self.addScalar(@as(u8, @backingInt(item.kind)));
         self.addOptionalString(item.text);
         self.addOptionalI32(item.fontSize);
         self.addOptionalF32(item.line_height_factor);
-        self.addScalar(@as(u8, @intFromEnum(item.text_alignment)));
-        self.addScalar(@as(u8, @intFromEnum(item.text_vertical_alignment)));
+        self.addScalar(@as(u8, @backingInt(item.text_alignment)));
+        self.addScalar(@as(u8, @backingInt(item.text_vertical_alignment)));
         self.addF32(item.corner_radius);
         self.addF32(item.line_width);
-        self.addScalar(@as(u8, @intFromEnum(item.line_direction)));
+        self.addScalar(@as(u8, @backingInt(item.line_direction)));
         self.addBool(item.line_arrow_start);
         self.addBool(item.line_arrow_end);
         self.addF32(item.rotation);
@@ -289,14 +290,14 @@ const RenderFingerprinter = struct {
         self.addOptionalString(item.vid_path);
         self.addBool(item.vid_is_camera);
         self.addVector(item.vid_camera_size);
-        self.addScalar(@as(u8, @intFromEnum(item.vid_camera_format)));
+        self.addScalar(@as(u8, @backingInt(item.vid_camera_format)));
         self.addOptionalString(item.vid_camera_poster);
         self.addBool(item.vid_autoplay);
         self.addBool(item.vid_loop);
         self.addOptionalF32(item.vid_poster);
         self.addF32(item.vid_volume);
         self.addBool(item.vid_muted);
-        self.addScalar(@as(u8, @intFromEnum(item.media_fit)));
+        self.addScalar(@as(u8, @backingInt(item.media_fit)));
         self.addVector(item.media_focus);
         self.addVector(item.position);
         self.addVector(item.size);
@@ -320,7 +321,7 @@ const RenderFingerprinter = struct {
 fn renderInputFingerprint(slide: *const slides.Slide, slideshow_filp: []const u8) u64 {
     var hash = RenderFingerprinter{};
     hash.addString(slideshow_filp);
-    hash.addScalar(@as(u8, @intFromEnum(slide.transition.effect)));
+    hash.addScalar(@as(u8, @backingInt(slide.transition.effect)));
     hash.addF32(slide.transition.duration);
     if (slide.items) |items| {
         hash.addScalar(items.items.len);
@@ -457,7 +458,7 @@ const VideoOverlayUi = struct {
 
 fn formatPlayerTime(buf: []u8, seconds: f64) [:0]const u8 {
     const total: u64 = @intFromFloat(@max(0, seconds));
-    return std.fmt.bufPrintZ(buf, "{d}:{d:0>2}", .{ total / 60, total % 60 }) catch "0:00";
+    return std.mem.printSentinel(buf, "{d}:{d:0>2}", .{ total / 60, total % 60 }, 0) catch "0:00";
 }
 
 pub const SlideshowRenderer = struct {
@@ -513,7 +514,7 @@ pub const SlideshowRenderer = struct {
     }
 
     fn ownRenderedText(self: *SlideshowRenderer, render_slide: *RenderedSlide, text: []const u8) ![:0]const u8 {
-        const owned = try self.allocator.dupeZ(u8, text);
+        const owned = try self.allocator.dupeSentinel(u8, text, 0);
         errdefer self.allocator.free(owned);
         try render_slide.owned_text.append(self.allocator, owned);
         return owned;
@@ -2671,7 +2672,7 @@ pub const SlideshowRenderer = struct {
         rl.drawRectangleRounded(panel, 0.04, 16, colorWithOpacity(.{ .r = 10, .g = 13, .b = 27, .a = 242 }, opacity));
         rl.drawRectangleRoundedLinesEx(panel, 0.04, 16, @max(1.0, 2.0 * scale), colorWithOpacity(.{ .r = 105, .g = 112, .b = 255, .a = 110 }, opacity));
 
-        const connected_text = std.fmt.bufPrintZ(&crowd_text_buffer_a, "{d} live", .{snapshot.connected}) catch return;
+        const connected_text = std.mem.printSentinel(&crowd_text_buffer_a, "{d} live", .{snapshot.connected}, 0) catch return;
         const pulse = @as(f32, 0.72) + @as(f32, 0.28) * std.math.sin(@as(f32, @floatCast(rl.getTime())) * 3.0);
         rl.drawCircleV(.{ .x = panel.x + panel.width - 194 * scale, .y = panel.y + 54 * scale }, (7.0 + pulse * 2.0) * scale, colorWithOpacity(.{ .r = 77, .g = 255, .b = 181, .a = 255 }, opacity));
         drawCrowdText(self.fonts, self.fonts.bold, connected_text, .{ .x = panel.x + panel.width - 172 * scale, .y = panel.y + 35 * scale }, 30 * scale, colorWithOpacity(.{ .r = 205, .g = 255, .b = 232, .a = 255 }, opacity));
@@ -2685,7 +2686,7 @@ pub const SlideshowRenderer = struct {
     fn renderCrowdJoin(self: *SlideshowRenderer, spec: slides.CrowdSpec, snapshot: crowdplay.Snapshot, crowd_url: []const u8, panel: rl.Rectangle, scale: f32, opacity: f32) void {
         const eyebrow = "CROWDPLAY\x00";
         drawCrowdText(self.fonts, self.fonts.bold, eyebrow, .{ .x = panel.x + 72 * scale, .y = panel.y + 52 * scale }, 24 * scale, colorWithOpacity(.{ .r = 147, .g = 156, .b = 255, .a = 255 }, opacity));
-        const prompt = std.fmt.bufPrintZ(&crowd_text_buffer_b, "{s}", .{spec.prompt}) catch return;
+        const prompt = std.mem.printSentinel(&crowd_text_buffer_b, "{s}", .{spec.prompt}, 0) catch return;
         drawCrowdTextFitted(self.fonts, self.fonts.bold, prompt, .{ .x = panel.x + 72 * scale, .y = panel.y + 116 * scale }, 62 * scale, panel.width - 144 * scale, colorWithOpacity(.white, opacity));
         drawCrowdText(self.fonts, self.fonts.normal, "Open this address on your phone\x00", .{ .x = panel.x + 74 * scale, .y = panel.y + 214 * scale }, 28 * scale, colorWithOpacity(.{ .r = 177, .g = 185, .b = 214, .a = 255 }, opacity));
 
@@ -2698,7 +2699,7 @@ pub const SlideshowRenderer = struct {
         };
         const url_panel = rl.Rectangle{ .x = panel.x + 72 * scale, .y = panel.y + 278 * scale, .width = panel.width - qr_side - 190 * scale, .height = 116 * scale };
         rl.drawRectangleRounded(url_panel, 0.16, 12, colorWithOpacity(.{ .r = 24, .g = 29, .b = 54, .a = 255 }, opacity));
-        const url = std.fmt.bufPrintZ(&crowd_text_buffer_a, "{s}", .{if (crowd_url.len > 0) crowd_url else "Crowdplay server unavailable"}) catch return;
+        const url = std.mem.printSentinel(&crowd_text_buffer_a, "{s}", .{if (crowd_url.len > 0) crowd_url else "Crowdplay server unavailable"}, 0) catch return;
         drawCrowdTextFitted(self.fonts, self.fonts.bold, url, .{ .x = url_panel.x + 34 * scale, .y = url_panel.y + 34 * scale }, 34 * scale, url_panel.width - 68 * scale, colorWithOpacity(.{ .r = 113, .g = 242, .b = 255, .a = 255 }, opacity));
         if (crowd_url.len > 0 and self.qr_code.ensure(crowd_url)) drawQrCode(&self.qr_code, qr_region, opacity);
 
@@ -2708,7 +2709,7 @@ pub const SlideshowRenderer = struct {
             .width = panel.width * 0.34,
             .height = panel.height * 0.22,
         }, scale, opacity);
-        const people = std.fmt.bufPrintZ(&crowd_text_buffer_b, "{d} {s} in the room", .{ snapshot.connected, if (snapshot.connected == 1) "person" else "people" }) catch return;
+        const people = std.mem.printSentinel(&crowd_text_buffer_b, "{d} {s} in the room", .{ snapshot.connected, if (snapshot.connected == 1) "person" else "people" }, 0) catch return;
         const measured = self.fonts.measureTextWithFallback(self.fonts.bold, people, 34 * scale, 0);
         drawCrowdText(self.fonts, self.fonts.bold, people, .{ .x = panel.x + (panel.width - measured.x) / 2, .y = panel.y + panel.height - 92 * scale }, 34 * scale, colorWithOpacity(.{ .r = 205, .g = 211, .b = 239, .a = 255 }, opacity));
     }
@@ -2725,10 +2726,10 @@ pub const SlideshowRenderer = struct {
 
         const poll_label = if (!available) "POLL OFFLINE\x00" else if (open) "LIVE POLL\x00" else "POLL LOCKED\x00";
         drawCrowdText(self.fonts, self.fonts.bold, poll_label, .{ .x = panel.x + 64 * scale, .y = panel.y + 42 * scale }, 23 * scale, colorWithOpacity(if (!available) .{ .r = 255, .g = 107, .b = 133, .a = 255 } else if (open) .{ .r = 77, .g = 255, .b = 181, .a = 255 } else .{ .r = 255, .g = 178, .b = 87, .a = 255 }, opacity));
-        const question = std.fmt.bufPrintZ(&crowd_text_buffer_a, "{s}", .{spec.prompt}) catch return;
+        const question = std.mem.printSentinel(&crowd_text_buffer_a, "{s}", .{spec.prompt}, 0) catch return;
         drawCrowdTextFitted(self.fonts, self.fonts.bold, question, .{ .x = panel.x + 64 * scale, .y = panel.y + 92 * scale }, 48 * scale, panel.width - 128 * scale, colorWithOpacity(.white, opacity));
 
-        const total_text = std.fmt.bufPrintZ(&crowd_text_buffer_b, "{d} {s}", .{ total, if (total == 1) "vote" else "votes" }) catch return;
+        const total_text = std.mem.printSentinel(&crowd_text_buffer_b, "{d} {s}", .{ total, if (total == 1) "vote" else "votes" }, 0) catch return;
         drawCrowdText(self.fonts, self.fonts.normal, total_text, .{ .x = panel.x + 66 * scale, .y = panel.y + 160 * scale }, 24 * scale, colorWithOpacity(.{ .r = 173, .g = 180, .b = 211, .a = 255 }, opacity));
 
         const count: usize = @min(spec.choices.len, crowdplay.max_choices);
@@ -2755,12 +2756,12 @@ pub const SlideshowRenderer = struct {
                 rl.drawRectangleRounded(fill, 0.14, 10, colorWithOpacity(accent, opacity * 0.42));
             }
             rl.drawRectangleRoundedLinesEx(card, 0.14, 10, @max(1.0, 1.5 * scale), colorWithOpacity(accent, opacity * 0.52));
-            const choice = std.fmt.bufPrintZ(&crowd_text_buffer_a, "{s}", .{choice_label}) catch continue;
+            const choice = std.mem.printSentinel(&crowd_text_buffer_a, "{s}", .{choice_label}, 0) catch continue;
             const label_width = card.width - (if (revealed) 245 * scale else 54 * scale);
             drawCrowdTextFitted(self.fonts, self.fonts.bold, choice, .{ .x = card.x + 27 * scale, .y = card.y + (card.height - 30 * scale) / 2 }, 28 * scale, label_width, colorWithOpacity(.white, opacity));
             if (revealed) {
                 const percent: u32 = if (total > 0) @intFromFloat(@round(fraction * 100.0)) else 0;
-                const result = std.fmt.bufPrintZ(&crowd_text_buffer_b, "{d}%  ·  {d}", .{ percent, votes }) catch continue;
+                const result = std.mem.printSentinel(&crowd_text_buffer_b, "{d}%  ·  {d}", .{ percent, votes }, 0) catch continue;
                 const measured = self.fonts.measureTextWithFallback(self.fonts.bold, result, 27 * scale, 0);
                 drawCrowdText(self.fonts, self.fonts.bold, result, .{ .x = card.x + card.width - measured.x - 26 * scale, .y = card.y + (card.height - 29 * scale) / 2 }, 27 * scale, colorWithOpacity(accent, opacity));
             }
@@ -3820,7 +3821,7 @@ test "repeated preRender releases slides morph scenes plans and owned text" {
         try std.testing.expectEqual(@as(usize, 1), rendered_slide.morph_scenes.items.len);
         try std.testing.expectEqual(@as(usize, 1), rendered_slide.steps.items.len);
         _ = try renderer.ownRenderedText(rendered_slide, "owned base text");
-        const scene_text = try allocator.dupeZ(u8, "owned morph text");
+        const scene_text = try allocator.dupeSentinel(u8, "owned morph text", 0);
         errdefer allocator.free(scene_text);
         try rendered_slide.morph_scenes.items[0].owned_text.append(allocator, scene_text);
     }
@@ -4843,3 +4844,13 @@ test "reveal transforms clamp opacity for overshooting easings" {
     const done = itemAnimationTransform(.fade, 1.0, size, size);
     try std.testing.expectApproxEqAbs(@as(f32, 1.0), done.opacity, 0.0001);
 }
+
+test "render fingerprints retain literal IEEE-754 scalar bits" {
+    var actual: RenderFingerprinter = .{};
+    var expected: RenderFingerprinter = .{};
+    actual.addF32(1.0);
+    actual.addF32(-0.0);
+    expected.addScalar(@as(u32, 0x3f800000));
+    expected.addScalar(@as(u32, 0x80000000));
+    try std.testing.expectEqual(expected.value, actual.value);
+}
diff --git a/src/source_editor.zig b/src/source_editor.zig
index 8fd2aed..49651e2 100644
--- a/src/source_editor.zig
+++ b/src/source_editor.zig
@@ -5389,8 +5389,8 @@ fn setPropertyOverride(overrides: *InheritedPropertyOverrides, property: Inherit
 }
 
 fn propertyForKey(key: []const u8) ?InheritedProperty {
-    inline for (std.meta.fields(InheritedProperty)) |field| {
-        const property: InheritedProperty = @enumFromInt(field.value);
+    inline for (@typeInfo(InheritedProperty).@"enum".field_names) |name| {
+        const property: InheritedProperty = @field(InheritedProperty, name);
         if (std.mem.eql(u8, key, propertyKey(property))) return property;
     }
     return null;
@@ -5422,8 +5422,8 @@ fn propertyOverridesOnDirective(
 }
 
 fn mergePropertyOverrides(target: *InheritedPropertyOverrides, source: InheritedPropertyOverrides) void {
-    inline for (std.meta.fields(InheritedProperty)) |field| {
-        const property: InheritedProperty = @enumFromInt(field.value);
+    inline for (@typeInfo(InheritedProperty).@"enum".field_names) |name| {
+        const property: InheritedProperty = @field(InheritedProperty, name);
         if (source.contains(property)) setPropertyOverride(target, property);
     }
 }
diff --git a/src/studio.zig b/src/studio.zig
index 720b97a..7c82337 100644
--- a/src/studio.zig
+++ b/src/studio.zig
@@ -1701,11 +1701,11 @@ pub const PropertyOverrideSet = struct {
     }
 
     pub fn set(self: *PropertyOverrideSet, property: AuthoredProperty) void {
-        self.bits |= @as(u32, 1) << @intCast(@intFromEnum(property));
+        self.bits |= @as(u32, 1) << @intCast(@backingInt(property));
     }
 
     pub fn contains(self: PropertyOverrideSet, property: AuthoredProperty) bool {
-        return self.bits & (@as(u32, 1) << @intCast(@intFromEnum(property))) != 0;
+        return self.bits & (@as(u32, 1) << @intCast(@backingInt(property))) != 0;
     }
 
     pub fn empty(self: PropertyOverrideSet) bool {
@@ -1866,7 +1866,7 @@ pub const StateChangeSummary = struct {
     label: []const u8 = "",
     kind: StateChangeKind,
     /// Attribute keys of the effective `@set/@show/@hide` line, e.g. "x, y".
-    keys: [48]u8 = [_]u8{0} ** 48,
+    keys: [48]u8 = @splat(0),
     keys_len: u8 = 0,
     /// The renderer cross-fades this object instead of interpolating it.
     cross_fades: bool = false,
@@ -2072,7 +2072,7 @@ pub const LibraryVisualItem = struct {
 pub const LibraryVisual = struct {
     available: bool = false,
     content_bounds: rl.Rectangle = .{ .x = 0, .y = 0, .width = 1920, .height = 1080 },
-    items: [max_library_visual_items]LibraryVisualItem = [_]LibraryVisualItem{.{}} ** max_library_visual_items,
+    items: [max_library_visual_items]LibraryVisualItem = @splat(.{}),
     item_count: usize = 0,
     total_item_count: usize = 0,
 };
@@ -2264,7 +2264,7 @@ pub const UiLayout = struct {
     duplicate_item: rl.Rectangle,
     delete_item: rl.Rectangle,
     promote: rl.Rectangle,
-    geometry_fields: [4]rl.Rectangle = [_]rl.Rectangle{empty_ui_rectangle} ** 4,
+    geometry_fields: [4]rl.Rectangle = @splat(empty_ui_rectangle),
     foreground_swatches: [palette.len]rl.Rectangle,
     custom_foreground: rl.Rectangle = empty_ui_rectangle,
     background_swatches: [palette.len]rl.Rectangle,
@@ -2273,12 +2273,12 @@ pub const UiLayout = struct {
     font_size: rl.Rectangle = empty_ui_rectangle,
     rotation: rl.Rectangle = empty_ui_rectangle,
     opacity: rl.Rectangle = empty_ui_rectangle,
-    media_fit_buttons: [3]rl.Rectangle = [_]rl.Rectangle{empty_ui_rectangle} ** 3,
+    media_fit_buttons: [3]rl.Rectangle = @splat(empty_ui_rectangle),
     /// Layout-mode media scalars share one row in source order: focus X,
     /// focus Y, rotation, opacity. Keeping all four cells equal prevents the
     /// focal values from being squeezed inside the ordinary three-column
     /// font/rotation/opacity layout.
-    media_scalar_fields: [4]rl.Rectangle = [_]rl.Rectangle{empty_ui_rectangle} ** 4,
+    media_scalar_fields: [4]rl.Rectangle = @splat(empty_ui_rectangle),
     inline_error: rl.Rectangle = empty_ui_rectangle,
     align_buttons: [6]rl.Rectangle,
     distribute_buttons: [2]rl.Rectangle,
@@ -2290,7 +2290,7 @@ fn emptyUiLayout(scale: f32) UiLayout {
     return .{
         .scale = scale,
         .toolbar = empty_ui_rectangle,
-        .tool_buttons = [_]rl.Rectangle{empty_ui_rectangle} ** 8,
+        .tool_buttons = @splat(empty_ui_rectangle),
         .new_slide = empty_ui_rectangle,
         .grid_toggle = empty_ui_rectangle,
         .grid_settings_toggle = empty_ui_rectangle,
@@ -2302,12 +2302,12 @@ fn emptyUiLayout(scale: f32) UiLayout {
         .duplicate_item = empty_ui_rectangle,
         .delete_item = empty_ui_rectangle,
         .promote = empty_ui_rectangle,
-        .foreground_swatches = [_]rl.Rectangle{empty_ui_rectangle} ** palette.len,
-        .background_swatches = [_]rl.Rectangle{empty_ui_rectangle} ** palette.len,
+        .foreground_swatches = @splat(empty_ui_rectangle),
+        .background_swatches = @splat(empty_ui_rectangle),
         .clear_background = empty_ui_rectangle,
-        .align_buttons = [_]rl.Rectangle{empty_ui_rectangle} ** 6,
-        .distribute_buttons = [_]rl.Rectangle{empty_ui_rectangle} ** 2,
-        .layer_buttons = [_]rl.Rectangle{empty_ui_rectangle} ** 4,
+        .align_buttons = @splat(empty_ui_rectangle),
+        .distribute_buttons = @splat(empty_ui_rectangle),
+        .layer_buttons = @splat(empty_ui_rectangle),
         .lock_item = empty_ui_rectangle,
     };
 }
@@ -2420,7 +2420,7 @@ fn emptyWorkspaceLayout() WorkspaceLayout {
         .scale = 1,
         .sidebar = empty_frame_rectangle,
         .organizer = empty_frame_rectangle,
-        .organizer_actions = [_]rl.Rectangle{empty_frame_rectangle} ** organizer_action_count,
+        .organizer_actions = @splat(empty_frame_rectangle),
         .slide_cards_clip = empty_frame_rectangle,
         .slide_page_status = empty_frame_rectangle,
         .slide_page_previous = empty_frame_rectangle,
@@ -2898,7 +2898,7 @@ fn emptyObjectsLayout() ObjectsLayout {
         .objects_tab = empty_frame_rectangle,
         .properties_tab = empty_frame_rectangle,
         .motion_tab = empty_frame_rectangle,
-        .layer_actions = [_]rl.Rectangle{empty_frame_rectangle} ** 4,
+        .layer_actions = @splat(empty_frame_rectangle),
         .rows_clip = empty_frame_rectangle,
         .page_status = empty_frame_rectangle,
         .page_previous = empty_frame_rectangle,
@@ -3042,12 +3042,12 @@ pub const MotionLayout = struct {
     panel: rl.Rectangle = empty_frame_rectangle,
     /// Context line: "REVEAL · Direct" / "Select an object".
     context: rl.Rectangle = empty_frame_rectangle,
-    trigger: [motion_trigger_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_trigger_count,
-    effect: [motion_effect_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_effect_count,
-    grouping: [motion_choice_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_choice_count,
+    trigger: [motion_trigger_count]rl.Rectangle = @splat(empty_frame_rectangle),
+    effect: [motion_effect_count]rl.Rectangle = @splat(empty_frame_rectangle),
+    grouping: [motion_choice_count]rl.Rectangle = @splat(empty_frame_rectangle),
     /// DELAY, AFTER, DUR inline fields.
-    fields: [3]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 3,
-    easing: [motion_choice_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_choice_count,
+    fields: [3]rl.Rectangle = @splat(empty_frame_rectangle),
+    easing: [motion_choice_count]rl.Rectangle = @splat(empty_frame_rectangle),
     build_bullets: rl.Rectangle = empty_frame_rectangle,
     remove_reveal: rl.Rectangle = empty_frame_rectangle,
     summary: rl.Rectangle = empty_frame_rectangle,
@@ -3057,22 +3057,22 @@ pub const MotionLayout = struct {
     /// State section (drawn instead of the reveal section in a morph scene):
     /// LABEL, AFTER, DUR fields; Click/Auto strip; easing strip; object info
     /// line; Reset + Exit L/R/U/D; change rows.
-    state_fields: [3]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 3,
-    state_trigger: [2]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 2,
-    state_easing: [motion_choice_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_choice_count,
+    state_fields: [3]rl.Rectangle = @splat(empty_frame_rectangle),
+    state_trigger: [2]rl.Rectangle = @splat(empty_frame_rectangle),
+    state_easing: [motion_choice_count]rl.Rectangle = @splat(empty_frame_rectangle),
     state_object_info: rl.Rectangle = empty_frame_rectangle,
-    state_actions: [5]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 5,
+    state_actions: [5]rl.Rectangle = @splat(empty_frame_rectangle),
     state_changes_heading: rl.Rectangle = empty_frame_rectangle,
-    state_change_rows: [max_state_change_rows]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** max_state_change_rows,
+    state_change_rows: [max_state_change_rows]rl.Rectangle = @splat(empty_frame_rectangle),
     state_change_row_count: usize = 0,
     /// Transition section (base scene, nothing selected): Inherit + None +
     /// six effects in a 3x3 grid, DUR field, easing strip, deck default row.
-    transition_effects: [8]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 8,
+    transition_effects: [8]rl.Rectangle = @splat(empty_frame_rectangle),
     transition_duration: rl.Rectangle = empty_frame_rectangle,
-    transition_easing: [motion_choice_count]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** motion_choice_count,
+    transition_easing: [motion_choice_count]rl.Rectangle = @splat(empty_frame_rectangle),
     transition_info: rl.Rectangle = empty_frame_rectangle,
     transition_deck_info: rl.Rectangle = empty_frame_rectangle,
-    transition_deck_actions: [2]rl.Rectangle = [_]rl.Rectangle{empty_frame_rectangle} ** 2,
+    transition_deck_actions: [2]rl.Rectangle = @splat(empty_frame_rectangle),
 };
 
 pub const max_state_change_rows: usize = 8;
@@ -4014,7 +4014,7 @@ pub fn morphTimelineLayout(viewport: Viewport) MorphTimelineLayout {
         .scale = 1,
         .panel = empty_frame_rectangle,
         .cards_clip = empty_frame_rectangle,
-        .actions = [_]rl.Rectangle{empty_frame_rectangle} ** morph_timeline_action_count,
+        .actions = @splat(empty_frame_rectangle),
         .card_width = 0,
         .card_gap = 0,
         .compact = true,
@@ -4206,7 +4206,7 @@ pub fn morphTimelineCardRect(layout: MorphTimelineLayout, visible_slot: usize) ?
 /// A testable input snapshot. `updateFromRaylib` is the convenient runtime
 /// adapter; tests and other frontends can call `update` directly.
 pub const FrameInput = struct {
-    inline_chars: [256]u8 = [_]u8{0} ** 256,
+    inline_chars: [256]u8 = @splat(0),
     inline_chars_len: usize = 0,
     inline_paste: ?[]const u8 = null,
     inline_backspace_pressed: bool = false,
@@ -4481,7 +4481,7 @@ const DefinitionModeState = struct {
     workspace_index: usize,
     kind: LibraryEntryKind,
     use_count: usize,
-    name: [max_definition_name_bytes + 1]u8 = [_]u8{0} ** (max_definition_name_bytes + 1),
+    name: [max_definition_name_bytes + 1]u8 = @splat(0),
     name_len: usize = 0,
     return_selected_identity: ?usize = null,
     return_selected_source: ?slides.SourceRef = null,
@@ -4493,11 +4493,8 @@ const DefinitionModeState = struct {
     return_canvas_center: rl.Vector2 = .{ .x = default_logical_size.x / 2, .y = default_logical_size.y / 2 },
     return_active_dock: DockPanel = .slides,
     return_inspector_panel: InspectorPanel = .objects,
-    pending_selection_ids: [max_selection_items][max_definition_selection_id_bytes + 1]u8 =
-        [_][max_definition_selection_id_bytes + 1]u8{
-            [_]u8{0} ** (max_definition_selection_id_bytes + 1),
-        } ** max_selection_items,
-    pending_selection_lengths: [max_selection_items]usize = [_]usize{0} ** max_selection_items,
+    pending_selection_ids: [max_selection_items][max_definition_selection_id_bytes + 1]u8 = @splat(@splat(0)),
+    pending_selection_lengths: [max_selection_items]usize = @splat(0),
     pending_selection_count: usize = 0,
     /// ITEM definitions project exactly one editable object. Select it once
     /// when the detached scene first arrives so Properties is immediately
@@ -4556,8 +4553,8 @@ const InlineEditor = struct {
     field: InlineField = .x,
     target: CommandTarget = .{ .item_identity = 0, .source = .{} },
     targets: ItemBatchCommand = .{},
-    buffer: [max_inline_input_bytes + 1]u8 = [_]u8{0} ** (max_inline_input_bytes + 1),
-    opening_buffer: [max_inline_input_bytes + 1]u8 = [_]u8{0} ** (max_inline_input_bytes + 1),
+    buffer: [max_inline_input_bytes + 1]u8 = @splat(0),
+    opening_buffer: [max_inline_input_bytes + 1]u8 = @splat(0),
     len: usize = 0,
     opening_len: usize = 0,
     cursor: usize = 0,
@@ -4615,7 +4612,7 @@ const StatusRevealState = struct {
 
 const CommandPaletteState = struct {
     active: bool = false,
-    query: [max_command_query_bytes + 1]u8 = [_]u8{0} ** (max_command_query_bytes + 1),
+    query: [max_command_query_bytes + 1]u8 = @splat(0),
     len: usize = 0,
     selected_result: usize = 0,
     first_visible: usize = 0,
@@ -4632,7 +4629,7 @@ const SearchPanel = enum {
 };
 
 const PanelSearchState = struct {
-    query: [max_panel_search_bytes + 1]u8 = [_]u8{0} ** (max_panel_search_bytes + 1),
+    query: [max_panel_search_bytes + 1]u8 = @splat(0),
     len: usize = 0,
     select_all: bool = false,
     selected_result: usize = 0,
@@ -5358,7 +5355,7 @@ pub const Studio = struct {
 
         for (settings.appearance_buttons, 0..) |button, index| {
             if (!pointInRectangle(input.pointer_screen, button)) continue;
-            self.grid_appearance = @enumFromInt(index);
+            self.grid_appearance = @fromBackingInt(@intCast(index));
             self.grid_snapping = true;
             self.snap_guides = .{};
             return true;
@@ -5370,7 +5367,7 @@ pub const Studio = struct {
         }
         for (settings.style_buttons, 0..) |button, index| {
             if (!pointInRectangle(input.pointer_screen, button)) continue;
-            self.grid_style = @enumFromInt(index);
+            self.grid_style = @fromBackingInt(@intCast(index));
             self.grid_snapping = true;
             self.snap_guides = .{};
             return true;
@@ -10962,7 +10959,7 @@ pub const Studio = struct {
             if (self.inspector_panel == .objects) {
                 for (inspector.layer_actions, 0..) |button, index| {
                     if (pointInRectangle(pointer, button))
-                        return self.emitLayerCommand(items, @enumFromInt(index));
+                        return self.emitLayerCommand(items, @fromBackingInt(@intCast(index)));
                 }
                 if (pointInRectangle(pointer, inspector.page_status)) {
                     self.activatePanelSearch(.objects);
@@ -11061,9 +11058,9 @@ pub const Studio = struct {
         for (layout.geometry_fields, 0..) |button, index| {
             if (pointInRectangle(pointer, button))
                 return if (inline_properties)
-                    self.beginInlineEdit(items, resolved_bounds, @enumFromInt(index + 1), allow_shared_edit)
+                    self.beginInlineEdit(items, resolved_bounds, @fromBackingInt(@intCast(index + 1)), allow_shared_edit)
                 else
-                    self.emitPropertyRequest(items, allow_shared_edit, .{ .numeric_geometry = @enumFromInt(index) });
+                    self.emitPropertyRequest(items, allow_shared_edit, .{ .numeric_geometry = @fromBackingInt(@intCast(index)) });
         }
         if (selected_media) {
             if (selected_item.?.kind == .vid and pointInRectangle(pointer, mediaPageToggleRect(layout))) {
@@ -11202,16 +11199,16 @@ pub const Studio = struct {
                 if (selected_line) return true;
                 if (self.selectionAllTextboxes(items)) {
                     const change: TextAlignmentChange = if (index < 3)
-                        .{ .horizontal = @enumFromInt(index) }
+                        .{ .horizontal = @fromBackingInt(@intCast(index)) }
                     else
-                        .{ .vertical = @enumFromInt(index - 3) };
+                        .{ .vertical = @fromBackingInt(@intCast(index - 3)) };
                     return self.emitTextAlignment(items, allow_shared_edit, change);
                 }
                 self.pending_geometry_command = self.alignSelected(
                     items,
                     resolved_bounds,
                     viewport.logical_size,
-                    @enumFromInt(index),
+                    @fromBackingInt(@intCast(index)),
                     allow_shared_edit,
                 );
                 return true;
@@ -11222,7 +11219,7 @@ pub const Studio = struct {
                 self.distributeSelected(
                     items,
                     resolved_bounds,
-                    @enumFromInt(index),
+                    @fromBackingInt(@intCast(index)),
                     allow_shared_edit,
                 );
                 return true;
@@ -11230,7 +11227,7 @@ pub const Studio = struct {
         }
         for (layout.layer_buttons, 0..) |button, index| {
             if (pointInRectangle(pointer, button))
-                return self.emitLayerCommand(items, @enumFromInt(index));
+                return self.emitLayerCommand(items, @fromBackingInt(@intCast(index)));
         }
         if (pointInRectangle(pointer, layout.lock_item))
             return self.emitSelectedLockCommand(items, allow_shared_edit);
@@ -12961,9 +12958,9 @@ pub const Studio = struct {
             const rect = geometryToScreenRect(viewport, itemGeometry(item, resolved_bounds)) orelse continue;
             var text_buffer: [24]u8 = undefined;
             const text: [:0]const u8 = if (build.step_count == 1)
-                std.fmt.bufPrintZ(&text_buffer, "{d}", .{build.first_step}) catch "?"
+                std.mem.printSentinel(&text_buffer, "{d}", .{build.first_step}, 0) catch "?"
             else
-                std.fmt.bufPrintZ(&text_buffer, "{d}-{d}", .{ build.first_step, build.lastStep() }) catch "?";
+                std.mem.printSentinel(&text_buffer, "{d}-{d}", .{ build.first_step, build.lastStep() }, 0) catch "?";
             const text_width = self.measureUiText(text, badge_font);
             const padding = 6 * scale;
             const height = @as(f32, @floatFromInt(badge_font)) + 6 * scale;
@@ -13066,18 +13063,18 @@ pub const Studio = struct {
             const active = if (index == 0)
                 !any_reveal
             else
-                trigger != null and @intFromEnum(trigger.?) == index - 1;
+                trigger != null and @backingInt(trigger.?) == index - 1;
             const fitted_label: [:0]const u8 = if (index == 3 and layout.compact) "Clk>Auto" else label;
             drawToggleButton(self, cell, fitted_label, active);
         }
         for (layout.effect, motion_effect_labels, 0..) |cell, label, index| {
-            const active = common != null and @intFromEnum(common.?.effect) == index + 1;
+            const active = common != null and @backingInt(common.?.effect) == index + 1;
             drawToggleButton(self, cell, label, active);
         }
         const grouping_applies = selection_count == 1 and primary.kind == .textbox and primary.text != null;
         for (layout.grouping, motion_grouping_labels, 0..) |cell, label, index| {
             if (grouping_applies) {
-                drawToggleButton(self, cell, label, common != null and @intFromEnum(common.?.by) == index);
+                drawToggleButton(self, cell, label, common != null and @backingInt(common.?.by) == index);
             } else {
                 drawDisabledBadge(self, cell, label);
             }
@@ -13098,7 +13095,7 @@ pub const Studio = struct {
         }
         for (layout.easing, motion_easing_labels, 0..) |cell, label, index| {
             if (any_reveal) {
-                drawToggleButton(self, cell, label, common != null and @intFromEnum(common.?.easing) == index);
+                drawToggleButton(self, cell, label, common != null and @backingInt(common.?.easing) == index);
             } else {
                 drawDisabledBadge(self, cell, label);
             }
@@ -13200,7 +13197,7 @@ pub const Studio = struct {
             const value = if (active) self.inline_editor.text() else self.sceneInitialValue(.transition_duration, &scalar_buffer);
             self.drawInlineField(layout.transition_duration, "DUR", value, active, active and self.inline_editor.error_value != null, false, false, false, false, viewport);
             for (layout.transition_easing, motion_easing_labels, 0..) |cell, label, index| {
-                drawToggleButton(self, cell, label, @intFromEnum(summary.transition.easing) == index);
+                drawToggleButton(self, cell, label, @backingInt(summary.transition.easing) == index);
             }
         } else {
             drawDisabledBadge(self, layout.transition_duration, "DUR");
@@ -13277,7 +13274,7 @@ pub const Studio = struct {
                 self.notice = .property_unavailable;
                 return true;
             }
-            const easing: animation.Easing = @enumFromInt(index);
+            const easing: animation.Easing = @fromBackingInt(@intCast(index));
             if (summary.transition.easing != easing) {
                 self.cancelInlineEdit();
                 self.pending_semantic_command = .{ .set_slide_transition = .{ .easing = easing, .shared = allow_shared_edit } };
@@ -13339,7 +13336,7 @@ pub const Studio = struct {
         drawToggleButton(self, layout.state_trigger[0], state_trigger_labels[0], !automatic);
         drawToggleButton(self, layout.state_trigger[1], state_trigger_labels[1], automatic);
         for (layout.state_easing, motion_easing_labels, 0..) |cell, label, index| {
-            drawToggleButton(self, cell, label, summary != null and @intFromEnum(summary.?.easing) == index);
+            drawToggleButton(self, cell, label, summary != null and @backingInt(summary.?.easing) == index);
         }
 
         var info_buffer: [128]u8 = undefined;
@@ -13438,7 +13435,7 @@ pub const Studio = struct {
         }
         for (layout.state_easing, 0..) |cell, index| {
             if (!pointInRectangle(pointer, cell)) continue;
-            const easing: animation.Easing = @enumFromInt(index);
+            const easing: animation.Easing = @fromBackingInt(@intCast(index));
             if (summary != null and summary.?.easing != easing) {
                 self.cancelInlineEdit();
                 self.pending_semantic_command = .{ .set_morph_state_timing = .{ .state_index = state_index, .easing = easing } };
@@ -13489,12 +13486,12 @@ pub const Studio = struct {
         for (layout.trigger, 0..) |cell, index| {
             if (!pointInRectangle(pointer, cell)) continue;
             if (index == 0) return self.emitRevealCommand(items, .{ .action = .remove }, allow_shared_edit);
-            const trigger: RevealTrigger = @enumFromInt(index - 1);
+            const trigger: RevealTrigger = @fromBackingInt(@intCast(index - 1));
             return self.emitRevealCommand(items, .{ .patch = .{ .trigger = trigger }, .template = template }, allow_shared_edit);
         }
         for (layout.effect, 0..) |cell, index| {
             if (!pointInRectangle(pointer, cell)) continue;
-            const effect: animation.Effect = @enumFromInt(index + 1);
+            const effect: animation.Effect = @fromBackingInt(@intCast(index + 1));
             return self.emitRevealCommand(items, .{ .patch = .{ .effect = effect }, .template = template }, allow_shared_edit);
         }
         const primary_index = self.selectedIndex(items) orelse return true;
@@ -13506,7 +13503,7 @@ pub const Studio = struct {
                 self.notice = .property_unavailable;
                 return true;
             }
-            const by: animation.Grouping = @enumFromInt(index);
+            const by: animation.Grouping = @fromBackingInt(@intCast(index));
             return self.emitRevealCommand(items, .{ .patch = .{ .by = by }, .template = template }, allow_shared_edit);
         }
         if (motionFieldAtPoint(layout, pointer)) |field| {
@@ -13524,7 +13521,7 @@ pub const Studio = struct {
                 self.notice = .property_unavailable;
                 return true;
             }
-            const easing: animation.Easing = @enumFromInt(index);
+            const easing: animation.Easing = @fromBackingInt(@intCast(index));
             return self.emitRevealCommand(items, .{ .patch = .{ .easing = easing }, .template = template }, allow_shared_edit);
         }
         if (pointInRectangle(pointer, layout.build_bullets)) return self.emitBuildBullets(items, allow_shared_edit);
@@ -13696,7 +13693,7 @@ pub const Studio = struct {
         rl.drawRectangleLinesEx(left, 1, .{ .r = 80, .g = 215, .b = 255, .a = 145 });
         rl.drawRectangleRec(.{ .x = corner.x, .y = corner.y, .width = 3 * scale, .height = corner.height }, .{ .r = 255, .g = 92, .b = 198, .a = 255 });
         var zoom_buffer: [16]u8 = undefined;
-        const zoom_label = std.fmt.bufPrintZ(&zoom_buffer, "{d:.1}×", .{self.canvas_zoom}) catch "×";
+        const zoom_label = std.mem.printSentinel(&zoom_buffer, "{d:.1}×", .{self.canvas_zoom}, 0) catch "×";
         self.drawUiText(
             zoom_label,
             .{ .x = corner.x + 5 * scale, .y = corner.y + (corner.height - @as(f32, @floatFromInt(scaledUiFont(scale, UiTypography.compact)))) / 2 },
@@ -13760,7 +13757,7 @@ pub const Studio = struct {
         self.drawDistanceMeasurement(viewport, .{ .x = rect.x + rect.width / 2, .y = rect.y + rect.height }, .{ .x = rect.x + rect.width / 2, .y = slide_rect.y + slide_rect.height }, viewport.logical_size.y - geometry.position.y - geometry.size.y, cyan);
 
         var size_buffer: [64]u8 = undefined;
-        const size_text = std.fmt.bufPrintZ(&size_buffer, "{d:.0} × {d:.0}", .{ geometry.size.x, geometry.size.y }) catch return;
+        const size_text = std.mem.printSentinel(&size_buffer, "{d:.0} × {d:.0}", .{ geometry.size.x, geometry.size.y }, 0) catch return;
         self.drawMeasurementPill(viewport, .{ .x = rect.x + rect.width / 2, .y = rect.y + rect.height / 2 }, size_text, magenta);
     }
 
@@ -13776,7 +13773,7 @@ pub const Studio = struct {
             rl.drawLineEx(.{ .x = end.x - 4, .y = end.y }, .{ .x = end.x + 4, .y = end.y }, 1.25, color);
         }
         var buffer: [32]u8 = undefined;
-        const text = std.fmt.bufPrintZ(&buffer, "{d:.0}", .{value}) catch return;
+        const text = std.mem.printSentinel(&buffer, "{d:.0}", .{value}, 0) catch return;
         self.drawMeasurementPill(viewport, .{ .x = (start.x + end.x) / 2, .y = (start.y + end.y) / 2 }, text, color);
     }
 
@@ -13821,11 +13818,7 @@ pub const Studio = struct {
 
     fn drawGeometryHud(self: Studio, viewport: Viewport, item_rect: rl.Rectangle, geometry: Geometry) void {
         var buffer: [128]u8 = undefined;
-        const text = std.fmt.bufPrintZ(
-            &buffer,
-            "x {d:.1}  y {d:.1}  w {d:.1}  h {d:.1}",
-            .{ geometry.position.x, geometry.position.y, geometry.size.x, geometry.size.y },
-        ) catch return;
+        const text = std.mem.printSentinel(&buffer, "x {d:.1}  y {d:.1}  w {d:.1}  h {d:.1}", .{ geometry.position.x, geometry.position.y, geometry.size.x, geometry.size.y }, 0) catch return;
         const scale = uiScale(viewport);
         const font_size = scaledUiFont(scale, UiTypography.body);
         const padding: f32 = 8 * scale;
@@ -14135,11 +14128,7 @@ pub const Studio = struct {
             self.organizer_first_visible;
         var slide_progress_buffer: [64]u8 = undefined;
         const current_summary = currentSlideOrdinal(workspace);
-        const slide_progress = std.fmt.bufPrintZ(
-            &slide_progress_buffer,
-            "{d} / {d}  Find",
-            .{ current_summary, workspace.slides.len },
-        ) catch "slides";
+        const slide_progress = std.mem.printSentinel(&slide_progress_buffer, "{d} / {d}  Find", .{ current_summary, workspace.slides.len }, 0) catch "slides";
         self.drawPanelSearchField(
             layout.slide_page_status,
             self.slide_search,
@@ -14189,24 +14178,16 @@ pub const Studio = struct {
                 .height = card.height - 4 * font_scale,
             });
             var line_buffer: [96]u8 = undefined;
-            const slide_number = std.fmt.bufPrintZ(&line_buffer, "SLIDE {d}", .{summary.index + 1}) catch "SLIDE";
+            const slide_number = std.mem.printSentinel(&line_buffer, "SLIDE {d}", .{summary.index + 1}, 0) catch "SLIDE";
             self.drawUiText(slide_number, .{ .x = text_x, .y = card.y + 6 * font_scale }, compact_font, if (summary.hidden) theme.text_disabled else if (active) theme.accent_bright else theme.text_muted);
             var title_buffer: [96]u8 = undefined;
             const title = self.fitUiText(&title_buffer, if (summary.title.len == 0) "Untitled" else summary.title, body_font, text_width);
             self.drawUiText(title, .{ .x = text_x, .y = card.y + 23 * font_scale }, body_font, if (summary.hidden) theme.text_muted else theme.text);
             var metadata_buffer: [96]u8 = undefined;
             const metadata = if (summary.transition_effect != .none)
-                std.fmt.bufPrintZ(
-                    &metadata_buffer,
-                    "{d} items · {d} states · {s}",
-                    .{ summary.item_count, summary.morph_count, animation.effectLiteral(summary.transition_effect) },
-                ) catch "slide details"
+                std.mem.printSentinel(&metadata_buffer, "{d} items · {d} states · {s}", .{ summary.item_count, summary.morph_count, animation.effectLiteral(summary.transition_effect) }, 0) catch "slide details"
             else
-                std.fmt.bufPrintZ(
-                    &metadata_buffer,
-                    "{d} items · {d} states",
-                    .{ summary.item_count, summary.morph_count },
-                ) catch "slide details";
+                std.mem.printSentinel(&metadata_buffer, "{d} items · {d} states", .{ summary.item_count, summary.morph_count }, 0) catch "slide details";
             var fitted_metadata_buffer: [96]u8 = undefined;
             const fitted_metadata = self.fitUiText(&fitted_metadata_buffer, metadata, compact_font, text_width);
             self.drawUiText(fitted_metadata, .{ .x = text_x, .y = card.y + 45 * font_scale }, compact_font, theme.text_muted);
@@ -14235,11 +14216,7 @@ pub const Studio = struct {
         var library_progress_buffer: [64]u8 = undefined;
         const library_first = if (library_result_count == 0) 0 else library_first_visible + 1;
         const library_last = @min(library_result_count, library_first_visible + libraryRowCapacity(layout));
-        const library_progress = std.fmt.bufPrintZ(
-            &library_progress_buffer,
-            "{d}–{d} / {d}  Find",
-            .{ library_first, library_last, library_result_count },
-        ) catch "Find reusable";
+        const library_progress = std.mem.printSentinel(&library_progress_buffer, "{d}–{d} / {d}  Find", .{ library_first, library_last, library_result_count }, 0) catch "Find reusable";
         self.drawPanelSearchField(
             layout.library_page_status,
             self.library_search,
@@ -14319,7 +14296,7 @@ pub const Studio = struct {
             const usage: [:0]const u8 = if (entry.use_count == 0)
                 "unused"
             else
-                std.fmt.bufPrintZ(&usage_buffer, "{d} use{s}", .{ entry.use_count, if (entry.use_count == 1) "" else "s" }) catch "used";
+                std.mem.printSentinel(&usage_buffer, "{d} use{s}", .{ entry.use_count, if (entry.use_count == 1) "" else "s" }, 0) catch "used";
             self.drawUiText(usage, .{
                 .x = text_x,
                 .y = row.y + row.height - @as(f32, @floatFromInt(compact_font)) - 5 * font_scale,
@@ -14376,11 +14353,7 @@ pub const Studio = struct {
             .slide_template => "SLIDE",
         };
         var title_buffer: [192]u8 = undefined;
-        const title = std.fmt.bufPrintZ(
-            &title_buffer,
-            "LIBRARY PREVIEW · {s} · {s}",
-            .{ kind, entry.name },
-        ) catch "LIBRARY PREVIEW";
+        const title = std.mem.printSentinel(&title_buffer, "LIBRARY PREVIEW · {s} · {s}", .{ kind, entry.name }, 0) catch "LIBRARY PREVIEW";
         var fitted_buffer: [192]u8 = undefined;
         const heading_font = scaledUiFont(scale, UiTypography.heading);
         const fitted = self.fitUiText(
@@ -14480,21 +14453,17 @@ pub const Studio = struct {
             .slide_template => "SLIDE",
         };
         var title_buffer: [192]u8 = undefined;
-        const title = std.fmt.bufPrintZ(&title_buffer, "DEFINITION · {s} · {s}", .{ kind, mode.nameSlice() }) catch "DEFINITION";
+        const title = std.mem.printSentinel(&title_buffer, "DEFINITION · {s} · {s}", .{ kind, mode.nameSlice() }, 0) catch "DEFINITION";
         var fitted_buffer: [192]u8 = undefined;
         const heading_font = scaledUiFont(scale, UiTypography.heading);
         const fitted = self.fitUiText(&fitted_buffer, title, heading_font, @max(0, card.width - 28 * scale));
         self.drawUiText(fitted, .{ .x = card.x + 14 * scale, .y = card.y + 10 * scale }, heading_font, theme.text);
         var detail_buffer: [160]u8 = undefined;
-        const detail = std.fmt.bufPrintZ(
-            &detail_buffer,
-            "SHARED · affects {d} use{s} · {s} edit the definition",
-            .{
-                mode.use_count,
-                if (mode.use_count == 1) "" else "s",
-                if (mode.kind == .element) "properties" else "structure + properties",
-            },
-        ) catch "SHARED · edits update the definition";
+        const detail = std.mem.printSentinel(&detail_buffer, "SHARED · affects {d} use{s} · {s} edit the definition", .{
+            mode.use_count,
+            if (mode.use_count == 1) "" else "s",
+            if (mode.kind == .element) "properties" else "structure + properties",
+        }, 0) catch "SHARED · edits update the definition";
         self.drawUiText(
             self.fitUiText(&fitted_buffer, detail, scaledUiFont(scale, UiTypography.compact), @max(0, card.width - 28 * scale)),
             .{ .x = card.x + 14 * scale, .y = card.y + 36 * scale },
@@ -14612,11 +14581,7 @@ pub const Studio = struct {
             line_y += layout.line_height;
 
             var view_buffer: [192]u8 = undefined;
-            const view_help = std.fmt.bufPrintZ(
-                &view_buffer,
-                "VIEW {d:.0}% · Cmd/Ctrl +/- zoom · Space/middle drag pan · Cmd/Ctrl-0 fit",
-                .{self.canvasZoomPercent()},
-            ) catch "Cmd/Ctrl +/- zoom · Space/middle drag pan · Cmd/Ctrl-0 fit";
+            const view_help = std.mem.printSentinel(&view_buffer, "VIEW {d:.0}% · Cmd/Ctrl +/- zoom · Space/middle drag pan · Cmd/Ctrl-0 fit", .{self.canvasZoomPercent()}, 0) catch "Cmd/Ctrl +/- zoom · Space/middle drag pan · Cmd/Ctrl-0 fit";
             var view_fitted: [192]u8 = undefined;
             self.drawUiText(
                 self.fitUiText(&view_fitted, view_help, compact_font, text_width),
@@ -14780,11 +14745,11 @@ pub const Studio = struct {
         self.drawUiText("GRID APPEARANCE", .{ .x = layout.panel.x + 14 * scale, .y = layout.panel.y + 12 * scale }, body_font, theme.text_heading);
         const appearance_labels = [_][:0]const u8{ "AUTO", "DARK", "LIGHT" };
         for (layout.appearance_buttons, appearance_labels, 0..) |button, label, index|
-            drawToggleButton(self, button, label, @intFromEnum(self.grid_appearance) == index);
+            drawToggleButton(self, button, label, @backingInt(self.grid_appearance) == index);
 
         self.drawUiText("CONTRAST", .{ .x = layout.panel.x + 14 * scale, .y = layout.panel.y + 79 * scale }, compact_font, muted);
         var contrast_buffer: [16]u8 = undefined;
-        const contrast_label = std.fmt.bufPrintZ(&contrast_buffer, "{d:.0}%", .{self.grid_contrast * 100}) catch "";
+        const contrast_label = std.mem.printSentinel(&contrast_buffer, "{d:.0}%", .{self.grid_contrast * 100}, 0) catch "";
         const contrast_width = self.measureUiText(contrast_label, compact_font);
         self.drawUiText(contrast_label, .{
             .x = layout.panel.x + layout.panel.width - 14 * scale - contrast_width,
@@ -14808,7 +14773,7 @@ pub const Studio = struct {
         self.drawUiText("STYLE", .{ .x = layout.panel.x + 14 * scale, .y = layout.panel.y + 139 * scale }, compact_font, muted);
         const style_labels = [_][:0]const u8{ "LINES", "DOTS" };
         for (layout.style_buttons, style_labels, 0..) |button, label, index|
-            drawToggleButton(self, button, label, @intFromEnum(self.grid_style) == index);
+            drawToggleButton(self, button, label, @backingInt(self.grid_style) == index);
     }
 
     /// The search line for a floating overlay: magnifier glyph, query text, a
@@ -14964,19 +14929,15 @@ pub const Studio = struct {
 
             var detail_buffer: [192]u8 = undefined;
             const detail = if (entry.available)
-                std.fmt.bufPrintZ(
-                    &detail_buffer,
-                    "{s} · {d} use{s}",
-                    .{
-                        switch (entry.kind) {
-                            .element => "Place on the canvas",
-                            .group => "Insert the complete group",
-                            .slide_template => "Create a slide from this template",
-                        },
-                        entry.use_count,
-                        if (entry.use_count == 1) "" else "s",
+                std.mem.printSentinel(&detail_buffer, "{s} · {d} use{s}", .{
+                    switch (entry.kind) {
+                        .element => "Place on the canvas",
+                        .group => "Insert the complete group",
+                        .slide_template => "Create a slide from this template",
                     },
-                ) catch "Reusable definition"
+                    entry.use_count,
+                    if (entry.use_count == 1) "" else "s",
+                }, 0) catch "Reusable definition"
             else
                 "Unavailable in this source context";
             const detail_x = text_x + name_width + 10 * scale;
@@ -15438,9 +15399,9 @@ pub const Studio = struct {
         const readout: [:0]const u8 = if (!preview_status.available)
             "--"
         else if (preview_status.active())
-            std.fmt.bufPrintZ(&readout_buffer, "{d:.1}/{d:.1}s", .{ preview_status.time, preview_status.total }) catch "--"
+            std.mem.printSentinel(&readout_buffer, "{d:.1}/{d:.1}s", .{ preview_status.time, preview_status.total }, 0) catch "--"
         else
-            std.fmt.bufPrintZ(&readout_buffer, "{d:.1}s", .{preview_status.total}) catch "--";
+            std.mem.printSentinel(&readout_buffer, "{d:.1}s", .{preview_status.total}, 0) catch "--";
         drawButtonLabel(self, layout.transport_readout, readout, compact_font, if (preview_status.active()) theme.text else theme.text_muted);
     }
 
@@ -15509,7 +15470,7 @@ pub const Studio = struct {
             drawStarterPreview(self, preview, preset, colors);
 
             var shortcut_buffer: [4]u8 = undefined;
-            const shortcut = std.fmt.bufPrintZ(&shortcut_buffer, "{d}", .{index + 1}) catch "";
+            const shortcut = std.mem.printSentinel(&shortcut_buffer, "{d}", .{index + 1}, 0) catch "";
             const shortcut_rect: rl.Rectangle = .{
                 .x = card.x + card.width - 29,
                 .y = card.y + 9,
@@ -15722,7 +15683,7 @@ pub const Studio = struct {
         var page_buffer: [64]u8 = undefined;
         const first = if (count == 0) 0 else first_visible + 1;
         const last = @min(count, first_visible + objectRowCapacity(layout));
-        const page_text = std.fmt.bufPrintZ(&page_buffer, "{d}–{d} / {d}  Find", .{ first, last, count }) catch "Find objects";
+        const page_text = std.mem.printSentinel(&page_buffer, "{d}–{d} / {d}  Find", .{ first, last, count }, 0) catch "Find objects";
         self.drawPanelSearchField(
             layout.page_status,
             self.objects_search,
@@ -15852,7 +15813,7 @@ pub const Studio = struct {
         drawStudioPanel(panel);
         const edit = notesEditButton(panel, scale);
         var heading: [96]u8 = undefined;
-        const title = std.fmt.bufPrintZ(&heading, "SPEAKER NOTES · SLIDE {d}", .{slide_number}) catch "SPEAKER NOTES";
+        const title = std.mem.printSentinel(&heading, "SPEAKER NOTES · SLIDE {d}", .{slide_number}, 0) catch "SPEAKER NOTES";
         self.drawUiText(title, .{ .x = panel.x + 12 * scale, .y = panel.y + 12 * scale }, scaledUiFont(scale, UiTypography.compact), theme.text_heading);
         if (self.definition_mode == null) drawActionButton(self, edit, "Edit") else drawDisabledBadge(self, edit, "Edit");
         if (layout.max_scroll > 0) {
@@ -15899,8 +15860,8 @@ pub const Studio = struct {
         var scene_buffer: [32]u8 = undefined;
         const active_scene = self.activeTimelineScene();
         const scene_label: [:0]const u8 = switch (self.timelineSceneAt(active_scene)) {
-            .state => |state| std.fmt.bufPrintZ(&scene_buffer, "STATE {d}/{d}", .{ state + 1, self.morph_state_count }) catch "MORPH",
-            .build => |build| std.fmt.bufPrintZ(&scene_buffer, "BUILD {d}/{d}", .{ build + 1, self.build_count }) catch "BUILD",
+            .state => |state| std.mem.printSentinel(&scene_buffer, "STATE {d}/{d}", .{ state + 1, self.morph_state_count }, 0) catch "MORPH",
+            .build => |build| std.mem.printSentinel(&scene_buffer, "BUILD {d}/{d}", .{ build + 1, self.build_count }, 0) catch "BUILD",
             .base => "BASE",
         };
         drawActionButton(self, layout.scene_label, scene_label);
@@ -16376,41 +16337,29 @@ pub const Studio = struct {
                 .group => "GROUP",
                 .slide_template => "SLIDE",
             };
-            return std.fmt.bufPrintZ(
-                buffer,
-                "{s} definition · edits shared source",
-                .{kind},
-            ) catch null;
+            return std.mem.printSentinel(buffer, "{s} definition · edits shared source", .{kind}, 0) catch null;
         }
         if (self.selectionCount() > 1)
-            return std.fmt.bufPrintZ(buffer, "Selected group · Reuse creates one source-native component", .{}) catch null;
+            return std.mem.printSentinel(buffer, "Selected group · Reuse creates one source-native component", .{}, 0) catch null;
         const item_index = self.selectedIndex(items) orelse return null;
         const item = items[item_index];
         const context = self.compositionContextForSelection(items) orelse {
             return switch (item.source.scope) {
-                .component_instance => std.fmt.bufPrintZ(buffer, "Component instance · waiting for safe detach details", .{}) catch null,
-                .group_instance_member => std.fmt.bufPrintZ(buffer, "Group instance member · composition details pending", .{}) catch null,
-                .slide_template => std.fmt.bufPrintZ(buffer, "Template instance · waiting for ownership details", .{}) catch null,
-                else => std.fmt.bufPrintZ(buffer, "Direct item · properties belong to this slide", .{}) catch null,
+                .component_instance => std.mem.printSentinel(buffer, "Component instance · waiting for safe detach details", .{}, 0) catch null,
+                .group_instance_member => std.mem.printSentinel(buffer, "Group instance member · composition details pending", .{}, 0) catch null,
+                .slide_template => std.mem.printSentinel(buffer, "Template instance · waiting for ownership details", .{}, 0) catch null,
+                else => std.mem.printSentinel(buffer, "Direct item · properties belong to this slide", .{}, 0) catch null,
             };
         };
         const kind = compositionKindLabel(context.kind);
         if (!context.local_overrides.empty()) {
             var fields_buffer: [96]u8 = undefined;
             const fields = formatOverrideFields(&fields_buffer, context.local_overrides);
-            return std.fmt.bufPrintZ(
-                buffer,
-                "{s} · local {s} · {s}",
-                .{ kind, fields, if (context.reset_target != null) "R resets one" else "local source is read-only" },
-            ) catch null;
+            return std.mem.printSentinel(buffer, "{s} · local {s} · {s}", .{ kind, fields, if (context.reset_target != null) "R resets one" else "local source is read-only" }, 0) catch null;
         }
         if (context.detach_target != null)
-            return std.fmt.bufPrintZ(buffer, "{s} · inherited · Detach makes local boxes", .{kind}) catch null;
-        return std.fmt.bufPrintZ(
-            buffer,
-            "{s} · inherited · {s}",
-            .{ kind, compositionBlockLabel(context.detach_block) },
-        ) catch null;
+            return std.mem.printSentinel(buffer, "{s} · inherited · Detach makes local boxes", .{kind}, 0) catch null;
+        return std.mem.printSentinel(buffer, "{s} · inherited · {s}", .{ kind, compositionBlockLabel(context.detach_block) }, 0) catch null;
     }
 
     fn drawInlineProperties(
@@ -16522,43 +16471,23 @@ pub const Studio = struct {
             var metadata_buffer: [96]u8 = undefined;
             const metadata: [:0]const u8 = if (resolved) |value| metadata: {
                 if (value.media_availability != .ready)
-                    break :metadata std.fmt.bufPrintZ(
-                        &metadata_buffer,
-                        "{s}",
-                        .{mediaAvailabilityInspectorLabel(value.media_availability)},
-                    ) catch "MEDIA UNAVAILABLE";
+                    break :metadata std.mem.printSentinel(&metadata_buffer, "{s}", .{mediaAvailabilityInspectorLabel(value.media_availability)}, 0) catch "MEDIA UNAVAILABLE";
                 if (selected_video_playback) {
                     // A live camera has neither duration nor an audio stream by
                     // definition, so reporting their absence would flag normal
                     // state as a problem. It reports what it is capturing.
                     if (item.vid_is_camera)
-                        break :metadata std.fmt.bufPrintZ(
-                            &metadata_buffer,
-                            "LIVE CAMERA · {d:.0}×{d:.0}",
-                            .{ value.natural_size.x, value.natural_size.y },
-                        ) catch "LIVE CAMERA";
+                        break :metadata std.mem.printSentinel(&metadata_buffer, "LIVE CAMERA · {d:.0}×{d:.0}", .{ value.natural_size.x, value.natural_size.y }, 0) catch "LIVE CAMERA";
                     if (value.media_duration <= 0) break :metadata "DURATION UNAVAILABLE";
                     break :metadata if (value.media_audio == .unavailable)
-                        std.fmt.bufPrintZ(
-                            &metadata_buffer,
-                            "DURATION {d:.1}s · {d:.0}×{d:.0} · NO AUDIO STREAM",
-                            .{ value.media_duration, value.natural_size.x, value.natural_size.y },
-                        ) catch "VIDEO METADATA"
+                        std.mem.printSentinel(&metadata_buffer, "DURATION {d:.1}s · {d:.0}×{d:.0} · NO AUDIO STREAM", .{ value.media_duration, value.natural_size.x, value.natural_size.y }, 0) catch "VIDEO METADATA"
                     else
-                        std.fmt.bufPrintZ(
-                            &metadata_buffer,
-                            "DURATION {d:.1}s · {d:.0}×{d:.0}",
-                            .{ value.media_duration, value.natural_size.x, value.natural_size.y },
-                        ) catch "VIDEO METADATA";
+                        std.mem.printSentinel(&metadata_buffer, "DURATION {d:.1}s · {d:.0}×{d:.0}", .{ value.media_duration, value.natural_size.x, value.natural_size.y }, 0) catch "VIDEO METADATA";
                 }
                 break :metadata if (value.natural_size.x > 0 and value.natural_size.y > 0)
-                    std.fmt.bufPrintZ(
-                        &metadata_buffer,
-                        "NATURAL {d:.0}×{d:.0} · BOX {d:.0}×{d:.0}",
-                        .{ value.natural_size.x, value.natural_size.y, value.size.x, value.size.y },
-                    ) catch "MEDIA DIMENSIONS"
+                    std.mem.printSentinel(&metadata_buffer, "NATURAL {d:.0}×{d:.0} · BOX {d:.0}×{d:.0}", .{ value.natural_size.x, value.natural_size.y, value.size.x, value.size.y }, 0) catch "MEDIA DIMENSIONS"
                 else
-                    std.fmt.bufPrintZ(&metadata_buffer, "BOX {d:.0}×{d:.0}", .{ value.size.x, value.size.y }) catch "MEDIA DIMENSIONS";
+                    std.mem.printSentinel(&metadata_buffer, "BOX {d:.0}×{d:.0}", .{ value.size.x, value.size.y }, 0) catch "MEDIA DIMENSIONS";
             } else if (selected_video_playback)
                 "VIDEO METADATA UNAVAILABLE"
             else
@@ -16629,7 +16558,7 @@ pub const Studio = struct {
                 );
                 if (camera_item) {
                     var format_buffer: [32]u8 = undefined;
-                    const format_label = std.fmt.bufPrintZ(&format_buffer, "FORMAT  {s}", .{item.vid_camera_format.label()}) catch "FORMAT";
+                    const format_label = std.mem.printSentinel(&format_buffer, "FORMAT  {s}", .{item.vid_camera_format.label()}, 0) catch "FORMAT";
                     const format_override = if (composition) |context| context.local_overrides.contains(.camera_format) else false;
                     const format_resettable = if (composition) |context|
                         context.reset_target != null and context.resettable_overrides.contains(.camera_format)
@@ -16819,9 +16748,9 @@ pub const Studio = struct {
                         false;
                     for (layout.align_buttons, align_labels, 0..) |button, label, index| {
                         const active = if (index < 3)
-                            horizontal_homogeneous and @intFromEnum(primary.text_alignment) == index
+                            horizontal_homogeneous and @backingInt(primary.text_alignment) == index
                         else
-                            vertical_homogeneous and @intFromEnum(primary.text_vertical_alignment) == index - 3;
+                            vertical_homogeneous and @backingInt(primary.text_vertical_alignment) == index - 3;
                         drawPropertyToggleButton(
                             self,
                             button,
@@ -16884,22 +16813,22 @@ pub const Studio = struct {
         const geometry_fallbacks = [_][:0]const u8{ "X --", "Y --", "W --", "H --" };
         for (layout.geometry_fields, 0..) |button, index| {
             const label = if (selected_geometry) |geometry| blk: {
-                const value = switch (@as(GeometryField, @enumFromInt(index))) {
+                const value = switch (@as(GeometryField, @fromBackingInt(@intCast(index)))) {
                     .x => geometry.position.x,
                     .y => geometry.position.y,
                     .width => geometry.size.x,
                     .height => geometry.size.y,
                 };
-                const prefix: []const u8 = switch (@as(GeometryField, @enumFromInt(index))) {
+                const prefix: []const u8 = switch (@as(GeometryField, @fromBackingInt(@intCast(index)))) {
                     .x => "X",
                     .y => "Y",
                     .width => "W",
                     .height => "H",
                 };
                 break :blk if (layout.compact_properties)
-                    std.fmt.bufPrintZ(&geometry_buffers[index], "{s} {d:.0}", .{ prefix, value }) catch geometry_fallbacks[index]
+                    std.mem.printSentinel(&geometry_buffers[index], "{s} {d:.0}", .{ prefix, value }, 0) catch geometry_fallbacks[index]
                 else
-                    std.fmt.bufPrintZ(&geometry_buffers[index], "{s} {d:.1}", .{ prefix, value }) catch geometry_fallbacks[index];
+                    std.mem.printSentinel(&geometry_buffers[index], "{s} {d:.1}", .{ prefix, value }, 0) catch geometry_fallbacks[index];
             } else geometry_fallbacks[index];
             drawActionButton(self, button, label);
         }
@@ -16916,7 +16845,7 @@ pub const Studio = struct {
         var font_buffer: [32]u8 = undefined;
         const font_label: [:0]const u8 = if (selected_item) |item|
             if (item.kind == .textbox and item.fontSize != null)
-                std.fmt.bufPrintZ(&font_buffer, "Font {d}", .{item.fontSize.?}) catch "Font"
+                std.mem.printSentinel(&font_buffer, "Font {d}", .{item.fontSize.?}, 0) catch "Font"
             else
                 "Font --"
         else
@@ -16925,7 +16854,7 @@ pub const Studio = struct {
         var rotation_buffer: [32]u8 = undefined;
         const rotation_label: [:0]const u8 = if (selected_item) |item|
             if (inlineFieldApplies(.rotation, item))
-                std.fmt.bufPrintZ(&rotation_buffer, "Rot {d:.0}°", .{item.rotation}) catch "Rot"
+                std.mem.printSentinel(&rotation_buffer, "Rot {d:.0}°", .{item.rotation}, 0) catch "Rot"
             else
                 "Rot --"
         else
@@ -16934,9 +16863,9 @@ pub const Studio = struct {
         var opacity_buffer: [32]u8 = undefined;
         const opacity_label: [:0]const u8 = if (selected_item) |item|
             if (layout.minimal_properties)
-                std.fmt.bufPrintZ(&opacity_buffer, "Op {d:.0}%", .{item.opacity * 100}) catch "Opacity"
+                std.mem.printSentinel(&opacity_buffer, "Op {d:.0}%", .{item.opacity * 100}, 0) catch "Opacity"
             else
-                std.fmt.bufPrintZ(&opacity_buffer, "Opacity {d:.0}%", .{item.opacity * 100}) catch "Opacity"
+                std.mem.printSentinel(&opacity_buffer, "Opacity {d:.0}%", .{item.opacity * 100}, 0) catch "Opacity"
         else if (layout.minimal_properties) "Op --" else "Opacity --";
         drawActionButton(self, layout.opacity, opacity_label);
 
@@ -16980,11 +16909,7 @@ pub const Studio = struct {
                 self.groupDestinationLabel()
             else
                 self.editDestinationLabel(item);
-            return std.fmt.bufPrintZ(
-                buffer,
-                "STUDIO{s} · {d} selected · primary #{d} · {s}, line {d} · x {d:.0} y {d:.0} w {d:.0} h {d:.0}",
-                .{ if (self.dirty) " *" else "", self.selectionCount(), identity, destination_label, source.line_number, geometry.position.x, geometry.position.y, geometry.size.x, geometry.size.y },
-            ) catch "STUDIO · selected item";
+            return std.mem.printSentinel(buffer, "STUDIO{s} · {d} selected · primary #{d} · {s}, line {d} · x {d:.0} y {d:.0} w {d:.0} h {d:.0}", .{ if (self.dirty) " *" else "", self.selectionCount(), identity, destination_label, source.line_number, geometry.position.x, geometry.position.y, geometry.size.x, geometry.size.y }, 0) catch "STUDIO · selected item";
         }
         return if (self.dirty) "STUDIO * · click an item to select it" else "STUDIO · click an item to select it";
     }
@@ -17033,20 +16958,12 @@ pub const Studio = struct {
             .library_name_conflict => "That library name is already defined",
             .library_entry_in_use => "Cannot delete: later source instances still use this reusable",
             .library_delete_unsupported => "Slide-template deletion is not source-safe yet",
-            .library_cleanup_ready => std.fmt.bufPrintZ(
-                buffer,
-                "Cleanup preview: {d} safe to remove · {d} blocked · click Apply",
-                .{ self.library_cleanup_preview_count, self.library_cleanup_blocked_count },
-            ) catch "Cleanup preview ready - click Apply",
+            .library_cleanup_ready => std.mem.printSentinel(buffer, "Cleanup preview: {d} safe to remove · {d} blocked · click Apply", .{ self.library_cleanup_preview_count, self.library_cleanup_blocked_count }, 0) catch "Cleanup preview ready - click Apply",
             .library_cleanup_empty => "Library cleanup found no safely unreachable definitions",
-            .library_cleanup_blocked => std.fmt.bufPrintZ(
-                buffer,
-                "Library cleanup: {d} unreachable definition{s} blocked by source context",
-                .{
-                    self.library_cleanup_blocked_count,
-                    if (self.library_cleanup_blocked_count == 1) "" else "s",
-                },
-            ) catch "Unused definitions need manual cleanup",
+            .library_cleanup_blocked => std.mem.printSentinel(buffer, "Library cleanup: {d} unreachable definition{s} blocked by source context", .{
+                self.library_cleanup_blocked_count,
+                if (self.library_cleanup_blocked_count == 1) "" else "s",
+            }, 0) catch "Unused definitions need manual cleanup",
             .slide_template_promotion_locked => "This slide cannot be promoted without changing its source semantics",
             .group_reusable_needs_source_support => "Group reusable needs explicit component-group source-format support",
             .override_reset_unsupported => "That local property cannot be reset safely; no source change was made",
@@ -17166,10 +17083,10 @@ fn rulerLabel(buffer: []u8, value: f32) [:0]const u8 {
     if (@abs(value) >= 1000) {
         const thousands = value / 1000;
         if (@abs(thousands - @round(thousands)) < 0.01)
-            return std.fmt.bufPrintZ(buffer, "{d:.0}k", .{thousands}) catch "";
-        return std.fmt.bufPrintZ(buffer, "{d:.1}k", .{thousands}) catch "";
+            return std.mem.printSentinel(buffer, "{d:.0}k", .{thousands}, 0) catch "";
+        return std.mem.printSentinel(buffer, "{d:.1}k", .{thousands}, 0) catch "";
     }
-    return std.fmt.bufPrintZ(buffer, "{d:.0}", .{value}) catch "";
+    return std.mem.printSentinel(buffer, "{d:.0}", .{value}, 0) catch "";
 }
 
 fn toolLabel(tool: Tool) [:0]const u8 {
@@ -18076,7 +17993,7 @@ test "grid settings popover applies appearance contrast and style" {
     try std.testing.expect(!studio.grid_snapping);
 
     _ = studio.update(&items, &.{}, viewport, .{
-        .pointer_screen = rectangleCenter(settings.appearance_buttons[@intFromEnum(GridAppearance.dark)]),
+        .pointer_screen = rectangleCenter(settings.appearance_buttons[@backingInt(GridAppearance.dark)]),
         .pointer_pressed = true,
     });
     try std.testing.expectEqual(GridAppearance.dark, studio.grid_appearance);
@@ -18103,7 +18020,7 @@ test "grid settings popover applies appearance contrast and style" {
     try std.testing.expectApproxEqAbs(maximum_grid_contrast * 0.25, studio.grid_contrast, 0.0001);
 
     _ = studio.update(&items, &.{}, viewport, .{
-        .pointer_screen = rectangleCenter(settings.style_buttons[@intFromEnum(GridStyle.dots)]),
+        .pointer_screen = rectangleCenter(settings.style_buttons[@backingInt(GridStyle.dots)]),
         .pointer_pressed = true,
     });
     try std.testing.expectEqual(GridStyle.dots, studio.grid_style);
@@ -19721,7 +19638,7 @@ test "property hit targets emit delete and color commands" {
         else => return error.UnexpectedSemanticCommand,
     }
 
-    const cyan_index = @intFromEnum(PaletteColor.cyan);
+    const cyan_index = @backingInt(PaletteColor.cyan);
     _ = studio.update(&items, &.{}, viewport, .{
         .pointer_screen = rectangleCenter(layout.foreground_swatches[cyan_index]),
         .pointer_pressed = true,
@@ -20602,7 +20519,7 @@ test "panel search rejects oversized replacement without losing the visible quer
     studio.activatePanelSearch(.slides);
     studio.appendPanelSearchQuery(.slides, "architecture");
     studio.slide_search.select_all = true;
-    const oversized = [_]u8{'x'} ** (max_panel_search_bytes + 1);
+    const oversized: [max_panel_search_bytes + 1]u8 = @splat('x');
     studio.appendPanelSearchQuery(.slides, &oversized);
     try std.testing.expectEqualStrings("architecture", studio.slide_search.text());
     try std.testing.expect(studio.slide_search.select_all);
@@ -21477,7 +21394,7 @@ test "precise property controls emit field-specific single-item intentions" {
     var studio: Studio = .{ .enabled = true, .selected_identity = 301 };
 
     _ = studio.update(&items, &.{}, viewport, .{
-        .pointer_screen = rectangleCenter(layout.geometry_fields[@intFromEnum(GeometryField.width)]),
+        .pointer_screen = rectangleCenter(layout.geometry_fields[@backingInt(GeometryField.width)]),
         .pointer_pressed = true,
     });
     switch (studio.takeSemanticCommand().?) {
@@ -21532,7 +21449,7 @@ test "property requests honor local shared lock group and item-kind guards" {
     var studio: Studio = .{ .enabled = true, .selected_identity = 302 };
 
     _ = studio.update(&items, &.{}, viewport, .{
-        .pointer_screen = rectangleCenter(layout.geometry_fields[@intFromEnum(GeometryField.x)]),
+        .pointer_screen = rectangleCenter(layout.geometry_fields[@backingInt(GeometryField.x)]),
         .pointer_pressed = true,
     });
     switch (studio.takeSemanticCommand().?) {
@@ -21540,7 +21457,7 @@ test "property requests honor local shared lock group and item-kind guards" {
         else => return error.UnexpectedSemanticCommand,
     }
     _ = studio.update(&items, &.{}, viewport, .{
-        .pointer_screen = rectangleCenter(layout.geometry_fields[@intFromEnum(GeometryField.x)]),
+        .pointer_screen = rectangleCenter(layout.geometry_fields[@backingInt(GeometryField.x)]),
         .pointer_pressed = true,
         .allow_shared_edit = true,
     });
@@ -22664,7 +22581,7 @@ test "pristine inline click away reaches the intended palette action" {
     });
     try std.testing.expect(studio.inlineEditActive());
 
-    const cyan_index = @intFromEnum(PaletteColor.cyan);
+    const cyan_index = @backingInt(PaletteColor.cyan);
     _ = studio.update(&items, &.{}, frame.viewport, .{
         .pointer_screen = rectangleCenter(layout.foreground_swatches[cyan_index]),
         .pointer_pressed = true,
@@ -24868,7 +24785,9 @@ test "notes preview wheel, paging, and scrollbar drag stay inside the notes pane
     var editor: Studio = .{ .enabled = true, .notes_visible = true };
     var items = [_]slides.SlideItem{};
     const summaries = [_]SlideSummary{ .{ .index = 0 }, .{ .index = 1 } };
-    var workspace: Workspace = .{ .visible = true, .slides = &summaries, .speaker_notes = "A line of speaker notes.\n" ** 40 };
+    const notes_line = "A line of speaker notes.\n";
+    const notes_storage: [40][notes_line.len]u8 = @splat(notes_line.*);
+    var workspace: Workspace = .{ .visible = true, .slides = &summaries, .speaker_notes = std.mem.asBytes(¬es_storage) };
     const frame = editor.layoutFrame(.{ .x = 0, .y = 0, .width = 1600, .height = 900 });
     var layout = editor.notesPreviewLayout(frame.viewport, workspace.speaker_notes, 0);
     try std.testing.expect(layout.max_scroll > 0);
diff --git a/src/studio_motion.zig b/src/studio_motion.zig
index 00ab59d..eefab35 100644
--- a/src/studio_motion.zig
+++ b/src/studio_motion.zig
@@ -169,7 +169,7 @@ pub const Reveal = struct {
     }
 };
 
-const reveal_count = @typeInfo(RevealKind).@"enum".fields.len;
+const reveal_count = @typeInfo(RevealKind).@"enum".field_names.len;
 
 var reveals: [reveal_count]Reveal = defaultReveals();
 
@@ -177,7 +177,7 @@ fn defaultReveals() [reveal_count]Reveal {
     var result: [reveal_count]Reveal = undefined;
     for (&result, 0..) |*entry, index| {
         entry.* = .{};
-        switch (@as(RevealKind, @enumFromInt(index))) {
+        switch (@as(RevealKind, @fromBackingInt(@intCast(index)))) {
             .neovim => {
                 entry.open_seconds = 0.24;
                 entry.close_seconds = 0.18;
@@ -203,7 +203,7 @@ fn defaultReveals() [reveal_count]Reveal {
 }
 
 pub fn reveal(kind: RevealKind) *Reveal {
-    return &reveals[@intFromEnum(kind)];
+    return &reveals[@backingInt(kind)];
 }
 
 // ---------------------------------------------------------------------------
@@ -641,7 +641,7 @@ const Glide = struct {
     last_frame: f64 = -1,
 };
 
-const glide_count = @typeInfo(GlideSlot).@"enum".fields.len;
+const glide_count = @typeInfo(GlideSlot).@"enum".field_names.len;
 var glides: [glide_count]Glide = @splat(.{});
 
 pub const glide_seconds: f32 = 0.16;
@@ -656,7 +656,7 @@ pub const GlideResult = struct {
 };
 
 pub fn glide(slot: GlideSlot, target: rl.Rectangle) GlideResult {
-    const entry = &glides[@intFromEnum(slot)];
+    const entry = &glides[@backingInt(slot)];
     const key = rectKey(target);
     var retargeted = false;
     if (!entry.initialized or !enabled) {
diff --git a/src/studio_prompt.zig b/src/studio_prompt.zig
index 3559133..e135c32 100644
--- a/src/studio_prompt.zig
+++ b/src/studio_prompt.zig
@@ -64,7 +64,7 @@ pub const Notice = enum {
 pub const Prompt = struct {
     active: bool = false,
     kind: Kind = .text,
-    buffer: [max_input_bytes + 1]u8 = [_]u8{0} ** (max_input_bytes + 1),
+    buffer: [max_input_bytes + 1]u8 = @splat(0),
     len: usize = 0,
     cursor: usize = 0,
     preferred_column: ?usize = null,
diff --git a/src/texturecache.zig b/src/texturecache.zig
index 2e1a518..b53627a 100644
--- a/src/texturecache.zig
+++ b/src/texturecache.zig
@@ -1,9 +1,7 @@
 const std = @import("std");
 const rl = @import("raylib");
 const pathRelativeTo = @import("utils.zig").pathRelativeTo;
-const svg = @cImport({
-    @cInclude("svg_rasterizer.h");
-});
+const svg = @import("svg_rasterizer_c");
 
 allocator: std.mem.Allocator,
 /// Optional only for renderer unit tests. The app supplies its I/O backend so
@@ -55,7 +53,7 @@ pub fn getImageTexture(
     // box-aware 2x resolution, so Studio zoom, HiDPI presentation, and export
     // do not depend on an external converter or a tiny intrinsic bitmap.
     var path_buffer: [std.fs.max_path_bytes]u8 = undefined;
-    const zpath = try std.fmt.bufPrintZ(&path_buffer, "{s}", .{realpath});
+    const zpath = try std.mem.printSentinel(&path_buffer, "{s}", .{realpath}, 0);
     const result: TextureWithDimensions = if (is_svg) svg_result: {
         var raster: svg.RayslidesSvgImage = std.mem.zeroes(svg.RayslidesSvgImage);
         if (svg.rayslides_svg_rasterize_file(zpath.ptr, requested_width, requested_height, &raster) != 0 or
diff --git a/tools/zig_port_smoke.py b/tools/zig_port_smoke.py
new file mode 100644
index 0000000..31580f2
--- /dev/null
+++ b/tools/zig_port_smoke.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python3
+"""Qualify CLI exit and real framebuffer rendering without timing comparisons."""
+import argparse
+import json
+import os
+import re
+import subprocess
+from pathlib import Path
+
+from PIL import Image
+from studio_baseline import assert_frame_not_blank
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument('--binary', required=True, type=Path)
+    parser.add_argument('--output', required=True, type=Path)
+    parser.add_argument('--cli-only', action='store_true')
+    parser.add_argument('--no-display', action='store_true', help='Require an ordinary startup error without a Linux display')
+    parser.add_argument('--neovim', action='store_true')
+    parser.add_argument('--visible', action='store_true', help='Map the capture window (needed by some macOS compositors)')
+    args = parser.parse_args()
+    binary = args.binary.resolve()
+    output = args.output.resolve()
+    output.mkdir(parents=True, exist_ok=True)
+    version = subprocess.check_output([str(binary), '--version'], text=True, timeout=30).strip()
+    expected_version = re.search(r'^\s*\.version\s*=\s*"([^"]+)"', (ROOT / 'build.zig.zon').read_text(), re.MULTILINE).group(1)
+    if version != f'rayslides {expected_version}':
+        raise RuntimeError(f'Unexpected version output: {version!r}')
+    help_text = subprocess.check_output([str(binary), '--help'], text=True, timeout=30)
+    if '--studio' not in help_text or '--portable-show=' not in help_text:
+        raise RuntimeError('CLI help lost its Studio or portable-show command')
+    print(f'CLI version/help passed: {version}', flush=True)
+    if args.cli_only:
+        return
+    if args.no_display:
+        environment = dict(os.environ)
+        environment.pop('DISPLAY', None)
+        environment.pop('WAYLAND_DISPLAY', None)
+        result = subprocess.run(
+            [str(binary), '--studio', '--no-crowd', '--diagnostics-hidden',
+             f'--diagnostics-capture={output / "unexpected.png"}', '--diagnostics-exit-after-capture'],
+            cwd=ROOT, env=environment, capture_output=True, text=True, timeout=30)
+        (output / 'no-display.log').write_text(result.stdout + result.stderr)
+        if result.returncode != 1 or 'WindowInitializationFailed' not in result.stderr:
+            raise RuntimeError(f'Expected ordinary no-display startup error, got {result.returncode}')
+        print('No-display startup exits with an ordinary error', flush=True)
+        return
+    for name in (['studio', 'neovim'] if args.neovim else ['studio']):
+        image = output / f'{name}.png'
+        report = output / f'{name}.json'
+        command = [str(binary), '--studio', '--no-crowd',
+                   '--diagnostics-window=900x506', '--diagnostics-large-deck=4',
+                   f'--diagnostics-capture={image}', f'--diagnostics-report={report}',
+                   f'--diagnostics-capture-scenario=zig-port-{name}',
+                   '--diagnostics-exit-after-capture', '--diagnostics-hide-hud']
+        if not args.visible:
+            command += ['--diagnostics-hidden']
+        if name == 'neovim':
+            command += ['--diagnostics-neovim-editor', '--neovim-clean']
+        with (output / f'{name}.log').open('w') as log:
+            process = subprocess.Popen(command, cwd=ROOT, stdin=subprocess.DEVNULL,
+                                       stdout=log, stderr=subprocess.STDOUT)
+            try:
+                return_code = process.wait(timeout=60)
+            except subprocess.TimeoutExpired:
+                process.terminate()
+                try:
+                    process.wait(timeout=10)
+                except subprocess.TimeoutExpired:
+                    process.kill()
+                    process.wait(timeout=10)
+                raise RuntimeError(f'{name} render did not exit after capture')
+        if return_code:
+            raise RuntimeError(f'{name} exited {return_code}; see {output / f"{name}.log"}')
+        result = json.loads(report.read_text())
+        if result['capture'] != {'width': 900, 'height': 506}:
+            raise RuntimeError(f'Unexpected capture size: {result["capture"]}')
+        if result['deck']['slides'] != 4 or result['deck']['active_items'] < 1:
+            raise RuntimeError(f'Unexpected deck state: {result["deck"]}')
+        if result['render']['full_count'] < 1 or result['render']['total_slides'] != 4:
+            raise RuntimeError(f'Expected an actual full render: {result["render"]}')
+        with Image.open(image) as capture:
+            if capture.size != (900, 506):
+                raise RuntimeError(f'Unexpected PNG dimensions: {capture.size}')
+        assert_frame_not_blank(image, name)
+        print(f'{name} framebuffer render/exit passed: 900x506, four parsed/rendered slides', flush=True)
+
+
+if __name__ == '__main__':
+    main()

From ca0418794a76d42dce7aa95e9f3142718b9d6063 Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 16:30:11 +0200
Subject: [PATCH 02/10] Run feature-branch native CI once per pull request

---
 .github/workflows/verify.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index 71cc53c..5b6d6f9 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -2,6 +2,7 @@ name: Native correctness
 
 on:
   push:
+    branches: [master]
   pull_request:
     branches: [master]
   workflow_dispatch:

From 8333ecfb4947233cf5462afada414e12c0699f3d Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 16:38:56 +0200
Subject: [PATCH 03/10] Link Windows SDK directly and explain Neovim probe
 mismatches

---
 build.zig                  | 2 +-
 src/nvim/session_probe.zig | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.zig b/build.zig
index 2b2afa6..13d2524 100644
--- a/build.zig
+++ b/build.zig
@@ -201,7 +201,7 @@ pub fn build(b: *std.Build) !void {
         exe_mod.linkFramework("AppKit", .{});
         exe_mod.linkFramework("Foundation", .{});
     } else if (target.result.os.tag == .windows) {
-        exe_mod.linkSystemLibrary("iphlpapi", .{});
+        exe_mod.linkSystemLibrary("iphlpapi", .{ .use_pkg_config = .no });
     } else if (native_linux) {
         addNativeSystemPaths(b, exe_mod);
     }
diff --git a/src/nvim/session_probe.zig b/src/nvim/session_probe.zig
index 4efcf26..b8eeca1 100644
--- a/src/nvim/session_probe.zig
+++ b/src/nvim/session_probe.zig
@@ -155,6 +155,7 @@ fn expectApply(
             if (apply.opening_revision != expected_revision or
                 !std.mem.eql(u8, apply.source, expected_source))
             {
+                std.debug.print("session probe apply mismatch: expected revision={}, actual revision={}, expected source={s}, actual source={s}\n", .{ expected_revision, apply.opening_revision, expected_source, apply.source });
                 try embedded.rejectApply("unexpected session probe source");
                 return error.UnexpectedApplySource;
             }

From 3c1408555bcb22855432c1f04284f83bf7396653 Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 16:46:55 +0200
Subject: [PATCH 04/10] Keep live Neovim probe edits and writes in input order

---
 .github/workflows/verify.yml |  1 +
 src/nvim/session_probe.zig   | 30 +++++++++++++-----------------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index 5b6d6f9..93aed41 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -45,6 +45,7 @@ jobs:
           mkdir -p "$RUNNER_TEMP/rayslides-ci"
           { git rev-parse HEAD; zig version; python --version; } > "$RUNNER_TEMP/rayslides-ci/environment.log"
           python -c 'import platform; print(platform.platform()); print(platform.machine())' >> "$RUNNER_TEMP/rayslides-ci/environment.log"
+          if [ "${{ runner.os }}" != "Windows" ]; then nvim --version >> "$RUNNER_TEMP/rayslides-ci/environment.log"; fi
       - name: Build and verify built-in editor
         shell: bash
         run: |
diff --git a/src/nvim/session_probe.zig b/src/nvim/session_probe.zig
index b8eeca1..e1538e4 100644
--- a/src/nvim/session_probe.zig
+++ b/src/nvim/session_probe.zig
@@ -74,8 +74,9 @@ fn runBasicProbe(
     if (!result.rendered) return error.SessionDidNotRender;
     if (!result.initial_cursor_line) return error.SessionDidNotPositionCursor;
 
-    try embedded.input("Go@text changed");
-    try embedded.command("write");
+    // nvim_input queues asynchronously. Keep the edit and its write in the
+    // same input stream so an independent RPC command cannot overtake it.
+    try embedded.input("Go@text changed:w");
     try expectApply(io, embedded, 73, "@slide\n@text hello\n@text changed\n", 74);
     result.write_round_trip = true;
 
@@ -185,8 +186,7 @@ fn runRejectedWriteProbe(
 ) !void {
     const embedded = try openProbe(io, allocator, executable, "@slide\n", 91, 44, 10);
     defer embedded.deinit();
-    try embedded.input("Go@definitely-invalid-probe");
-    try embedded.command("wq");
+    try embedded.input("Go@definitely-invalid-probe:wq");
 
     for (0..wait_iterations) |_| {
         if (embedded.takeApply()) |_| {
@@ -220,12 +220,11 @@ fn runApplyAndCloseProbe(
 ) !bool {
     const embedded = try openProbe(io, allocator, executable, "@slide\n", revision, 40, 9);
     defer embedded.deinit();
-    try embedded.input("Go@text applied");
-    switch (kind) {
-        .wq => try embedded.command("wq"),
-        .xit => try embedded.command("xit"),
-        .zz => try embedded.input("ZZ"),
-    }
+    try embedded.input(switch (kind) {
+        .wq => "Go@text applied:wq",
+        .xit => "Go@text applied:x",
+        .zz => "Go@text appliedZZ",
+    });
     try expectApply(io, embedded, revision, "@slide\n@text applied\n", revision + 1);
     try waitForClose(io, embedded);
     return true;
@@ -256,8 +255,7 @@ fn runQuitAllProbe(
     {
         const embedded = try openProbe(io, allocator, executable, "@slide\n", 121, 40, 9);
         defer embedded.deinit();
-        try embedded.input("Go@text dirty");
-        try embedded.command("qa");
+        try embedded.input("Go@text dirty:qa");
         try io.sleep(.fromMilliseconds(100), .awake);
         result.dirty_qa_stayed_open = !embedded.shouldClose();
         if (!result.dirty_qa_stayed_open) return error.DirtyQuitAllClosedOverlay;
@@ -279,7 +277,7 @@ fn runBufferCloseProbe(io: std.Io, allocator: std.mem.Allocator, executable: []c
 fn runChildFailureProbe(io: std.Io, allocator: std.mem.Allocator, executable: []const u8) !bool {
     const embedded = try openProbe(io, allocator, executable, "@slide\n", 140, 40, 9);
     defer embedded.deinit();
-    try embedded.command("lua vim.uv.kill(vim.fn.getpid(), 9)");
+    try embedded.command("lua (vim.uv or vim.loop).kill(vim.fn.getpid(), 9)");
     try waitForClose(io, embedded);
     return embedded.state() == .closed or embedded.state() == .failed;
 }
@@ -288,13 +286,11 @@ fn runRepeatedWriteProbe(io: std.Io, allocator: std.mem.Allocator, executable: [
     const embedded = try openProbe(io, allocator, executable, "@slide\n", 150, 40, 9);
     defer embedded.deinit();
 
-    try embedded.input("Go@text one");
-    try embedded.command("write");
+    try embedded.input("Go@text one:w");
     try expectApply(io, embedded, 150, "@slide\n@text one\n", 151);
     try io.sleep(.fromMilliseconds(50), .awake);
 
-    try embedded.input("Go@text two");
-    try embedded.command("write");
+    try embedded.input("Go@text two:w");
     try expectApply(io, embedded, 151, "@slide\n@text one\n@text two\n", 152);
     try io.sleep(.fromMilliseconds(50), .awake);
 

From 66102054a5d943e03df18d7cf1a3a8d076fa7d2c Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 16:52:33 +0200
Subject: [PATCH 05/10] Acknowledge typed Neovim errors before discard probes

---
 src/nvim/session_probe.zig | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/nvim/session_probe.zig b/src/nvim/session_probe.zig
index e1538e4..0b3ea32 100644
--- a/src/nvim/session_probe.zig
+++ b/src/nvim/session_probe.zig
@@ -199,12 +199,14 @@ fn runRejectedWriteProbe(
     result.rejected_wq_stayed_open = !embedded.shouldClose();
     if (!result.rejected_wq_stayed_open) return error.RejectedWriteClosedOverlay;
 
-    try embedded.command("quit");
+    // A typed failed write can leave a hit-enter prompt. Acknowledge it
+    // before exercising dirty :q, then acknowledge that refusal before :q!.
+    try embedded.input(":q");
     try io.sleep(.fromMilliseconds(100), .awake);
     result.dirty_q_stayed_open = !embedded.shouldClose();
     if (!result.dirty_q_stayed_open) return error.DirtyQuitClosedOverlay;
 
-    try embedded.command("quit!");
+    try embedded.input(":q!");
     try waitForClose(io, embedded);
     result.forced_quit_closed_overlay = true;
 }
@@ -259,7 +261,7 @@ fn runQuitAllProbe(
         try io.sleep(.fromMilliseconds(100), .awake);
         result.dirty_qa_stayed_open = !embedded.shouldClose();
         if (!result.dirty_qa_stayed_open) return error.DirtyQuitAllClosedOverlay;
-        try embedded.command("qa!");
+        try embedded.input(":qa!");
         try waitForClose(io, embedded);
         try expectNoApply(io, embedded);
         result.forced_qa_closed = true;

From 90eeeeca890e6109c7629213b02acc31039dc71b Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 16:55:10 +0200
Subject: [PATCH 06/10] Record the native Neovim ordering diagnosis and
 retained oracles

---
 docs/ZIG_0_17_MIGRATION.md | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/docs/ZIG_0_17_MIGRATION.md b/docs/ZIG_0_17_MIGRATION.md
index 29e2986..999d4f5 100644
--- a/docs/ZIG_0_17_MIGRATION.md
+++ b/docs/ZIG_0_17_MIGRATION.md
@@ -82,6 +82,27 @@ zig build verify neovim-probe neovim-runtime-test -Doptimize=debug -Dneovim=true
 zig build verify neovim-probe neovim-runtime-test macos-app -Doptimize=safe -Dneovim=true -j2 --summary all
 ```
 
+## Neovim probe ordering and compatibility
+
+The first hosted Ubuntu job installed Neovim 0.9.5. Its default and embedded
+unit suites passed, but a live probe returned the correct revision with the
+original source instead of a just-queued edit. The
+[exact 0.9.5 API documentation](https://github.com/neovim/neovim/blob/v0.9.5/runtime/doc/api.txt#L1046)
+specifies asynchronous processing for `nvim_input`. Sending an independent
+`nvim_command("write")` or `"wq"` immediately afterward did not establish that
+the edit had run. This was a probe-ordering defect, not evidence of source
+encoding loss or a Zig compiler regression.
+
+The probes now queue edits and their typed `:w`, `:wq`, `:x`, `ZZ`, and dirty
+`:qa` commands through the same input stream. Literal expected source and
+revision assertions remain unchanged. Typed rejected writes can display a
+hit-enter prompt, so the dirty-quit and forced-discard probes acknowledge it
+before their next typed command, as the existing compact field-editor probe
+already did. The child-failure probe uses `vim.uv or vim.loop` for the renamed
+libuv namespace. No production editor code or supported minimum version was
+changed. Corrected live probes pass on the local Mac in Debug and Safe; hosted
+Linux results qualify the older version separately.
+
 ## Graphics and startup boundaries
 
 The Mac console was locked (`CGSSessionScreenIsLocked=Yes`). GLFW excludes

From acc26e5ed30eea8ab7667226928a94331c98ca15 Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 17:32:35 +0200
Subject: [PATCH 07/10] Qualify Windows tooling, portable media paths, and Save
 As ownership

---
 build.zig                  | 14 +++---
 build.zig.zon              |  4 +-
 docs/ZIG_0_17_MIGRATION.md | 55 +++++++++++++++++++-----
 src/file_browser.zig       | 16 +++++--
 src/main.zig               | 88 +++++++++++++++++++++++++++++++++++---
 5 files changed, 148 insertions(+), 29 deletions(-)

diff --git a/build.zig b/build.zig
index 13d2524..eb72f36 100644
--- a/build.zig
+++ b/build.zig
@@ -101,6 +101,8 @@ pub fn build(b: *std.Build) !void {
     const target = b.standardTargetOptions(.{ .default_target = default_target });
 
     const optimize = b.standardOptimizeOption(.{});
+    const python = b.option([]const u8, "python", "Python 3 interpreter for development tooling") orelse
+        if (builtin.os.tag == .windows) "python" else "python3";
     const neovim_supported = switch (target.result.os.tag) {
         .linux, .macos => true,
         else => false,
@@ -325,17 +327,17 @@ pub fn build(b: *std.Build) !void {
     const neovim_runtime_test_step = b.step("neovim-runtime-test", "Test the bundled .sld Neovim runtime");
     neovim_runtime_test_step.dependOn(&neovim_runtime_test_cmd.step);
 
-    const baseline_self_test_cmd = b.addSystemCommand(&.{ "python3", "tools/studio_baseline.py", "self-test" });
+    const baseline_self_test_cmd = b.addSystemCommand(&.{ python, "tools/studio_baseline.py", "self-test" });
     const baseline_self_test_step = b.step("studio-baseline-test", "Test the Studio visual/performance baseline harness");
     baseline_self_test_step.dependOn(&baseline_self_test_cmd.step);
 
-    const baseline_check_cmd = b.addSystemCommand(&.{ "python3", "tools/studio_baseline.py", "check", "--binary" });
+    const baseline_check_cmd = b.addSystemCommand(&.{ python, "tools/studio_baseline.py", "check", "--binary" });
     baseline_check_cmd.addArtifactArg(exe);
     baseline_check_cmd.addPassthruArgs();
     const baseline_check_step = b.step("studio-baselines", "Capture and compare opt-in Studio visual/performance baselines");
     baseline_check_step.dependOn(&baseline_check_cmd.step);
 
-    const baseline_update_cmd = b.addSystemCommand(&.{ "python3", "tools/studio_baseline.py", "update", "--binary" });
+    const baseline_update_cmd = b.addSystemCommand(&.{ python, "tools/studio_baseline.py", "update", "--binary" });
     baseline_update_cmd.addArtifactArg(exe);
     baseline_update_cmd.addPassthruArgs();
     const baseline_update_step = b.step("studio-baselines-update", "Capture and replace Studio visual/performance baselines");
@@ -343,7 +345,7 @@ pub fn build(b: *std.Build) !void {
 
     if (enable_neovim) {
         const neovim_baseline_check_cmd = b.addSystemCommand(&.{
-            "python3",
+            python,
             "tools/studio_baseline.py",
             "check",
             "--suite=neovim",
@@ -358,7 +360,7 @@ pub fn build(b: *std.Build) !void {
         neovim_baseline_check_step.dependOn(&neovim_baseline_check_cmd.step);
 
         const neovim_baseline_update_cmd = b.addSystemCommand(&.{
-            "python3",
+            python,
             "tools/studio_baseline.py",
             "update",
             "--suite=neovim",
@@ -387,7 +389,7 @@ pub fn build(b: *std.Build) !void {
     macos_release_qa_step.dependOn(baseline_check_step);
 
     if (target.result.os.tag == .macos) {
-        const package_cmd = b.addSystemCommand(&.{"python3"});
+        const package_cmd = b.addSystemCommand(&.{python});
         package_cmd.addFileArg(b.path("tools/package_macos_app.py"));
         package_cmd.addArg("--binary");
         package_cmd.addArtifactArg(exe);
diff --git a/build.zig.zon b/build.zig.zon
index b62fd4b..9087afd 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -19,8 +19,8 @@
             .lazy = true,
         },
         .raylib_zig = .{
-            .url = "git+https://github.com/raylib-zig/raylib-zig?ref=devel#50d450099da664bedd7dcc6ed40204ab0bb861a5",
-            .hash = "raylib_zig-6.0.0-KE8REDSmBQAbyUv_Fh71wgvhQSP2zsmVxtPRLzCgIXWK",
+            .url = "git+https://github.com/renerocksai/raylib-zig#5e4bf359bcf958884289ec165fd89261937d8f1b",
+            .hash = "raylib_zig-6.0.0-KE8REDimBQDOsYOJkaDz88hsBpTsBb1DRENZ2OU_yKua",
         },
     },
 
diff --git a/docs/ZIG_0_17_MIGRATION.md b/docs/ZIG_0_17_MIGRATION.md
index 999d4f5..ad7f9fc 100644
--- a/docs/ZIG_0_17_MIGRATION.md
+++ b/docs/ZIG_0_17_MIGRATION.md
@@ -1,7 +1,7 @@
 # Zig 0.17.0 migration evidence
 
-Rayslides now requires exact Zig 0.17.0 and consumes the official immutable
-raylib-zig 0.17 port. The complete application, built-in editor, optional embedded
+Rayslides now requires exact Zig 0.17.0 and consumes an immutable relay of the
+official raylib-zig 0.17 port with a minimal upstream Windows SDK build fix. The complete application, built-in editor, optional embedded
 Neovim editor, and macOS packaging compile with safety checks enabled. Native
 macOS test, Neovim protocol, and actual application framebuffer gates pass.
 The Retina startup fix restores correct Studio and editor geometry. Framebuffer
@@ -10,15 +10,24 @@ qualification remains separate from compilation and headless protocol evidence.
 ## Source graph and representation audit
 
 The application baseline is `630948d4bce9139679832a95dbdc229b597d51a1`.
-The new raylib-zig pin is
-[`50d450099da664bedd7dcc6ed40204ab0bb861a5`](https://github.com/raylib-zig/raylib-zig/commit/50d450099da664bedd7dcc6ed40204ab0bb861a5),
-with package hash `raylib_zig-6.0.0-KE8REDSmBQAbyUv_Fh71wgvhQSP2zsmVxtPRLzCgIXWK`.
-Its C implementation identifies itself as raylib 6.1-dev, although its Zig
-package version remains 6.0.0. It pins raylib
-`2dee47282ae75d241759cc35f22e4768dcd092be` and raygui
+The official raylib-zig 0.17 baseline is
+[`50d450099da664bedd7dcc6ed40204ab0bb861a5`](https://github.com/raylib-zig/raylib-zig/commit/50d450099da664bedd7dcc6ed40204ab0bb861a5).
+The final wrapper pin is the manifest-only relay
+[`5e4bf359bcf958884289ec165fd89261937d8f1b`](https://github.com/renerocksai/raylib-zig/commit/5e4bf359bcf958884289ec165fd89261937d8f1b),
+with hash `raylib_zig-6.0.0-KE8REDimBQDOsYOJkaDz88hsBpTsBb1DRENZ2OU_yKua`.
+It selects the C raylib SDK-link fix
+[`89f86afe0fef6f2d0f684313fd58af0c85ce7a4c`](https://github.com/renerocksai/raylib/commit/89f86afe0fef6f2d0f684313fd58af0c85ce7a4c)
+(hash `raylib-6.0.0-whq8uCmfNwWMzHMDK29Wxfg0cSg1myyFGFDJakT1fQv_`), based on
+official `2dee47282ae75d241759cc35f22e4768dcd092be`.
+That owning-dependency change disables pkg-config for four native Windows SDK
+libraries; no runtime or binding code changes. Upstream review is tracked in
+[raylib #6242](https://github.com/raysan5/raylib/pull/6242) and the
+[wrapper relay #363](https://github.com/raylib-zig/raylib-zig/pull/363).
+The C implementation identifies itself as raylib 6.1-dev, although its Zig
+package version remains 6.0.0. Raygui remains pinned to
 `9cb5cfa73290ba920d071f57c1d06a4daee22f52`.
 The existing MPack 1.1.1 and JetBrains Mono 2.304 commits and hashes are retained.
-No upstream dependency source is patched by this application.
+Dependency fixes remain in their owning repositories; this application consumes their immutable hashes.
 
 The exact compiler source defines the port; the
 [wiki migration guide](https://github.com/technologylab-ai/zigllmwiki/blob/main/docs/zig-0.16-to-0.17-migration.md)
@@ -62,8 +71,8 @@ that check is not an application performance claim.
 
 | Gate | Observed result |
 | --- | --- |
-| Complete application + built-in editor, Debug/Safe | 631 application tests and 1 stub test pass |
-| Complete application + embedded editor, Debug/Safe | 631 application tests and 23 editor tests pass |
+| Complete application + built-in editor, Debug/Safe | 632 application tests and 1 stub test pass |
+| Complete application + embedded editor, Debug/Safe | 632 application tests and 23 editor tests pass |
 | Live Neovim embed/session probes, Debug/Safe | Grid rendering protocol, edits, quit/apply fidelity, child failure and host reaping pass |
 | Neovim syntax runtime | 26 real decks pass |
 | Studio baseline harness | Comparator/schema self-test passes |
@@ -82,6 +91,30 @@ zig build verify neovim-probe neovim-runtime-test -Doptimize=debug -Dneovim=true
 zig build verify neovim-probe neovim-runtime-test macos-app -Doptimize=safe -Dneovim=true -j2 --summary all
 ```
 
+## Windows SDK, tooling, paths, and save ownership
+
+The first native Windows gate passed 626 application tests and exposed five
+failures: three path-fixture mismatches and two Save As failures. Native SDK
+links now bypass pkg-config in both the application and the owning C dependency,
+so Strawberry Perl's broken batch wrapper is not involved. Windows development
+tooling uses the selected `python` interpreter, keeping Pillow in the same
+isolated environment; `-Dpython` permits an explicit Python 3 path.
+
+Authored Windows media references use portable forward slashes in `.sld`
+source, while browser filesystem fixtures compare native separators. The
+exclusive Save As reservation requests read access so exact Zig 0.17's Windows
+`FILE_ALL_INFORMATION` stat query can inspect its identity. Exclusivity and the
+identity/version checks remain intact.
+
+Review also found a pre-existing data-preservation defect: after the atomic
+writer detected a changed source, outer error cleanup deleted the now-foreign
+pathname. The detected-conflict path now retains it. A deterministic regression
+replaces the actual closed reservation during the writer's first allocation,
+requires `SourceChangedOnDisk`, and verifies the external replacement bytes
+remain. Ordinary allocation failure still removes an unchanged reservation.
+This protects detected conflicts; the existing compare/rename gap does not
+provide atomic isolation from every uncooperative concurrent writer.
+
 ## Neovim probe ordering and compatibility
 
 The first hosted Ubuntu job installed Neovim 0.9.5. Its default and embedded
diff --git a/src/file_browser.zig b/src/file_browser.zig
index 5d9e2d3..cab74ad 100644
--- a/src/file_browser.zig
+++ b/src/file_browser.zig
@@ -1098,7 +1098,11 @@ fn testBrowser() *Browser {
 }
 
 fn joinedTestPath(buffer: []u8, root: []const u8, tail: []const u8) []const u8 {
-    return joinPath(buffer, root, tail).?;
+    const path = @constCast(joinPath(buffer, root, tail).?);
+    // realPath returns native separators for every component, including
+    // nested fixture directories such as Talks/archive.
+    if (std.fs.path.sep == '\\') std.mem.replaceScalar(u8, path, '/', '\\');
+    return path;
 }
 
 test "deck purpose lists folders first and only .sld files, hiding dotfiles" {
@@ -1285,9 +1289,13 @@ test "entry ordering is folders first then case-insensitive names" {
 
 test "joinPath never doubles separators and fitTail respects UTF-8" {
     var buffer: [64]u8 = undefined;
-    try std.testing.expectEqualStrings("/a/b", joinPath(&buffer, "/a", "b").?);
-    try std.testing.expectEqualStrings("/b", joinPath(&buffer, "/", "b").?);
-    try std.testing.expectEqualStrings("/a", joinPath(&buffer, "/a", "").?);
+    const directory = if (std.fs.path.sep == '\\') "C:\\a" else "/a";
+    const root = if (std.fs.path.sep == '\\') "C:\\" else "/";
+    const child = if (std.fs.path.sep == '\\') "C:\\a\\b" else "/a/b";
+    const root_child = if (std.fs.path.sep == '\\') "C:\\b" else "/b";
+    try std.testing.expectEqualStrings(child, joinPath(&buffer, directory, "b").?);
+    try std.testing.expectEqualStrings(root_child, joinPath(&buffer, root, "b").?);
+    try std.testing.expectEqualStrings(directory, joinPath(&buffer, directory, "").?);
     try std.testing.expectEqualStrings("€b", fitTail("a€b", 4));
     try std.testing.expectEqualStrings("b", fitTail("a€b", 3));
 }
diff --git a/src/main.zig b/src/main.zig
index 7cad5a0..473c833 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -137,9 +137,15 @@ fn studioMediaPathFromSelection(
     deck_path: ?[]const u8,
     selected_path: []const u8,
 ) ![]u8 {
-    const deck_dir = if (deck_path) |path| std.fs.path.dirname(path) orelse "." else return allocator.dupe(u8, selected_path);
-    return std.fs.path.relative(allocator, cwd, null, deck_dir, selected_path) catch
-        allocator.dupe(u8, selected_path);
+    const result = if (deck_path) |path|
+        std.fs.path.relative(allocator, cwd, null, std.fs.path.dirname(path) orelse ".", selected_path) catch
+            try allocator.dupe(u8, selected_path)
+    else
+        try allocator.dupe(u8, selected_path);
+    // Authored .sld paths travel with the deck. Windows accepts forward
+    // slashes too; do not encode its native separator into portable source.
+    if (builtin.os.tag == .windows) std.mem.replaceScalar(u8, result, '\\', '/');
+    return result;
 }
 
 fn studioMediaDirective(
@@ -7805,13 +7811,21 @@ fn writeNewSourceFile(
     path: []const u8,
     source: []const u8,
 ) !void {
-    const reservation = try dir.createFile(io, path, .{ .exclusive = true });
-    errdefer dir.deleteFile(io, path) catch {};
+    // fileStatWindows queries FILE_ALL_INFORMATION, which needs read access
+    // to attributes. The reservation's identity is required for atomic save.
+    const reservation = try dir.createFile(io, path, .{ .exclusive = true, .read = true });
+    var remove_reservation_on_error = true;
+    errdefer if (remove_reservation_on_error) dir.deleteFile(io, path) catch {};
     const reserved_stat = blk: {
         defer reservation.close(io);
         break :blk try reservation.stat(io);
     };
-    try writeSourceAtomically(allocator, io, dir, path, source, reserved_stat);
+    writeSourceAtomically(allocator, io, dir, path, source, reserved_stat) catch |err| {
+        // A detected replacement belongs to another writer. Keep its bytes;
+        // the atomic writer already discards its own temporary on this path.
+        if (err == error.SourceChangedOnDisk) remove_reservation_on_error = false;
+        return err;
+    };
 }
 
 fn saveUntitledEditorSourceAs(raw_path: []const u8) !void {
@@ -7888,6 +7902,68 @@ test "untitled Save As removes its reservation when the atomic writer fails" {
     try std.testing.expectError(error.FileNotFound, tmp.dir.statFile(io, "retryable.sld", .{}));
 }
 
+test "untitled Save As preserves an external replacement after a detected conflict" {
+    const io = std.testing.io;
+    const allocator = std.testing.allocator;
+    var tmp = std.testing.tmpDir(.{});
+    defer tmp.cleanup();
+
+    const ReplacingAllocator = struct {
+        backing: std.mem.Allocator,
+        io: std.Io,
+        dir: std.Io.Dir,
+        fired: bool = false,
+        io_error: ?anyerror = null,
+
+        fn getAllocator(self: *@This()) std.mem.Allocator {
+            return .{ .ptr = self, .vtable = &.{
+                .alloc = alloc,
+                .resize = std.mem.Allocator.noResize,
+                .remap = std.mem.Allocator.noRemap,
+                .free = free,
+            } };
+        }
+
+        fn alloc(context: *anyopaque, len: usize, alignment: std.mem.Alignment, return_address: usize) ?[*]u8 {
+            const self: *@This() = @ptrCast(@alignCast(context));
+            if (!self.fired) {
+                self.fired = true;
+                self.replaceReservation() catch |err| {
+                    self.io_error = err;
+                    return null;
+                };
+            }
+            return self.backing.rawAlloc(len, alignment, return_address);
+        }
+
+        fn free(context: *anyopaque, memory: []u8, alignment: std.mem.Alignment, return_address: usize) void {
+            const self: *@This() = @ptrCast(@alignCast(context));
+            self.backing.rawFree(memory, alignment, return_address);
+        }
+
+        fn replaceReservation(self: *@This()) !void {
+            // The writer's first allocation occurs after reservation close
+            // and before its final identity check. Replace the actual file,
+            // rather than mocking the reported conflict or cleanup result.
+            try self.dir.writeFile(self.io, .{ .sub_path = "external.sld", .data = "@slide\n@text external editor\n" });
+            try self.dir.rename("external.sld", self.dir, "conflicted.sld", self.io);
+        }
+    };
+    var replacing: ReplacingAllocator = .{ .backing = allocator, .io = io, .dir = tmp.dir };
+    try std.testing.expectError(error.SourceChangedOnDisk, writeNewSourceFile(
+        replacing.getAllocator(),
+        io,
+        tmp.dir,
+        "conflicted.sld",
+        "@slide\n@text application draft\n",
+    ));
+    try std.testing.expect(replacing.fired);
+    try std.testing.expectEqual(@as(?anyerror, null), replacing.io_error);
+    const preserved = try tmp.dir.readFileAlloc(io, "conflicted.sld", allocator, .unlimited);
+    defer allocator.free(preserved);
+    try std.testing.expectEqualStrings("@slide\n@text external editor\n", preserved);
+}
+
 test "recovery copies are unique and preserve every source byte" {
     const allocator = std.testing.allocator;
     const io = std.testing.io;

From 14147d269994b6b58941dfadc7a7c8e03625a54d Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 17:48:49 +0200
Subject: [PATCH 08/10] Make Windows metadata conflicts and chosen paths
 deterministic

---
 src/file_browser.zig | 2 ++
 src/main.zig         | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/file_browser.zig b/src/file_browser.zig
index cab74ad..9220b05 100644
--- a/src/file_browser.zig
+++ b/src/file_browser.zig
@@ -406,6 +406,8 @@ pub const Browser = struct {
     fn choose(self: *Browser, directory_path: []const u8, name: []const u8) Outcome {
         const chosen = joinPath(&self.chosen_buffer, directory_path, name) orelse return .none;
         self.chosen_len = chosen.len;
+        if (builtin.os.tag == .windows)
+            std.mem.replaceScalar(u8, self.chosen_buffer[0..self.chosen_len], '/', '\\');
         self.active = false;
         return .chosen;
     }
diff --git a/src/main.zig b/src/main.zig
index 473c833..fff3c49 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -7676,14 +7676,16 @@ test "atomic Studio writer replaces expected source and rejects a conflict" {
     try std.testing.expectEqualStrings("Studio source\n", written);
 
     const studio_version = try tmp.dir.statFile(io, "deck.sld", .{});
-    try tmp.dir.writeFile(io, .{ .sub_path = "deck.sld", .data = "external edit\n" });
+    // Metadata is the conflict contract. Make its size differ explicitly;
+    // consecutive same-sized writes need not get distinct Windows times.
+    try tmp.dir.writeFile(io, .{ .sub_path = "deck.sld", .data = "external edit with a different length\n" });
     try std.testing.expectError(
         error.SourceChangedOnDisk,
         writeSourceAtomically(allocator, io, tmp.dir, "deck.sld", "must not win\n", studio_version),
     );
     const preserved = try tmp.dir.readFileAlloc(io, "deck.sld", allocator, .unlimited);
     defer allocator.free(preserved);
-    try std.testing.expectEqualStrings("external edit\n", preserved);
+    try std.testing.expectEqualStrings("external edit with a different length\n", preserved);
 }
 
 fn saveEditorSource() !void {

From b5f9440ffad34d438c410e791aeac2a9f7747182 Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 19:02:47 +0200
Subject: [PATCH 09/10] docs: identify obsolete pre-Notes visual reference

---
 docs/ZIG_0_17_MIGRATION.md | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/docs/ZIG_0_17_MIGRATION.md b/docs/ZIG_0_17_MIGRATION.md
index ad7f9fc..4a88849 100644
--- a/docs/ZIG_0_17_MIGRATION.md
+++ b/docs/ZIG_0_17_MIGRATION.md
@@ -79,7 +79,7 @@ that check is not an application performance claim.
 | CLI | Real executable version/help exit successfully |
 | macOS app bundles | Built-in and embedded editor packages build with Safe |
 | Actual application framebuffers | Hidden 900×506 Studio and Neovim captures pass nonblank, 4-slide render-state, and clean-exit checks; actual Safe bundle passes too |
-| Historical compact visual reference | Capture succeeds; pixel comparison fails (details below), references retained |
+| Historical compact visual reference | Obsolete UI reference; capture succeeds and comparison is recorded separately below |
 
 Run the local correctness matrix with the exact compiler and Python Pillow on
 `PATH`:
@@ -173,13 +173,17 @@ pass 900×506 Studio and real embedded-Neovim framebuffer checks on the Apple M3
 Max GPU, with clean exit. The screenshot is normalized from Retina backing
 pixels to the requested logical dimensions.
 
-The existing `compact-properties` reference comparison remains a failed,
-separately scoped gate: mean channel delta 2.082, RMS 9.557, and 5.32% changed
-pixels (3% limit). The current frame includes the Notes toolbar control absent
-from that older reference and uses Retina rasterization. The complete geometry
-was visually inspected, but the references and thresholds were not changed.
-Passing nonblank/current-frame checks does not claim a pixel match to that
-historical image. Full historical visual-suite requalification remains pending.
+The checked-in `compact-properties` image is an obsolete UI reference. It was
+last refreshed by `682ad87` on 2026-08-25, before `630948d` added the Notes UI on
+2026-09-11, while the application still used Zig 0.16. The Notes toolbar control
+shifts the existing controls; the current Retina capture also differs in text
+and edge rasterization. Comparing against that historical image reports mean
+channel delta 2.082, RMS 9.557, and 5.32% changed pixels (3% limit). That result
+records disagreement with the old reference rather than establishing a port
+regression. The complete current geometry was visually inspected and the named
+framebuffer checks above pass. Historical references and thresholds are retained;
+refreshing the visual suite requires reviewing each affected current scene before
+promoting new images, as described in `tests/studio_baselines/README.md`.
 
 The native CI matrix builds and tests Debug/Safe on Linux, macOS, and Windows,
 with the optional editor on Linux/macOS. Its Safe Linux Xvfb gate exercises a

From 37c7eabebb32074b89066bc0fb00e6f1a37d68b5 Mon Sep 17 00:00:00 2001
From: renerocksai 
Date: Fri, 9 Oct 2026 19:30:08 +0200
Subject: [PATCH 10/10] Keep macOS fullscreen geometry coherent on HiDPI
 displays

---
 docs/MACOS_RELEASE_QA.md   |  11 ++-
 docs/REFERENCE.md          |  17 ++++-
 docs/ZIG_0_17_MIGRATION.md |  20 +++++
 src/main.zig               | 152 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 194 insertions(+), 6 deletions(-)

diff --git a/docs/MACOS_RELEASE_QA.md b/docs/MACOS_RELEASE_QA.md
index ff842cb..9e89d73 100644
--- a/docs/MACOS_RELEASE_QA.md
+++ b/docs/MACOS_RELEASE_QA.md
@@ -136,10 +136,17 @@ sleep/wake, Android, latency, or real-projector checklist item.
       margins, diagnostics HUD, cursor, laser drawing, or geometry preview.
 - [ ] Cancel or finish export, return to the original slide/step, then edit and
       Undo/Redo once to verify GPU/parser ownership is still sound.
-- [ ] Press Q and Esc repeatedly in windowed, borderless,
-      and exclusive fullscreen presentation. Neither key ends the app. Quit
+- [ ] Press Q and Esc repeatedly in windowed and borderless
+      fullscreen presentation. On macOS, F and Shift +
+      F both select borderless fullscreen. Neither Q nor Esc ends the app. Quit
       through the palette's **Quit Rayslides** and through the window's close
       button; both run the recovery-copy path above.
+- [ ] On a Retina display, run `rayslides --diagnostics-fullscreen-check=exclusive
+      --diagnostics-window=900x506 --diagnostics-report=/tmp/fullscreen.json`.
+      Require `passed: true`, effective mode `borderless`, consistent
+      logical/render/DPI geometry, pointer coordinates, and clipping for every
+      stage, including display-picker confirm/cancel and restored window size.
+      Repeat with `--diagnostics-fullscreen-check=borderless`.
 
 ## 6. Embedded Neovim (enabled build)
 
diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md
index 9d8a31e..1df55f0 100644
--- a/docs/REFERENCE.md
+++ b/docs/REFERENCE.md
@@ -86,7 +86,8 @@ See the next section for keyboard shortcuts for slideshow control and slide navi
 | -------- | ----------- |
 | S | Screen-Shot current slide  to PNG |
 | SHIFT + S | Screen-Shot and export slideshow to PDF |
-| F | Toggle fullscreen |
+| F | Toggle borderless fullscreen |
+| SHIFT + F | Toggle exclusive fullscreen on Linux/Windows; borderless fullscreen on macOS |
 | D | Identify and choose the presentation display |
 | L | Toggle laserpointer |
 | SHIFT + L | Iterate laserpointer sizes |
@@ -574,6 +575,15 @@ frame. Pair it with `--diagnostics-display-picker` to capture the selected and
 current monitor labels, or with `--diagnostics-showtime` to preflight the exact
 confirmed display. This is a diagnostics-only venue harness; ordinary users
 still identify and confirm displays interactively.
+`--diagnostics-fullscreen-check=borderless` or
+`--diagnostics-fullscreen-check=exclusive` opens one visible window, checks
+logical/render/DPI geometry, pointer coordinates, and a clipped drawing pattern
+in fullscreen and after display-picker confirm/cancel, restores its original
+window size, and exits. On macOS the requested exclusive mode uses borderless.
+Add `--diagnostics-report=JSON` for the five-stage result and optionally
+`--diagnostics-capture=PNG` for the fullscreen pattern. This check uses its own
+framebuffer and does not capture the desktop. It cannot run with
+`--diagnostics-hidden`.
 `--diagnostics-presenter-session` starts Presenter with the private pairing
 screen, then automatically hides setup and enters normal presentation after an
 authenticated client begins polling. It is a browser-QA harness that exercises
@@ -974,6 +984,11 @@ cancel restores the same borderless or exclusive fullscreen mode on the chosen
 or previous display. A disconnected choice is clamped to an active display,
 and the window is aspect-preservingly reduced if it would not fit.
 
+On macOS, both F and Shift + F use borderless
+fullscreen. This keeps Retina drawing, pointer input, and clipped overlays in
+the same logical coordinates. Linux and Windows retain exclusive fullscreen
+with Shift + F.
+
 Phone navigation enters the same main-thread playback functions as keyboard,
 mouse, and clicker input, preserving reveal animations, reversal, transitions,
 and auto-reveal behavior. A lost phone or failed network never prevents local
diff --git a/docs/ZIG_0_17_MIGRATION.md b/docs/ZIG_0_17_MIGRATION.md
index 4a88849..494e292 100644
--- a/docs/ZIG_0_17_MIGRATION.md
+++ b/docs/ZIG_0_17_MIGRATION.md
@@ -79,6 +79,7 @@ that check is not an application performance claim.
 | CLI | Real executable version/help exit successfully |
 | macOS app bundles | Built-in and embedded editor packages build with Safe |
 | Actual application framebuffers | Hidden 900×506 Studio and Neovim captures pass nonblank, 4-slide render-state, and clean-exit checks; actual Safe bundle passes too |
+| Retina fullscreen transitions | Exclusive requests use effective borderless mode on macOS; geometry, scissor and input checks pass through entry, picker confirmation/cancellation and window restoration |
 | Historical compact visual reference | Obsolete UI reference; capture succeeds and comparison is recorded separately below |
 
 Run the local correctness matrix with the exact compiler and Python Pillow on
@@ -173,6 +174,25 @@ pass 900×506 Studio and real embedded-Neovim framebuffer checks on the Apple M3
 Max GPU, with clean exit. The screenshot is normalized from Retina backing
 pixels to the requested logical dimensions.
 
+Independent PR review then found that raylib's macOS exclusive-fullscreen path
+reports DPI 1 while retaining a Retina framebuffer. A native reproduction drew
+the corner markers correctly but clipped the lower-right scissor marker away.
+On macOS, requested exclusive fullscreen now selects and records effective
+borderless mode, keeping drawing, mouse and scissor coordinates coherent.
+Shift+F and display-picker restoration use that same policy. Linux and Windows
+retain exclusive fullscreen. The reference and macOS release QA document the
+platform behavior.
+
+The bounded in-app diagnostic qualifies both exclusive and borderless requests
+on the M3 Max with a 2× LG HDR 4K display. Five stages pass: windowed, fullscreen,
+picker confirmation, picker cancellation and restored window. Logical dimensions
+are 900×506 windowed and 3840×2160 fullscreen; backing framebuffers are 1800×1012
+and 7680×4320, with DPI 2 throughout. Geometry, input coordinates and clipped
+drawings pass, and an independent nine-pixel PNG oracle checks corner colors,
+the scissor marker and four pixels outside the clip. The owned window restores
+and exits cleanly. Debug and Safe verification still pass all 632 application
+tests; the existing Studio framebuffer smoke also passes after the change.
+
 The checked-in `compact-properties` image is an obsolete UI reference. It was
 last refreshed by `682ad87` on 2026-08-25, before `630948d` added the Notes UI on
 2026-09-11, while the application still used Zig 0.16. The Notes toolbar control
diff --git a/src/main.zig b/src/main.zig
index fff3c49..019b400 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -75,6 +75,8 @@ const cli_help =
     \\                                    Capture a presentation-size framebuffer
     \\  --diagnostics-display-picker     Show the presentation display picker
     \\  --diagnostics-confirm-display=N  Confirm active display N (1-based) before QA
+    \\  --diagnostics-fullscreen-check=MODE
+    \\                                    Check borderless/exclusive geometry, clipping, and restore; exit
     \\  --diagnostics-showtime           Open the Showtime readiness overlay
     \\  --diagnostics-large-deck=N       Generate an N-slide stress deck (1-200)
     \\  --diagnostics-incremental-edit=N Edit slide N after the initial render
@@ -585,6 +587,13 @@ const FullscreenMode = enum {
     exclusive,
 };
 
+fn effectivePresentationFullscreen(desired: FullscreenMode) FullscreenMode {
+    // The pinned Cocoa backend's exclusive path reports DPI=1 while its
+    // framebuffer is Retina-sized and its cursor coordinates remain points.
+    // Keep drawing, input, and scissor coordinates in the windowed point space.
+    return if (builtin.os.tag == .macos and desired == .exclusive) .borderless else desired;
+}
+
 const DisplayPicker = struct {
     visible: bool = false,
     candidate_monitor: i32 = 0,
@@ -708,12 +717,13 @@ fn enterPresentationFullscreen(
     rl.setWindowSize(rl.getMonitorWidth(monitor), rl.getMonitorHeight(monitor));
     screen_width.* = rl.getMonitorWidth(monitor);
     screen_height.* = rl.getMonitorHeight(monitor);
-    switch (desired) {
+    const effective = effectivePresentationFullscreen(desired);
+    switch (effective) {
         .windowed => unreachable,
         .borderless => rl.toggleBorderlessWindowed(),
         .exclusive => rl.toggleFullscreen(),
     }
-    mode.* = desired;
+    mode.* = effective;
 }
 
 fn parseDiagnosticWindowSize(value: []const u8) ?WindowDimensions {
@@ -1863,6 +1873,129 @@ fn closeDisplayPicker(
     );
 }
 
+const FullscreenCheckFrame = struct {
+    stage: []const u8,
+    mode: FullscreenMode,
+    screen: WindowDimensions,
+    render: WindowDimensions,
+    dpi: rl.Vector2,
+    mouse: rl.Vector2,
+    geometry_ok: bool,
+    clipping_ok: bool,
+    input_ok: bool,
+};
+
+fn checkFullscreenFrame(
+    stage: []const u8,
+    mode: FullscreenMode,
+    width: i32,
+    height: i32,
+    capture_path: ?[]const u8,
+) !FullscreenCheckFrame {
+    if (width <= 0 or height <= 0 or width > 16384 or height > 16384)
+        return error.FullscreenDiagnosticDimensionsOutOfRange;
+    const mouse_x = @divTrunc(width * 7, 8);
+    const mouse_y = @divTrunc(height * 7, 8);
+    rl.setMousePosition(mouse_x, mouse_y);
+    // Settle native resize/input callbacks, then read our own framebuffer
+    // before swapping. The markers distinguish point/pixel scale errors from
+    // a nonblank frame; the magenta patch must occupy only the scissor region.
+    for (0..24) |frame| {
+        rl.beginDrawing();
+        rl.clearBackground(.black);
+        rl.drawRectangle(0, 0, @divTrunc(width, 4), @divTrunc(height, 4), .red);
+        rl.drawRectangle(@divTrunc(width * 3, 4), 0, @divTrunc(width, 4), @divTrunc(height, 4), .green);
+        rl.drawRectangle(0, @divTrunc(height * 3, 4), @divTrunc(width, 4), @divTrunc(height, 4), .blue);
+        rl.drawRectangle(@divTrunc(width * 3, 4), @divTrunc(height * 3, 4), @divTrunc(width, 4), @divTrunc(height, 4), .yellow);
+        rl.beginScissorMode(@divTrunc(width, 2), @divTrunc(height, 2), @divTrunc(width, 4), @divTrunc(height, 4));
+        rl.drawRectangle(0, 0, width, height, .magenta);
+        rl.endScissorMode();
+        defer rl.endDrawing();
+        if (frame != 23) continue;
+        rl.gl.rlDrawRenderBatchActive();
+        const image = try rl.loadImageFromScreen();
+        defer rl.unloadImage(image);
+        if (capture_path) |path| {
+            var path_buffer: [std.fs.max_path_bytes:0]u8 = undefined;
+            const path_z = try std.fmt.bufPrintSentinel(&path_buffer, "{s}", .{path}, 0);
+            if (!image.exportToFile(path_z)) return error.DiagnosticImageExportFailed;
+        }
+        const samples = .{
+            .{ 1, 1, rl.Color.red },     .{ 7, 1, rl.Color.green },
+            .{ 1, 7, rl.Color.blue },    .{ 7, 7, rl.Color.yellow },
+            .{ 5, 5, rl.Color.magenta }, .{ 7, 5, rl.Color.black },
+            .{ 5, 7, rl.Color.black },   .{ 3, 5, rl.Color.black },
+            .{ 5, 3, rl.Color.black },
+        };
+        var clipping_ok = true;
+        inline for (samples) |sample| {
+            const color = image.getColor(@divTrunc(image.width * sample[0], 8), @divTrunc(image.height * sample[1], 8));
+            clipping_ok = clipping_ok and color.r == sample[2].r and color.g == sample[2].g and color.b == sample[2].b;
+        }
+        const dpi = rl.getWindowScaleDPI();
+        const mouse = rl.getMousePosition();
+        const screen = WindowDimensions{ .width = rl.getScreenWidth(), .height = rl.getScreenHeight() };
+        const render = WindowDimensions{ .width = rl.getRenderWidth(), .height = rl.getRenderHeight() };
+        const geometry_ok = screen.width == width and screen.height == height and
+            @abs(@as(f32, @floatFromInt(render.width)) - @as(f32, @floatFromInt(width)) * dpi.x) <= 1 and
+            @abs(@as(f32, @floatFromInt(render.height)) - @as(f32, @floatFromInt(height)) * dpi.y) <= 1 and
+            rl.isWindowFullscreen() == (mode == .exclusive) and
+            rl.isWindowState(.{ .borderless_windowed_mode = true }) == (mode == .borderless);
+        return .{
+            .stage = stage,
+            .mode = mode,
+            .screen = screen,
+            .render = render,
+            .dpi = dpi,
+            .mouse = mouse,
+            .geometry_ok = geometry_ok,
+            .clipping_ok = clipping_ok,
+            .input_ok = @abs(mouse.x - @as(f32, @floatFromInt(mouse_x))) <= 1 and
+                @abs(mouse.y - @as(f32, @floatFromInt(mouse_y))) <= 1,
+        };
+    }
+    unreachable;
+}
+
+fn checkPresentationFullscreen(io: std.Io, desired: FullscreenMode, capture_path: ?[]const u8, report_path: ?[]const u8) !void {
+    var mode: FullscreenMode = .windowed;
+    var screen_width = rl.getScreenWidth();
+    var screen_height = rl.getScreenHeight();
+    var windowed_width = screen_width;
+    var windowed_height = screen_height;
+    const initial_size = WindowDimensions{ .width = screen_width, .height = screen_height };
+    const initial_mouse = rl.getMousePosition();
+    var picker = DisplayPicker.init();
+    defer {
+        leavePresentationFullscreen(&mode, picker.confirmed_monitor, initial_size.width, initial_size.height, &screen_width, &screen_height);
+        rl.setMousePosition(@intFromFloat(initial_mouse.x), @intFromFloat(initial_mouse.y));
+    }
+    var frames: [5]FullscreenCheckFrame = undefined;
+    frames[0] = try checkFullscreenFrame("windowed", mode, screen_width, screen_height, null);
+    enterPresentationFullscreen(&mode, desired, picker.confirmed_monitor, &windowed_width, &windowed_height, &screen_width, &screen_height);
+    frames[1] = try checkFullscreenFrame("fullscreen", mode, screen_width, screen_height, capture_path);
+    openDisplayPicker(&picker, &mode, windowed_width, windowed_height, &screen_width, &screen_height);
+    closeDisplayPicker(&picker, true, &mode, &windowed_width, &windowed_height, &screen_width, &screen_height);
+    frames[2] = try checkFullscreenFrame("picker_confirm", mode, screen_width, screen_height, null);
+    openDisplayPicker(&picker, &mode, windowed_width, windowed_height, &screen_width, &screen_height);
+    closeDisplayPicker(&picker, false, &mode, &windowed_width, &windowed_height, &screen_width, &screen_height);
+    frames[3] = try checkFullscreenFrame("picker_cancel", mode, screen_width, screen_height, null);
+    leavePresentationFullscreen(&mode, picker.confirmed_monitor, windowed_width, windowed_height, &screen_width, &screen_height);
+    frames[4] = try checkFullscreenFrame("restored", mode, screen_width, screen_height, null);
+    var passed = screen_width == initial_size.width and screen_height == initial_size.height;
+    for (frames) |frame| passed = passed and frame.geometry_ok and frame.clipping_ok and frame.input_ok;
+    const report = try std.json.Stringify.valueAlloc(std.heap.page_allocator, .{
+        .requested = desired,
+        .effective = effectivePresentationFullscreen(desired),
+        .passed = passed,
+        .frames = frames,
+    }, .{ .whitespace = .indent_2 });
+    defer std.heap.page_allocator.free(report);
+    if (report_path) |path| try std.Io.Dir.cwd().writeFile(io, .{ .sub_path = path, .data = report });
+    try std.Io.File.stdout().writeStreamingAll(io, report);
+    if (!passed) return error.FullscreenDiagnosticFailed;
+}
+
 const DisplayPickerLayout = struct {
     top: i32,
     row_height: i32,
@@ -3271,6 +3404,7 @@ pub fn main(init: std.process.Init) anyerror!void {
     var diagnostics_presentation_capture = false;
     var diagnostics_display_picker = false;
     var diagnostics_confirm_display: ?i32 = null;
+    var diagnostics_fullscreen_check: ?FullscreenMode = null;
     var diagnostics_showtime = false;
     var diagnostics_large_deck_count: ?usize = null;
     var diagnostics_incremental_edit_slide: ?usize = null;
@@ -3412,6 +3546,10 @@ pub fn main(init: std.process.Init) anyerror!void {
             } else if (!positional_only and std.mem.eql(u8, arg, "--diagnostics-display-picker")) {
                 diagnostics_display_picker = true;
                 launch_studio = true;
+            } else if (!positional_only and std.mem.startsWith(u8, arg, "--diagnostics-fullscreen-check=")) {
+                const value = arg["--diagnostics-fullscreen-check=".len..];
+                diagnostics_fullscreen_check = if (std.mem.eql(u8, value, "borderless")) .borderless else if (std.mem.eql(u8, value, "exclusive")) .exclusive else return error.InvalidDiagnosticFullscreenMode;
+                launch_studio = true;
             } else if (!positional_only and std.mem.startsWith(u8, arg, "--diagnostics-confirm-display=")) {
                 diagnostics_confirm_display = parseDiagnosticDisplayNumber(arg["--diagnostics-confirm-display=".len..]) orelse
                     return error.InvalidDiagnosticMonitorIndex;
@@ -3574,10 +3712,14 @@ pub fn main(init: std.process.Init) anyerror!void {
         break :blk try std.fmt.bufPrint(&G.slideshow_filp_to_load_buffer, "{s}", .{selected});
     };
 
-    if ((diagnostics_report_path != null or diagnostics_exit_after_capture) and diagnostics_capture_path == null)
+    if ((diagnostics_report_path != null or diagnostics_exit_after_capture) and diagnostics_capture_path == null and diagnostics_fullscreen_check == null)
         return error.DiagnosticCapturePathRequired;
     if (diagnostics_hidden and (diagnostics_capture_path == null or !diagnostics_exit_after_capture))
         return error.HiddenDiagnosticsRequireCaptureAndExit;
+    if (diagnostics_fullscreen_check != null and diagnostics_hidden)
+        return error.FullscreenDiagnosticsRequireVisibleWindow;
+    if (diagnostics_fullscreen_check != null and (showtime_report_path != null or portable_show_path != null))
+        return error.FullscreenDiagnosticsOutputModesConflict;
     if (diagnostics_presentation_capture) {
         if (slideshow_to_load == null or diagnostics_window_size == null or diagnostics_capture_path == null or
             !diagnostics_presenter_session)
@@ -3637,6 +3779,10 @@ pub fn main(init: std.process.Init) anyerror!void {
     rl.setExitKey(.null);
     defer rl.closeWindow(); // Close window and OpenGL context
 
+    if (diagnostics_fullscreen_check) |desired| {
+        return checkPresentationFullscreen(io, desired, diagnostics_capture_path, diagnostics_report_path);
+    }
+
     // Video sound arrives as raw PCM chunks streamed into an AudioStream.
     rl.setAudioStreamBufferSizeDefault(videoplayer.audio_stream_buffer_frames);
     rl.initAudioDevice();