From 615140135b3e5cca1c3b6bf3dd55285ca9c04e7e Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:59:09 -0300 Subject: [PATCH 1/7] xcl-gui: a window to run XCL, read its log, edit settings and update A program of its own that drives xcl.exe from outside: a home page with the game and its Play button, the console and xcl.log followed live (errors and warnings on a page of their own), the title's xcl.toml and the per-run switches, and updating and building XCL with a progress bar. English and Spanish, dark and light themes. Nothing of XCL's runtime is linked or changed. Its tests pass on Windows and Linux; the window builds and opens on Windows. Not yet run with a real title. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- Cargo.lock | 2952 ++++++++++++++++++++++++++++++++-- Cargo.toml | 2 +- crates/xcl-gui/Cargo.toml | 17 + crates/xcl-gui/README.md | 67 + crates/xcl-gui/src/logic.rs | 804 +++++++++ crates/xcl-gui/src/main.rs | 1074 +++++++++++++ crates/xcl-gui/src/runner.rs | 291 ++++ 7 files changed, 5050 insertions(+), 157 deletions(-) create mode 100644 crates/xcl-gui/Cargo.toml create mode 100644 crates/xcl-gui/README.md create mode 100644 crates/xcl-gui/src/logic.rs create mode 100644 crates/xcl-gui/src/main.rs create mode 100644 crates/xcl-gui/src/runner.rs diff --git a/Cargo.lock b/Cargo.lock index 9fcde4604a..4d03c83f2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,18 +2,214 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "accesskit" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e883d1d28c5fd5568c79ed2d2bd48d9f2fd3945c8974ed0f53690ceddb051be" +dependencies = [ + "uuid", +] + [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "ahash" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fca89247609239eeb6915e6991111866b92d7b31025e69302bbf430cc4d2c38" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "serde", + "version_check", + "zerocopy", +] + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags 2.13.2", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "wl-clipboard-rs", + "x11rb", +] + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2 0.5.3", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.5", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "calloop" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" +dependencies = [ + "bitflags 2.13.2", + "log", + "polling", + "rustix 0.38.44", + "slab", + "thiserror 1.0.69", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" +dependencies = [ + "calloop", + "rustix 0.38.44", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.11.2" @@ -21,6 +217,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -31,297 +229,2543 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] -name = "equivalent" -version = "1.0.3" +name = "cfg_aliases" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] -name = "find-msvc-tools" -version = "0.1.15" +name = "cgl" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] [[package]] -name = "generic-array" -version = "0.14.9" +name = "clipboard-win" +version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" dependencies = [ - "typenum", - "version_check", + "error-code", ] [[package]] -name = "hashbrown" -version = "0.17.1" +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "libc", + "objc2 0.6.5", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "ecolor" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31bcbef0d4263a63eb32c4834e5d711613035ce1333468e107d928923e21e6e2" +dependencies = [ + "bytemuck", + "emath", +] + +[[package]] +name = "eframe" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c5642501a65ca657d05f00c643a5c14ff2346cb3818032bfe23d58e1f8e5f84" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "egui-wgpu", + "egui-winit", + "egui_glow", + "glow", + "glutin", + "glutin-winit", + "image", + "js-sys", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "parking_lot", + "percent-encoding", + "profiling", + "raw-window-handle", + "send_wrapper", + "static_assertions", + "wasm-bindgen", + "web-sys", + "web-time", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec9144f49b7a28b5f395d3147e325b4fe3e77ba686eac11d1bdf0a7da3f375f" +dependencies = [ + "accesskit", + "ahash", + "bitflags 2.13.2", + "emath", + "epaint", + "itertools", + "log", + "nohash-hasher", + "profiling", + "smallvec", + "unicode-segmentation", + "web-sys", +] + +[[package]] +name = "egui-wgpu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0309cbe1febed48af5b974e4bcc424b35e9664863a4d402697147b57a488c864" +dependencies = [ + "ahash", + "bytemuck", + "document-features", + "egui", + "epaint", + "log", + "profiling", + "thiserror 2.0.21", + "type-map", + "web-time", + "wgpu", + "winit", +] + +[[package]] +name = "egui-winit" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e449f4c4a2a60c7ccb4ba7fa4078417bfe1f9ddc03b5e05ce75748e33a70de" +dependencies = [ + "arboard", + "block2 0.6.2", + "bytemuck", + "egui", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-foundation 0.3.2", + "objc2-ui-kit 0.3.2", + "profiling", + "raw-window-handle", + "web-time", + "windows-sys 0.61.2", + "winit", +] + +[[package]] +name = "egui_glow" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9275ca5cc35a6b7c94e0e8cedf22542f66cb0cf45ed8ab2657c78ff49fec7268" +dependencies = [ + "bytemuck", + "egui", + "glow", + "log", + "profiling", + "winit", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "emath" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e73ce90f54750be8672c02be0743fe47530e6f251e066f0ee2869b59eb297af5" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "epaint" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97bac86ae3dde93fc3951e790951caea739ff39a6c89d909cdaf1d9278dbb1bd" +dependencies = [ + "ahash", + "bytemuck", + "ecolor", + "emath", + "epaint_default_fonts", + "font-types", + "harfrust", + "log", + "nohash-hasher", + "parking_lot", + "profiling", + "self_cell", + "skrifa", + "smallvec", + "unicode-general-category", + "unicode-properties", + "unicode-segmentation", + "vello_cpu", +] + +[[package]] +name = "epaint_default_fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfc1cc505827f4c23eedc297975a0fd038268d41293f389dd8ff3b574aefab19" + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "fixedbitset" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5905ec755cc8386d7928353e4d356d2be3e89e81e5ca01fe630a1ca4d08dc175" + +[[package]] +name = "flate2" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.6", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasm-bindgen", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glifo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "skrifa", + "smallvec", + "vello_common", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.13.2", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "tiff", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "itertools" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags 2.13.2", + "libc", + "plain", + "redox_syscall 0.9.5", +] + +[[package]] +name = "libudis86-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139bbf9ddb1bfc90c1ac64dd2923d9c957cd433cee7315c018125d72ab08a6b0" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litrs" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b614978e47ce529faee66579f2b2fe19c94aa96d910a6a9a8043b2b02d8175" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "mach2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memmap2" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157" +dependencies = [ + "libc", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mmap-fixed-fixed" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0681853891801e4763dc252e843672faf32bcfee27a0aa3b19733902af450acc" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "naga" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd0dd362bf26c0ffdd143df6da66a25d287e196eff482f117771010b207ad163" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14474170feb673cfb18b3565111a9869797cc1d290fb9ec969c53f5e1e231c6d" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "libc", + "objc2 0.5.3", + "objc2-core-data", + "objc2-core-image", + "objc2-foundation 0.2.2", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-data" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-core-location" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-contacts", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "dispatch", + "libc", + "objc2 0.5.3", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2 0.6.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-metal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", + "objc2-metal", +] + +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation 0.2.2", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers 0.2.2", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "objc2 0.6.5", + "objc2-core-foundation", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2 0.5.1", + "objc2 0.5.3", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4" +dependencies = [ + "objc2 0.6.5", + "objc2-foundation 0.3.2", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.13.2", + "block2 0.5.1", + "objc2 0.5.3", + "objc2-core-location", + "objc2-foundation 0.2.2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "orbclient" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747" +dependencies = [ + "libc", + "libredox", +] + +[[package]] +name = "os_pipe" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "petgraph" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" +dependencies = [ + "fixedbitset", + "hashbrown 0.15.5", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6c2123f4708bbd422630a6dae7c03f678b1ce1f1c99e4c4b3beac69c8174cc9" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358938fd6df944c1e44bb328b60fb275f13c804aac47ba26a1165d45a3f87756" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.6", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9b9cf600136f5b976fbc5727d58c26e1ecab8ee23088d44ef1c7af793550ab" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_syscall" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "region" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" +dependencies = [ + "bitflags 1.3.2", + "libc", + "mach2", + "windows-sys 0.52.0", +] + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "retour" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9af44d40e2400b44d491bfaf8eae111b09f23ac4de6e92728e79d93e699c527" +dependencies = [ + "cfg-if", + "generic-array", + "libc", + "libudis86-sys", + "mmap-fixed-fixed", + "once_cell", + "region", + "slice-pool2", +] + +[[package]] +name = "rfd" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4b9d4857b10297ffb0f64cae711e983a7aeaee561848d56d429d3858bd8ed93" +dependencies = [ + "block2 0.6.2", + "dispatch2", + "js-sys", + "libc", + "log", + "objc2 0.6.5", + "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-uniform-type-identifiers 0.3.2", + "percent-encoding", + "pollster", + "raw-window-handle", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" +dependencies = [ + "serde_core", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slice-pool2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3d689654af89bdfeba29a914ab6ac0236d382eb3b764f7454dde052f2821f8" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" + +[[package]] +name = "smithay-client-toolkit" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" +dependencies = [ + "bitflags 2.13.2", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 0.38.44", + "thiserror 1.0.69", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "testgame-mw" +version = "0.1.0" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "1.2.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.20+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e76360e201d6dbd6583e17795ba71a88f47365a9139c8450a7979c32303b8e73" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.2.0+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" + +[[package]] +name = "tree_magic_mini" +version = "3.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6" +dependencies = [ + "memchr", + "nom", + "petgraph", +] + +[[package]] +name = "type-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90" +dependencies = [ + "rustc-hash 2.1.3", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-properties" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833" [[package]] -name = "indexmap" -version = "2.14.2" +name = "unicode-segmentation" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" -dependencies = [ - "equivalent", - "hashbrown", -] +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] -name = "itoa" -version = "1.0.19" +name = "unicode-width" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" +checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" [[package]] -name = "libc" -version = "0.2.191" +name = "uuid" +version = "1.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" [[package]] -name = "libudis86-sys" -version = "0.2.1" +name = "vello_common" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139bbf9ddb1bfc90c1ac64dd2923d9c957cd433cee7315c018125d72ab08a6b0" +checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd" dependencies = [ - "cc", - "libc", + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "smallvec", + "thiserror 2.0.21", ] [[package]] -name = "mach2" -version = "0.4.3" +name = "vello_cpu" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" +checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9" dependencies = [ - "libc", + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "vello_common", ] [[package]] -name = "memchr" -version = "2.8.3" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "miniz_oxide" -version = "0.9.1" +name = "walkdir" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403" dependencies = [ - "adler2", + "same-file", + "winapi-util", ] [[package]] -name = "mmap-fixed-fixed" -version = "0.1.3" +name = "wasm-bindgen" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0681853891801e4763dc252e843672faf32bcfee27a0aa3b19733902af450acc" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" dependencies = [ - "libc", - "winapi", + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", ] [[package]] -name = "once_cell" -version = "1.21.4" +name = "wasm-bindgen-futures" +version = "0.4.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] [[package]] -name = "proc-macro2" -version = "1.0.107" +name = "wasm-bindgen-macro" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" dependencies = [ - "unicode-ident", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "quote" -version = "1.0.47" +name = "wasm-bindgen-macro-support" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" dependencies = [ + "bumpalo", "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", ] [[package]] -name = "region" -version = "3.0.2" +name = "wasm-bindgen-shared" +version = "0.2.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" dependencies = [ - "bitflags", - "libc", - "mach2", - "windows-sys 0.52.0", + "unicode-ident", ] [[package]] -name = "retour" -version = "0.3.1" +name = "wayland-backend" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9af44d40e2400b44d491bfaf8eae111b09f23ac4de6e92728e79d93e699c527" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ - "cfg-if", - "generic-array", - "libc", - "libudis86-sys", - "mmap-fixed-fixed", - "once_cell", - "region", - "slice-pool2", + "cc", + "downcast-rs", + "rustix 1.1.6", + "scoped-tls", + "smallvec", + "wayland-sys", ] [[package]] -name = "serde" -version = "1.0.229" +name = "wayland-client" +version = "0.31.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ - "serde_core", - "serde_derive", + "bitflags 2.13.2", + "rustix 1.1.6", + "wayland-backend", + "wayland-scanner", ] [[package]] -name = "serde_core" -version = "1.0.229" +name = "wayland-csd-frame" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "serde_derive", + "bitflags 2.13.2", + "cursor-icon", + "wayland-backend", ] [[package]] -name = "serde_derive" -version = "1.0.229" +name = "wayland-cursor" +version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "proc-macro2", - "quote", - "syn 3.0.10", + "rustix 1.1.6", + "wayland-client", + "xcursor", ] [[package]] -name = "serde_json" -version = "1.0.154" +name = "wayland-protocols" +version = "0.32.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-scanner", ] [[package]] -name = "serde_spanned" -version = "1.1.3" +name = "wayland-protocols-plasma" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" dependencies = [ - "serde_core", + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] -name = "shlex" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" - -[[package]] -name = "slice-pool2" -version = "0.4.3" +name = "wayland-protocols-wlr" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a3d689654af89bdfeba29a914ab6ac0236d382eb3b764f7454dde052f2821f8" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] [[package]] -name = "syn" -version = "2.0.119" +name = "wayland-scanner" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" dependencies = [ "proc-macro2", + "quick-xml", "quote", - "unicode-ident", ] [[package]] -name = "syn" -version = "3.0.10" +name = "wayland-sys" +version = "0.31.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "dlib", + "log", + "once_cell", + "pkg-config", ] [[package]] -name = "testgame-mw" -version = "0.1.0" +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] -name = "toml" -version = "1.2.1+spec-1.1.0" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ - "indexmap", - "serde_core", - "serde_spanned", - "toml_datetime", - "toml_parser", - "toml_writer", - "winnow", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "toml_datetime" -version = "1.1.3+spec-1.1.0" +name = "weezl" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "30.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146fc3d654250e6207921a66c87534c621bc886c70df83dcf466c1d66813810e" dependencies = [ - "serde_core", + "arrayvec", + "bitflags 2.13.2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", ] [[package]] -name = "toml_parser" -version = "1.1.5+spec-1.1.0" +name = "wgpu-core" +version = "30.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +checksum = "ad661da2ee99f208c30090b585284b2ab5b8bf2358ddf2d2215592808ec62f1a" dependencies = [ - "winnow", + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.13.2", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", ] [[package]] -name = "toml_writer" -version = "1.2.0+spec-1.1.0" +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" +checksum = "1331b08fa2362c5d454eccc4448e6e4f01eccfea569a00e310adbfc4415f2bdc" +dependencies = [ + "wgpu-hal", +] [[package]] -name = "typenum" -version = "1.20.1" +name = "wgpu-hal" +version = "30.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" +checksum = "a57452fe453658e141aafdb09de1028afa498805fab518238ddf372a518813ff" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "hashbrown 0.17.1", + "libloading", + "log", + "naga", + "naga-types", + "portable-atomic", + "portable-atomic-util", + "raw-window-handle", + "renderdoc-sys", + "static_assertions", + "thiserror 2.0.21", + "wgpu-naga-bridge", + "wgpu-types", +] [[package]] -name = "unicode-ident" -version = "1.0.27" +name = "wgpu-naga-bridge" +version = "30.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +checksum = "44a62ead68aad7cd40ac9e2cd2b8ec64f32dfbad2765f429b9fb74b8b735869f" +dependencies = [ + "naga", + "wgpu-types", +] [[package]] -name = "version_check" -version = "0.9.5" +name = "wgpu-types" +version = "30.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "a9f6ee0bd50f5ab79fb8c25e3f33afb27126f034af4ba5909c7a0967058659e6" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] [[package]] name = "winapi" @@ -339,6 +2783,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -537,17 +2990,121 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winit" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d" +dependencies = [ + "ahash", + "android-activity", + "atomic-waker", + "bitflags 2.13.2", + "block2 0.5.1", + "bytemuck", + "calloop", + "cfg_aliases", + "concurrent-queue", + "core-foundation", + "core-graphics", + "cursor-icon", + "dpi", + "js-sys", + "libc", + "memmap2", + "ndk", + "objc2 0.5.3", + "objc2-app-kit 0.2.2", + "objc2-foundation 0.2.2", + "objc2-ui-kit 0.2.2", + "orbclient", + "percent-encoding", + "pin-project", + "raw-window-handle", + "redox_syscall 0.4.1", + "rustix 0.38.44", + "smithay-client-toolkit", + "smol_str", + "tracing", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.52.0", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + [[package]] name = "winnow" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] + +[[package]] +name = "wl-clipboard-rs" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848" +dependencies = [ + "libc", + "log", + "os_pipe", + "rustix 1.1.6", + "thiserror 2.0.21", + "tree_magic_mini", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-wlr", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.6", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" [[package]] name = "xcl" version = "0.1.0" dependencies = [ - "miniz_oxide", + "miniz_oxide 0.9.1", "retour", "serde", "serde_json", @@ -556,16 +3113,99 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "xcl-gui" +version = "0.1.0" +dependencies = [ + "eframe", + "rfd", + "serde", + "toml", + "toml_edit", +] + [[package]] name = "xcl-testtitle" version = "0.1.0" dependencies = [ - "miniz_oxide", + "miniz_oxide 0.9.1", "windows", ] +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.13.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "zerocopy" +version = "0.8.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed43f3060383c64b000f3c630550aebdfa9d3b76d48de32390483dd2cc7e0865" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5cbd820fe3e35fb38c83b6dc7e6b1618bc46e0cd10073ae94e8d52dc468d8b9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zlib-rs" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac" + [[package]] name = "zmij" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] diff --git a/Cargo.toml b/Cargo.toml index 94e3a9a941..6626059ff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["crates/xcl", "tests/testtitle", "tests/testgamedll"] +members = ["crates/xcl", "crates/xcl-gui", "tests/testtitle", "tests/testgamedll"] [workspace.package] version = "0.1.0" diff --git a/crates/xcl-gui/Cargo.toml b/crates/xcl-gui/Cargo.toml new file mode 100644 index 0000000000..9f1c8469ad --- /dev/null +++ b/crates/xcl-gui/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "xcl-gui" +description = "A window for XCL: pick the game, run it, read its log, edit its settings" +version.workspace = true +edition.workspace = true +license.workspace = true + +[[bin]] +name = "xcl-gui" +path = "src/main.rs" + +[dependencies] +eframe = { version = "0.37.0", default-features = false, features = ["default_fonts", "glow", "wayland", "x11"] } +rfd = "0.18.0" +serde = { version = "1", features = ["derive"] } +toml = "1" +toml_edit = "0.25.20" diff --git a/crates/xcl-gui/README.md b/crates/xcl-gui/README.md new file mode 100644 index 0000000000..eb0541e591 --- /dev/null +++ b/crates/xcl-gui/README.md @@ -0,0 +1,67 @@ +# xcl-gui – a window for XCL + +`xcl-gui` runs `xcl.exe` for you, so a game can be started, watched and configured without a +command line. It is a program of its own: it starts `xcl run ` as you would, reads what it +prints and the `xcl.log` it writes, and edits the title's `xcl.toml`. Nothing of XCL's runtime is +linked into it or changed by it. + +```powershell +cargo build --release -p xcl-gui # target\release\xcl-gui.exe, next to xcl.exe +``` + +## What it does + +- **Home:** the game's folder, its exe or its `MicrosoftGame.config`, chosen once and kept. + *Play* runs it; *Stop* ends `xcl` and the game process it started. Under it, what is known of + the title's last run and of this PC (the graphics adapter `xcl run` named). +- **Console:** what `xcl` prints, as it prints it, and how the run ended (the exit code and, for + the known ones, what it means: device removed, device hung, out of memory, …). +- **Log (xcl.log):** the title's log, followed while the game runs. +- **Errors and warnings:** the `WARN` / `ERROR` lines of the log and the console lines that + report a failure, on a tab of their own with a count. +- **Settings** + - *Every run:* offline (`XCL_NETWORK=0`), `XCL_PIPELINE_THREADS`, `XCL_RUN_SECONDS`, any other + variable as `NAME=value` lines, and arguments for the game. + - *This title:* the settings of its `xcl.toml` that matter most – Series X / S, title memory + (and `title_memory_fit`, shown only where the file has that key), + GPU-visible memory, ray tracing, adapter, log level, window size, keyboard and mouse. The + file's other keys, its comments and its order are kept; a key it does not have is added only + when its value is not XCL's default. XCL writes a title's `xcl.toml` at its first run, so + the section is empty until then. +- **Graphics and shaders (every run):** the shader translator (`XCL_DIRECT_DXIL`), the shader + compiler's threads, the two disk caches, background pipelines and `XCL_DRED`. XCL has no + resolution scale, V-Sync or frame limit to set. +- **XCL:** which `xcl.exe` and which source folder are used (found from where `xcl-gui.exe` is, + or set by hand). *Update and build* runs `git pull --rebase --autostash` and then + `cargo build --release -p xcl` in that folder, with a progress bar that follows cargo's own + count; each step has a button of its own too. Only `xcl` is built: `xcl-gui.exe` is running + and cannot be written over. + +Every view has a filter, *Follow* (stay at the end), *Copy* and *Clear*. + +## Where it keeps things + +Under XCL's data root (`%LOCALAPPDATA%\XCL`, or `%XCL_DATA_ROOT%`): + +- `gui\settings.toml` – the window's own settings; +- `gui\sessions\_console.log`, `_xcl.log`, `_report.json` – what a run printed, + and copies of its log and report (XCL itself keeps the last two runs). The newest 20 runs are + kept. *Save what each run prints* turns it off. + +The game folder is not written to, as with `xcl run`. + +## Languages + +English and Spanish; the button at the foot of the side column switches. Next to it, the theme: dark (the +default) or light. + +## Tested + +Its own tests pass on Windows and Linux. The window was tried on Linux with a stand-in for +`xcl.exe` (the pages, the settings, stop, saved sessions, update and build) and builds and opens on +Windows. + +## Not tested + +Not yet run with a real title: stopping a running game, the log followed live and the title's +settings page on a real `xcl.toml` are untried. diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs new file mode 100644 index 0000000000..e83bc4c963 --- /dev/null +++ b/crates/xcl-gui/src/logic.rs @@ -0,0 +1,804 @@ +//! What the window knows without a window: XCL's folders, its log lines, a title's `xcl.toml`, +//! the window's own settings and the two languages of its texts. + +use std::path::{Path, PathBuf}; + +use serde::{Deserialize, Serialize}; + +/// XCL's data root, as `xcl` finds it: `%XCL_DATA_ROOT%` or `%LOCALAPPDATA%\XCL`. +pub fn data_root() -> PathBuf { + if let Ok(p) = std::env::var("XCL_DATA_ROOT") { + if !p.trim().is_empty() { + return PathBuf::from(p); + } + } + let base = std::env::var("LOCALAPPDATA").unwrap_or_else(|_| std::env::temp_dir().to_string_lossy().into_owned()); + PathBuf::from(base).join("XCL") +} + +/// The window's own folder under the data root: its settings and the sessions it saved. +pub fn gui_dir() -> PathBuf { + data_root().join("gui") +} + +// ---------------------------------------------------------------- log lines + +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum Severity { + Error, + Warn, + Info, + Detail, +} + +/// How serious a line is. A line of `xcl.log` carries its level (`[ 1.234][ 1234][WARN ] …`); +/// what `xcl` prints to the console does not, so those go by what they say. +pub fn severity(line: &str) -> Severity { + if let Some(tag) = log_tag(line) { + return match tag { + "ERROR" => Severity::Error, + "WARN" => Severity::Warn, + "INFO" => Severity::Info, + _ => Severity::Detail, + }; + } + let l = line.to_ascii_lowercase(); + const ERRORS: [&str; 9] = + ["crash", "unhandled exception", "device removed", "device was removed", "error", "failed", "panicked", "0x887a", "out of memory"]; + const WARNINGS: [&str; 4] = ["warning", "missing on this pc", "unimplemented", "not available"]; + // cargo's and git's own words for nothing wrong + if l.contains("0 errors") || l.contains("error: 0") { + return Severity::Info; + } + if ERRORS.iter().any(|w| l.contains(w)) { + Severity::Error + } else if WARNINGS.iter().any(|w| l.contains(w)) { + Severity::Warn + } else { + Severity::Info + } +} + +/// The level tag of an `xcl.log` line (third bracket), trimmed. +fn log_tag(line: &str) -> Option<&str> { + let mut rest = line.strip_prefix('[')?; + for _ in 0..2 { + rest = &rest[rest.find("][")? + 2..]; + } + let tag = rest[..rest.find(']')?].trim(); + matches!(tag, "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE").then_some(tag) +} + +/// The title's data folder from the line `xcl run` prints at the start (` data: C:\…`). +pub fn data_dir_line(line: &str) -> Option { + let p = line.trim_start().strip_prefix("data:")?.trim(); + (!p.is_empty()).then(|| PathBuf::from(p)) +} + +/// The graphics adapter from the line `xcl run` prints at the start (` GPU: name (N MiB VRAM)`). +pub fn gpu_line(line: &str) -> Option { + let g = line.trim_start().strip_prefix("GPU:")?.trim(); + (!g.is_empty()).then(|| g.to_string()) +} + +/// The exit code from `xcl run`'s last words (`Game exited with code 0x… (…)`). +pub fn exit_code_line(line: &str) -> Option { + let rest = line.trim().strip_prefix("Game exited with code 0x")?; + u32::from_str_radix(rest.split_whitespace().next()?, 16).ok() +} + +/// What an exit code of the game's process means, where it is one of the known ones. +pub fn exit_code_meaning(code: u32, lang: Lang) -> Option<&'static str> { + let (en, es) = match code { + 0 => ("ended normally", "terminó normalmente"), + 0x887a_0005 | 0x887a_0007 => ("the graphics device was removed", "se perdió el dispositivo gráfico"), + 0x887a_0006 => ("the GPU stopped answering (device hung)", "la GPU dejó de responder (colgada)"), + 0x8007_000e => ("out of memory", "sin memoria"), + 0xc000_0005 => ("access violation (crash)", "violación de acceso (caída)"), + 0xc000_001d => ("illegal instruction: the CPU lacks an extension", "instrucción ilegal: al procesador le falta una extensión"), + 0xc000_0409 => ("stack check failed (crash)", "falló la comprobación de pila (caída)"), + 0x8000_0003 => ("the title's own assert (breakpoint)", "aserción del propio juego (breakpoint)"), + 1 | 2 => ("XCL could not start the game", "XCL no pudo iniciar el juego"), + _ => return None, + }; + Some(if lang == Lang::Es { es } else { en }) +} + +/// Cargo's progress line (` Building [====> ] 12/345: xcl, windows`), as it prints it with +/// `CARGO_TERM_PROGRESS_WHEN=always`: the units done, their number and what is being built. +pub fn cargo_progress(line: &str) -> Option<(u32, u32, String)> { + let rest = line.trim_start().strip_prefix("Building")?.trim_start().strip_prefix('[')?; + let rest = rest[rest.find(']')? + 1..].trim_start(); + let (counts, names) = rest.split_once(':').unwrap_or((rest, "")); + let (done, total) = counts.trim().split_once('/')?; + let (done, total): (u32, u32) = (done.trim().parse().ok()?, total.trim().parse().ok()?); + (total > 0 && done <= total).then(|| (done, total, names.trim().trim_end_matches("...").trim().to_string())) +} + +// ---------------------------------------------------------------- the window's settings + +#[derive(Clone, Copy, PartialEq, Eq, Debug, Default, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum Lang { + #[default] + En, + Es, +} + +/// What the window keeps between runs (`gui\settings.toml` under the data root). +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(default)] +pub struct Settings { + pub lang: Lang, + /// The game: its folder, its exe or its `MicrosoftGame.config`. + pub game: String, + /// `xcl.exe`; empty = next to this program, then `target\release` of `repo`. + pub xcl_exe: String, + /// XCL's source folder, for updating and building; empty = found from this program's place. + pub repo: String, + /// The title's data folder of the last run (where its `xcl.toml` and logs are). + pub last_data_dir: String, + /// `XCL_NETWORK=0`: the title's network calls fail as offline. + pub offline: bool, + /// `XCL_PIPELINE_THREADS`; 0 = XCL's own number. + pub pipeline_threads: u32, + /// `XCL_RUN_SECONDS`: end the run after this long; 0 = no limit. + pub run_seconds: u32, + /// More variables, one `NAME=value` a line. + pub extra_env: String, + /// Arguments passed on to the game. + pub game_args: String, + /// Keep what a run printed under `gui\sessions`. + pub save_sessions: bool, + /// `XCL_DIRECT_DXIL`: "" (the HLSL path), "1" (compute shaders go the direct way) or "all" + /// (vertex and pixel shaders too). + pub direct_dxil: String, + /// `XCL_DXC_THREADS`; 0 = XCL's own number (the cores less one). + pub dxc_threads: u32, + /// Off = `XCL_TRANSLATED_CACHE=0`: translated shaders are not kept on disk. + pub shader_cache: bool, + /// Off = `XCL_PSO_DISK_CACHE=0`: the driver's pipelines are not kept on disk. + pub pipeline_cache: bool, + /// Off = `XCL_ASYNC_PSO=0`: pipelines are built where the title asks for them. + pub async_pipelines: bool, + /// `XCL_DRED=1`: the GPU's last operations are logged when the device is removed. + pub dred: bool, + /// The window's colours: dark (the default) or light, whatever Windows uses. + pub dark: bool, + /// The graphics adapter `xcl run` named at its last run, for the home page. + pub last_gpu: String, +} + +impl Default for Settings { + fn default() -> Self { + Settings { + lang: Lang::default(), + game: String::new(), + xcl_exe: String::new(), + repo: String::new(), + last_data_dir: String::new(), + offline: true, + pipeline_threads: 0, + run_seconds: 0, + extra_env: String::new(), + game_args: String::new(), + save_sessions: true, + direct_dxil: String::new(), + dxc_threads: 0, + shader_cache: true, + pipeline_cache: true, + async_pipelines: true, + dred: false, + dark: true, + last_gpu: String::new(), + } + } +} + +impl Settings { + pub fn load(path: &Path) -> Settings { + std::fs::read_to_string(path).ok().and_then(|s| toml::from_str(&s).ok()).unwrap_or_default() + } + + pub fn save(&self, path: &Path) -> Result<(), String> { + if let Some(dir) = path.parent() { + std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?; + } + let body = toml::to_string_pretty(self).map_err(|e| e.to_string())?; + std::fs::write(path, body).map_err(|e| format!("{}: {e}", path.display())) + } + + /// The variables a run gets, in the order shown. Lines of `extra_env` that are not + /// `NAME=value` are returned apart, to be shown as refused. + pub fn environment(&self) -> (Vec<(String, String)>, Vec) { + let mut env = Vec::new(); + let mut refused = Vec::new(); + if self.offline { + env.push(("XCL_NETWORK".to_string(), "0".to_string())); + } + if self.pipeline_threads > 0 { + env.push(("XCL_PIPELINE_THREADS".to_string(), self.pipeline_threads.to_string())); + } + if self.run_seconds > 0 { + env.push(("XCL_RUN_SECONDS".to_string(), self.run_seconds.to_string())); + } + if matches!(self.direct_dxil.trim(), "1" | "all") { + env.push(("XCL_DIRECT_DXIL".to_string(), self.direct_dxil.trim().to_string())); + } + if self.dxc_threads > 0 { + env.push(("XCL_DXC_THREADS".to_string(), self.dxc_threads.to_string())); + } + for (on, name) in [(self.shader_cache, "XCL_TRANSLATED_CACHE"), (self.pipeline_cache, "XCL_PSO_DISK_CACHE"), (self.async_pipelines, "XCL_ASYNC_PSO")] { + if !on { + env.push((name.to_string(), "0".to_string())); + } + } + if self.dred { + env.push(("XCL_DRED".to_string(), "1".to_string())); + } + for line in self.extra_env.lines().map(str::trim).filter(|l| !l.is_empty() && !l.starts_with('#')) { + match line.split_once('=') { + Some((name, value)) if is_env_name(name.trim()) => { + let name = name.trim().to_string(); + env.retain(|(n, _)| !n.eq_ignore_ascii_case(&name)); + env.push((name, value.trim().to_string())); + } + _ => refused.push(line.to_string()), + } + } + (env, refused) + } + + /// The game's arguments, split at spaces; a part in double quotes stays whole. + pub fn arguments(&self) -> Vec { + let mut out = Vec::new(); + let mut cur = String::new(); + let (mut quoted, mut any) = (false, false); + for c in self.game_args.chars() { + match c { + '"' => { + quoted = !quoted; + any = true; + } + c if c.is_whitespace() && !quoted => { + if any { + out.push(std::mem::take(&mut cur)); + any = false; + } + } + c => { + cur.push(c); + any = true; + } + } + } + if any { + out.push(cur); + } + out + } +} + +fn is_env_name(name: &str) -> bool { + !name.is_empty() && name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') && !name.starts_with(|c: char| c.is_ascii_digit()) +} + +// ---------------------------------------------------------------- a title's xcl.toml + +/// The settings of a title's `xcl.toml` the window edits. The file's other keys, its comments +/// and its order are kept as they are (`TitleFile`). +#[derive(Clone, Debug, PartialEq)] +pub struct TitleConfig { + pub device_type: String, + pub title_memory_mb: u64, + /// `title_memory_fit`, where the file has it (an XCL that fits the standard budget to the + /// GPU's video memory writes the key): `None` on an XCL without the setting. + pub title_memory_fit: Option, + pub uma_mb: u64, + pub raytracing: String, + pub d3d12_adapter: String, + pub d3d12_debug: bool, + pub log_level: String, + pub window_width: u32, + pub window_height: u32, + /// "auto", "center" or "x,y". + pub window_pos: String, + /// "auto" (the title's frames in XCL's window) or "off". + pub present: String, + pub keyboard_mouse: bool, + pub mouse_sensitivity: f32, +} + +impl Default for TitleConfig { + /// XCL's defaults, for keys a file does not have. + fn default() -> Self { + TitleConfig { + device_type: "anaconda".into(), + title_memory_mb: 0, + title_memory_fit: None, + uma_mb: 0, + raytracing: "auto".into(), + d3d12_adapter: "auto".into(), + d3d12_debug: false, + log_level: "info".into(), + window_width: 1280, + window_height: 720, + window_pos: "auto".into(), + present: "auto".into(), + keyboard_mouse: true, + mouse_sensitivity: 1.0, + } + } +} + +impl TitleConfig { + pub fn is_series_s(&self) -> bool { + self.device_type.eq_ignore_ascii_case("lockhart") || self.device_type.eq_ignore_ascii_case("series s") + } + + /// The budget XCL tells the title with these settings (MiB), as `Config::title_memory_budget_mb`. + pub fn title_memory_budget_mb(&self) -> u64 { + match self.title_memory_mb { + 0 if self.is_series_s() => 8_192, + 0 => 13_824, + v => v, + } + } +} + +/// A title's `xcl.toml` as text that keeps its shape. +pub struct TitleFile { + doc: toml_edit::DocumentMut, +} + +impl TitleFile { + pub fn parse(text: &str) -> Result { + text.parse::().map(|doc| TitleFile { doc }).map_err(|e| e.to_string()) + } + + pub fn read(path: &Path) -> Result { + let text = std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?; + TitleFile::parse(&text).map_err(|e| format!("{}: {e}", path.display())) + } + + pub fn config(&self) -> TitleConfig { + let d = TitleConfig::default(); + let text = |k: &str, or: &str| self.doc.get(k).and_then(|v| v.as_str()).unwrap_or(or).to_string(); + let int = |k: &str, or: i64| self.doc.get(k).and_then(|v| v.as_integer()).unwrap_or(or).max(0); + let flag = |k: &str, or: bool| self.doc.get(k).and_then(|v| v.as_bool()).unwrap_or(or); + let float = self.doc.get("mouse_sensitivity").and_then(|v| v.as_float().or(v.as_integer().map(|i| i as f64))); + TitleConfig { + device_type: text("device_type", &d.device_type), + title_memory_mb: int("title_memory_mb", 0) as u64, + title_memory_fit: self.doc.get("title_memory_fit").and_then(|v| v.as_bool()), + uma_mb: int("uma_mb", 0) as u64, + raytracing: text("raytracing", &d.raytracing), + d3d12_adapter: text("d3d12_adapter", &d.d3d12_adapter), + d3d12_debug: flag("d3d12_debug", d.d3d12_debug), + log_level: text("log_level", &d.log_level), + window_width: int("window_width", d.window_width as i64) as u32, + window_height: int("window_height", d.window_height as i64) as u32, + window_pos: text("window_pos", &d.window_pos), + present: text("present", &d.present), + keyboard_mouse: flag("keyboard_mouse", d.keyboard_mouse), + mouse_sensitivity: float.map_or(d.mouse_sensitivity, |f| f as f32), + } + } + + /// Writes the edited settings into the document. Every other key stays, a changed value + /// keeps the comment on its line, and a key the file does not have is added only when its + /// value is not XCL's default. + pub fn set(&mut self, c: &TitleConfig) { + use toml_edit::Value; + let d = TitleConfig::default(); + let doc = &mut self.doc; + let mut put = |key: &str, new: Value, is_default: bool| match doc.get_mut(key).and_then(|i| i.as_value_mut()) { + Some(old) => { + let decor = old.decor().clone(); + *old = new; + *old.decor_mut() = decor; + } + None if is_default => {} + None => doc[key] = toml_edit::Item::Value(new), + }; + // two decimals: the slider's step, and no 1.2000000476837158 in the file + let mouse = (c.mouse_sensitivity as f64 * 100.0).round() / 100.0; + put("device_type", c.device_type.trim().into(), c.device_type.trim() == d.device_type); + put("title_memory_mb", (c.title_memory_mb as i64).into(), c.title_memory_mb == d.title_memory_mb); + // never added: only an XCL that knows the key writes it + if let Some(fit) = c.title_memory_fit { + put("title_memory_fit", fit.into(), true); + } + put("uma_mb", (c.uma_mb as i64).into(), c.uma_mb == d.uma_mb); + put("raytracing", c.raytracing.trim().into(), c.raytracing.trim() == d.raytracing); + put("d3d12_adapter", c.d3d12_adapter.trim().into(), c.d3d12_adapter.trim() == d.d3d12_adapter); + put("d3d12_debug", c.d3d12_debug.into(), c.d3d12_debug == d.d3d12_debug); + put("log_level", c.log_level.trim().into(), c.log_level.trim() == d.log_level); + put("window_width", i64::from(c.window_width).into(), c.window_width == d.window_width); + put("window_height", i64::from(c.window_height).into(), c.window_height == d.window_height); + put("window_pos", c.window_pos.trim().into(), c.window_pos.trim() == d.window_pos); + put("present", c.present.trim().into(), c.present.trim() == d.present); + put("keyboard_mouse", c.keyboard_mouse.into(), c.keyboard_mouse == d.keyboard_mouse); + put("mouse_sensitivity", mouse.into(), mouse == f64::from(d.mouse_sensitivity)); + } + + pub fn text(&self) -> String { + self.doc.to_string() + } + + pub fn write(&self, path: &Path) -> Result<(), String> { + std::fs::write(path, self.text()).map_err(|e| format!("{}: {e}", path.display())) + } +} + +/// The titles XCL has run: the folders under the data root with an `xcl.toml`, newest first. +pub fn title_dirs(root: &Path) -> Vec { + let mut dirs: Vec<(std::time::SystemTime, PathBuf)> = std::fs::read_dir(root) + .into_iter() + .flatten() + .flatten() + .map(|e| e.path()) + .filter(|p| p.join("xcl.toml").is_file()) + .map(|p| (p.join("xcl.toml").metadata().and_then(|m| m.modified()).unwrap_or(std::time::UNIX_EPOCH), p)) + .collect(); + dirs.sort_by(|a, b| b.0.cmp(&a.0).then(a.1.cmp(&b.1))); + dirs.into_iter().map(|(_, p)| p).collect() +} + +// ---------------------------------------------------------------- XCL's own files + +/// XCL's source folder above `exe` (`\target\\xcl-gui.exe`): the nearest folder +/// above it with `crates\xcl\Cargo.toml`. +pub fn repo_above(exe: &Path) -> Option { + exe.ancestors().skip(1).take(5).find(|d| d.join("crates").join("xcl").join("Cargo.toml").is_file()).map(Path::to_path_buf) +} + +/// `xcl.exe` for these settings: the one named, else the one next to this program, else the +/// release build of the source folder. +pub fn find_xcl(settings: &Settings, me: &Path, repo: Option<&Path>) -> Option { + let name = if cfg!(windows) { "xcl.exe" } else { "xcl" }; + let named = settings.xcl_exe.trim(); + if !named.is_empty() { + return Some(PathBuf::from(named)).filter(|p| p.is_file()); + } + let beside = me.parent().map(|d| d.join(name)); + let built = repo.map(|r| r.join("target").join("release").join(name)); + [beside, built].into_iter().flatten().find(|p| p.is_file()) +} + +// ---------------------------------------------------------------- sessions + +/// `2026-11-24_15-08-31` for seconds since 1970 (UTC): the names of saved sessions. +pub fn stamp(secs: u64) -> String { + let (days, rem) = (secs / 86_400, secs % 86_400); + // civil date from days (Howard Hinnant's algorithm) + let z = days as i64 + 719_468; + let era = z.div_euclid(146_097); + let doe = z.rem_euclid(146_097); + let yoe = (doe - doe / 1_460 + doe / 36_524 - doe / 146_096) / 365; + let doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + let mp = (5 * doy + 2) / 153; + let (d, m) = (doy - (153 * mp + 2) / 5 + 1, if mp < 10 { mp + 3 } else { mp - 9 }); + let y = yoe + era * 400 + i64::from(m <= 2); + format!("{y:04}-{m:02}-{d:02}_{:02}-{:02}-{:02}", rem / 3_600, rem % 3_600 / 60, rem % 60) +} + +/// Removes the oldest files of `dir` beyond the newest `keep` (names sort by time). +pub fn prune(dir: &Path, keep: usize) { + let mut files: Vec = std::fs::read_dir(dir).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.is_file()).collect(); + files.sort(); + let extra = files.len().saturating_sub(keep); + for p in files.into_iter().take(extra) { + let _ = std::fs::remove_file(p); + } +} + +// ---------------------------------------------------------------- texts + +/// The window's texts, English and Spanish. +pub fn tr(lang: Lang, key: &'static str) -> &'static str { + let (en, es) = match key { + "game" => ("Game", "Juego"), + "game_hint" => ("the game's folder, its .exe or its MicrosoftGame.config", "la carpeta del juego, su .exe o su MicrosoftGame.config"), + "folder" => ("Folder…", "Carpeta…"), + "file" => ("File…", "Archivo…"), + "play" => ("Play", "Jugar"), + "stop" => ("Stop", "Detener"), + "idle" => ("Not running", "Detenido"), + "running" => ("Running", "En ejecución"), + "busy" => ("Working", "Trabajando"), + "exited" => ("Exited with", "Terminó con"), + "stopped" => ("stopped from this window", "detenido desde esta ventana"), + "console" => ("Console", "Consola"), + "log" => ("Log (xcl.log)", "Registro (xcl.log)"), + "errors" => ("Errors and warnings", "Errores y avisos"), + "settings" => ("Settings", "Ajustes"), + "xcl" => ("XCL", "XCL"), + "filter" => ("Filter", "Filtro"), + "follow" => ("Follow", "Seguir"), + "copy" => ("Copy", "Copiar"), + "clear" => ("Clear", "Limpiar"), + "lines" => ("lines", "líneas"), + "open_logs" => ("Open the logs folder", "Abrir carpeta de registros"), + "open_sessions" => ("Open saved sessions", "Abrir sesiones guardadas"), + "open_report" => ("Open report.json", "Abrir report.json"), + "no_xcl" => ("xcl.exe not found – set it, or build XCL, under the XCL tab", "No se encuentra xcl.exe: indícalo o compila XCL en la pestaña XCL"), + "no_game" => ("Choose the game first", "Primero elige el juego"), + "title_cfg" => ("This title (xcl.toml)", "Este juego (xcl.toml)"), + "title_none" => ( + "Greyed until the game has run once: XCL writes a title's xcl.toml at its first run, and these settings are kept in it.", + "En gris hasta que el juego corra una vez: XCL crea el xcl.toml del juego en su primera ejecución, y estos ajustes se guardan ahí.", + ), + "title" => ("Title", "Juego"), + "console_kind" => ("Console", "Consola"), + "memory" => ("Title memory (MiB)", "Memoria del juego (MiB)"), + "memory_hint" => ("0 = the console's budget", "0 = el presupuesto de la consola"), + "memory_told" => ("the title is told", "al juego se le informa"), + "memory_fit" => ("Fit the memory to my graphics card (when the figure is 0)", "Ajustar la memoria a la de mi tarjeta gráfica (cuando el valor es 0)"), + "memory_fit_on" => ( + "at most the console's figure: XCL lowers it to the card's video memory less 1536 MiB, never below 4096 – the log says the figure it used", + "como máximo el valor de la consola: XCL lo baja a la memoria de video de la tarjeta menos 1536 MiB, nunca bajo 4096; el registro dice el valor que usó", + ), + "memory_fit_manual" => ("a figure written by hand is used as it is", "un valor escrito a mano se usa tal cual"), + "uma" => ("GPU-visible memory (MiB)", "Memoria visible para la GPU (MiB)"), + "uma_hint" => ("0 = XCL's choice (2048, or 4095 for \"advanced\")", "0 = lo que XCL elija (2048, o 4095 en modo \"advanced\")"), + "raytracing" => ("Ray tracing", "Trazado de rayos"), + "adapter" => ("Graphics adapter", "Adaptador gráfico"), + "adapter_hint" => ("auto, warp, a number, or part of the name", "auto, warp, un número o parte del nombre"), + "debug_layer" => ("D3D12 debug layer (needs Graphics Tools)", "Capa de depuración de D3D12 (requiere Herramientas de gráficos)"), + "log_level" => ("Log level", "Nivel de registro"), + "window" => ("Window", "Ventana"), + "kbm" => ("Keyboard and mouse as the gamepad", "Teclado y mouse como mando"), + "mouse" => ("Mouse sensitivity", "Sensibilidad del mouse"), + "save" => ("Save", "Guardar"), + "reload" => ("Reload", "Recargar"), + "saved" => ("Saved", "Guardado"), + "while_running" => ("Settings are read when the game starts: changes apply to the next run.", "Los ajustes se leen al iniciar el juego: los cambios valen para la próxima ejecución."), + "run_cfg" => ("Every run", "Cada ejecución"), + "offline" => ("Offline (XCL_NETWORK=0)", "Sin red (XCL_NETWORK=0)"), + "threads" => ("Pipeline threads (0 = XCL's own)", "Hilos de pipelines (0 = los de XCL)"), + "seconds" => ("Stop after seconds (0 = no limit)", "Detener tras segundos (0 = sin límite)"), + "extra_env" => ("More variables, one NAME=value a line", "Más variables, una NOMBRE=valor por línea"), + "refused" => ("Not NAME=value, left out", "No es NOMBRE=valor, se omite"), + "args" => ("Arguments for the game", "Argumentos para el juego"), + "sessions" => ("Save what each run prints", "Guardar lo que imprime cada ejecución"), + "xcl_exe" => ("xcl.exe", "xcl.exe"), + "repo" => ("XCL's source folder", "Carpeta del código de XCL"), + "auto" => ("found by itself", "se busca solo"), + "using" => ("using", "se usa"), + "none" => ("none", "ninguno"), + "update" => ("Update only (git pull)", "Solo actualizar (git pull)"), + "build" => ("Build only (cargo build)", "Solo compilar (cargo build)"), + "version" => ("Show version (git log -1)", "Ver versión (git log -1)"), + "build_note" => ( + "Output goes to the Console tab. Updating keeps your local changes and puts them back on top; git stops if one conflicts.", + "La salida va a la pestaña Consola. Actualizar conserva tus cambios locales y los vuelve a poner encima; git se detiene si alguno choca.", + ), + "update_build" => ("Update and build", "Actualizar y compilar"), + "step_git" => ("Downloading changes from GitHub", "Bajando cambios de GitHub"), + "step_cargo" => ("Building XCL", "Compilando XCL"), + "starting" => ("starting", "iniciando"), + "done" => ("Done: XCL is up to date and built", "Listo: XCL quedó actualizado y compilado"), + "step_failed" => ("It stopped with an error – see the Console tab", "Se detuvo con un error: revisa la pestaña Consola"), + "no_git" => ("Git is not installed, or not in the PATH (install Git for Windows)", "Git no está instalado o no está en el PATH (instala Git for Windows)"), + "no_cargo" => ("Rust (cargo) is not installed, or not in the PATH (https://rustup.rs)", "Rust (cargo) no está instalado o no está en el PATH (https://rustup.rs)"), + "one_by_one" => ("One step at a time", "Paso a paso"), + "gfx_run" => ("Graphics and shaders (every run)", "Gráficos y shaders (cada ejecución)"), + "translator" => ("Shader translator", "Traductor de shaders"), + "tr_hlsl" => ("HLSL + DXC (XCL's default)", "HLSL + DXC (el de XCL por defecto)"), + "tr_cs" => ("Direct DXIL: compute shaders (experimental)", "DXIL directo: shaders de cómputo (experimental)"), + "tr_all" => ("Direct DXIL: all shaders (experimental)", "DXIL directo: todos los shaders (experimental)"), + "dxc_threads" => ("Shader compiler threads (0 = XCL's own)", "Hilos del compilador de shaders (0 = los de XCL)"), + "shader_cache" => ("Keep translated shaders on disk", "Guardar en disco los shaders traducidos"), + "pipeline_cache" => ("Keep the driver's pipelines on disk", "Guardar en disco los pipelines del driver"), + "async_pso" => ("Build pipelines in the background", "Compilar pipelines en segundo plano"), + "dred" => ("Log the GPU's last operations when it is lost (XCL_DRED)", "Registrar las últimas operaciones de la GPU si se pierde (XCL_DRED)"), + "gfx_note" => ( + "These are the graphics switches XCL has. It has no resolution scale, V-Sync, frame limit or filters: the game draws as on the console.", + "Estos son los ajustes gráficos que XCL tiene. No tiene escala de resolución, V-Sync, límite de FPS ni filtros: el juego dibuja como en la consola.", + ), + "window_pos" => ("Window position", "Posición de la ventana"), + "pos_auto" => ("Windows decides", "La elige Windows"), + "pos_center" => ("Centre of the main monitor", "Centro del monitor principal"), + "pos_custom" => ("At x,y", "En x,y"), + "present" => ("Show the game's image in XCL's window", "Mostrar la imagen del juego en la ventana de XCL"), + "home" => ("Home", "Inicio"), + "tagline" => ("Xbox Series titles on Windows", "Juegos de Xbox Series en Windows"), + "sec_logs" => ("LOGS", "REGISTROS"), + "sec_setup" => ("SETUP", "CONFIGURACIÓN"), + "pick_game" => ("Choose a game", "Elige un juego"), + "this_pc" => ("This PC", "Este PC"), + "gpu" => ("Graphics", "Gráficos"), + "gpu_unknown" => ("known after the first run", "se sabrá tras la primera ejecución"), + "data_dir" => ("Data folder", "Carpeta de datos"), + "last_run" => ("Last run", "Última ejecución"), + "not_yet" => ("not yet", "todavía no"), + "network" => ("Network", "Red"), + "net_off" => ("off (offline)", "desactivada (sin red)"), + "net_on" => ("on", "activada"), + "ready" => ("READY", "LISTO"), + "state_running" => ("RUNNING", "EN EJECUCIÓN"), + "state_busy" => ("WORKING", "TRABAJANDO"), + "state_no_xcl" => ("XCL NOT BUILT", "XCL SIN COMPILAR"), + "theme" => ("Light theme", "Tema claro"), + "theme_dark" => ("Dark theme", "Tema oscuro"), + "language" => ("Español", "English"), + other => (other, other), + }; + if lang == Lang::Es { + es + } else { + en + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn log_lines_carry_their_level_and_console_lines_are_read() { + assert_eq!(severity("[ 1.234][ 1234][ERROR] D3D12 device removed"), Severity::Error); + assert_eq!(severity("[ 12.000][12345][WARN ] D3D12: DRED requested but unavailable"), Severity::Warn); + assert_eq!(severity("[ 0.001][ 1][INFO ] title memory: an error-free line"), Severity::Info); + assert_eq!(severity("[ 0.001][ 1][DEBUG] x"), Severity::Detail); + assert_eq!(severity("CRASH: unhandled exception 0xc0000005 in nvwgf2umx.dll"), Severity::Error); + assert_eq!(severity("xcl: failed to start the game process: x"), Severity::Error); + assert_eq!(severity(" WARNING: this CPU lacks avx2"), Severity::Warn); + assert_eq!(severity(" Compiling xcl v0.1.0"), Severity::Info); + assert_eq!(severity("test result: ok. 12 passed; 0 errors"), Severity::Info); + // a bracket that is not a log line's + assert_eq!(severity("[note] nothing"), Severity::Info); + } + + #[test] + fn the_start_and_the_end_of_a_run_are_read() { + assert_eq!(data_dir_line(" data: C:\\Users\\a b\\AppData\\Local\\XCL\\Title_1"), Some(PathBuf::from("C:\\Users\\a b\\AppData\\Local\\XCL\\Title_1"))); + assert_eq!(data_dir_line(" exe: D:\\g\\game.exe"), None); + assert_eq!(gpu_line(" GPU: Intel(R) Iris(R) Xe Graphics (128 MiB VRAM)").as_deref(), Some("Intel(R) Iris(R) Xe Graphics (128 MiB VRAM)")); + assert_eq!(gpu_line("xcl: D3D12.X: backend 'real'"), None); + assert_eq!(exit_code_line("Game exited with code 0x887a0006 (2289696774)"), Some(0x887a_0006)); + assert_eq!(exit_code_line("Game exited"), None); + assert!(exit_code_meaning(0x887a_0006, Lang::Es).unwrap().contains("GPU")); + assert_eq!(exit_code_meaning(0x1234_5678, Lang::En), None); + } + + #[test] + fn a_run_gets_its_variables_and_arguments() { + let mut s = Settings { pipeline_threads: 12, extra_env: "XCL_UMA_MB = 4095\n# note\nnot a variable\nxcl_network=1\n1X=2".into(), ..Settings::default() }; + let (env, refused) = s.environment(); + // a line of the box replaces the switch of the same name + assert_eq!( + env, + [("XCL_PIPELINE_THREADS", "12"), ("XCL_UMA_MB", "4095"), ("xcl_network", "1")].map(|(a, b)| (a.to_string(), b.to_string())) + ); + assert_eq!(refused, ["not a variable", "1X=2"]); + let g = Settings { offline: false, direct_dxil: "all".into(), dxc_threads: 6, shader_cache: false, dred: true, ..Settings::default() }; + assert_eq!( + g.environment().0, + [("XCL_DIRECT_DXIL", "all"), ("XCL_DXC_THREADS", "6"), ("XCL_TRANSLATED_CACHE", "0"), ("XCL_DRED", "1")].map(|(a, b)| (a.to_string(), b.to_string())) + ); + s.game_args = " -windowed \"-name=a b\" x".into(); + assert_eq!(s.arguments(), ["-windowed", "-name=a b", "x"]); + s.game_args = "\"\"".into(); + assert_eq!(s.arguments(), [""]); + } + + #[test] + fn settings_round_trip_and_old_files_get_defaults() { + let dir = std::env::temp_dir().join(format!("xcl_gui_settings_{}", std::process::id())); + let path = dir.join("gui").join("settings.toml"); + let s = Settings { lang: Lang::Es, game: "D:\\Games\\X".into(), run_seconds: 60, ..Settings::default() }; + s.save(&path).unwrap(); + assert_eq!(Settings::load(&path), s); + std::fs::write(&path, "game = \"E:\\\\g\"\n").unwrap(); + let old = Settings::load(&path); + assert_eq!((old.game.as_str(), old.offline, old.save_sessions), ("E:\\g", true, true)); + // an unreadable file is the defaults, not an error + std::fs::write(&path, "game = [").unwrap(); + assert_eq!(Settings::load(&path), Settings::default()); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn a_titles_file_keeps_what_the_window_does_not_edit() { + let text = "# XCL – title configuration.\n\ndevice_type = \"anaconda\"\ngamertag = \"Player1\"\ntitle_memory_mb = 0 # the console's\nmouse_sensitivity = 1\n\n[mounts]\n\"G:\" = \"{game}\"\n"; + let mut f = TitleFile::parse(text).unwrap(); + let mut c = f.config(); + assert_eq!((c.title_memory_mb, c.window_width, c.mouse_sensitivity, c.raytracing.as_str()), (0, 1280, 1.0, "auto")); + assert_eq!(c.title_memory_budget_mb(), 13_824); + c.device_type = "lockhart".into(); + assert_eq!(c.title_memory_budget_mb(), 8_192); + c.title_memory_mb = 10_240; + c.mouse_sensitivity = 1.2; + f.set(&c); + let out = f.text(); + assert!(out.starts_with("# XCL – title configuration.\n\ndevice_type = \"lockhart\"\ngamertag = \"Player1\"\ntitle_memory_mb = 10240 # the console's\n"), "{out}"); + assert!(out.ends_with("mouse_sensitivity = 1.2\n\n[mounts]\n\"G:\" = \"{game}\"\n"), "{out}"); + // and reads back as written + assert_eq!(TitleFile::parse(&out).unwrap().config(), c); + // a key the file lacks appears once it is not the default + c.window_width = 1920; + c.window_pos = "center".into(); + // a key only some XCLs have is not added to a file without it + assert!(c.title_memory_fit.is_none()); + c.title_memory_fit = Some(false); + f.set(&c); + assert!(f.text().contains("window_pos = \"center\"\n") && !f.text().contains("present"), "{}", f.text()); + assert!(!f.text().contains("title_memory_fit"), "{}", f.text()); + let mut fitted = TitleFile::parse("title_memory_mb = 0\ntitle_memory_fit = true # follows the GPU\n").unwrap(); + let mut fc = fitted.config(); + assert_eq!(fc.title_memory_fit, Some(true)); + fc.title_memory_fit = Some(false); + fitted.set(&fc); + assert_eq!(fitted.text(), "title_memory_mb = 0\ntitle_memory_fit = false # follows the GPU\n"); + assert!(f.text().contains("window_width = 1920\n") && !f.text().contains("window_height"), "{}", f.text()); + assert!(TitleFile::parse("device_type = ").is_err()); + } + + #[test] + fn xcl_and_its_titles_are_found() { + let dir = std::env::temp_dir().join(format!("xcl_gui_find_{}", std::process::id())); + let repo = dir.join("xcl"); + let release = repo.join("target").join("release"); + std::fs::create_dir_all(repo.join("crates").join("xcl")).unwrap(); + std::fs::create_dir_all(&release).unwrap(); + std::fs::write(repo.join("crates").join("xcl").join("Cargo.toml"), "").unwrap(); + let me = release.join("xcl-gui.exe"); + assert_eq!(repo_above(&me), Some(repo.clone())); + assert_eq!(repo_above(&dir.join("elsewhere").join("xcl-gui.exe")), None); + let name = if cfg!(windows) { "xcl.exe" } else { "xcl" }; + let s = Settings::default(); + assert_eq!(find_xcl(&s, &me, Some(&repo)), None); + std::fs::write(release.join(name), "").unwrap(); + assert_eq!(find_xcl(&s, &me, Some(&repo)), Some(release.join(name))); + // a named one that is not there is not replaced by another + let named = Settings { xcl_exe: dir.join("gone.exe").to_string_lossy().into_owned(), ..Settings::default() }; + assert_eq!(find_xcl(&named, &me, Some(&repo)), None); + + let root = dir.join("data"); + for t in ["A", "B", "gui"] { + std::fs::create_dir_all(root.join(t)).unwrap(); + } + std::fs::write(root.join("A").join("xcl.toml"), "").unwrap(); + std::fs::write(root.join("B").join("xcl.toml"), "").unwrap(); + let titles = title_dirs(&root); + assert_eq!(titles.len(), 2); + assert!(titles.iter().all(|p| p.file_name().is_some_and(|n| n != "gui"))); + + let sessions = dir.join("sessions"); + std::fs::create_dir_all(&sessions).unwrap(); + for i in 0..5 { + std::fs::write(sessions.join(format!("{}.log", stamp(1_795_500_000 + i))), "").unwrap(); + } + prune(&sessions, 2); + let mut left: Vec = std::fs::read_dir(&sessions).unwrap().flatten().map(|e| e.file_name().to_string_lossy().into_owned()).collect(); + left.sort(); + assert_eq!(left, [format!("{}.log", stamp(1_795_500_003)), format!("{}.log", stamp(1_795_500_004))]); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn cargo_s_progress_line_is_read() { + assert_eq!(cargo_progress(" Building [=======> ] 12/345: xcl, windows..."), Some((12, 345, "xcl, windows".to_string()))); + assert_eq!(cargo_progress(" Building [=========================] 345/345"), Some((345, 345, String::new()))); + assert_eq!(cargo_progress(" Compiling xcl v0.1.0"), None); + assert_eq!(cargo_progress(" Building [==> ] 9/0: x"), None); + } + + #[test] + fn stamps_are_dates() { + assert_eq!(stamp(0), "1970-01-01_00-00-00"); + assert_eq!(stamp(951_782_400), "2000-02-29_00-00-00"); + assert_eq!(stamp(1_795_543_711), "2026-11-24_18-08-31"); + } + + #[test] + fn every_text_has_both_languages() { + for key in ["play", "stop", "errors", "memory_hint", "title_none", "build_note"] { + assert_ne!(tr(Lang::En, key), key); + assert_ne!(tr(Lang::Es, key), tr(Lang::En, key), "{key}"); + } + assert_eq!(tr(Lang::Es, "no such key"), "no such key"); + } +} diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs new file mode 100644 index 0000000000..1596258d30 --- /dev/null +++ b/crates/xcl-gui/src/main.rs @@ -0,0 +1,1074 @@ +//! A window for XCL: pick the game once, run and stop it, read what it prints and its +//! `xcl.log` as they grow (errors and warnings on a tab of their own), edit the title's +//! `xcl.toml`, and update and build XCL – without a command line. It drives `xcl.exe` from +//! outside: nothing of XCL's runtime is changed or linked. +#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")] + +mod logic; +mod runner; + +use std::io::Write; +use std::path::{Path, PathBuf}; +use std::sync::mpsc::{channel, Receiver, Sender}; +use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; + +use eframe::egui; +use logic::{tr, Lang, Settings, Severity, TitleConfig, TitleFile}; +use runner::{Event, Running, Tail}; + +/// Lines a view keeps; the oldest go first. +const MAX_LINES: usize = 200_000; +/// Files kept under `gui\sessions` (three a run: console, xcl.log, report.json). +const KEEP_SESSION_FILES: usize = 60; + +fn main() -> eframe::Result { + let options = eframe::NativeOptions { + viewport: egui::ViewportBuilder::default().with_title("XCL").with_inner_size([1100.0, 720.0]).with_min_inner_size([760.0, 420.0]), + ..Default::default() + }; + eframe::run_native("XCL", options, Box::new(|_cc| Ok(Box::new(App::new())))) +} + +#[derive(Clone, Copy, PartialEq, Eq)] +enum Tab { + Home, + Console, + Log, + Errors, + Settings, + Xcl, +} + +#[derive(Clone, Copy, PartialEq, Eq)] +enum Job { + Game, + Tool, +} + +/// One program of a chain run from the XCL tab (update, then build). +struct Step { + program: &'static str, + args: Vec, + env: Vec<(String, String)>, + /// The text key of what it does, for the progress bar. + label: &'static str, +} + +impl Step { + fn git(args: &[&str]) -> Step { + Step { program: "git", args: args.iter().map(|s| s.to_string()).collect(), env: Vec::new(), label: "step_git" } + } + + /// Cargo prints its progress bar to a terminal only; these two make it print the line + /// (`Building [==> ] 12/345: …`) to a pipe too, which the window turns into its own bar. + fn cargo(args: &[&str]) -> Step { + let env = [("CARGO_TERM_PROGRESS_WHEN", "always"), ("CARGO_TERM_PROGRESS_WIDTH", "100")].map(|(k, v)| (k.to_string(), v.to_string())).to_vec(); + Step { program: "cargo", args: args.iter().map(|s| s.to_string()).collect(), env, label: "step_cargo" } + } + + fn update() -> Step { + // local changes (this crate is one) are set aside and put back on top + Step::git(&["pull", "--rebase", "--autostash"]) + } + + fn build() -> Step { + // `-p xcl` only: this program is running and cannot be written over + Step::cargo(&["build", "--release", "-p", "xcl"]) + } +} + +/// How far the running step of a chain is. +struct Progress { + label: &'static str, + /// Which step of how many. + step: (usize, usize), + /// Units done and their number, once the program says them. + units: Option<(u32, u32)>, + detail: String, +} + +/// The window's own colours, over egui's dark and light themes. +struct Palette { + bg: egui::Color32, + side: egui::Color32, + card: egui::Color32, + line: egui::Color32, + field: egui::Color32, + button: egui::Color32, + button_hover: egui::Color32, + accent: egui::Color32, +} + +fn palette(dark: bool) -> Palette { + let c = egui::Color32::from_rgb; + if dark { + Palette { bg: c(17, 19, 24), side: c(12, 14, 18), card: c(25, 28, 35), line: c(38, 42, 52), field: c(12, 14, 18), button: c(40, 45, 56), button_hover: c(52, 58, 72), accent: c(38, 132, 255) } + } else { + Palette { bg: c(243, 245, 248), side: c(232, 235, 240), card: c(255, 255, 255), line: c(218, 222, 230), field: c(243, 245, 248), button: c(226, 230, 237), button_hover: c(210, 216, 226), accent: c(24, 110, 230) } + } +} + +/// Dark or light, with rounded corners, roomier controls and the window's own colours. +fn apply_style(ctx: &egui::Context, dark: bool) { + let theme = if dark { egui::Theme::Dark } else { egui::Theme::Light }; + ctx.set_theme(theme); + let p = palette(dark); + ctx.style_mut_of(theme, |style| { + style.spacing.item_spacing = egui::vec2(8.0, 7.0); + style.spacing.button_padding = egui::vec2(11.0, 5.0); + let v = &mut style.visuals; + v.panel_fill = p.bg; + v.window_fill = p.card; + v.extreme_bg_color = p.field; + v.selection.bg_fill = p.accent; + v.selection.stroke.color = egui::Color32::WHITE; + v.widgets.noninteractive.bg_stroke.color = p.line; + v.widgets.inactive.weak_bg_fill = p.button; + v.widgets.inactive.bg_fill = p.button; + v.widgets.hovered.weak_bg_fill = p.button_hover; + v.widgets.hovered.bg_fill = p.button_hover; + for w in [&mut v.widgets.noninteractive, &mut v.widgets.inactive, &mut v.widgets.hovered, &mut v.widgets.active, &mut v.widgets.open] { + w.corner_radius = egui::CornerRadius::same(8); + } + }); +} + +/// A rounded box of the page: the hero, the two tables under it, this PC in the side column. +fn card(ui: &mut egui::Ui, p: &Palette, margin: i8, add: impl FnOnce(&mut egui::Ui) -> R) -> R { + egui::Frame::new().fill(p.card).stroke(egui::Stroke::new(1.0, p.line)).corner_radius(12).inner_margin(margin).show(ui, add).inner +} + +struct Line { + text: String, + severity: Severity, +} + +/// One scrolling view of lines. +#[derive(Default)] +struct View { + lines: Vec, + filter: String, + free: bool, +} + +impl View { + fn push(&mut self, text: String, severity: Severity) { + if self.lines.len() >= MAX_LINES { + self.lines.drain(..MAX_LINES / 10); + } + self.lines.push(Line { text, severity }); + } +} + +struct App { + settings: Settings, + settings_path: PathBuf, + saved: Settings, + me: PathBuf, + tab: Tab, + console: View, + log: View, + errors: View, + tx: Sender, + rx: Receiver, + running: Option<(Running, Job)>, + /// Stop was pressed for the running program. + stopping: bool, + started: Instant, + /// How the last program ended: the game's own code where `xcl run` printed it. + ended: Option, + game_code: Option, + tail: Option, + data_dir: Option, + session: Option<(std::fs::File, String)>, + titles: Vec, + title: Option, + title_file: Option, + title_cfg: TitleConfig, + title_saved: TitleConfig, + notice: String, + /// The steps of a chain still to run, and how many it had. + pending: std::collections::VecDeque, + chain_len: usize, + progress: Option, +} + +impl App { + fn new() -> App { + let settings_path = logic::gui_dir().join("settings.toml"); + let settings = Settings::load(&settings_path); + let (tx, rx) = channel(); + let mut app = App { + saved: settings.clone(), + settings, + settings_path, + me: std::env::current_exe().unwrap_or_default(), + tab: Tab::Home, + console: View::default(), + log: View::default(), + errors: View::default(), + tx, + rx, + running: None, + stopping: false, + started: Instant::now(), + ended: None, + game_code: None, + tail: None, + data_dir: None, + session: None, + titles: Vec::new(), + title: None, + title_file: None, + title_cfg: TitleConfig::default(), + title_saved: TitleConfig::default(), + notice: String::new(), + pending: std::collections::VecDeque::new(), + chain_len: 0, + progress: None, + }; + if !app.settings.last_data_dir.is_empty() { + app.data_dir = Some(PathBuf::from(&app.settings.last_data_dir)); + } + app.find_titles(); + app + } + + fn lang(&self) -> Lang { + self.settings.lang + } + + fn t(&self, key: &'static str) -> &'static str { + tr(self.lang(), key) + } + + fn repo(&self) -> Option { + let named = self.settings.repo.trim(); + if named.is_empty() { + logic::repo_above(&self.me) + } else { + Some(PathBuf::from(named)) + } + } + + fn xcl(&self) -> Option { + logic::find_xcl(&self.settings, &self.me, self.repo().as_deref()) + } + + /// The titles XCL has run; the one of the last run is chosen, else the newest. + fn find_titles(&mut self) { + self.titles = logic::title_dirs(&logic::data_root()); + let wanted = self.data_dir.clone().filter(|d| self.titles.contains(d)).or_else(|| self.titles.first().cloned()); + if wanted != self.title || self.title_file.is_none() { + self.load_title(wanted); + } + } + + fn load_title(&mut self, dir: Option) { + self.title = dir; + self.title_file = None; + if let Some(dir) = &self.title { + match TitleFile::read(&dir.join("xcl.toml")) { + Ok(f) => { + self.title_cfg = f.config(); + self.title_saved = self.title_cfg.clone(); + self.title_file = Some(f); + } + Err(e) => self.notice = e, + } + } + } + + fn save_title(&mut self) { + let (Some(dir), Some(file)) = (&self.title, &mut self.title_file) else { return }; + file.set(&self.title_cfg); + match file.write(&dir.join("xcl.toml")) { + Ok(()) => { + self.title_saved = self.title_cfg.clone(); + self.notice = format!("{}: {}", tr(self.settings.lang, "saved"), dir.join("xcl.toml").display()); + } + Err(e) => self.notice = e, + } + } + + fn save_settings(&mut self) { + if self.settings != self.saved { + match self.settings.save(&self.settings_path) { + Ok(()) => self.saved = self.settings.clone(), + Err(e) => self.notice = e, + } + } + } + + fn say(&mut self, text: impl Into) { + let text = text.into(); + if let Some((file, _)) = &mut self.session { + let _ = writeln!(file, "{text}"); + } + let severity = logic::severity(&text); + if matches!(severity, Severity::Error | Severity::Warn) { + self.errors.push(text.clone(), severity); + } + self.console.push(text, severity); + } + + fn start(&mut self, job: Job, program: &Path, args: Vec, env: Vec<(String, String)>, cwd: Option, ctx: &egui::Context) { + if self.running.is_some() { + return; + } + self.ended = None; + self.stopping = false; + self.game_code = None; + self.notice.clear(); + if job == Job::Game { + self.console.lines.clear(); + self.log.lines.clear(); + self.errors.lines.clear(); + self.tail = None; + self.session = None; + if self.settings.save_sessions { + let dir = logic::gui_dir().join("sessions"); + let stamp = logic::stamp(SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())); + if std::fs::create_dir_all(&dir).is_ok() { + if let Ok(f) = std::fs::File::create(dir.join(format!("{stamp}_console.log"))) { + self.session = Some((f, stamp)); + } + } + } + } + let shown: Vec = std::iter::once(program.to_string_lossy().into_owned()).chain(args.iter().cloned()).collect(); + self.say(format!("> {}", shown.join(" "))); + for (k, v) in &env { + self.say(format!(" {k}={v}")); + } + let wake = ctx.clone(); + match runner::start(program, &args, &env, cwd.as_deref(), self.tx.clone(), move || wake.request_repaint()) { + Ok(r) => { + self.running = Some((r, job)); + self.started = Instant::now(); + } + Err(e) => { + self.say(format!("error: {e}")); + self.session = None; + self.pending.clear(); + self.progress = None; + match program.to_str() { + Some("git") => self.notice = self.t("no_git").into(), + Some("cargo") => self.notice = self.t("no_cargo").into(), + _ => {} + } + } + } + } + + fn play(&mut self, ctx: &egui::Context) { + let game = self.settings.game.trim().trim_matches('"').to_string(); + if game.is_empty() { + self.notice = self.t("no_game").into(); + return; + } + let Some(xcl) = self.xcl() else { + self.notice = self.t("no_xcl").into(); + self.tab = Tab::Xcl; + return; + }; + self.save_settings(); + let (env, refused) = self.settings.environment(); + let mut args = vec!["run".to_string(), game]; + let game_args = self.settings.arguments(); + if !game_args.is_empty() { + args.push("--".into()); + args.extend(game_args); + } + self.tab = Tab::Console; + self.start(Job::Game, &xcl, args, env, None, ctx); + for line in refused { + self.say(format!("warning: {}: {line}", self.t("refused"))); + } + } + + /// Runs `steps` one after another in XCL's source folder; a step that fails ends the chain. + fn chain(&mut self, steps: Vec, ctx: &egui::Context) { + if self.running.is_some() { + return; + } + if self.repo().filter(|r| r.is_dir()).is_none() { + self.notice = format!("{}: {}", self.t("repo"), self.t("none")); + return; + } + self.save_settings(); + self.chain_len = steps.len(); + self.pending = steps.into(); + self.next_step(ctx); + } + + fn next_step(&mut self, ctx: &egui::Context) { + let (Some(step), Some(repo)) = (self.pending.pop_front(), self.repo()) else { return }; + self.progress = Some(Progress { label: step.label, step: (self.chain_len - self.pending.len(), self.chain_len), units: None, detail: String::new() }); + self.start(Job::Tool, Path::new(step.program), step.args, step.env, Some(repo), ctx); + } + + /// Takes what the running program and the followed log have sent. + fn receive(&mut self, ctx: &egui::Context) { + while let Ok(event) = self.rx.try_recv() { + match event { + Event::Console(line) => { + if matches!(self.running, Some((_, Job::Tool))) { + if let Some((done, total, detail)) = logic::cargo_progress(&line) { + // the bar's own line: shown as the bar, not as text + if let Some(p) = &mut self.progress { + p.units = Some((done, total)); + p.detail = detail; + } + continue; + } + } + if let Some(dir) = logic::data_dir_line(&line) { + // the title's folder: its log is followed from here on + let wake = ctx.clone(); + self.tail = Some(Tail::follow(dir.join("logs").join("xcl.log"), self.tx.clone(), move || wake.request_repaint())); + self.settings.last_data_dir = dir.to_string_lossy().into_owned(); + self.data_dir = Some(dir); + } + if let Some(gpu) = logic::gpu_line(&line) { + self.settings.last_gpu = gpu; + } + if let Some(code) = logic::exit_code_line(&line) { + self.game_code = Some(code); + } + self.say(line); + } + Event::Log(line) => { + let severity = logic::severity(&line); + if matches!(severity, Severity::Error | Severity::Warn) { + self.errors.push(line.clone(), severity); + } + self.log.push(line, severity); + } + Event::Exited(code) => { + let job = self.running.take().map(|(_, job)| job); + if let Some(tail) = &self.tail { + tail.stop(); + } + let lang = self.lang(); + let code = self.game_code.or(code.map(|c| c as u32)); + let text = match code { + _ if std::mem::take(&mut self.stopping) => tr(lang, "stopped").to_string(), + Some(c) => match logic::exit_code_meaning(c, lang) { + Some(meaning) => format!("{c:#x} – {meaning}"), + None => format!("{c:#x}"), + }, + None => "?".to_string(), + }; + self.say(format!("[{}] {} {text}", logic::stamp(SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())), tr(lang, "exited"))); + self.ended = Some(text); + if job == Some(Job::Tool) { + let ok = code == Some(0) && self.ended.as_deref() != Some(tr(lang, "stopped")); + let chained = self.chain_len > 1; + if ok && !self.pending.is_empty() { + self.next_step(ctx); + } else { + self.pending.clear(); + self.progress = None; + if !ok { + self.notice = tr(lang, "step_failed").into(); + } else if chained { + self.notice = tr(lang, "done").into(); + } + } + } + if job == Some(Job::Game) { + self.keep_session(); + self.find_titles(); + self.save_settings(); + } + } + } + } + } + + /// Copies the run's `xcl.log` and `report.json` next to its console text: XCL itself keeps + /// the last two runs only. + fn keep_session(&mut self) { + let Some((_, stamp)) = self.session.take() else { return }; + let dir = logic::gui_dir().join("sessions"); + if let Some(data) = &self.data_dir { + let logs = data.join("logs"); + let _ = std::fs::copy(logs.join("xcl.log"), dir.join(format!("{stamp}_xcl.log"))); + let _ = std::fs::copy(logs.join("report.json"), dir.join(format!("{stamp}_report.json"))); + } + logic::prune(&dir, KEEP_SESSION_FILES); + } + + // ------------------------------------------------------------ the window's parts + + /// The column on the left: the program's name, the pages, and this PC at the bottom. + fn side(&mut self, ui: &mut egui::Ui) { + let lang = self.lang(); + let p = palette(self.settings.dark); + ui.add_space(14.0); + ui.horizontal(|ui| { + let (rect, _) = ui.allocate_exact_size(egui::vec2(30.0, 30.0), egui::Sense::hover()); + ui.painter().rect_filled(rect, 8.0, p.accent); + ui.painter().text(rect.center(), egui::Align2::CENTER_CENTER, "X", egui::FontId::proportional(18.0), egui::Color32::WHITE); + ui.vertical(|ui| { + ui.spacing_mut().item_spacing.y = 0.0; + ui.label(egui::RichText::new("XCL").strong().size(17.0)); + ui.label(egui::RichText::new(tr(lang, "tagline")).weak().size(10.5)); + }); + }); + ui.add_space(16.0); + let errors = format!("{} ({})", tr(lang, "errors"), self.errors.lines.len()); + let groups: [(&str, Vec<(Tab, String)>); 3] = [ + ("", vec![(Tab::Home, tr(lang, "home").to_string())]), + ("sec_logs", vec![(Tab::Console, tr(lang, "console").to_string()), (Tab::Log, tr(lang, "log").to_string()), (Tab::Errors, errors)]), + ("sec_setup", vec![(Tab::Settings, tr(lang, "settings").to_string()), (Tab::Xcl, tr(lang, "xcl").to_string())]), + ]; + ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| { + ui.spacing_mut().item_spacing.y = 3.0; + ui.spacing_mut().button_padding = egui::vec2(10.0, 7.0); + for (title, tabs) in groups { + if !title.is_empty() { + ui.add_space(12.0); + ui.label(egui::RichText::new(tr(lang, title)).weak().size(10.5)); + ui.add_space(2.0); + } + for (tab, text) in tabs { + ui.selectable_value(&mut self.tab, tab, text); + } + } + }); + ui.with_layout(egui::Layout::bottom_up(egui::Align::Min), |ui| { + ui.add_space(12.0); + ui.horizontal(|ui| { + if ui.small_button(tr(lang, "language")).clicked() { + self.settings.lang = if self.lang() == Lang::Es { Lang::En } else { Lang::Es }; + } + // the button names the theme it switches to + if ui.small_button(tr(lang, if self.settings.dark { "theme" } else { "theme_dark" })).clicked() { + self.settings.dark = !self.settings.dark; + } + }); + ui.add_space(4.0); + card(ui, &p, 10, |ui| { + ui.set_width(ui.available_width()); + // this column is laid out from the bottom up: the last line first + ui.spacing_mut().item_spacing.y = 2.0; + let gpu = if self.settings.last_gpu.is_empty() { tr(lang, "gpu_unknown") } else { self.settings.last_gpu.as_str() }; + ui.add(egui::Label::new(egui::RichText::new(gpu).size(11.5)).wrap()); + ui.label(egui::RichText::new(tr(lang, "this_pc").to_uppercase()).weak().size(10.5)); + }); + }); + } + + /// What is going on, above every page: shown while something runs, ended, or needs saying. + fn status(&mut self, ui: &mut egui::Ui) { + let lang = self.lang(); + ui.horizontal(|ui| { + match (&self.running, &self.ended) { + (Some((_, job)), _) => { + let secs = self.started.elapsed().as_secs(); + let what = if *job == Job::Game { tr(lang, "running") } else { tr(lang, "busy") }; + ui.colored_label(egui::Color32::from_rgb(90, 190, 110), format!("● {what} {:02}:{:02}", secs / 60, secs % 60)); + if *job == Job::Tool { + self.progress_bar(ui, (ui.available_width() - 90.0).clamp(200.0, 620.0)); + } + if ui.button(tr(lang, "stop")).clicked() { + self.stop(); + } + } + (None, Some(text)) => { + ui.label(format!("{} {text}", tr(lang, "exited"))); + } + (None, None) => {} + } + if !self.notice.is_empty() { + ui.colored_label(egui::Color32::from_rgb(230, 170, 60), &self.notice); + } + }); + } + + fn stop(&mut self) { + if let Some((running, _)) = &self.running { + self.stopping = true; + self.pending.clear(); + running.stop(); + } + } + + /// The first page: the game with its Play button, then what is known of it and of this PC. + fn home(&mut self, ui: &mut egui::Ui) { + let lang = self.lang(); + let p = palette(self.settings.dark); + let busy = self.running.is_some(); + let ctx = ui.ctx().clone(); + egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| { + card(ui, &p, 22, |ui| { + ui.set_width(ui.available_width()); + let (state, colour) = match &self.running { + Some((_, Job::Game)) => ("state_running", egui::Color32::from_rgb(70, 170, 100)), + Some((_, Job::Tool)) => ("state_busy", egui::Color32::from_rgb(200, 150, 50)), + None if self.xcl().is_none() => ("state_no_xcl", egui::Color32::from_rgb(200, 90, 90)), + None => ("ready", egui::Color32::from_rgb(70, 170, 100)), + }; + egui::Frame::new().fill(colour).corner_radius(5).inner_margin(egui::Margin::symmetric(7, 2)).show(ui, |ui| { + ui.label(egui::RichText::new(tr(lang, state)).size(10.0).strong().color(egui::Color32::WHITE)); + }); + let game = self.settings.game.trim().trim_matches('"').to_string(); + // the folder's or the file's own name, whichever way its path is written + let name = game.trim_end_matches(['\\', '/']).rsplit(['\\', '/']).next().filter(|n| !n.is_empty()).map(str::to_string); + ui.label(egui::RichText::new(name.as_deref().unwrap_or(tr(lang, "pick_game"))).size(28.0).strong()); + ui.add_enabled(!busy, egui::TextEdit::singleline(&mut self.settings.game).hint_text(tr(lang, "game_hint")).desired_width(f32::INFINITY)); + ui.add_space(6.0); + ui.horizontal(|ui| { + let play = egui::Button::new(egui::RichText::new(tr(lang, "play")).size(16.0).strong().color(egui::Color32::WHITE)) + .fill(p.accent) + .min_size(egui::vec2(140.0, 40.0)); + if ui.add_enabled(!busy, play).clicked() { + self.play(&ctx); + } + let side = |text: &str| egui::Button::new(text.to_string()).min_size(egui::vec2(0.0, 40.0)); + if ui.add_enabled(busy, side(tr(lang, "stop"))).clicked() { + self.stop(); + } + if ui.add_enabled(!busy, side(tr(lang, "folder"))).clicked() { + if let Some(dir) = rfd::FileDialog::new().pick_folder() { + self.settings.game = dir.to_string_lossy().into_owned(); + } + } + if ui.add_enabled(!busy, side(tr(lang, "file"))).clicked() { + if let Some(file) = rfd::FileDialog::new().add_filter("exe / MicrosoftGame.config", &["exe", "config"]).pick_file() { + self.settings.game = file.to_string_lossy().into_owned(); + } + } + }); + }); + ui.add_space(10.0); + let (none, not_yet) = (tr(lang, "none").to_string(), tr(lang, "not_yet").to_string()); + let path = |p: Option| p.map_or(none.clone(), |p| p.to_string_lossy().into_owned()); + let later = |p: Option| p.map_or(not_yet.clone(), |p| p.to_string_lossy().into_owned()); + let memory = match (self.title_file.is_some(), self.title_cfg.title_memory_mb, self.title_cfg.title_memory_fit) { + (false, ..) => tr(lang, "not_yet").to_string(), + (true, 0, Some(true)) => format!("≤ {} MiB", self.title_cfg.title_memory_budget_mb()), + (true, ..) => format!("{} MiB", self.title_cfg.title_memory_budget_mb()), + }; + let game_rows = [ + (tr(lang, "title"), later(self.title.as_ref().and_then(|t| t.file_name()).map(PathBuf::from))), + (tr(lang, "data_dir"), later(self.data_dir.clone())), + (tr(lang, "last_run"), self.ended.clone().unwrap_or_else(|| tr(lang, "not_yet").to_string())), + (tr(lang, "errors"), self.errors.lines.len().to_string()), + (tr(lang, "memory"), memory), + ]; + let gpu = if self.settings.last_gpu.is_empty() { tr(lang, "gpu_unknown").to_string() } else { self.settings.last_gpu.clone() }; + let translator = match self.settings.direct_dxil.trim() { + "1" => "tr_cs", + "all" => "tr_all", + _ => "tr_hlsl", + }; + let pc_rows = [ + (tr(lang, "gpu"), gpu), + (tr(lang, "xcl_exe"), path(self.xcl())), + (tr(lang, "repo"), path(self.repo())), + (tr(lang, "translator"), tr(lang, translator).to_string()), + (tr(lang, "network"), tr(lang, if self.settings.offline { "net_off" } else { "net_on" }).to_string()), + ]; + ui.columns(2, |cols| { + for (col, (title, rows)) in cols.iter_mut().zip([(tr(lang, "game"), game_rows), (tr(lang, "this_pc"), pc_rows)]) { + card(col, &p, 16, |ui| { + ui.set_width(ui.available_width()); + ui.label(egui::RichText::new(title.to_uppercase()).weak().size(10.5)); + for (key, value) in rows { + ui.separator(); + ui.horizontal(|ui| { + ui.label(egui::RichText::new(key).weak()); + ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { + ui.add(egui::Label::new(value).truncate()); + }); + }); + } + }); + } + }); + }); + } + + /// The bar of the running step: cargo's own count once it says it, else a moving one. + fn progress_bar(&self, ui: &mut egui::Ui, width: f32) { + let Some(p) = &self.progress else { return }; + let lang = self.lang(); + let step = if p.step.1 > 1 { format!("{}/{} ", p.step.0, p.step.1) } else { String::new() }; + let (fraction, text) = match p.units { + Some((done, total)) => { + let detail = if p.detail.is_empty() { String::new() } else { format!(" {}", p.detail) }; + (done as f32 / total as f32, format!("{step}{} {done}/{total} ({:.0} %){detail}", tr(lang, p.label), done as f32 * 100.0 / total as f32)) + } + None => (0.0, format!("{step}{} – {}…", tr(lang, p.label), tr(lang, "starting"))), + }; + ui.add(egui::ProgressBar::new(fraction).desired_width(width).text(text).animate(p.units.is_none())); + } + + fn lines(&mut self, ui: &mut egui::Ui, which: Tab) { + let lang = self.lang(); + let logs = self.data_dir.as_ref().map(|d| d.join("logs")); + let view = match which { + Tab::Log => &mut self.log, + Tab::Errors => &mut self.errors, + _ => &mut self.console, + }; + let needle = view.filter.trim().to_lowercase(); + let shown: Vec = if needle.is_empty() { + Vec::new() + } else { + view.lines.iter().enumerate().filter(|(_, l)| l.text.to_lowercase().contains(&needle)).map(|(i, _)| i).collect() + }; + let count = if needle.is_empty() { view.lines.len() } else { shown.len() }; + let at = |row: usize| if needle.is_empty() { row } else { shown[row] }; + ui.horizontal(|ui| { + ui.label(tr(lang, "filter")); + ui.add(egui::TextEdit::singleline(&mut view.filter).desired_width(220.0)); + let mut follow = !view.free; + ui.checkbox(&mut follow, tr(lang, "follow")); + view.free = !follow; + if ui.button(tr(lang, "copy")).clicked() { + let text: Vec<&str> = (0..count).map(|row| view.lines[at(row)].text.as_str()).collect(); + ui.ctx().copy_text(text.join("\n")); + } + if ui.button(tr(lang, "clear")).clicked() { + view.lines.clear(); + } + ui.label(format!("{count} {}", tr(lang, "lines"))); + ui.separator(); + if let Some(logs) = logs.filter(|l| l.is_dir()) { + if ui.button(tr(lang, "open_logs")).clicked() { + runner::open(&logs); + } + if logs.join("report.json").is_file() && ui.button(tr(lang, "open_report")).clicked() { + runner::open(&logs.join("report.json")); + } + } + let sessions = logic::gui_dir().join("sessions"); + if sessions.is_dir() && ui.button(tr(lang, "open_sessions")).clicked() { + runner::open(&sessions); + } + }); + ui.separator(); + // a filter that leaves nothing, or a cleared view, has no rows to lay out + let count = if view.lines.is_empty() { 0 } else { count }; + let row_height = ui.text_style_height(&egui::TextStyle::Monospace); + egui::ScrollArea::both().auto_shrink(false).stick_to_bottom(!view.free).show_rows(ui, row_height, count, |ui, rows| { + for row in rows { + let line = &view.lines[at(row)]; + let text = egui::RichText::new(&line.text).monospace(); + let text = match line.severity { + Severity::Error => text.color(egui::Color32::from_rgb(240, 100, 100)), + Severity::Warn => text.color(egui::Color32::from_rgb(230, 180, 70)), + Severity::Detail => text.weak(), + Severity::Info => text, + }; + ui.add(egui::Label::new(text).wrap_mode(egui::TextWrapMode::Extend)); + } + }); + } + + fn settings_tab(&mut self, ui: &mut egui::Ui) { + let lang = self.lang(); + egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| { + ui.heading(tr(lang, "run_cfg")); + ui.checkbox(&mut self.settings.offline, tr(lang, "offline")); + ui.checkbox(&mut self.settings.save_sessions, tr(lang, "sessions")); + egui::Grid::new("run").num_columns(2).show(ui, |ui| { + ui.label(tr(lang, "threads")); + ui.add(egui::DragValue::new(&mut self.settings.pipeline_threads).range(0..=64)); + ui.end_row(); + ui.label(tr(lang, "seconds")); + ui.add(egui::DragValue::new(&mut self.settings.run_seconds).range(0..=86_400)); + ui.end_row(); + ui.label(tr(lang, "args")); + ui.add(egui::TextEdit::singleline(&mut self.settings.game_args).desired_width(420.0)); + ui.end_row(); + }); + ui.label(tr(lang, "extra_env")); + ui.add(egui::TextEdit::multiline(&mut self.settings.extra_env).code_editor().desired_rows(3).desired_width(520.0)); + for line in self.settings.environment().1 { + ui.colored_label(egui::Color32::from_rgb(230, 170, 60), format!("{}: {line}", tr(lang, "refused"))); + } + + ui.add_space(12.0); + ui.separator(); + ui.heading(tr(lang, "gfx_run")); + egui::Grid::new("gfx").num_columns(2).spacing([16.0, 6.0]).show(ui, |ui| { + ui.label(tr(lang, "translator")); + let names = [("", "tr_hlsl"), ("1", "tr_cs"), ("all", "tr_all")]; + let now = names.iter().find(|(v, _)| *v == self.settings.direct_dxil.trim()).map_or("tr_hlsl", |(_, k)| *k); + egui::ComboBox::from_id_salt("translator").selected_text(tr(lang, now)).width(340.0).show_ui(ui, |ui| { + for (value, key) in names { + ui.selectable_value(&mut self.settings.direct_dxil, value.to_string(), tr(lang, key)); + } + }); + ui.end_row(); + ui.label(tr(lang, "dxc_threads")); + ui.add(egui::DragValue::new(&mut self.settings.dxc_threads).range(0..=64)); + ui.end_row(); + }); + ui.checkbox(&mut self.settings.shader_cache, tr(lang, "shader_cache")); + ui.checkbox(&mut self.settings.pipeline_cache, tr(lang, "pipeline_cache")); + ui.checkbox(&mut self.settings.async_pipelines, tr(lang, "async_pso")); + ui.checkbox(&mut self.settings.dred, tr(lang, "dred")); + ui.weak(tr(lang, "gfx_note")); + + ui.add_space(12.0); + ui.separator(); + ui.heading(tr(lang, "title_cfg")); + if self.titles.is_empty() { + ui.colored_label(egui::Color32::from_rgb(230, 170, 60), tr(lang, "title_none")); + if ui.button(tr(lang, "reload")).clicked() { + self.find_titles(); + } + // what the section holds, greyed: there is no file to write them to yet + let mut preview = TitleConfig::default(); + ui.add_enabled_ui(false, |ui| Self::title_controls(ui, lang, &mut preview)); + return; + } + let name = |p: &Path| p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(); + let mut chosen = self.title.clone(); + ui.horizontal(|ui| { + ui.label(tr(lang, "title")); + egui::ComboBox::from_id_salt("title").selected_text(chosen.as_deref().map(name).unwrap_or_default()).width(320.0).show_ui(ui, |ui| { + for dir in &self.titles { + ui.selectable_value(&mut chosen, Some(dir.clone()), name(dir)); + } + }); + }); + if chosen != self.title { + self.load_title(chosen); + } + if self.title_file.is_none() { + return; + } + Self::title_controls(ui, lang, &mut self.title_cfg); + ui.add_space(6.0); + let changed = self.title_cfg != self.title_saved; + let (mut save, mut reload) = (false, false); + ui.horizontal(|ui| { + save = ui.add_enabled(changed, egui::Button::new(tr(lang, "save"))).clicked(); + reload = ui.button(tr(lang, "reload")).clicked(); + if let Some(dir) = &self.title { + ui.weak(dir.join("xcl.toml").to_string_lossy()); + } + }); + if save { + self.save_title(); + } + if reload { + self.title_file = None; + self.find_titles(); + } + if self.running.is_some() { + ui.weak(tr(lang, "while_running")); + } + }); + } + + /// The controls of a title's `xcl.toml`. + fn title_controls(ui: &mut egui::Ui, lang: Lang, c: &mut TitleConfig) { + egui::Grid::new("title").num_columns(2).spacing([16.0, 6.0]).show(ui, |ui| { + ui.label(tr(lang, "console_kind")); + ui.horizontal(|ui| { + let mut series_s = c.is_series_s(); + ui.radio_value(&mut series_s, false, "Series X (anaconda)"); + ui.radio_value(&mut series_s, true, "Series S (lockhart)"); + if series_s != c.is_series_s() { + c.device_type = if series_s { "lockhart" } else { "anaconda" }.into(); + } + }); + ui.end_row(); + + ui.label(tr(lang, "memory")); + ui.horizontal(|ui| { + ui.add(egui::DragValue::new(&mut c.title_memory_mb).range(0..=65_536).speed(64)); + for preset in [0u64, 6_144, 8_192, 10_240, 13_824] { + let name = if preset == 0 { "auto".to_string() } else { preset.to_string() }; + if ui.small_button(name).clicked() { + c.title_memory_mb = preset; + } + } + }); + ui.end_row(); + if let Some(fit) = &mut c.title_memory_fit { + ui.label(""); + ui.add_enabled(c.title_memory_mb == 0, egui::Checkbox::new(fit, tr(lang, "memory_fit"))); + ui.end_row(); + } + ui.label(""); + let told = format!("{} – {}: {} MiB", tr(lang, "memory_hint"), tr(lang, "memory_told"), c.title_memory_budget_mb()); + let how = match (c.title_memory_mb, c.title_memory_fit) { + (0, Some(true)) => format!("{told} ({})", tr(lang, "memory_fit_on")), + (0, _) | (_, None) => told, + _ => format!("{told} ({})", tr(lang, "memory_fit_manual")), + }; + ui.add(egui::Label::new(egui::RichText::new(how).weak()).wrap()); + ui.end_row(); + + ui.label(tr(lang, "uma")); + ui.horizontal(|ui| { + ui.add(egui::DragValue::new(&mut c.uma_mb).range(0..=16_380).speed(64)); + ui.weak(tr(lang, "uma_hint")); + }); + ui.end_row(); + + ui.label(tr(lang, "raytracing")); + egui::ComboBox::from_id_salt("rt").selected_text(c.raytracing.clone()).show_ui(ui, |ui| { + for v in ["auto", "tier1_1", "tier1_0", "off"] { + ui.selectable_value(&mut c.raytracing, v.to_string(), v); + } + }); + ui.end_row(); + + ui.label(tr(lang, "adapter")); + ui.horizontal(|ui| { + ui.add(egui::TextEdit::singleline(&mut c.d3d12_adapter).desired_width(160.0)); + ui.weak(tr(lang, "adapter_hint")); + }); + ui.end_row(); + + ui.label(tr(lang, "log_level")); + egui::ComboBox::from_id_salt("level").selected_text(c.log_level.clone()).show_ui(ui, |ui| { + for v in ["error", "warn", "info", "debug", "trace"] { + ui.selectable_value(&mut c.log_level, v.to_string(), v); + } + }); + ui.end_row(); + + ui.label(tr(lang, "window")); + ui.horizontal(|ui| { + ui.add(egui::DragValue::new(&mut c.window_width).range(320..=7_680)); + ui.label("×"); + ui.add(egui::DragValue::new(&mut c.window_height).range(180..=4_320)); + for (w, h) in [(1280, 720), (1920, 1080), (2560, 1440)] { + if ui.small_button(format!("{w}×{h}")).clicked() { + (c.window_width, c.window_height) = (w, h); + } + } + }); + ui.end_row(); + + ui.label(tr(lang, "window_pos")); + ui.horizontal(|ui| { + let custom = !matches!(c.window_pos.trim(), "auto" | "center"); + if ui.radio(c.window_pos.trim() == "auto", tr(lang, "pos_auto")).clicked() { + c.window_pos = "auto".into(); + } + if ui.radio(c.window_pos.trim() == "center", tr(lang, "pos_center")).clicked() { + c.window_pos = "center".into(); + } + if ui.radio(custom, tr(lang, "pos_custom")).clicked() && !custom { + c.window_pos = "0,0".into(); + } + if custom { + ui.add(egui::TextEdit::singleline(&mut c.window_pos).desired_width(90.0)); + } + }); + ui.end_row(); + + ui.label(tr(lang, "mouse")); + ui.add(egui::Slider::new(&mut c.mouse_sensitivity, 0.1..=5.0).step_by(0.05)); + ui.end_row(); + }); + let mut shown = !c.present.trim().eq_ignore_ascii_case("off"); + if ui.checkbox(&mut shown, tr(lang, "present")).changed() { + c.present = if shown { "auto" } else { "off" }.into(); + } + ui.checkbox(&mut c.keyboard_mouse, tr(lang, "kbm")); + ui.checkbox(&mut c.d3d12_debug, tr(lang, "debug_layer")); + } + + fn xcl_tab(&mut self, ui: &mut egui::Ui) { + let lang = self.lang(); + let busy = self.running.is_some(); + let found = |p: Option| p.map_or_else(|| tr(lang, "none").to_string(), |p| p.to_string_lossy().into_owned()); + egui::Grid::new("xcl").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { + ui.label(tr(lang, "xcl_exe")); + ui.add(egui::TextEdit::singleline(&mut self.settings.xcl_exe).hint_text(tr(lang, "auto")).desired_width(460.0)); + if ui.button(tr(lang, "file")).clicked() { + if let Some(p) = rfd::FileDialog::new().add_filter("xcl", &["exe"]).pick_file() { + self.settings.xcl_exe = p.to_string_lossy().into_owned(); + } + } + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.xcl()))); + ui.end_row(); + + ui.label(tr(lang, "repo")); + ui.add(egui::TextEdit::singleline(&mut self.settings.repo).hint_text(tr(lang, "auto")).desired_width(460.0)); + if ui.button(tr(lang, "folder")).clicked() { + if let Some(p) = rfd::FileDialog::new().pick_folder() { + self.settings.repo = p.to_string_lossy().into_owned(); + } + } + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.repo()))); + ui.end_row(); + }); + ui.add_space(8.0); + let ctx = ui.ctx().clone(); + if ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "update_build")).strong().size(16.0).color(egui::Color32::WHITE)).fill(palette(self.settings.dark).accent).min_size(egui::vec2(0.0, 38.0))).clicked() { + self.chain(vec![Step::update(), Step::build()], &ctx); + } + if matches!(self.running, Some((_, Job::Tool))) { + ui.add_space(4.0); + self.progress_bar(ui, ui.available_width().min(720.0)); + } + ui.add_space(8.0); + ui.horizontal(|ui| { + ui.weak(tr(lang, "one_by_one")); + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "version"))).clicked() { + self.chain(vec![Step::git(&["log", "-1", "--format=%h %ci %s"])], &ctx); + } + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "update"))).clicked() { + self.chain(vec![Step::update()], &ctx); + } + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "build"))).clicked() { + self.chain(vec![Step::build()], &ctx); + } + }); + ui.weak(tr(lang, "build_note")); + } +} + +impl eframe::App for App { + fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { + let ctx = ui.ctx().clone(); + apply_style(&ctx, self.settings.dark); + self.receive(&ctx); + if self.running.is_some() { + // the clock in the status line + ctx.request_repaint_after(Duration::from_millis(500)); + } + let p = palette(self.settings.dark); + let side = egui::Frame::new().fill(p.side).inner_margin(egui::Margin::symmetric(12, 0)); + egui::Panel::left("side").resizable(false).exact_size(214.0).frame(side).show(ui, |ui| self.side(ui)); + if self.running.is_some() || self.ended.is_some() || !self.notice.is_empty() { + let strip = egui::Frame::new().fill(p.bg).inner_margin(egui::Margin::symmetric(16, 8)); + egui::Panel::top("status").frame(strip).show(ui, |ui| self.status(ui)); + } + let page = egui::Frame::new().fill(p.bg).inner_margin(16); + egui::CentralPanel::default().frame(page).show(ui, |ui| match self.tab { + Tab::Home => self.home(ui), + Tab::Settings => self.settings_tab(ui), + Tab::Xcl => self.xcl_tab(ui), + tab => self.lines(ui, tab), + }); + if !ctx.egui_is_using_pointer() && !ctx.egui_wants_keyboard_input() { + self.save_settings(); + } + } + + fn on_exit(&mut self, _gl: Option<&eframe::glow::Context>) { + if let Some((running, _)) = &self.running { + running.stop(); + } + let _ = self.settings.save(&self.settings_path); + } +} diff --git a/crates/xcl-gui/src/runner.rs b/crates/xcl-gui/src/runner.rs new file mode 100644 index 0000000000..41e3efc42e --- /dev/null +++ b/crates/xcl-gui/src/runner.rs @@ -0,0 +1,291 @@ +//! Running a program for the window: its output line by line, the tail of a log file, and +//! stopping it with what it started. + +use std::io::{BufRead, BufReader, Read, Seek, SeekFrom}; +use std::path::{Path, PathBuf}; +use std::process::{Child, Command, Stdio}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::mpsc::Sender; +use std::sync::Arc; +use std::time::Duration; + +/// What a running program and a followed log send to the window. +pub enum Event { + /// A line the program printed (stdout or stderr). + Console(String), + /// A line added to the followed log file. + Log(String), + /// The program ended: its exit code, if it has one. + Exited(Option), +} + +/// A program the window started. +pub struct Running { + pid: u32, + child: Arc>, +} + +/// Starts `program` with `args` and `env` in `cwd`, without a console window of its own; every +/// line it prints, and its end, go to `events`. `wake` is called after each of them. +pub fn start( + program: &Path, + args: &[String], + env: &[(String, String)], + cwd: Option<&Path>, + events: Sender, + wake: impl Fn() + Send + Sync + 'static, +) -> Result { + let mut cmd = Command::new(program); + cmd.args(args).envs(env.iter().map(|(k, v)| (k, v))).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()); + if let Some(dir) = cwd { + cmd.current_dir(dir); + } + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + // CREATE_NO_WINDOW: this program has no console, and its children get none either + cmd.creation_flags(0x0800_0000); + } + let mut child = cmd.spawn().map_err(|e| format!("{}: {e}", program.display()))?; + let pid = child.id(); + let wake = Arc::new(wake); + let mut readers = Vec::new(); + let streams: [Option>; 2] = + [child.stdout.take().map(|s| Box::new(s) as Box), child.stderr.take().map(|s| Box::new(s) as Box)]; + for stream in streams.into_iter().flatten() { + let (events, wake) = (events.clone(), wake.clone()); + readers.push(std::thread::spawn(move || { + for line in lines(stream) { + if events.send(Event::Console(line)).is_err() { + break; + } + wake(); + } + })); + } + let child = Arc::new(std::sync::Mutex::new(child)); + let waited = child.clone(); + std::thread::spawn(move || { + // the pipes close when the program and what it started have ended + for r in readers { + let _ = r.join(); + } + let code = waited.lock().ok().and_then(|mut c| c.wait().ok()).and_then(|s| s.code()); + let _ = events.send(Event::Exited(code)); + wake(); + }); + Ok(Running { pid, child }) +} + +impl Running { + /// Ends the program and every process it started (`xcl run` runs the game in a second + /// process of its own). + pub fn stop(&self) { + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + let killed = Command::new("taskkill") + .args(["/PID", &self.pid.to_string(), "/T", "/F"]) + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .creation_flags(0x0800_0000) + .status(); + if killed.is_ok_and(|s| s.success()) { + return; + } + } + let _ = self.pid; + if let Ok(mut c) = self.child.lock() { + let _ = c.kill(); + } + } +} + +/// The lines of a stream that are not empty, whatever their encoding: bytes that are not +/// UTF-8 are replaced, and `\r\n` and a lone `\r` (cargo's progress) end a line too. +fn lines(stream: impl Read) -> impl Iterator { + let mut reader = BufReader::new(stream); + std::iter::from_fn(move || { + let mut buf = Vec::new(); + loop { + let available = match reader.fill_buf() { + Ok(b) if !b.is_empty() => b, + _ => break, + }; + match available.iter().position(|&b| b == b'\n' || b == b'\r') { + Some(i) => { + buf.extend_from_slice(&available[..i]); + reader.consume(i + 1); + if buf.is_empty() { + // the `\n` of `\r\n`, or an empty line + continue; + } + return Some(String::from_utf8_lossy(&buf).into_owned()); + } + None => { + let n = available.len(); + buf.extend_from_slice(available); + reader.consume(n); + } + } + } + (!buf.is_empty()).then(|| String::from_utf8_lossy(&buf).into_owned()) + }) +} + +/// A followed file: what is added to it goes to `events` as `Event::Log` lines until `stop`. +pub struct Tail { + stop: Arc, +} + +impl Tail { + /// Follows `path` from its start, waiting for it to appear (XCL makes a new log each run). + /// After `stop` what is still unread is sent, then the thread ends. + pub fn follow(path: PathBuf, events: Sender, wake: impl Fn() + Send + 'static) -> Tail { + let stop = Arc::new(AtomicBool::new(false)); + let stopped = stop.clone(); + std::thread::spawn(move || { + let mut at = 0u64; + let mut rest = Vec::new(); + loop { + let last = stopped.load(Ordering::Relaxed); + let before = at; + if let Some(added) = read_from(&path, &mut at) { + if at < before + added.len() as u64 { + // a new file: the unfinished line of the old one is not its start + rest.clear(); + } + rest.extend_from_slice(&added); + let mut sent = false; + while let Some(i) = rest.iter().position(|&b| b == b'\n') { + let line: Vec = rest.drain(..=i).collect(); + let line = String::from_utf8_lossy(&line).trim_end_matches(['\r', '\n']).to_string(); + if events.send(Event::Log(line)).is_err() { + return; + } + sent = true; + } + if sent { + wake(); + } + } + if last { + if !rest.is_empty() { + let _ = events.send(Event::Log(String::from_utf8_lossy(&rest).into_owned())); + wake(); + } + return; + } + std::thread::sleep(Duration::from_millis(200)); + } + }); + Tail { stop } + } + + pub fn stop(&self) { + self.stop.store(true, Ordering::Relaxed); + } +} + +impl Drop for Tail { + fn drop(&mut self) { + self.stop(); + } +} + +/// The bytes of `path` from `*at` on (`None`: none, or no file yet). A file shorter than +/// `*at` is a new one and is read from its start. +fn read_from(path: &Path, at: &mut u64) -> Option> { + let mut f = std::fs::File::open(path).ok()?; + let len = f.metadata().ok()?.len(); + if len < *at { + *at = 0; + } + if len == *at { + return None; + } + f.seek(SeekFrom::Start(*at)).ok()?; + let mut buf = Vec::new(); + // at most 4 MiB a turn: a log that grows faster is read over the next ones + f.take(4 << 20).read_to_end(&mut buf).ok()?; + *at += buf.len() as u64; + Some(buf) +} + +/// Opens a folder or a file with the system's program for it. +pub fn open(path: &Path) { + #[cfg(windows)] + let cmd = Command::new("explorer").arg(path).spawn(); + #[cfg(target_os = "macos")] + let cmd = Command::new("open").arg(path).spawn(); + #[cfg(all(unix, not(target_os = "macos")))] + let cmd = Command::new("xdg-open").arg(path).spawn(); + let _ = cmd; +} + +#[cfg(test)] +mod tests { + use super::*; + use std::sync::mpsc::channel; + + #[test] + fn lines_end_at_any_line_end_and_survive_bad_bytes() { + let data = b"one\r\ntwo\n\nthree\rfo\xffur".to_vec(); + let got: Vec = lines(&data[..]).collect(); + assert_eq!(got, ["one", "two", "three", "fo\u{fffd}ur"]); + assert_eq!(lines(&b""[..]).count(), 0); + } + + #[test] + fn a_tail_follows_a_file_that_appears_grows_and_starts_again() { + let dir = std::env::temp_dir().join(format!("xcl_gui_tail_{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("xcl.log"); + let _ = std::fs::remove_file(&path); + let (tx, rx) = channel(); + let tail = Tail::follow(path.clone(), tx, || {}); + let next = |rx: &std::sync::mpsc::Receiver| match rx.recv_timeout(Duration::from_secs(5)) { + Ok(Event::Log(l)) => l, + _ => panic!("no log line"), + }; + std::fs::write(&path, "[ 0.1][ 1][INFO ] a\r\n[ 0.2][ 1][WARN ] b\npart").unwrap(); + assert_eq!(next(&rx), "[ 0.1][ 1][INFO ] a"); + assert_eq!(next(&rx), "[ 0.2][ 1][WARN ] b"); + // a new, shorter file is read from its start + std::fs::write(&path, "new\n").unwrap(); + assert_eq!(next(&rx), "new"); + std::fs::write(&path, "new\nend").unwrap(); + tail.stop(); + // the unfinished last line comes with the stop + assert_eq!(next(&rx), "end"); + assert!(rx.recv_timeout(Duration::from_secs(5)).is_err()); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn a_program_s_output_and_end_arrive() { + let (tx, rx) = channel(); + let (program, args): (&str, Vec) = if cfg!(windows) { + ("cmd", vec!["/C".into(), "echo out& echo err 1>&2& exit 3".into()]) + } else { + ("sh", vec!["-c".into(), "echo out; echo err 1>&2; echo $XCL_GUI_TEST; exit 3".into()]) + }; + let env = [("XCL_GUI_TEST".to_string(), "set".to_string())]; + let _running = start(Path::new(program), &args, &env, None, tx, || {}).unwrap(); + let mut lines = Vec::new(); + let code = loop { + match rx.recv_timeout(Duration::from_secs(10)).expect("an event") { + Event::Console(l) => lines.push(l.trim().to_string()), + Event::Exited(code) => break code, + Event::Log(_) => unreachable!(), + } + }; + assert_eq!(code, Some(3)); + assert!(lines.contains(&"out".to_string()) && lines.contains(&"err".to_string()), "{lines:?}"); + if !cfg!(windows) { + assert!(lines.contains(&"set".to_string())); + } + assert!(start(Path::new("no-such-program-xcl-gui"), &[], &[], None, channel().0, || {}).is_err()); + } +} From 7867904077085c0af315dd5125506141fa7efd2e Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:16:03 -0300 Subject: [PATCH 2/7] xcl-gui: precompile shaders from the window, select and copy lines Precompile shaders (Home, under Play, and the XCL page) runs xcl shaders --precompile --only cs --pipelines [--used-only], with a progress bar that says the pipelines built and the time left, and Stop beside it. An update compares the shader translators' files before and after git pull and says when the pass has to be run again. Lines of the console and the logs can be selected (click, Shift+click, drag with scrolling, Ctrl+A) and copied (Ctrl+C, Copy selection); eframe's clipboard feature was missing, so nothing reached the system clipboard. A run stopped from the window no longer reads 'Exited with stopped from this window'. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- Cargo.lock | 100 +++++++++- crates/xcl-gui/Cargo.toml | 2 +- crates/xcl-gui/README.md | 16 +- crates/xcl-gui/src/logic.rs | 219 +++++++++++++++++++++- crates/xcl-gui/src/main.rs | 358 +++++++++++++++++++++++++++++++++--- 5 files changed, 663 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 536daf22b4..aec16a2a23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -198,18 +198,42 @@ dependencies = [ "thiserror 1.0.69", ] +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags 2.13.2", + "polling", + "rustix 1.1.6", + "tracing", +] + [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop", + "calloop 0.13.0", "rustix 0.38.44", "wayland-backend", "wayland-client", ] +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop 0.14.5", + "rustix 1.1.6", + "wayland-backend", + "wayland-client", +] + [[package]] name = "cc" version = "1.11.2" @@ -506,6 +530,7 @@ dependencies = [ "objc2-ui-kit 0.3.2", "profiling", "raw-window-handle", + "smithay-clipboard", "web-time", "windows-sys 0.61.2", "winit", @@ -2163,8 +2188,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.13.2", - "calloop", - "calloop-wayland-source", + "calloop 0.13.0", + "calloop-wayland-source 0.3.0", "cursor-icon", "libc", "log", @@ -2181,6 +2206,44 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags 2.13.2", + "calloop 0.14.5", + "calloop-wayland-source 0.4.1", + "cursor-icon", + "libc", + "log", + "memmap2", + "rustix 1.1.6", + "thiserror 2.0.21", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smithay-clipboard" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226" +dependencies = [ + "libc", + "smithay-client-toolkit 0.20.0", + "wayland-backend", +] + [[package]] name = "smol_str" version = "0.2.2" @@ -2343,6 +2406,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -2573,6 +2637,32 @@ dependencies = [ "wayland-scanner", ] +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags 2.13.2", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + [[package]] name = "wayland-protocols-plasma" version = "0.3.12" @@ -3002,7 +3092,7 @@ dependencies = [ "bitflags 2.13.2", "block2 0.5.1", "bytemuck", - "calloop", + "calloop 0.13.0", "cfg_aliases", "concurrent-queue", "core-foundation", @@ -3023,7 +3113,7 @@ dependencies = [ "raw-window-handle", "redox_syscall 0.4.1", "rustix 0.38.44", - "smithay-client-toolkit", + "smithay-client-toolkit 0.19.2", "smol_str", "tracing", "unicode-segmentation", diff --git a/crates/xcl-gui/Cargo.toml b/crates/xcl-gui/Cargo.toml index 9f1c8469ad..d6c99cf5e9 100644 --- a/crates/xcl-gui/Cargo.toml +++ b/crates/xcl-gui/Cargo.toml @@ -10,7 +10,7 @@ name = "xcl-gui" path = "src/main.rs" [dependencies] -eframe = { version = "0.37.0", default-features = false, features = ["default_fonts", "glow", "wayland", "x11"] } +eframe = { version = "0.37.0", default-features = false, features = ["clipboard", "default_fonts", "glow", "wayland", "x11"] } rfd = "0.18.0" serde = { version = "1", features = ["derive"] } toml = "1" diff --git a/crates/xcl-gui/README.md b/crates/xcl-gui/README.md index eb0541e591..3445372322 100644 --- a/crates/xcl-gui/README.md +++ b/crates/xcl-gui/README.md @@ -36,8 +36,22 @@ cargo build --release -p xcl-gui # target\release\xcl-gui.exe, next to xcl. `cargo build --release -p xcl` in that folder, with a progress bar that follows cargo's own count; each step has a button of its own too. Only `xcl` is built: `xcl-gui.exe` is running and cannot be written over. +- **Shaders (on Home under *Play*, and on the XCL page):** *Precompile shaders* runs + `xcl shaders --precompile --only cs --pipelines` (with + `--used-only` unless unticked), so a title does not wait for the graphics driver's compiler + while its world loads. The pass's own reports become a progress bar with the pipelines built + and the time left, taken from the speed between its last reports, beside the button, with + *Stop* next to it. It can be stopped and goes + on later from where it was. + What is precompiled belongs to one build of XCL, one graphics card and one driver. An update + notes the commit before `git pull` and compares the shader translators' files + (`crates/xcl/src/gpu`, `crates/xcl/build.rs`) after it: when they changed, the window says + that the pass has to be run again, until one has finished. -Every view has a filter, *Follow* (stay at the end), *Copy* and *Clear*. +Every view has a filter, *Follow* (stay at the end), *Copy* and *Clear*. Lines are selected with +a click, Shift+click or by dragging (the view scrolls when the pointer leaves it), Ctrl+A takes +all that is shown, and Ctrl+C or *Copy selection* copies them; the selected lines are also shown +in a box under the view, where part of a line can be selected. ## Where it keeps things diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index e83bc4c963..adec5de306 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -115,6 +115,98 @@ pub fn cargo_progress(line: &str) -> Option<(u32, u32, String)> { (total > 0 && done <= total).then(|| (done, total, names.trim().trim_end_matches("...").trim().to_string())) } +/// `xcl shaders --precompile` says how far it is on a line of its own, ` 22400/26503 (463 s)`: +/// shaders done, their number, and the seconds the pass has run. +pub fn precompile_progress(line: &str) -> Option<(u32, u32, u64)> { + let (counts, rest) = line.trim().split_once(' ')?; + let (done, total) = counts.split_once('/')?; + let secs: f64 = rest.trim().strip_prefix('(')?.strip_suffix("s)")?.trim().parse().ok()?; + let (done, total): (u32, u32) = (done.parse().ok()?, total.parse().ok()?); + (total > 0 && done <= total && secs >= 0.0).then_some((done, total, secs as u64)) +} + +/// ` pipelines: 400 made, 0 refused` of the same pass: the compute pipelines the driver built +/// and the ones it refused. +pub fn pipelines_line(line: &str) -> Option<(u32, u32)> { + let (made, refused) = line.trim().strip_prefix("pipelines:")?.split_once(',')?; + Some((made.trim().strip_suffix("made")?.trim().parse().ok()?, refused.trim().strip_suffix("refused")?.trim().parse().ok()?)) +} + +/// The time a pass still takes, from how fast its last reports came. A pass that goes on from +/// an earlier one reports thousands of shaders done in its first seconds (they are skipped, +/// not built), so the speed is taken between reports and never from zero. +#[derive(Clone, Debug, Default)] +pub struct Eta { + reports: std::collections::VecDeque<(u32, u64)>, +} + +impl Eta { + /// Reports the speed is taken over: the last ones, as a pass's shaders differ a lot in size. + const KEEP: usize = 6; + + pub fn report(&mut self, done: u32, secs: u64) { + if self.reports.back().is_some_and(|&(d, s)| done < d || secs < s) { + // another pass + self.reports.clear(); + } + if self.reports.back() != Some(&(done, secs)) { + self.reports.push_back((done, secs)); + } + while self.reports.len() > Self::KEEP { + self.reports.pop_front(); + } + } + + /// Seconds left for `total`, once two reports tell a speed. + pub fn left(&self, total: u32) -> Option { + let (&(d0, s0), &(d1, s1)) = (self.reports.front()?, self.reports.back()?); + (d1 > d0 && s1 > s0).then(|| total.saturating_sub(d1) as u64 * (s1 - s0) / (d1 - d0) as u64) + } +} + +/// `secs` as a person says it: `2 h 05 min`, `12 min`, `less than a minute`. +pub fn duration_text(secs: u64, lang: Lang) -> String { + let minutes = secs.div_ceil(60); + match (minutes / 60, minutes % 60) { + (0, 0 | 1) if secs < 60 => tr(lang, "under_minute").to_string(), + (0, m) => format!("{m} min"), + (h, m) => format!("{h} h {m:02} min"), + } +} + +/// The game's shader packages (`*shader*.rpf`), for `xcl shaders --precompile`: in the game's +/// folder and up to two folders below it. `game` is that folder, or the game's exe or config. +pub fn shader_packs(game: &Path) -> Vec { + fn walk(dir: &Path, depth: usize, found: &mut Vec) { + let Ok(entries) = std::fs::read_dir(dir) else { return }; + for entry in entries.flatten() { + let path = entry.path(); + let name = entry.file_name().to_string_lossy().to_lowercase(); + if path.is_dir() { + if depth > 0 { + walk(&path, depth - 1, found); + } + } else if name.ends_with(".rpf") && name.contains("shader") { + found.push(path); + } + } + } + let dir = if game.is_dir() { game } else { game.parent().unwrap_or(game) }; + let mut found = Vec::new(); + walk(dir, 2, &mut found); + found.sort(); + found +} + +/// A full commit id, as `git rev-parse HEAD` prints it. +pub fn is_commit_id(line: &str) -> bool { + line.len() == 40 && line.bytes().all(|b| b.is_ascii_hexdigit()) +} + +/// Where XCL's shader translators are: a change there gives translated shaders another identity +/// (`XCL_TRANSLATOR_SOURCE_ID`), and what was precompiled before is translated and built again. +pub const TRANSLATOR_PATHS: [&str; 2] = ["crates/xcl/src/gpu", "crates/xcl/build.rs"]; + // ---------------------------------------------------------------- the window's settings #[derive(Clone, Copy, PartialEq, Eq, Debug, Default, Serialize, Deserialize)] @@ -167,6 +259,12 @@ pub struct Settings { pub dark: bool, /// The graphics adapter `xcl run` named at its last run, for the home page. pub last_gpu: String, + /// The game's shader package for the precompile pass; empty = found in the game's folder. + pub shader_pack: String, + /// `--used-only`: precompile only the compute pipelines earlier runs of the title used. + pub used_only: bool, + /// An update changed XCL's shader translators since the last precompile pass. + pub precompile_stale: bool, } impl Default for Settings { @@ -191,6 +289,9 @@ impl Default for Settings { dred: false, dark: true, last_gpu: String::new(), + shader_pack: String::new(), + used_only: true, + precompile_stale: false, } } } @@ -508,7 +609,7 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "running" => ("Running", "En ejecución"), "busy" => ("Working", "Trabajando"), "exited" => ("Exited with", "Terminó con"), - "stopped" => ("stopped from this window", "detenido desde esta ventana"), + "stopped" => ("Stopped from this window", "Detenido desde esta ventana"), "console" => ("Console", "Consola"), "log" => ("Log (xcl.log)", "Registro (xcl.log)"), "errors" => ("Errors and warnings", "Errores y avisos"), @@ -578,7 +679,45 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "step_git" => ("Downloading changes from GitHub", "Bajando cambios de GitHub"), "step_cargo" => ("Building XCL", "Compilando XCL"), "starting" => ("starting", "iniciando"), + "step_head" => ("Noting the version before the update", "Anotando la versión antes de actualizar"), + "step_diff" => ("Checking whether the shader translators changed", "Revisando si cambiaron los traductores de shaders"), + "step_precompile" => ("Precompiling shaders", "Precompilando shaders"), + "under_minute" => ("less than a minute", "menos de un minuto"), + "eta" => ("about {} left", "faltan cerca de {}"), + "eta_wait" => ("time left: after the next report", "tiempo restante: tras el próximo aviso"), + "pipelines" => ("pipelines built", "pipelines compilados"), + "shaders" => ("Shaders", "Shaders"), + "shader_pack" => ("Shader package", "Paquete de shaders"), + "shader_pack_hint" => ("found in the game's folder", "se busca en la carpeta del juego"), + "used_only" => ( + "Only what the game used in earlier runs (much faster; play once first)", + "Solo lo que el juego usó en ejecuciones anteriores (mucho más rápido; juega una vez antes)", + ), + "precompile" => ("Precompile shaders", "Precompilar shaders"), + "precompile_note" => ( + "Builds the game's compute pipelines ahead, so the game does not wait for the graphics driver while its world loads. It can take hours. Stop it whenever you like: the next pass goes on from where this one stopped.", + "Compila por adelantado los pipelines de cómputo del juego, para que no espere al driver gráfico mientras carga el mundo. Puede tardar horas. Detenlo cuando quieras: la próxima pasada sigue desde donde quedó esta.", + ), + "precompile_warn" => ( + "What is precompiled belongs to this build of XCL, this graphics card and this driver. After an update of XCL that changes its shader translators, or a new graphics driver, the pass starts from zero.", + "Lo precompilado pertenece a esta compilación de XCL, a esta tarjeta gráfica y a este driver. Tras una actualización de XCL que cambie sus traductores de shaders, o un driver gráfico nuevo, la pasada empieza de cero.", + ), + "precompile_stale" => ( + "The last update changed XCL's shader translators: what was precompiled before no longer counts. Precompile again (from zero).", + "La última actualización cambió los traductores de shaders de XCL: lo precompilado antes ya no sirve. Precompila de nuevo (desde cero).", + ), + "copy_selection" => ("Copy selection", "Copiar selección"), + "selected" => ("Lines selected", "Líneas seleccionadas"), + "select_hint" => ( + "click a line, Shift+click or drag to another; Ctrl+A takes all, Ctrl+C copies; part of a line can be picked here", + "clic en una línea, Mayús+clic o arrastra hasta otra; Ctrl+A toma todas, Ctrl+C copia; aquí se puede marcar parte de una línea", + ), + "precompile_again" => ("The update changed the shader translators: precompile again", "La actualización cambió los traductores de shaders: precompila de nuevo"), + "precompile_done" => ("Done: the shaders are precompiled", "Listo: los shaders quedaron precompilados"), + "no_pack" => ("No shader package (*shader*.rpf) in the game's folder: choose it", "No hay paquete de shaders (*shader*.rpf) en la carpeta del juego: elígelo"), + "close_game" => ("Not while the game runs", "No mientras el juego corre"), "done" => ("Done: XCL is up to date and built", "Listo: XCL quedó actualizado y compilado"), + "updated" => ("Done: XCL's source is up to date (not built yet)", "Listo: el código de XCL quedó actualizado (falta compilar)"), "step_failed" => ("It stopped with an error – see the Console tab", "Se detuvo con un error: revisa la pestaña Consola"), "no_git" => ("Git is not installed, or not in the PATH (install Git for Windows)", "Git no está instalado o no está en el PATH (instala Git for Windows)"), "no_cargo" => ("Rust (cargo) is not installed, or not in the PATH (https://rustup.rs)", "Rust (cargo) no está instalado o no está en el PATH (https://rustup.rs)"), @@ -793,9 +932,85 @@ mod tests { assert_eq!(stamp(1_795_543_711), "2026-11-24_18-08-31"); } + #[test] + fn precompile_lines_are_read() { + assert_eq!(precompile_progress(" 22400/26503 (463 s)"), Some((22400, 26503, 463))); + assert_eq!(precompile_progress("26503/26503 (7205 s)"), Some((26503, 26503, 7205))); + assert_eq!(precompile_progress(" pipelines: 400 made, 0 refused"), None); + assert_eq!(precompile_progress(" 30000/26503 (1 s)"), None, "more done than there are"); + assert_eq!(precompile_progress("DXC: 3/10"), None); + assert_eq!(precompile_progress(" Building [=====> ] 12/345: xcl"), None, "cargo's bar is not this pass"); + assert_eq!(pipelines_line(" pipelines: 400 made, 0 refused"), Some((400, 0))); + assert_eq!(pipelines_line("pipelines: 1225 made, 3 refused"), Some((1225, 3))); + assert_eq!(pipelines_line("pipelines made on the GPU 824, refused 0"), None, "the pass's last line is another"); + } + + #[test] + fn time_left_is_taken_between_reports() { + let mut eta = Eta::default(); + assert_eq!(eta.left(26503), None); + // the first report: 22 200 shaders an earlier pass left done, skipped in 4 s + eta.report(22200, 4); + assert_eq!(eta.left(26503), None, "one report tells no speed"); + eta.report(22400, 463); + // 200 shaders in 459 s, 4103 to go + assert_eq!(eta.left(26503), Some(4103 * 459 / 200)); + eta.report(22400, 463); + assert_eq!(eta.left(26503), Some(4103 * 459 / 200), "the same report twice changes nothing"); + // only the last reports count + for (done, secs) in [(22600, 701), (22800, 1006), (23000, 1300), (23200, 1600), (23400, 1900), (23600, 2200)] { + eta.report(done, secs); + } + assert_eq!(eta.left(26503), Some((26503 - 23600) * (2200 - 701) / 1000)); + assert_eq!(eta.left(23600), Some(0)); + // another pass starts over + eta.report(100, 3); + assert_eq!(eta.left(26503), None); + } + + #[test] + fn durations_are_said_in_hours_and_minutes() { + assert_eq!(duration_text(0, Lang::En), "less than a minute"); + assert_eq!(duration_text(59, Lang::Es), "menos de un minuto"); + assert_eq!(duration_text(60, Lang::En), "1 min"); + assert_eq!(duration_text(61, Lang::En), "2 min"); + assert_eq!(duration_text(3600, Lang::En), "1 h 00 min"); + assert_eq!(duration_text(9417, Lang::Es), "2 h 37 min"); + } + + #[test] + fn shader_packages_are_found_in_the_games_folder() { + let dir = std::env::temp_dir().join(format!("xcl_gui_packs_{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(dir.join("data").join("deep").join("deeper")).unwrap(); + for file in ["Shaders.RPF", "game.exe", "data/shaders_extra.rpf", "data/textures.rpf", "data/deep/deeper/shaders_far.rpf"] { + std::fs::write(dir.join(file), b"x").unwrap(); + } + let names = |from: &Path| shader_packs(from).iter().map(|p| p.strip_prefix(&dir).unwrap().to_string_lossy().replace('\\', "/")).collect::>(); + // from the folder, and from the game's exe in it; three folders down is too far + assert_eq!(names(&dir), ["Shaders.RPF", "data/shaders_extra.rpf"]); + assert_eq!(names(&dir.join("game.exe")), ["Shaders.RPF", "data/shaders_extra.rpf"]); + assert!(shader_packs(&dir.join("none").join("game.exe")).is_empty(), "a folder that is not there"); + let _ = std::fs::remove_dir_all(&dir); + } + + #[test] + fn commit_ids_are_told_from_other_lines() { + assert!(is_commit_id("4178e888c0b5be50a2887eda45cdb832763b68a4")); + assert!(!is_commit_id("4178e88")); + assert!(!is_commit_id("Already up to date. 0000000000000000000000")); + assert!(!is_commit_id("crates/xcl/src/gpu/recomp/lower.rs")); + } + + #[test] + fn settings_from_before_the_precompile_page_load() { + let old: Settings = toml::from_str("game = 'D:\\Game'\ndark = false\n").unwrap(); + assert!(old.used_only && !old.precompile_stale && old.shader_pack.is_empty() && !old.dark); + } + #[test] fn every_text_has_both_languages() { - for key in ["play", "stop", "errors", "memory_hint", "title_none", "build_note"] { + for key in ["play", "stop", "errors", "memory_hint", "title_none", "build_note", "precompile", "precompile_warn", "precompile_stale", "eta", "stopped"] { assert_ne!(tr(Lang::En, key), key); assert_ne!(tr(Lang::Es, key), tr(Lang::En, key), "{key}"); } diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index 1596258d30..c70666175b 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -45,30 +45,52 @@ enum Job { Tool, } +/// What the window takes from a step's output, besides showing it. +#[derive(Clone, Copy, PartialEq, Eq, Default)] +enum Capture { + #[default] + Nothing, + /// The commit the source folder is at (`git rev-parse HEAD`). + Head, + /// Files of the shader translators an update changed: each line is one. + TranslatorChanges, +} + /// One program of a chain run from the XCL tab (update, then build). struct Step { - program: &'static str, + program: String, + /// `{before}` in an argument is the commit noted before the update. args: Vec, env: Vec<(String, String)>, /// The text key of what it does, for the progress bar. label: &'static str, + capture: Capture, } impl Step { fn git(args: &[&str]) -> Step { - Step { program: "git", args: args.iter().map(|s| s.to_string()).collect(), env: Vec::new(), label: "step_git" } + Step { program: "git".into(), args: args.iter().map(|s| s.to_string()).collect(), env: Vec::new(), label: "step_git", capture: Capture::Nothing } } /// Cargo prints its progress bar to a terminal only; these two make it print the line /// (`Building [==> ] 12/345: …`) to a pipe too, which the window turns into its own bar. fn cargo(args: &[&str]) -> Step { let env = [("CARGO_TERM_PROGRESS_WHEN", "always"), ("CARGO_TERM_PROGRESS_WIDTH", "100")].map(|(k, v)| (k.to_string(), v.to_string())).to_vec(); - Step { program: "cargo", args: args.iter().map(|s| s.to_string()).collect(), env, label: "step_cargo" } + Step { program: "cargo".into(), args: args.iter().map(|s| s.to_string()).collect(), env, label: "step_cargo", capture: Capture::Nothing } } - fn update() -> Step { - // local changes (this crate is one) are set aside and put back on top - Step::git(&["pull", "--rebase", "--autostash"]) + /// Updating, with a look at what it changed: the commit before, the pull, and the files of + /// the shader translators that differ since. A change there makes XCL translate and build + /// again what a precompile pass did, and the window says so. + fn update() -> Vec { + let mut changed = vec!["diff", "--name-only", "{before}", "HEAD", "--"]; + changed.extend(logic::TRANSLATOR_PATHS); + vec![ + Step { label: "step_head", capture: Capture::Head, ..Step::git(&["rev-parse", "HEAD"]) }, + // local changes (this crate is one) are set aside and put back on top + Step::git(&["pull", "--rebase", "--autostash"]), + Step { label: "step_diff", capture: Capture::TranslatorChanges, ..Step::git(&changed) }, + ] } fn build() -> Step { @@ -149,15 +171,30 @@ struct View { lines: Vec, filter: String, free: bool, + /// The lines selected, as the line clicked first and the one reached (either may be the + /// later one), and whether the mouse is still held down from that click. + selection: Option<(usize, usize)>, + selecting: bool, } impl View { fn push(&mut self, text: String, severity: Severity) { if self.lines.len() >= MAX_LINES { - self.lines.drain(..MAX_LINES / 10); + let gone = MAX_LINES / 10; + self.lines.drain(..gone); + // the selection moves up with its lines, and is dropped once one of them is gone + self.selection = self.selection.and_then(|(a, b)| Some((a.checked_sub(gone)?, b.checked_sub(gone)?))); } self.lines.push(Line { text, severity }); } + + /// The selected lines that `shows` lets through, joined as text. + fn selected_text(&self, shows: impl Fn(&Line) -> bool) -> Option { + let (a, b) = self.selection?; + let (from, to) = (a.min(b), a.max(b).min(self.lines.len().checked_sub(1)?)); + let lines: Vec<&str> = self.lines.get(from..=to)?.iter().filter(|l| shows(l)).map(|l| l.text.as_str()).collect(); + (!lines.is_empty()).then(|| lines.join("\n")) + } } struct App { @@ -191,6 +228,16 @@ struct App { pending: std::collections::VecDeque, chain_len: usize, progress: Option, + capture: Capture, + /// The running chain builds XCL too (it does not only update). + builds: bool, + /// The commit noted before an update, and whether the update changed the shader translators. + head_before: Option, + translators_changed: bool, + /// The precompile pass: its speed, when it last reported, and the pipelines it built. + eta: logic::Eta, + eta_at: Instant, + pipelines: Option<(u32, u32)>, } impl App { @@ -226,6 +273,13 @@ impl App { pending: std::collections::VecDeque::new(), chain_len: 0, progress: None, + capture: Capture::Nothing, + builds: false, + head_before: None, + translators_changed: false, + eta: logic::Eta::default(), + eta_at: Instant::now(), + pipelines: None, }; if !app.settings.last_data_dir.is_empty() { app.data_dir = Some(PathBuf::from(&app.settings.last_data_dir)); @@ -398,14 +452,64 @@ impl App { } self.save_settings(); self.chain_len = steps.len(); + self.builds = steps.iter().any(|s| s.label == "step_cargo"); self.pending = steps.into(); + self.head_before = None; + self.translators_changed = false; self.next_step(ctx); } + /// `xcl shaders --precompile --only cs --pipelines`: the game's compute pipelines + /// built ahead and kept where a run reads them, so the title does not wait for the graphics + /// driver while its world loads. Its progress lines become the bar and the time left. + fn precompile(&mut self, ctx: &egui::Context) { + if self.running.is_some() { + return; + } + let Some(xcl) = self.xcl() else { + self.notice = self.t("no_xcl").into(); + return; + }; + let Some(pack) = self.shader_pack() else { + self.notice = self.t("no_pack").into(); + return; + }; + self.save_settings(); + let mut args: Vec = ["shaders", &pack.to_string_lossy(), "--precompile", "--only", "cs", "--pipelines"].map(String::from).to_vec(); + if self.settings.used_only { + args.push("--used-only".into()); + } + // the adapter and the caches a run would use: what is built here is what it looks for + let (env, _) = self.settings.environment(); + let env = env.into_iter().filter(|(k, _)| matches!(k.as_str(), "XCL_ADAPTER" | "XCL_DXIL_CACHE" | "XCL_DIRECT_DXIL" | "XCL_DXC_THREADS" | "XCL_PIPELINE_THREADS" | "XCL_DXC_DIR")).collect(); + self.pending.clear(); + self.chain_len = 1; + self.capture = Capture::Nothing; + self.eta = logic::Eta::default(); + self.pipelines = None; + self.progress = Some(Progress { label: "step_precompile", step: (1, 1), units: None, detail: String::new() }); + self.start(Job::Tool, &xcl, args, env, None, ctx); + } + + /// The shader package the precompile pass reads: the chosen one, else the first found in + /// the game's folder. + fn shader_pack(&self) -> Option { + let named = self.settings.shader_pack.trim().trim_matches('"'); + if !named.is_empty() { + return Some(PathBuf::from(named)); + } + let game = self.settings.game.trim().trim_matches('"'); + (!game.is_empty()).then(|| logic::shader_packs(Path::new(game)).into_iter().next()).flatten() + } + fn next_step(&mut self, ctx: &egui::Context) { let (Some(step), Some(repo)) = (self.pending.pop_front(), self.repo()) else { return }; self.progress = Some(Progress { label: step.label, step: (self.chain_len - self.pending.len(), self.chain_len), units: None, detail: String::new() }); - self.start(Job::Tool, Path::new(step.program), step.args, step.env, Some(repo), ctx); + self.capture = step.capture; + // without a commit noted before, the comparison is of HEAD with itself: no change + let before = self.head_before.clone().unwrap_or_else(|| "HEAD".into()); + let args = step.args.iter().map(|a| a.replace("{before}", &before)).collect(); + self.start(Job::Tool, Path::new(&step.program), args, step.env, Some(repo), ctx); } /// Takes what the running program and the followed log have sent. @@ -422,6 +526,21 @@ impl App { } continue; } + if let Some((done, total, secs)) = logic::precompile_progress(&line) { + if let Some(p) = &mut self.progress { + p.units = Some((done, total)); + } + self.eta.report(done, secs); + self.eta_at = Instant::now(); + } + if let Some(made) = logic::pipelines_line(&line) { + self.pipelines = Some(made); + } + match self.capture { + Capture::Head if logic::is_commit_id(line.trim()) => self.head_before = Some(line.trim().to_string()), + Capture::TranslatorChanges if line.trim().starts_with("crates/") => self.translators_changed = true, + _ => {} + } } if let Some(dir) = logic::data_dir_line(&line) { // the title's folder: its log is followed from here on @@ -460,20 +579,39 @@ impl App { }, None => "?".to_string(), }; - self.say(format!("[{}] {} {text}", logic::stamp(SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())), tr(lang, "exited"))); + // "Stopped from this window" is the whole of it; a code is "Exited with " + let stopped = text == tr(lang, "stopped"); + let text = if stopped { text } else { format!("{} {text}", tr(lang, "exited")) }; + self.say(format!("[{}] {text}", logic::stamp(SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())))); self.ended = Some(text); if job == Some(Job::Tool) { - let ok = code == Some(0) && self.ended.as_deref() != Some(tr(lang, "stopped")); + let ok = code == Some(0) && !stopped; let chained = self.chain_len > 1; if ok && !self.pending.is_empty() { self.next_step(ctx); } else { + let precompiled = self.progress.as_ref().is_some_and(|p| p.label == "step_precompile"); self.pending.clear(); self.progress = None; + self.capture = Capture::Nothing; + if self.translators_changed { + // also when a later step failed: the sources are the new ones + self.settings.precompile_stale = true; + self.save_settings(); + } if !ok { - self.notice = tr(lang, "step_failed").into(); + // a pass stopped half-way is no failure: the next one goes on from it + if !(precompiled && stopped) { + self.notice = tr(lang, "step_failed").into(); + } + } else if precompiled { + self.settings.precompile_stale = false; + self.save_settings(); + self.notice = tr(lang, "precompile_done").into(); + } else if self.translators_changed { + self.notice = tr(lang, "precompile_again").into(); } else if chained { - self.notice = tr(lang, "done").into(); + self.notice = tr(lang, if self.builds { "done" } else { "updated" }).into(); } } } @@ -566,6 +704,8 @@ impl App { let lang = self.lang(); ui.horizontal(|ui| { match (&self.running, &self.ended) { + // the precompile pass says all of this beside its own button + (Some(_), _) if self.precompiling() => {} (Some((_, job)), _) => { let secs = self.started.elapsed().as_secs(); let what = if *job == Job::Game { tr(lang, "running") } else { tr(lang, "busy") }; @@ -578,7 +718,7 @@ impl App { } } (None, Some(text)) => { - ui.label(format!("{} {text}", tr(lang, "exited"))); + ui.label(text); } (None, None) => {} } @@ -588,6 +728,11 @@ impl App { }); } + /// Whether the pass that precompiles the shaders is the thing running. + fn precompiling(&self) -> bool { + self.running.is_some() && self.progress.as_ref().is_some_and(|p| p.label == "step_precompile") + } + fn stop(&mut self) { if let Some((running, _)) = &self.running { self.stopping = true; @@ -628,7 +773,7 @@ impl App { self.play(&ctx); } let side = |text: &str| egui::Button::new(text.to_string()).min_size(egui::vec2(0.0, 40.0)); - if ui.add_enabled(busy, side(tr(lang, "stop"))).clicked() { + if ui.add_enabled(busy && !self.precompiling(), side(tr(lang, "stop"))).clicked() { self.stop(); } if ui.add_enabled(!busy, side(tr(lang, "folder"))).clicked() { @@ -642,6 +787,28 @@ impl App { } } }); + // under Play: the pass that spares the wait while the world loads, with what it + // is and when it has to be done again + ui.add_space(12.0); + let warn = egui::Color32::from_rgb(230, 170, 60); + let precompile = egui::Button::new(egui::RichText::new(tr(lang, "precompile")).size(14.0).strong().color(egui::Color32::WHITE)).fill(p.accent).min_size(egui::vec2(0.0, 34.0)); + ui.horizontal(|ui| { + if ui.add_enabled(!busy, precompile).clicked() { + self.precompile(&ctx); + } + // the pass's progress and the time left, beside its button + if self.precompiling() { + if ui.add(egui::Button::new(tr(lang, "stop")).min_size(egui::vec2(0.0, 34.0))).clicked() { + self.stop(); + } + self.progress_bar(ui, ui.available_width().min(720.0)); + } + }); + if self.settings.precompile_stale { + ui.colored_label(warn, tr(lang, "precompile_stale")); + } + ui.weak(tr(lang, "precompile_note")); + ui.colored_label(warn, tr(lang, "precompile_warn")); }); ui.add_space(10.0); let (none, not_yet) = (tr(lang, "none").to_string(), tr(lang, "not_yet").to_string()); @@ -699,7 +866,7 @@ impl App { let step = if p.step.1 > 1 { format!("{}/{} ", p.step.0, p.step.1) } else { String::new() }; let (fraction, text) = match p.units { Some((done, total)) => { - let detail = if p.detail.is_empty() { String::new() } else { format!(" {}", p.detail) }; + let detail = if p.label == "step_precompile" { format!(" {}", self.precompile_detail(total)) } else if p.detail.is_empty() { String::new() } else { format!(" {}", p.detail) }; (done as f32 / total as f32, format!("{step}{} {done}/{total} ({:.0} %){detail}", tr(lang, p.label), done as f32 * 100.0 / total as f32)) } None => (0.0, format!("{step}{} – {}…", tr(lang, p.label), tr(lang, "starting"))), @@ -707,6 +874,20 @@ impl App { ui.add(egui::ProgressBar::new(fraction).desired_width(width).text(text).animate(p.units.is_none())); } + /// The precompile pass in words: the pipelines built so far and the time left, counted down + /// between the pass's reports (they come minutes apart). + fn precompile_detail(&self, total: u32) -> String { + let lang = self.lang(); + let left = match self.eta.left(total) { + Some(secs) => tr(lang, "eta").replace("{}", &logic::duration_text(secs.saturating_sub(self.eta_at.elapsed().as_secs()), lang)), + None => tr(lang, "eta_wait").to_string(), + }; + match self.pipelines { + Some((made, _)) => format!("· {made} {} · {left}", tr(lang, "pipelines")), + None => format!("· {left}"), + } + } + fn lines(&mut self, ui: &mut egui::Ui, which: Tab) { let lang = self.lang(); let logs = self.data_dir.as_ref().map(|d| d.join("logs")); @@ -723,6 +904,7 @@ impl App { }; let count = if needle.is_empty() { view.lines.len() } else { shown.len() }; let at = |row: usize| if needle.is_empty() { row } else { shown[row] }; + let mut copy_selection = false; ui.horizontal(|ui| { ui.label(tr(lang, "filter")); ui.add(egui::TextEdit::singleline(&mut view.filter).desired_width(220.0)); @@ -733,8 +915,12 @@ impl App { let text: Vec<&str> = (0..count).map(|row| view.lines[at(row)].text.as_str()).collect(); ui.ctx().copy_text(text.join("\n")); } + if ui.add_enabled(view.selection.is_some(), egui::Button::new(tr(lang, "copy_selection"))).on_hover_text(tr(lang, "select_hint")).clicked() { + copy_selection = true; + } if ui.button(tr(lang, "clear")).clicked() { view.lines.clear(); + view.selection = None; } ui.label(format!("{count} {}", tr(lang, "lines"))); ui.separator(); @@ -755,9 +941,41 @@ impl App { // a filter that leaves nothing, or a cleared view, has no rows to lay out let count = if view.lines.is_empty() { 0 } else { count }; let row_height = ui.text_style_height(&egui::TextStyle::Monospace); - egui::ScrollArea::both().auto_shrink(false).stick_to_bottom(!view.free).show_rows(ui, row_height, count, |ui, rows| { + // Lines are selected whole: a click takes one, Shift+click or a drag takes all up to + // another (the view scrolls while the mouse is held past its edge), Ctrl+A takes every + // line shown and Ctrl+C copies. Only the rows in view exist as widgets, so egui's own + // text selection could never reach past them; a part of a line is taken in the box + // under the view, which holds the selected lines as text. + let shows = |l: &Line| needle.is_empty() || l.text.to_lowercase().contains(&needle); + let chosen = view.selected_text(shows); + let typing = ui.ctx().egui_wants_keyboard_input(); + let (pointer, down, shift, copy_key, all_key) = ui.input(|i| { + let copy = i.events.iter().any(|e| matches!(e, egui::Event::Copy)); + (i.pointer.latest_pos(), i.pointer.primary_down(), i.modifiers.shift, copy, i.modifiers.command && i.key_pressed(egui::Key::A)) + }); + if !down { + view.selecting = false; + } + if all_key && !typing && count > 0 { + view.selection = Some((at(0), at(count - 1))); + view.free = true; + } + if let Some(text) = chosen.as_ref().filter(|_| copy_selection || (copy_key && !typing)) { + ui.ctx().copy_text(text.clone()); + } + // the box of the selected lines keeps its place under the view + let box_rows = chosen.as_ref().map_or(0, |t| t.lines().count().min(5)); + let box_height = if box_rows == 0 { 0.0 } else { box_rows as f32 * row_height + 66.0 }; + let list_height = (ui.available_height() - box_height).max(row_height * 3.0); + let highlight = ui.visuals().selection.bg_fill.gamma_multiply(0.45); + let (mut first_shown, mut last_shown) = (None, None); + let area = egui::ScrollArea::both().auto_shrink(false).max_height(list_height).stick_to_bottom(!view.free).show_rows(ui, row_height, count, |ui, rows| { + let width = ui.available_width(); for row in rows { - let line = &view.lines[at(row)]; + let index = at(row); + first_shown.get_or_insert(index); + last_shown = Some(index); + let line = &view.lines[index]; let text = egui::RichText::new(&line.text).monospace(); let text = match line.severity { Severity::Error => text.color(egui::Color32::from_rgb(240, 100, 100)), @@ -765,9 +983,54 @@ impl App { Severity::Detail => text.weak(), Severity::Info => text, }; - ui.add(egui::Label::new(text).wrap_mode(egui::TextWrapMode::Extend)); + let selected = view.selection.is_some_and(|(a, b)| (a.min(b)..=a.max(b)).contains(&index)); + // the row's place first, so that its highlight lies under its text + let place = ui.painter().add(egui::Shape::Noop); + let label = ui.add(egui::Label::new(text).wrap_mode(egui::TextWrapMode::Extend).selectable(false).sense(egui::Sense::click_and_drag())); + let rect = egui::Rect::from_min_size(label.rect.min, egui::vec2(label.rect.width().max(width), label.rect.height())); + if selected { + ui.painter().set(place, egui::Shape::rect_filled(rect, 0.0, highlight)); + } + let under_pointer = pointer.is_some_and(|p| p.y >= rect.top() && p.y < rect.bottom() && ui.clip_rect().contains(p)); + if under_pointer && ui.input(|i| i.pointer.primary_pressed()) { + view.selection = Some(match view.selection { + Some((anchor, _)) if shift => (anchor, index), + _ => (index, index), + }); + view.selecting = true; + // the view stays where it is while lines are chosen in it + view.free = true; + } else if under_pointer && view.selecting { + if let Some((anchor, _)) = view.selection { + view.selection = Some((anchor, index)); + } + } } }); + if view.selecting { + // past an edge with the mouse held: the view follows and the selection with it + if let (Some(p), Some((anchor, _))) = (pointer, view.selection) { + let rect = area.inner_rect; + let step = if p.y < rect.top() { row_height * 2.0 } else if p.y > rect.bottom() { -row_height * 2.0 } else { 0.0 }; + if step != 0.0 { + ui.scroll_with_delta(egui::vec2(0.0, step)); + if let Some(edge) = if step > 0.0 { first_shown } else { last_shown } { + view.selection = Some((anchor, edge)); + } + ui.ctx().request_repaint(); + } + } + } + if let Some(text) = chosen { + ui.separator(); + let n = text.lines().count(); + ui.horizontal(|ui| { + ui.weak(format!("{}: {n} – {}", tr(lang, "selected"), tr(lang, "select_hint"))); + }); + egui::ScrollArea::both().id_salt("selected").auto_shrink(false).show(ui, |ui| { + ui.add(egui::TextEdit::multiline(&mut text.as_str()).font(egui::TextStyle::Monospace).desired_width(f32::INFINITY).desired_rows(box_rows)); + }); + } } fn settings_tab(&mut self, ui: &mut egui::Ui) { @@ -1014,9 +1277,11 @@ impl App { ui.add_space(8.0); let ctx = ui.ctx().clone(); if ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "update_build")).strong().size(16.0).color(egui::Color32::WHITE)).fill(palette(self.settings.dark).accent).min_size(egui::vec2(0.0, 38.0))).clicked() { - self.chain(vec![Step::update(), Step::build()], &ctx); + let mut steps = Step::update(); + steps.push(Step::build()); + self.chain(steps, &ctx); } - if matches!(self.running, Some((_, Job::Tool))) { + if matches!(self.running, Some((_, Job::Tool))) && self.progress.as_ref().is_some_and(|p| p.label != "step_precompile") { ui.add_space(4.0); self.progress_bar(ui, ui.available_width().min(720.0)); } @@ -1027,13 +1292,56 @@ impl App { self.chain(vec![Step::git(&["log", "-1", "--format=%h %ci %s"])], &ctx); } if ui.add_enabled(!busy, egui::Button::new(tr(lang, "update"))).clicked() { - self.chain(vec![Step::update()], &ctx); + self.chain(Step::update(), &ctx); } if ui.add_enabled(!busy, egui::Button::new(tr(lang, "build"))).clicked() { self.chain(vec![Step::build()], &ctx); } }); ui.weak(tr(lang, "build_note")); + + ui.add_space(14.0); + ui.separator(); + ui.add_space(6.0); + ui.heading(tr(lang, "shaders")); + let warn = egui::Color32::from_rgb(230, 170, 60); + if self.settings.precompile_stale { + ui.colored_label(warn, tr(lang, "precompile_stale")); + } + egui::Grid::new("shaders").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { + ui.label(tr(lang, "shader_pack")); + ui.add(egui::TextEdit::singleline(&mut self.settings.shader_pack).hint_text(tr(lang, "shader_pack_hint")).desired_width(460.0)); + if ui.button(tr(lang, "file")).clicked() { + if let Some(p) = rfd::FileDialog::new().add_filter("rpf", &["rpf"]).pick_file() { + self.settings.shader_pack = p.to_string_lossy().into_owned(); + } + } + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.shader_pack()))); + ui.end_row(); + }); + ui.checkbox(&mut self.settings.used_only, tr(lang, "used_only")); + ui.add_space(4.0); + let game_runs = matches!(self.running, Some((_, Job::Game))); + ui.horizontal(|ui| { + let precompile = ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "precompile")).strong().size(16.0).color(egui::Color32::WHITE)).fill(palette(self.settings.dark).accent).min_size(egui::vec2(0.0, 38.0))); + if precompile.clicked() { + self.precompile(&ctx); + } + if self.precompiling() { + if ui.add(egui::Button::new(tr(lang, "stop")).min_size(egui::vec2(0.0, 38.0))).clicked() { + self.stop(); + } + self.progress_bar(ui, ui.available_width().min(720.0)); + } + }); + if game_runs { + ui.weak(tr(lang, "close_game")); + } + ui.add_space(4.0); + ui.weak(tr(lang, "precompile_note")); + ui.colored_label(warn, tr(lang, "precompile_warn")); } } @@ -1049,7 +1357,9 @@ impl eframe::App for App { let p = palette(self.settings.dark); let side = egui::Frame::new().fill(p.side).inner_margin(egui::Margin::symmetric(12, 0)); egui::Panel::left("side").resizable(false).exact_size(214.0).frame(side).show(ui, |ui| self.side(ui)); - if self.running.is_some() || self.ended.is_some() || !self.notice.is_empty() { + // nothing to say above the page while the precompile pass runs: it reports beside its button + let said = if self.running.is_some() { !self.precompiling() } else { self.ended.is_some() }; + if said || !self.notice.is_empty() { let strip = egui::Frame::new().fill(p.bg).inner_margin(egui::Margin::symmetric(16, 8)); egui::Panel::top("status").frame(strip).show(ui, |ui| self.status(ui)); } @@ -1057,7 +1367,9 @@ impl eframe::App for App { egui::CentralPanel::default().frame(page).show(ui, |ui| match self.tab { Tab::Home => self.home(ui), Tab::Settings => self.settings_tab(ui), - Tab::Xcl => self.xcl_tab(ui), + Tab::Xcl => { + egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| self.xcl_tab(ui)); + } tab => self.lines(ui, tab), }); if !ctx.egui_is_using_pointer() && !ctx.egui_wants_keyboard_input() { From 195e6cfdcb6c070636d2eb4235a013fdedd2e0d9 Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:28:47 -0300 Subject: [PATCH 3/7] xcl-gui: the look of the project's pictures, one Precompile button The dark theme takes its colours from assets/readme: night blue to indigo ground, panels of white at a few percent, violet and cyan, the XCL mark drawn as the banner draws it, and the banner's ground behind the game's box on Home. Precompile shaders is on Home only, under Play; the XCL page keeps its choices. A failed git or cargo step ends as its exit code, not as a game's 'XCL could not start the game'. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- crates/xcl-gui/README.md | 2 +- crates/xcl-gui/src/logic.rs | 1 + crates/xcl-gui/src/main.rs | 246 +++++++++++++++++++++++++++++------- 3 files changed, 202 insertions(+), 47 deletions(-) diff --git a/crates/xcl-gui/README.md b/crates/xcl-gui/README.md index 3445372322..be6b773697 100644 --- a/crates/xcl-gui/README.md +++ b/crates/xcl-gui/README.md @@ -36,7 +36,7 @@ cargo build --release -p xcl-gui # target\release\xcl-gui.exe, next to xcl. `cargo build --release -p xcl` in that folder, with a progress bar that follows cargo's own count; each step has a button of its own too. Only `xcl` is built: `xcl-gui.exe` is running and cannot be written over. -- **Shaders (on Home under *Play*, and on the XCL page):** *Precompile shaders* runs +- **Shaders (on Home, under *Play*; its choices are on the XCL page):** *Precompile shaders* runs `xcl shaders --precompile --only cs --pipelines` (with `--used-only` unless unticked), so a title does not wait for the graphics driver's compiler while its world loads. The pass's own reports become a progress bar with the pipelines built diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index adec5de306..c97fa96531 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -694,6 +694,7 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "Solo lo que el juego usó en ejecuciones anteriores (mucho más rápido; juega una vez antes)", ), "precompile" => ("Precompile shaders", "Precompilar shaders"), + "shaders_where" => ("These are the choices of Precompile shaders, the button under Play on Home.", "Estas son las opciones de Precompilar shaders, el botón bajo Jugar en Inicio."), "precompile_note" => ( "Builds the game's compute pipelines ahead, so the game does not wait for the graphics driver while its world loads. It can take hours. Stop it whenever you like: the next pass goes on from where this one stopped.", "Compila por adelantado los pipelines de cómputo del juego, para que no espere al driver gráfico mientras carga el mundo. Puede tardar horas. Detenlo cuando quieras: la próxima pasada sigue desde donde quedó esta.", diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index c70666175b..b39b6d9eaf 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -119,17 +119,171 @@ struct Palette { button: egui::Color32, button_hover: egui::Color32, accent: egui::Color32, + /// The second colour of the project's pictures (cyan beside the violet). + accent2: egui::Color32, + /// What is written on `accent2`. + on_accent2: egui::Color32, + ink: egui::Color32, + soft: egui::Color32, } fn palette(dark: bool) -> Palette { let c = egui::Color32::from_rgb; + let a = egui::Color32::from_rgba_unmultiplied; if dark { - Palette { bg: c(17, 19, 24), side: c(12, 14, 18), card: c(25, 28, 35), line: c(38, 42, 52), field: c(12, 14, 18), button: c(40, 45, 56), button_hover: c(52, 58, 72), accent: c(38, 132, 255) } + // the colours of the pictures in the project's README (assets/readme): night blue to + // indigo, panels of white at a few percent, violet and cyan + Palette { + bg: c(13, 19, 40), + side: c(11, 16, 32), + card: a(255, 255, 255, 13), + line: a(255, 255, 255, 31), + field: a(4, 7, 18, 150), + button: c(36, 39, 76), + button_hover: c(52, 54, 104), + accent: c(124, 92, 255), + accent2: c(53, 214, 234), + on_accent2: c(7, 41, 58), + ink: c(243, 246, 255), + soft: c(188, 199, 234), + } } else { - Palette { bg: c(243, 245, 248), side: c(232, 235, 240), card: c(255, 255, 255), line: c(218, 222, 230), field: c(243, 245, 248), button: c(226, 230, 237), button_hover: c(210, 216, 226), accent: c(24, 110, 230) } + Palette { + bg: c(243, 245, 250), + side: c(232, 235, 244), + card: c(255, 255, 255), + line: c(216, 220, 234), + field: c(243, 245, 250), + button: c(226, 229, 242), + button_hover: c(209, 213, 234), + accent: c(104, 72, 235), + accent2: c(18, 150, 178), + on_accent2: c(255, 255, 255), + ink: c(21, 18, 58), + soft: c(84, 92, 128), + } } } +/// A colour between two, `t` of the way from the first. +fn mix(a: egui::Color32, b: egui::Color32, t: f32) -> egui::Color32 { + let m = |x: u8, y: u8| (x as f32 + (y as f32 - x as f32) * t.clamp(0.0, 1.0)).round() as u8; + egui::Color32::from_rgb(m(a.r(), b.r()), m(a.g(), b.g()), m(a.b(), b.b())) +} + +/// The violet-to-blue-to-cyan run of the project's mark, `t` of the way along it. +fn mark_colour(t: f32) -> egui::Color32 { + let c = egui::Color32::from_rgb; + let (violet, blue, cyan) = (c(179, 161, 255), c(127, 176, 255), c(79, 227, 242)); + if t < 0.55 { mix(violet, blue, t / 0.55) } else { mix(blue, cyan, (t - 0.55) / 0.45) } +} + +/// The project's mark, the letters XCL in one round stroke, as its banner draws them +/// (assets/readme/banner.svg), `height` high. +fn mark(ui: &mut egui::Ui, height: f32) { + // the banner's own numbers: the letters lie in 98..483 by 85..207, drawn 25 wide + let scale = height / 122.0; + let (rect, _) = ui.allocate_exact_size(egui::vec2(385.0 * scale, height), egui::Sense::hover()); + let at = |x: f32, y: f32| rect.min + egui::vec2((x - 98.0) * scale, (y - 85.0) * scale); + let mut points = Vec::new(); + let mut line = |from: (f32, f32), to: (f32, f32)| { + let steps = (((to.0 - from.0).hypot(to.1 - from.1)) * scale * 2.0).ceil().max(1.0) as usize; + for i in 0..=steps { + let t = i as f32 / steps as f32; + points.push((from.0 + (to.0 - from.0) * t, from.1 + (to.1 - from.1) * t)); + } + }; + line((112.0, 98.0), (208.0, 194.0)); + line((208.0, 98.0), (112.0, 194.0)); + line((404.0, 98.0), (404.0, 194.0)); + line((404.0, 194.0), (470.0, 194.0)); + // the C: a circle of 52 about (305.5, 146), open to the right + let open = (37.0f32 / 52.0).asin(); + let steps = (52.0 * scale * 10.0).ceil() as usize; + for i in 0..=steps { + let angle = open + (std::f32::consts::TAU - 2.0 * open) * i as f32 / steps as f32; + points.push((305.5 + 52.0 * angle.cos(), 146.0 + 52.0 * angle.sin())); + } + let painter = ui.painter(); + for (x, y) in points { + painter.circle_filled(at(x, y), 12.5 * scale, mark_colour((x - 98.0) / 385.0)); + } +} + +/// The banner's ground behind a box: night blue through indigo to deep teal, a violet glow low +/// on the left and a cyan one high on the right, and a faint grid. +fn banner_ground(rect: egui::Rect, radius: f32, page: egui::Color32) -> egui::Shape { + let c = egui::Color32::from_rgb; + let (from, mid, to) = (c(11, 16, 32), c(25, 18, 63), c(7, 41, 58)); + let (violet, cyan) = (c(124, 92, 255), c(34, 200, 230)); + let (cols, rows) = (40usize, 14usize); + let mut mesh = egui::Mesh::default(); + for row in 0..=rows { + for col in 0..=cols { + let (u, v) = (col as f32 / cols as f32, row as f32 / rows as f32); + let t = (u + v) / 2.0; + let mut colour = if t < 0.55 { mix(from, mid, t / 0.55) } else { mix(mid, to, (t - 0.55) / 0.45) }; + // the glows are circles on the banner's 1280 by 380: keep their shape on any box + let (x, y) = (u * 1280.0, v * 1280.0 * rect.height() / rect.width().max(1.0)); + let low = 1280.0 * rect.height() / rect.width().max(1.0); + let glow = |cx: f32, cy: f32| (1.0 - (x - cx).hypot(y - cy) / 330.0).max(0.0); + colour = mix(colour, violet, 0.55 * glow(180.0, low - 20.0)); + colour = mix(colour, cyan, 0.42 * glow(1130.0, 40.0)); + mesh.colored_vertex(rect.min + egui::vec2(u * rect.width(), v * rect.height()), colour); + } + } + for row in 0..rows { + for col in 0..cols { + let i = (row * (cols + 1) + col) as u32; + let below = i + cols as u32 + 1; + mesh.add_triangle(i, i + 1, below); + mesh.add_triangle(i + 1, below + 1, below); + } + } + let mut shapes = vec![egui::Shape::mesh(mesh)]; + let grid = egui::Stroke::new(1.0, egui::Color32::from_rgba_unmultiplied(255, 255, 255, 12)); + let mut x = rect.left() + 34.0; + while x < rect.right() { + shapes.push(egui::Shape::line_segment([egui::pos2(x, rect.top()), egui::pos2(x, rect.bottom())], grid)); + x += 34.0; + } + let mut y = rect.top() + 34.0; + while y < rect.bottom() { + shapes.push(egui::Shape::line_segment([egui::pos2(rect.left(), y), egui::pos2(rect.right(), y)], grid)); + y += 34.0; + } + // round the corners: the page's colour over what lies outside the arc + for (corner, sx, sy) in [(rect.left_top(), 1.0, 1.0), (rect.right_top(), -1.0, 1.0), (rect.right_bottom(), -1.0, -1.0), (rect.left_bottom(), 1.0, -1.0)] { + let centre = corner + egui::vec2(sx * radius, sy * radius); + let mut mask = egui::Mesh::default(); + mask.colored_vertex(corner, page); + for i in 0..=8 { + let angle = std::f32::consts::FRAC_PI_2 * i as f32 / 8.0; + mask.colored_vertex(centre - egui::vec2(sx * radius * angle.cos(), sy * radius * angle.sin()), page); + } + for i in 1..=8 { + mask.add_triangle(0, i, i + 1); + } + shapes.push(egui::Shape::mesh(mask)); + } + shapes.push(egui::Shape::rect_stroke(rect, radius, egui::Stroke::new(1.0, egui::Color32::from_rgba_unmultiplied(255, 255, 255, 34)), egui::StrokeKind::Inside)); + egui::Shape::Vec(shapes) +} + +/// The page's ground in the dark theme: the night blue to indigo of the project's pictures. +fn page_ground(rect: egui::Rect) -> egui::Shape { + let c = egui::Color32::from_rgb; + let (from, to) = (c(13, 19, 40), c(21, 18, 58)); + let mut mesh = egui::Mesh::default(); + mesh.colored_vertex(rect.left_top(), from); + mesh.colored_vertex(rect.right_top(), mix(from, to, 0.5)); + mesh.colored_vertex(rect.right_bottom(), to); + mesh.colored_vertex(rect.left_bottom(), mix(from, to, 0.5)); + mesh.add_triangle(0, 1, 2); + mesh.add_triangle(0, 2, 3); + egui::Shape::mesh(mesh) +} + /// Dark or light, with rounded corners, roomier controls and the window's own colours. fn apply_style(ctx: &egui::Context, dark: bool) { let theme = if dark { egui::Theme::Dark } else { egui::Theme::Light }; @@ -144,20 +298,26 @@ fn apply_style(ctx: &egui::Context, dark: bool) { v.extreme_bg_color = p.field; v.selection.bg_fill = p.accent; v.selection.stroke.color = egui::Color32::WHITE; + v.hyperlink_color = p.accent2; + v.weak_text_color = Some(p.soft.gamma_multiply(0.8)); + v.widgets.noninteractive.fg_stroke.color = p.soft; + v.widgets.inactive.fg_stroke.color = p.ink; + v.widgets.hovered.fg_stroke.color = p.ink; + v.widgets.active.fg_stroke.color = p.ink; v.widgets.noninteractive.bg_stroke.color = p.line; v.widgets.inactive.weak_bg_fill = p.button; v.widgets.inactive.bg_fill = p.button; v.widgets.hovered.weak_bg_fill = p.button_hover; v.widgets.hovered.bg_fill = p.button_hover; for w in [&mut v.widgets.noninteractive, &mut v.widgets.inactive, &mut v.widgets.hovered, &mut v.widgets.active, &mut v.widgets.open] { - w.corner_radius = egui::CornerRadius::same(8); + w.corner_radius = egui::CornerRadius::same(10); } }); } /// A rounded box of the page: the hero, the two tables under it, this PC in the side column. fn card(ui: &mut egui::Ui, p: &Palette, margin: i8, add: impl FnOnce(&mut egui::Ui) -> R) -> R { - egui::Frame::new().fill(p.card).stroke(egui::Stroke::new(1.0, p.line)).corner_radius(12).inner_margin(margin).show(ui, add).inner + egui::Frame::new().fill(p.card).stroke(egui::Stroke::new(1.0, p.line)).corner_radius(16).inner_margin(margin).show(ui, add).inner } struct Line { @@ -573,7 +733,8 @@ impl App { let code = self.game_code.or(code.map(|c| c as u32)); let text = match code { _ if std::mem::take(&mut self.stopping) => tr(lang, "stopped").to_string(), - Some(c) => match logic::exit_code_meaning(c, lang) { + // the meanings are those of a game's exit codes: a tool's failure is only its code + Some(c) => match logic::exit_code_meaning(c, lang).filter(|_| c == 0 || job != Some(Job::Tool)) { Some(meaning) => format!("{c:#x} – {meaning}"), None => format!("{c:#x}"), }, @@ -644,17 +805,13 @@ impl App { fn side(&mut self, ui: &mut egui::Ui) { let lang = self.lang(); let p = palette(self.settings.dark); - ui.add_space(14.0); + ui.add_space(18.0); ui.horizontal(|ui| { - let (rect, _) = ui.allocate_exact_size(egui::vec2(30.0, 30.0), egui::Sense::hover()); - ui.painter().rect_filled(rect, 8.0, p.accent); - ui.painter().text(rect.center(), egui::Align2::CENTER_CENTER, "X", egui::FontId::proportional(18.0), egui::Color32::WHITE); - ui.vertical(|ui| { - ui.spacing_mut().item_spacing.y = 0.0; - ui.label(egui::RichText::new("XCL").strong().size(17.0)); - ui.label(egui::RichText::new(tr(lang, "tagline")).weak().size(10.5)); - }); + ui.add_space(2.0); + mark(ui, 26.0); }); + ui.add_space(4.0); + ui.label(egui::RichText::new(tr(lang, "tagline")).color(p.soft).size(10.5)); ui.add_space(16.0); let errors = format!("{} ({})", tr(lang, "errors"), self.errors.lines.len()); let groups: [(&str, Vec<(Tab, String)>); 3] = [ @@ -748,7 +905,12 @@ impl App { let busy = self.running.is_some(); let ctx = ui.ctx().clone(); egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| { - card(ui, &p, 22, |ui| { + // the game's box stands on the banner's ground in the dark theme + let ground = ui.painter().add(egui::Shape::Noop); + let dark = self.settings.dark; + let hero = egui::Frame::new().corner_radius(16).inner_margin(22); + let hero = if dark { hero } else { hero.fill(p.card).stroke(egui::Stroke::new(1.0, p.line)) }; + let drawn = hero.show(ui, |ui| { ui.set_width(ui.available_width()); let (state, colour) = match &self.running { Some((_, Job::Game)) => ("state_running", egui::Color32::from_rgb(70, 170, 100)), @@ -762,7 +924,7 @@ impl App { let game = self.settings.game.trim().trim_matches('"').to_string(); // the folder's or the file's own name, whichever way its path is written let name = game.trim_end_matches(['\\', '/']).rsplit(['\\', '/']).next().filter(|n| !n.is_empty()).map(str::to_string); - ui.label(egui::RichText::new(name.as_deref().unwrap_or(tr(lang, "pick_game"))).size(28.0).strong()); + ui.label(egui::RichText::new(name.as_deref().unwrap_or(tr(lang, "pick_game"))).size(30.0).color(p.ink).strong()); ui.add_enabled(!busy, egui::TextEdit::singleline(&mut self.settings.game).hint_text(tr(lang, "game_hint")).desired_width(f32::INFINITY)); ui.add_space(6.0); ui.horizontal(|ui| { @@ -791,7 +953,7 @@ impl App { // is and when it has to be done again ui.add_space(12.0); let warn = egui::Color32::from_rgb(230, 170, 60); - let precompile = egui::Button::new(egui::RichText::new(tr(lang, "precompile")).size(14.0).strong().color(egui::Color32::WHITE)).fill(p.accent).min_size(egui::vec2(0.0, 34.0)); + let precompile = egui::Button::new(egui::RichText::new(tr(lang, "precompile")).size(14.0).strong().color(p.on_accent2)).fill(p.accent2).min_size(egui::vec2(0.0, 34.0)); ui.horizontal(|ui| { if ui.add_enabled(!busy, precompile).clicked() { self.precompile(&ctx); @@ -807,9 +969,13 @@ impl App { if self.settings.precompile_stale { ui.colored_label(warn, tr(lang, "precompile_stale")); } - ui.weak(tr(lang, "precompile_note")); + ui.label(egui::RichText::new(tr(lang, "precompile_note")).color(p.soft)); ui.colored_label(warn, tr(lang, "precompile_warn")); }); + if dark { + let rect = drawn.response.rect; + ui.painter().with_clip_rect(rect.intersect(ui.clip_rect())).set(ground, banner_ground(rect, 16.0, p.bg)); + } ui.add_space(10.0); let (none, not_yet) = (tr(lang, "none").to_string(), tr(lang, "not_yet").to_string()); let path = |p: Option| p.map_or(none.clone(), |p| p.to_string_lossy().into_owned()); @@ -843,13 +1009,13 @@ impl App { for (col, (title, rows)) in cols.iter_mut().zip([(tr(lang, "game"), game_rows), (tr(lang, "this_pc"), pc_rows)]) { card(col, &p, 16, |ui| { ui.set_width(ui.available_width()); - ui.label(egui::RichText::new(title.to_uppercase()).weak().size(10.5)); + ui.label(egui::RichText::new(title.to_uppercase()).color(p.accent2).size(10.5).strong()); for (key, value) in rows { ui.separator(); ui.horizontal(|ui| { ui.label(egui::RichText::new(key).weak()); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { - ui.add(egui::Label::new(value).truncate()); + ui.add(egui::Label::new(egui::RichText::new(value).color(p.ink)).truncate()); }); }); } @@ -871,7 +1037,7 @@ impl App { } None => (0.0, format!("{step}{} – {}…", tr(lang, p.label), tr(lang, "starting"))), }; - ui.add(egui::ProgressBar::new(fraction).desired_width(width).text(text).animate(p.units.is_none())); + ui.add(egui::ProgressBar::new(fraction).desired_width(width).fill(palette(self.settings.dark).accent).text(egui::RichText::new(text).color(egui::Color32::WHITE)).animate(p.units.is_none())); } /// The precompile pass in words: the pipelines built so far and the time left, counted down @@ -1323,25 +1489,7 @@ impl App { }); ui.checkbox(&mut self.settings.used_only, tr(lang, "used_only")); ui.add_space(4.0); - let game_runs = matches!(self.running, Some((_, Job::Game))); - ui.horizontal(|ui| { - let precompile = ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "precompile")).strong().size(16.0).color(egui::Color32::WHITE)).fill(palette(self.settings.dark).accent).min_size(egui::vec2(0.0, 38.0))); - if precompile.clicked() { - self.precompile(&ctx); - } - if self.precompiling() { - if ui.add(egui::Button::new(tr(lang, "stop")).min_size(egui::vec2(0.0, 38.0))).clicked() { - self.stop(); - } - self.progress_bar(ui, ui.available_width().min(720.0)); - } - }); - if game_runs { - ui.weak(tr(lang, "close_game")); - } - ui.add_space(4.0); - ui.weak(tr(lang, "precompile_note")); - ui.colored_label(warn, tr(lang, "precompile_warn")); + ui.weak(tr(lang, "shaders_where")); } } @@ -1364,13 +1512,19 @@ impl eframe::App for App { egui::Panel::top("status").frame(strip).show(ui, |ui| self.status(ui)); } let page = egui::Frame::new().fill(p.bg).inner_margin(16); - egui::CentralPanel::default().frame(page).show(ui, |ui| match self.tab { - Tab::Home => self.home(ui), - Tab::Settings => self.settings_tab(ui), - Tab::Xcl => { - egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| self.xcl_tab(ui)); + let dark = self.settings.dark; + egui::CentralPanel::default().frame(page).show(ui, |ui| { + if dark { + ui.painter().add(page_ground(ui.max_rect().expand(16.0))); + } + match self.tab { + Tab::Home => self.home(ui), + Tab::Settings => self.settings_tab(ui), + Tab::Xcl => { + egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| self.xcl_tab(ui)); + } + tab => self.lines(ui, tab), } - tab => self.lines(ui, tab), }); if !ctx.egui_is_using_pointer() && !ctx.egui_wants_keyboard_input() { self.save_settings(); From 9f3c367ed41b0aa301ec7f047f1bbb4b4543b9a1 Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:36:59 -0300 Subject: [PATCH 4/7] xcl-gui: a --used-only pass is measured in its pipelines Such a pass may report no shaders at all (they are translated already), so its bar stayed at 'starting'. It names the pipelines it set out to build: the bar follows the pipelines made of that count, with the time left from the speed between their reports. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- crates/xcl-gui/src/logic.rs | 9 +++++++++ crates/xcl-gui/src/main.rs | 32 +++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index c97fa96531..d4d169d751 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -132,6 +132,12 @@ pub fn pipelines_line(line: &str) -> Option<(u32, u32)> { Some((made.trim().strip_suffix("made")?.trim().parse().ok()?, refused.trim().strip_suffix("refused")?.trim().parse().ok()?)) } +/// `--used-only: 499 pipelines earlier runs used (used-pipelines.txt); ...` of the same pass: +/// the pipelines it set out to build. +pub fn used_pipelines_line(line: &str) -> Option { + line.trim().strip_prefix("--used-only:")?.split_whitespace().next()?.parse().ok() +} + /// The time a pass still takes, from how fast its last reports came. A pass that goes on from /// an earlier one reports thousands of shaders done in its first seconds (they are skipped, /// not built), so the speed is taken between reports and never from zero. @@ -935,6 +941,9 @@ mod tests { #[test] fn precompile_lines_are_read() { + assert_eq!(used_pipelines_line("--used-only: 499 pipelines earlier runs used (used-pipelines.txt); compute programs of other pipelines are passed over"), Some(499)); + assert_eq!(used_pipelines_line("--used-only: no earlier run"), None); + assert_eq!(used_pipelines_line("precompiling 26503 shaders into C:\\x"), None); assert_eq!(precompile_progress(" 22400/26503 (463 s)"), Some((22400, 26503, 463))); assert_eq!(precompile_progress("26503/26503 (7205 s)"), Some((26503, 26503, 7205))); assert_eq!(precompile_progress(" pipelines: 400 made, 0 refused"), None); diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index b39b6d9eaf..5faae56fca 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -398,6 +398,10 @@ struct App { eta: logic::Eta, eta_at: Instant, pipelines: Option<(u32, u32)>, + /// With --used-only: the pipelines the pass set out to build, and its speed in pipelines. + pipelines_total: Option, + pipeline_eta: logic::Eta, + pipeline_eta_at: Instant, } impl App { @@ -440,6 +444,9 @@ impl App { eta: logic::Eta::default(), eta_at: Instant::now(), pipelines: None, + pipelines_total: None, + pipeline_eta: logic::Eta::default(), + pipeline_eta_at: Instant::now(), }; if !app.settings.last_data_dir.is_empty() { app.data_dir = Some(PathBuf::from(&app.settings.last_data_dir)); @@ -647,6 +654,8 @@ impl App { self.capture = Capture::Nothing; self.eta = logic::Eta::default(); self.pipelines = None; + self.pipelines_total = None; + self.pipeline_eta = logic::Eta::default(); self.progress = Some(Progress { label: "step_precompile", step: (1, 1), units: None, detail: String::new() }); self.start(Job::Tool, &xcl, args, env, None, ctx); } @@ -695,6 +704,12 @@ impl App { } if let Some(made) = logic::pipelines_line(&line) { self.pipelines = Some(made); + // these lines carry no time of their own: the pass's clock here + self.pipeline_eta.report(made.0 + made.1, self.started.elapsed().as_secs()); + self.pipeline_eta_at = Instant::now(); + } + if let Some(total) = logic::used_pipelines_line(&line) { + self.pipelines_total = Some(total); } match self.capture { Capture::Head if logic::is_commit_id(line.trim()) => self.head_before = Some(line.trim().to_string()), @@ -1030,14 +1045,29 @@ impl App { let Some(p) = &self.progress else { return }; let lang = self.lang(); let step = if p.step.1 > 1 { format!("{}/{} ", p.step.0, p.step.1) } else { String::new() }; + // a --used-only pass names the pipelines it set out to build: that count is its measure, + // and it may never report shaders at all (they are translated already) + let by_pipelines = match (p.label, self.pipelines, self.pipelines_total) { + ("step_precompile", Some((made, refused)), Some(total)) if total > 0 => Some((made + refused, total)), + _ => None, + }; let (fraction, text) = match p.units { + _ if by_pipelines.is_some() => { + let (done, total) = by_pipelines.unwrap_or_default(); + let left = match self.pipeline_eta.left(total) { + Some(secs) => tr(lang, "eta").replace("{}", &logic::duration_text(secs.saturating_sub(self.pipeline_eta_at.elapsed().as_secs()), lang)), + None => tr(lang, "eta_wait").to_string(), + }; + let fraction = (done as f32 / total as f32).min(1.0); + (fraction, format!("{} {done}/{total} pipelines ({:.0} %) · {left}", tr(lang, p.label), fraction * 100.0)) + } Some((done, total)) => { let detail = if p.label == "step_precompile" { format!(" {}", self.precompile_detail(total)) } else if p.detail.is_empty() { String::new() } else { format!(" {}", p.detail) }; (done as f32 / total as f32, format!("{step}{} {done}/{total} ({:.0} %){detail}", tr(lang, p.label), done as f32 * 100.0 / total as f32)) } None => (0.0, format!("{step}{} – {}…", tr(lang, p.label), tr(lang, "starting"))), }; - ui.add(egui::ProgressBar::new(fraction).desired_width(width).fill(palette(self.settings.dark).accent).text(egui::RichText::new(text).color(egui::Color32::WHITE)).animate(p.units.is_none())); + ui.add(egui::ProgressBar::new(fraction).desired_width(width).fill(palette(self.settings.dark).accent).text(egui::RichText::new(text).color(egui::Color32::WHITE)).animate(p.units.is_none() && by_pipelines.is_none())); } /// The precompile pass in words: the pipelines built so far and the time left, counted down From 526ffa7cb11526e298248246d8569607c20f3810 Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:42:25 -0300 Subject: [PATCH 5/7] xcl-gui: panels on every page, a black theme The Settings and XCL pages stand in titled panels like Home's, and the lines of the console and the logs in a box of their own. The theme button goes round three: the project's colours, black (no colour at all) and light; settings from before read as they did. The status dot is drawn (the fonts have none), and warnings are darker on the light theme. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- crates/xcl-gui/README.md | 16 +- crates/xcl-gui/src/logic.rs | 79 ++++++- crates/xcl-gui/src/main.rs | 423 ++++++++++++++++++++---------------- 3 files changed, 324 insertions(+), 194 deletions(-) diff --git a/crates/xcl-gui/README.md b/crates/xcl-gui/README.md index be6b773697..1d89b5b3f7 100644 --- a/crates/xcl-gui/README.md +++ b/crates/xcl-gui/README.md @@ -66,16 +66,20 @@ The game folder is not written to, as with `xcl run`. ## Languages -English and Spanish; the button at the foot of the side column switches. Next to it, the theme: dark (the -default) or light. +English and Spanish; the button at the foot of the side column switches. Next to it, the theme: +the project's own colours (those of the pictures in `assets/readme`, the default), black, or light. ## Tested Its own tests pass on Windows and Linux. The window was tried on Linux with a stand-in for -`xcl.exe` (the pages, the settings, stop, saved sessions, update and build) and builds and opens on -Windows. +`xcl.exe`: the pages in the three themes, the settings, stop, saved sessions, update and build, +the precompile pass with its bar, and selecting and copying lines (click, Shift+click, drag with +scrolling, Ctrl+A, Ctrl+C). + +On Windows (RTX 3080 Ti) it ran a real title, stopped it, followed its log and saved its +`xcl.toml`, and ran the precompile pass on the title's shader package, in the project's theme. ## Not tested -Not yet run with a real title: stopping a running game, the log followed live and the title's -settings page on a real `xcl.toml` are untried. +On Windows: selecting and copying lines, and the black and light themes. A precompile pass +followed to its end from the window. diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index d4d169d751..a7b5c8c4c3 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -223,6 +223,36 @@ pub enum Lang { Es, } +/// The window's colours. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Theme { + /// The project's own: the night blue, violet and cyan of its pictures. + Xcl, + /// Black and greys, for who wants no colour. + Black, + Light, +} + +impl Theme { + /// The one the theme button switches to. + pub fn next(self) -> Theme { + match self { + Theme::Xcl => Theme::Black, + Theme::Black => Theme::Light, + Theme::Light => Theme::Xcl, + } + } + + /// The text key of the theme's name. + pub fn key(self) -> &'static str { + match self { + Theme::Xcl => "theme_xcl", + Theme::Black => "theme_black", + Theme::Light => "theme", + } + } +} + /// What the window keeps between runs (`gui\settings.toml` under the data root). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(default)] @@ -261,8 +291,12 @@ pub struct Settings { pub async_pipelines: bool, /// `XCL_DRED=1`: the GPU's last operations are logged when the device is removed. pub dred: bool, - /// The window's colours: dark (the default) or light, whatever Windows uses. + /// The window's colours before it had three themes: dark or light. Still written, so that + /// an older build of the window reads its own. pub dark: bool, + /// The window's colours: `xcl` (the project's own, the default), `black` or `light`, + /// whatever Windows uses. Empty = from `dark`. + pub theme: String, /// The graphics adapter `xcl run` named at its last run, for the home page. pub last_gpu: String, /// The game's shader package for the precompile pass; empty = found in the game's folder. @@ -294,6 +328,7 @@ impl Default for Settings { async_pipelines: true, dred: false, dark: true, + theme: String::new(), last_gpu: String::new(), shader_pack: String::new(), used_only: true, @@ -678,8 +713,8 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "build" => ("Build only (cargo build)", "Solo compilar (cargo build)"), "version" => ("Show version (git log -1)", "Ver versión (git log -1)"), "build_note" => ( - "Output goes to the Console tab. Updating keeps your local changes and puts them back on top; git stops if one conflicts.", - "La salida va a la pestaña Consola. Actualizar conserva tus cambios locales y los vuelve a poner encima; git se detiene si alguno choca.", + "Output goes to the Console tab. Updating keeps your local changes and puts them back on top; git stops if one conflicts. This builds xcl.exe; the window itself is rebuilt with it closed (cargo build --release).", + "La salida va a la pestaña Consola. Actualizar conserva tus cambios locales y los vuelve a poner encima; git se detiene si alguno choca. Esto compila xcl.exe; la ventana misma se recompila con ella cerrada (cargo build --release).", ), "update_build" => ("Update and build", "Actualizar y compilar"), "step_git" => ("Downloading changes from GitHub", "Bajando cambios de GitHub"), @@ -693,6 +728,7 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "eta_wait" => ("time left: after the next report", "tiempo restante: tras el próximo aviso"), "pipelines" => ("pipelines built", "pipelines compilados"), "shaders" => ("Shaders", "Shaders"), + "xcl_program" => ("XCL itself", "El propio XCL"), "shader_pack" => ("Shader package", "Paquete de shaders"), "shader_pack_hint" => ("found in the game's folder", "se busca en la carpeta del juego"), "used_only" => ( @@ -767,7 +803,8 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "state_busy" => ("WORKING", "TRABAJANDO"), "state_no_xcl" => ("XCL NOT BUILT", "XCL SIN COMPILAR"), "theme" => ("Light theme", "Tema claro"), - "theme_dark" => ("Dark theme", "Tema oscuro"), + "theme_xcl" => ("XCL theme", "Tema XCL"), + "theme_black" => ("Black theme", "Tema negro"), "language" => ("Español", "English"), other => (other, other), }; @@ -778,6 +815,29 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { } } +impl Settings { + pub fn theme(&self) -> Theme { + match self.theme.as_str() { + "xcl" => Theme::Xcl, + "black" => Theme::Black, + "light" => Theme::Light, + // settings from before the themes had names + _ if self.dark => Theme::Xcl, + _ => Theme::Light, + } + } + + pub fn set_theme(&mut self, theme: Theme) { + self.theme = match theme { + Theme::Xcl => "xcl", + Theme::Black => "black", + Theme::Light => "light", + } + .to_string(); + self.dark = theme != Theme::Light; + } +} + #[cfg(test)] mod tests { use super::*; @@ -1016,6 +1076,17 @@ mod tests { fn settings_from_before_the_precompile_page_load() { let old: Settings = toml::from_str("game = 'D:\\Game'\ndark = false\n").unwrap(); assert!(old.used_only && !old.precompile_stale && old.shader_pack.is_empty() && !old.dark); + // the theme is told from the old switch until one is chosen by name + assert_eq!(old.theme(), Theme::Light); + assert_eq!(Settings::default().theme(), Theme::Xcl); + let mut s = Settings::default(); + for _ in 0..3 { + let next = s.theme().next(); + s.set_theme(next); + assert_eq!(s.theme(), next); + assert_eq!(s.dark, next != Theme::Light); + } + assert_eq!(s.theme(), Theme::Xcl); } #[test] diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index 5faae56fca..2d2f2d9c95 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -13,7 +13,7 @@ use std::sync::mpsc::{channel, Receiver, Sender}; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use eframe::egui; -use logic::{tr, Lang, Settings, Severity, TitleConfig, TitleFile}; +use logic::{tr, Lang, Settings, Severity, Theme, TitleConfig, TitleFile}; use runner::{Event, Running, Tail}; /// Lines a view keeps; the oldest go first. @@ -119,6 +119,12 @@ struct Palette { button: egui::Color32, button_hover: egui::Color32, accent: egui::Color32, + /// What is written on `accent`. + on_accent: egui::Color32, + /// The fill of a progress bar, under white text. + bar: egui::Color32, + /// The small titles of the boxes. + head: egui::Color32, /// The second colour of the project's pictures (cyan beside the violet). accent2: egui::Color32, /// What is written on `accent2`. @@ -127,13 +133,13 @@ struct Palette { soft: egui::Color32, } -fn palette(dark: bool) -> Palette { +fn palette(theme: Theme) -> Palette { let c = egui::Color32::from_rgb; let a = egui::Color32::from_rgba_unmultiplied; - if dark { + match theme { // the colours of the pictures in the project's README (assets/readme): night blue to // indigo, panels of white at a few percent, violet and cyan - Palette { + Theme::Xcl => Palette { bg: c(13, 19, 40), side: c(11, 16, 32), card: a(255, 255, 255, 13), @@ -142,13 +148,33 @@ fn palette(dark: bool) -> Palette { button: c(36, 39, 76), button_hover: c(52, 54, 104), accent: c(124, 92, 255), + on_accent: c(255, 255, 255), accent2: c(53, 214, 234), on_accent2: c(7, 41, 58), + bar: c(124, 92, 255), + head: c(79, 227, 242), ink: c(243, 246, 255), soft: c(188, 199, 234), - } - } else { - Palette { + }, + // no colour at all: black, greys, and white for what is pressed first + Theme::Black => Palette { + bg: c(0, 0, 0), + side: c(0, 0, 0), + card: c(14, 14, 16), + line: c(42, 42, 46), + field: c(8, 8, 10), + button: c(32, 32, 36), + button_hover: c(50, 50, 56), + accent: c(238, 238, 242), + on_accent: c(0, 0, 0), + accent2: c(58, 58, 64), + on_accent2: c(255, 255, 255), + bar: c(92, 92, 102), + head: c(150, 150, 158), + ink: c(245, 245, 247), + soft: c(170, 170, 178), + }, + Theme::Light => Palette { bg: c(243, 245, 250), side: c(232, 235, 244), card: c(255, 255, 255), @@ -157,11 +183,14 @@ fn palette(dark: bool) -> Palette { button: c(226, 229, 242), button_hover: c(209, 213, 234), accent: c(104, 72, 235), + on_accent: c(255, 255, 255), accent2: c(18, 150, 178), on_accent2: c(255, 255, 255), + bar: c(104, 72, 235), + head: c(104, 72, 235), ink: c(21, 18, 58), soft: c(84, 92, 128), - } + }, } } @@ -180,7 +209,7 @@ fn mark_colour(t: f32) -> egui::Color32 { /// The project's mark, the letters XCL in one round stroke, as its banner draws them /// (assets/readme/banner.svg), `height` high. -fn mark(ui: &mut egui::Ui, height: f32) { +fn mark(ui: &mut egui::Ui, height: f32, plain: Option) { // the banner's own numbers: the letters lie in 98..483 by 85..207, drawn 25 wide let scale = height / 122.0; let (rect, _) = ui.allocate_exact_size(egui::vec2(385.0 * scale, height), egui::Sense::hover()); @@ -206,7 +235,7 @@ fn mark(ui: &mut egui::Ui, height: f32) { } let painter = ui.painter(); for (x, y) in points { - painter.circle_filled(at(x, y), 12.5 * scale, mark_colour((x - 98.0) / 385.0)); + painter.circle_filled(at(x, y), 12.5 * scale, plain.unwrap_or_else(|| mark_colour((x - 98.0) / 385.0))); } } @@ -285,10 +314,10 @@ fn page_ground(rect: egui::Rect) -> egui::Shape { } /// Dark or light, with rounded corners, roomier controls and the window's own colours. -fn apply_style(ctx: &egui::Context, dark: bool) { - let theme = if dark { egui::Theme::Dark } else { egui::Theme::Light }; +fn apply_style(ctx: &egui::Context, colours: Theme) { + let theme = if colours == Theme::Light { egui::Theme::Light } else { egui::Theme::Dark }; ctx.set_theme(theme); - let p = palette(dark); + let p = palette(colours); ctx.style_mut_of(theme, |style| { style.spacing.item_spacing = egui::vec2(8.0, 7.0); style.spacing.button_padding = egui::vec2(11.0, 5.0); @@ -297,7 +326,7 @@ fn apply_style(ctx: &egui::Context, dark: bool) { v.window_fill = p.card; v.extreme_bg_color = p.field; v.selection.bg_fill = p.accent; - v.selection.stroke.color = egui::Color32::WHITE; + v.selection.stroke.color = p.on_accent; v.hyperlink_color = p.accent2; v.weak_text_color = Some(p.soft.gamma_multiply(0.8)); v.widgets.noninteractive.fg_stroke.color = p.soft; @@ -320,6 +349,22 @@ fn card(ui: &mut egui::Ui, p: &Palette, margin: i8, add: impl FnOnce(&mut egu egui::Frame::new().fill(p.card).stroke(egui::Stroke::new(1.0, p.line)).corner_radius(16).inner_margin(margin).show(ui, add).inner } +/// The colour of what the reader is warned of: amber, darker on a light ground. +fn warn_colour(ui: &egui::Ui) -> egui::Color32 { + if ui.visuals().dark_mode { egui::Color32::from_rgb(230, 170, 60) } else { egui::Color32::from_rgb(170, 100, 0) } +} + +/// A box of a page with its small title, as wide as the page. +fn section(ui: &mut egui::Ui, p: &Palette, title: &str, add: impl FnOnce(&mut egui::Ui)) { + card(ui, p, 18, |ui| { + ui.set_width(ui.available_width()); + ui.label(egui::RichText::new(title.to_uppercase()).color(p.head).size(11.0).strong()); + ui.add_space(6.0); + add(ui); + }); + ui.add_space(10.0); +} + struct Line { text: String, severity: Severity, @@ -819,11 +864,11 @@ impl App { /// The column on the left: the program's name, the pages, and this PC at the bottom. fn side(&mut self, ui: &mut egui::Ui) { let lang = self.lang(); - let p = palette(self.settings.dark); + let p = palette(self.settings.theme()); ui.add_space(18.0); ui.horizontal(|ui| { ui.add_space(2.0); - mark(ui, 26.0); + mark(ui, 26.0, (self.settings.theme() == Theme::Black).then_some(p.ink)); }); ui.add_space(4.0); ui.label(egui::RichText::new(tr(lang, "tagline")).color(p.soft).size(10.5)); @@ -855,8 +900,9 @@ impl App { self.settings.lang = if self.lang() == Lang::Es { Lang::En } else { Lang::Es }; } // the button names the theme it switches to - if ui.small_button(tr(lang, if self.settings.dark { "theme" } else { "theme_dark" })).clicked() { - self.settings.dark = !self.settings.dark; + let next = self.settings.theme().next(); + if ui.small_button(tr(lang, next.key())).clicked() { + self.settings.set_theme(next); } }); ui.add_space(4.0); @@ -881,7 +927,11 @@ impl App { (Some((_, job)), _) => { let secs = self.started.elapsed().as_secs(); let what = if *job == Job::Game { tr(lang, "running") } else { tr(lang, "busy") }; - ui.colored_label(egui::Color32::from_rgb(90, 190, 110), format!("● {what} {:02}:{:02}", secs / 60, secs % 60)); + let green = egui::Color32::from_rgb(90, 190, 110); + // drawn: the window's fonts have no round dot + let (dot, _) = ui.allocate_exact_size(egui::vec2(10.0, 10.0), egui::Sense::hover()); + ui.painter().circle_filled(dot.center(), 4.0, green); + ui.colored_label(green, format!("{what} {:02}:{:02}", secs / 60, secs % 60)); if *job == Job::Tool { self.progress_bar(ui, (ui.available_width() - 90.0).clamp(200.0, 620.0)); } @@ -895,7 +945,7 @@ impl App { (None, None) => {} } if !self.notice.is_empty() { - ui.colored_label(egui::Color32::from_rgb(230, 170, 60), &self.notice); + ui.colored_label(warn_colour(ui), &self.notice); } }); } @@ -916,13 +966,13 @@ impl App { /// The first page: the game with its Play button, then what is known of it and of this PC. fn home(&mut self, ui: &mut egui::Ui) { let lang = self.lang(); - let p = palette(self.settings.dark); + let p = palette(self.settings.theme()); let busy = self.running.is_some(); let ctx = ui.ctx().clone(); egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| { // the game's box stands on the banner's ground in the dark theme let ground = ui.painter().add(egui::Shape::Noop); - let dark = self.settings.dark; + let dark = self.settings.theme() == Theme::Xcl; let hero = egui::Frame::new().corner_radius(16).inner_margin(22); let hero = if dark { hero } else { hero.fill(p.card).stroke(egui::Stroke::new(1.0, p.line)) }; let drawn = hero.show(ui, |ui| { @@ -943,7 +993,7 @@ impl App { ui.add_enabled(!busy, egui::TextEdit::singleline(&mut self.settings.game).hint_text(tr(lang, "game_hint")).desired_width(f32::INFINITY)); ui.add_space(6.0); ui.horizontal(|ui| { - let play = egui::Button::new(egui::RichText::new(tr(lang, "play")).size(16.0).strong().color(egui::Color32::WHITE)) + let play = egui::Button::new(egui::RichText::new(tr(lang, "play")).size(16.0).strong().color(p.on_accent)) .fill(p.accent) .min_size(egui::vec2(140.0, 40.0)); if ui.add_enabled(!busy, play).clicked() { @@ -967,7 +1017,7 @@ impl App { // under Play: the pass that spares the wait while the world loads, with what it // is and when it has to be done again ui.add_space(12.0); - let warn = egui::Color32::from_rgb(230, 170, 60); + let warn = warn_colour(ui); let precompile = egui::Button::new(egui::RichText::new(tr(lang, "precompile")).size(14.0).strong().color(p.on_accent2)).fill(p.accent2).min_size(egui::vec2(0.0, 34.0)); ui.horizontal(|ui| { if ui.add_enabled(!busy, precompile).clicked() { @@ -1024,7 +1074,7 @@ impl App { for (col, (title, rows)) in cols.iter_mut().zip([(tr(lang, "game"), game_rows), (tr(lang, "this_pc"), pc_rows)]) { card(col, &p, 16, |ui| { ui.set_width(ui.available_width()); - ui.label(egui::RichText::new(title.to_uppercase()).color(p.accent2).size(10.5).strong()); + ui.label(egui::RichText::new(title.to_uppercase()).color(p.head).size(10.5).strong()); for (key, value) in rows { ui.separator(); ui.horizontal(|ui| { @@ -1067,7 +1117,7 @@ impl App { } None => (0.0, format!("{step}{} – {}…", tr(lang, p.label), tr(lang, "starting"))), }; - ui.add(egui::ProgressBar::new(fraction).desired_width(width).fill(palette(self.settings.dark).accent).text(egui::RichText::new(text).color(egui::Color32::WHITE)).animate(p.units.is_none() && by_pipelines.is_none())); + ui.add(egui::ProgressBar::new(fraction).desired_width(width).fill(palette(self.settings.theme()).bar).text(egui::RichText::new(text).color(egui::Color32::WHITE)).animate(p.units.is_none() && by_pipelines.is_none())); } /// The precompile pass in words: the pipelines built so far and the time left, counted down @@ -1086,6 +1136,7 @@ impl App { fn lines(&mut self, ui: &mut egui::Ui, which: Tab) { let lang = self.lang(); + let p = palette(self.settings.theme()); let logs = self.data_dir.as_ref().map(|d| d.join("logs")); let view = match which { Tab::Log => &mut self.log, @@ -1162,10 +1213,14 @@ impl App { // the box of the selected lines keeps its place under the view let box_rows = chosen.as_ref().map_or(0, |t| t.lines().count().min(5)); let box_height = if box_rows == 0 { 0.0 } else { box_rows as f32 * row_height + 66.0 }; - let list_height = (ui.available_height() - box_height).max(row_height * 3.0); + // the list stands in a box of its own, as a terminal does: its margins come off the height + let list_height = (ui.available_height() - box_height - 24.0).max(row_height * 3.0); let highlight = ui.visuals().selection.bg_fill.gamma_multiply(0.45); let (mut first_shown, mut last_shown) = (None, None); - let area = egui::ScrollArea::both().auto_shrink(false).max_height(list_height).stick_to_bottom(!view.free).show_rows(ui, row_height, count, |ui, rows| { + let terminal = egui::Frame::new().fill(p.field).stroke(egui::Stroke::new(1.0, p.line)).corner_radius(12).inner_margin(10); + let area = terminal + .show(ui, |ui| { + egui::ScrollArea::both().auto_shrink(false).max_height(list_height).stick_to_bottom(!view.free).show_rows(ui, row_height, count, |ui, rows| { let width = ui.available_width(); for row in rows { let index = at(row); @@ -1202,7 +1257,9 @@ impl App { } } } - }); + }) + }) + .inner; if view.selecting { // past an edge with the mouse held: the view follows and the selection with it if let (Some(p), Some((anchor, _))) = (pointer, view.selection) { @@ -1231,100 +1288,98 @@ impl App { fn settings_tab(&mut self, ui: &mut egui::Ui) { let lang = self.lang(); + let p = palette(self.settings.theme()); egui::ScrollArea::vertical().auto_shrink(false).show(ui, |ui| { - ui.heading(tr(lang, "run_cfg")); - ui.checkbox(&mut self.settings.offline, tr(lang, "offline")); - ui.checkbox(&mut self.settings.save_sessions, tr(lang, "sessions")); - egui::Grid::new("run").num_columns(2).show(ui, |ui| { - ui.label(tr(lang, "threads")); - ui.add(egui::DragValue::new(&mut self.settings.pipeline_threads).range(0..=64)); - ui.end_row(); - ui.label(tr(lang, "seconds")); - ui.add(egui::DragValue::new(&mut self.settings.run_seconds).range(0..=86_400)); - ui.end_row(); - ui.label(tr(lang, "args")); - ui.add(egui::TextEdit::singleline(&mut self.settings.game_args).desired_width(420.0)); - ui.end_row(); + section(ui, &p, tr(lang, "run_cfg"), |ui| { + ui.checkbox(&mut self.settings.offline, tr(lang, "offline")); + ui.checkbox(&mut self.settings.save_sessions, tr(lang, "sessions")); + egui::Grid::new("run").num_columns(2).show(ui, |ui| { + ui.label(tr(lang, "threads")); + ui.add(egui::DragValue::new(&mut self.settings.pipeline_threads).range(0..=64)); + ui.end_row(); + ui.label(tr(lang, "seconds")); + ui.add(egui::DragValue::new(&mut self.settings.run_seconds).range(0..=86_400)); + ui.end_row(); + ui.label(tr(lang, "args")); + ui.add(egui::TextEdit::singleline(&mut self.settings.game_args).desired_width(420.0)); + ui.end_row(); + }); + ui.label(tr(lang, "extra_env")); + ui.add(egui::TextEdit::multiline(&mut self.settings.extra_env).code_editor().desired_rows(3).desired_width(520.0)); + for line in self.settings.environment().1 { + ui.colored_label(warn_colour(ui), format!("{}: {line}", tr(lang, "refused"))); + } }); - ui.label(tr(lang, "extra_env")); - ui.add(egui::TextEdit::multiline(&mut self.settings.extra_env).code_editor().desired_rows(3).desired_width(520.0)); - for line in self.settings.environment().1 { - ui.colored_label(egui::Color32::from_rgb(230, 170, 60), format!("{}: {line}", tr(lang, "refused"))); - } - - ui.add_space(12.0); - ui.separator(); - ui.heading(tr(lang, "gfx_run")); - egui::Grid::new("gfx").num_columns(2).spacing([16.0, 6.0]).show(ui, |ui| { - ui.label(tr(lang, "translator")); - let names = [("", "tr_hlsl"), ("1", "tr_cs"), ("all", "tr_all")]; - let now = names.iter().find(|(v, _)| *v == self.settings.direct_dxil.trim()).map_or("tr_hlsl", |(_, k)| *k); - egui::ComboBox::from_id_salt("translator").selected_text(tr(lang, now)).width(340.0).show_ui(ui, |ui| { - for (value, key) in names { - ui.selectable_value(&mut self.settings.direct_dxil, value.to_string(), tr(lang, key)); - } + section(ui, &p, tr(lang, "gfx_run"), |ui| { + egui::Grid::new("gfx").num_columns(2).spacing([16.0, 6.0]).show(ui, |ui| { + ui.label(tr(lang, "translator")); + let names = [("", "tr_hlsl"), ("1", "tr_cs"), ("all", "tr_all")]; + let now = names.iter().find(|(v, _)| *v == self.settings.direct_dxil.trim()).map_or("tr_hlsl", |(_, k)| *k); + egui::ComboBox::from_id_salt("translator").selected_text(tr(lang, now)).width(340.0).show_ui(ui, |ui| { + for (value, key) in names { + ui.selectable_value(&mut self.settings.direct_dxil, value.to_string(), tr(lang, key)); + } + }); + ui.end_row(); + ui.label(tr(lang, "dxc_threads")); + ui.add(egui::DragValue::new(&mut self.settings.dxc_threads).range(0..=64)); + ui.end_row(); }); - ui.end_row(); - ui.label(tr(lang, "dxc_threads")); - ui.add(egui::DragValue::new(&mut self.settings.dxc_threads).range(0..=64)); - ui.end_row(); + ui.checkbox(&mut self.settings.shader_cache, tr(lang, "shader_cache")); + ui.checkbox(&mut self.settings.pipeline_cache, tr(lang, "pipeline_cache")); + ui.checkbox(&mut self.settings.async_pipelines, tr(lang, "async_pso")); + ui.checkbox(&mut self.settings.dred, tr(lang, "dred")); + ui.weak(tr(lang, "gfx_note")); }); - ui.checkbox(&mut self.settings.shader_cache, tr(lang, "shader_cache")); - ui.checkbox(&mut self.settings.pipeline_cache, tr(lang, "pipeline_cache")); - ui.checkbox(&mut self.settings.async_pipelines, tr(lang, "async_pso")); - ui.checkbox(&mut self.settings.dred, tr(lang, "dred")); - ui.weak(tr(lang, "gfx_note")); - - ui.add_space(12.0); - ui.separator(); - ui.heading(tr(lang, "title_cfg")); - if self.titles.is_empty() { - ui.colored_label(egui::Color32::from_rgb(230, 170, 60), tr(lang, "title_none")); - if ui.button(tr(lang, "reload")).clicked() { - self.find_titles(); + section(ui, &p, tr(lang, "title_cfg"), |ui| { + if self.titles.is_empty() { + ui.colored_label(warn_colour(ui), tr(lang, "title_none")); + if ui.button(tr(lang, "reload")).clicked() { + self.find_titles(); + } + // what the section holds, greyed: there is no file to write them to yet + let mut preview = TitleConfig::default(); + ui.add_enabled_ui(false, |ui| Self::title_controls(ui, lang, &mut preview)); + return; } - // what the section holds, greyed: there is no file to write them to yet - let mut preview = TitleConfig::default(); - ui.add_enabled_ui(false, |ui| Self::title_controls(ui, lang, &mut preview)); - return; - } - let name = |p: &Path| p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(); - let mut chosen = self.title.clone(); - ui.horizontal(|ui| { - ui.label(tr(lang, "title")); - egui::ComboBox::from_id_salt("title").selected_text(chosen.as_deref().map(name).unwrap_or_default()).width(320.0).show_ui(ui, |ui| { - for dir in &self.titles { - ui.selectable_value(&mut chosen, Some(dir.clone()), name(dir)); + let name = |p: &Path| p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(); + let mut chosen = self.title.clone(); + ui.horizontal(|ui| { + ui.label(tr(lang, "title")); + egui::ComboBox::from_id_salt("title").selected_text(chosen.as_deref().map(name).unwrap_or_default()).width(320.0).show_ui(ui, |ui| { + for dir in &self.titles { + ui.selectable_value(&mut chosen, Some(dir.clone()), name(dir)); + } + }); + }); + if chosen != self.title { + self.load_title(chosen); + } + if self.title_file.is_none() { + return; + } + Self::title_controls(ui, lang, &mut self.title_cfg); + ui.add_space(6.0); + let changed = self.title_cfg != self.title_saved; + let (mut save, mut reload) = (false, false); + ui.horizontal(|ui| { + save = ui.add_enabled(changed, egui::Button::new(tr(lang, "save"))).clicked(); + reload = ui.button(tr(lang, "reload")).clicked(); + if let Some(dir) = &self.title { + ui.weak(dir.join("xcl.toml").to_string_lossy()); } }); - }); - if chosen != self.title { - self.load_title(chosen); - } - if self.title_file.is_none() { - return; - } - Self::title_controls(ui, lang, &mut self.title_cfg); - ui.add_space(6.0); - let changed = self.title_cfg != self.title_saved; - let (mut save, mut reload) = (false, false); - ui.horizontal(|ui| { - save = ui.add_enabled(changed, egui::Button::new(tr(lang, "save"))).clicked(); - reload = ui.button(tr(lang, "reload")).clicked(); - if let Some(dir) = &self.title { - ui.weak(dir.join("xcl.toml").to_string_lossy()); + if save { + self.save_title(); + } + if reload { + self.title_file = None; + self.find_titles(); + } + if self.running.is_some() { + ui.weak(tr(lang, "while_running")); } }); - if save { - self.save_title(); - } - if reload { - self.title_file = None; - self.find_titles(); - } - if self.running.is_some() { - ui.weak(tr(lang, "while_running")); - } }); } @@ -1445,94 +1500,94 @@ impl App { let lang = self.lang(); let busy = self.running.is_some(); let found = |p: Option| p.map_or_else(|| tr(lang, "none").to_string(), |p| p.to_string_lossy().into_owned()); - egui::Grid::new("xcl").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { - ui.label(tr(lang, "xcl_exe")); - ui.add(egui::TextEdit::singleline(&mut self.settings.xcl_exe).hint_text(tr(lang, "auto")).desired_width(460.0)); - if ui.button(tr(lang, "file")).clicked() { - if let Some(p) = rfd::FileDialog::new().add_filter("xcl", &["exe"]).pick_file() { - self.settings.xcl_exe = p.to_string_lossy().into_owned(); + let p = palette(self.settings.theme()); + section(ui, &p, tr(lang, "xcl_program"), |ui| { + egui::Grid::new("xcl").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { + ui.label(tr(lang, "xcl_exe")); + ui.add(egui::TextEdit::singleline(&mut self.settings.xcl_exe).hint_text(tr(lang, "auto")).desired_width(460.0)); + if ui.button(tr(lang, "file")).clicked() { + if let Some(p) = rfd::FileDialog::new().add_filter("xcl", &["exe"]).pick_file() { + self.settings.xcl_exe = p.to_string_lossy().into_owned(); + } } - } - ui.end_row(); - ui.label(""); - ui.weak(format!("{}: {}", tr(lang, "using"), found(self.xcl()))); - ui.end_row(); + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.xcl()))); + ui.end_row(); - ui.label(tr(lang, "repo")); - ui.add(egui::TextEdit::singleline(&mut self.settings.repo).hint_text(tr(lang, "auto")).desired_width(460.0)); - if ui.button(tr(lang, "folder")).clicked() { - if let Some(p) = rfd::FileDialog::new().pick_folder() { - self.settings.repo = p.to_string_lossy().into_owned(); + ui.label(tr(lang, "repo")); + ui.add(egui::TextEdit::singleline(&mut self.settings.repo).hint_text(tr(lang, "auto")).desired_width(460.0)); + if ui.button(tr(lang, "folder")).clicked() { + if let Some(p) = rfd::FileDialog::new().pick_folder() { + self.settings.repo = p.to_string_lossy().into_owned(); + } } + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.repo()))); + ui.end_row(); + }); + ui.add_space(8.0); + let ctx = ui.ctx().clone(); + if ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "update_build")).strong().size(16.0).color(p.on_accent)).fill(p.accent).min_size(egui::vec2(0.0, 38.0))).clicked() { + let mut steps = Step::update(); + steps.push(Step::build()); + self.chain(steps, &ctx); } - ui.end_row(); - ui.label(""); - ui.weak(format!("{}: {}", tr(lang, "using"), found(self.repo()))); - ui.end_row(); - }); - ui.add_space(8.0); - let ctx = ui.ctx().clone(); - if ui.add_enabled(!busy, egui::Button::new(egui::RichText::new(tr(lang, "update_build")).strong().size(16.0).color(egui::Color32::WHITE)).fill(palette(self.settings.dark).accent).min_size(egui::vec2(0.0, 38.0))).clicked() { - let mut steps = Step::update(); - steps.push(Step::build()); - self.chain(steps, &ctx); - } - if matches!(self.running, Some((_, Job::Tool))) && self.progress.as_ref().is_some_and(|p| p.label != "step_precompile") { - ui.add_space(4.0); - self.progress_bar(ui, ui.available_width().min(720.0)); - } - ui.add_space(8.0); - ui.horizontal(|ui| { - ui.weak(tr(lang, "one_by_one")); - if ui.add_enabled(!busy, egui::Button::new(tr(lang, "version"))).clicked() { - self.chain(vec![Step::git(&["log", "-1", "--format=%h %ci %s"])], &ctx); - } - if ui.add_enabled(!busy, egui::Button::new(tr(lang, "update"))).clicked() { - self.chain(Step::update(), &ctx); - } - if ui.add_enabled(!busy, egui::Button::new(tr(lang, "build"))).clicked() { - self.chain(vec![Step::build()], &ctx); + if matches!(self.running, Some((_, Job::Tool))) && self.progress.as_ref().is_some_and(|p| p.label != "step_precompile") { + ui.add_space(4.0); + self.progress_bar(ui, ui.available_width().min(720.0)); } - }); - ui.weak(tr(lang, "build_note")); - - ui.add_space(14.0); - ui.separator(); - ui.add_space(6.0); - ui.heading(tr(lang, "shaders")); - let warn = egui::Color32::from_rgb(230, 170, 60); - if self.settings.precompile_stale { - ui.colored_label(warn, tr(lang, "precompile_stale")); - } - egui::Grid::new("shaders").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { - ui.label(tr(lang, "shader_pack")); - ui.add(egui::TextEdit::singleline(&mut self.settings.shader_pack).hint_text(tr(lang, "shader_pack_hint")).desired_width(460.0)); - if ui.button(tr(lang, "file")).clicked() { - if let Some(p) = rfd::FileDialog::new().add_filter("rpf", &["rpf"]).pick_file() { - self.settings.shader_pack = p.to_string_lossy().into_owned(); + ui.add_space(8.0); + ui.horizontal(|ui| { + ui.weak(tr(lang, "one_by_one")); + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "version"))).clicked() { + self.chain(vec![Step::git(&["log", "-1", "--format=%h %ci %s"])], &ctx); + } + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "update"))).clicked() { + self.chain(Step::update(), &ctx); } + if ui.add_enabled(!busy, egui::Button::new(tr(lang, "build"))).clicked() { + self.chain(vec![Step::build()], &ctx); + } + }); + ui.weak(tr(lang, "build_note")); + }); + section(ui, &p, tr(lang, "shaders"), |ui| { + let warn = warn_colour(ui); + if self.settings.precompile_stale { + ui.colored_label(warn, tr(lang, "precompile_stale")); } - ui.end_row(); - ui.label(""); - ui.weak(format!("{}: {}", tr(lang, "using"), found(self.shader_pack()))); - ui.end_row(); + egui::Grid::new("shaders").num_columns(3).spacing([12.0, 8.0]).show(ui, |ui| { + ui.label(tr(lang, "shader_pack")); + ui.add(egui::TextEdit::singleline(&mut self.settings.shader_pack).hint_text(tr(lang, "shader_pack_hint")).desired_width(460.0)); + if ui.button(tr(lang, "file")).clicked() { + if let Some(p) = rfd::FileDialog::new().add_filter("rpf", &["rpf"]).pick_file() { + self.settings.shader_pack = p.to_string_lossy().into_owned(); + } + } + ui.end_row(); + ui.label(""); + ui.weak(format!("{}: {}", tr(lang, "using"), found(self.shader_pack()))); + ui.end_row(); + }); + ui.checkbox(&mut self.settings.used_only, tr(lang, "used_only")); + ui.add_space(4.0); + ui.weak(tr(lang, "shaders_where")); }); - ui.checkbox(&mut self.settings.used_only, tr(lang, "used_only")); - ui.add_space(4.0); - ui.weak(tr(lang, "shaders_where")); } } impl eframe::App for App { fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { let ctx = ui.ctx().clone(); - apply_style(&ctx, self.settings.dark); + apply_style(&ctx, self.settings.theme()); self.receive(&ctx); if self.running.is_some() { // the clock in the status line ctx.request_repaint_after(Duration::from_millis(500)); } - let p = palette(self.settings.dark); + let p = palette(self.settings.theme()); let side = egui::Frame::new().fill(p.side).inner_margin(egui::Margin::symmetric(12, 0)); egui::Panel::left("side").resizable(false).exact_size(214.0).frame(side).show(ui, |ui| self.side(ui)); // nothing to say above the page while the precompile pass runs: it reports beside its button @@ -1542,7 +1597,7 @@ impl eframe::App for App { egui::Panel::top("status").frame(strip).show(ui, |ui| self.status(ui)); } let page = egui::Frame::new().fill(p.bg).inner_margin(16); - let dark = self.settings.dark; + let dark = self.settings.theme() == Theme::Xcl; egui::CentralPanel::default().frame(page).show(ui, |ui| { if dark { ui.painter().add(page_ground(ui.max_rect().expand(16.0))); From 32087fae1cdf8ca9256422349a2bfa409d8269cd Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:50:09 -0300 Subject: [PATCH 6/7] xcl-gui: the precompile pass compiles vertex and pixel shaders too The pass ran with --only cs, so a title still compiled its vertex and pixel shaders itself, on a black screen ('compiling shaders: N running' in its window's title). --only cs is now left out unless a switch on the XCL page asks for compute alone; --used-only goes on choosing the compute pipelines built. The bar follows the pipelines only in a pass of compute alone. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- crates/xcl-gui/README.md | 7 +++++-- crates/xcl-gui/src/logic.rs | 18 +++++++++++++----- crates/xcl-gui/src/main.rs | 13 +++++++++++-- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/crates/xcl-gui/README.md b/crates/xcl-gui/README.md index 1d89b5b3f7..15f16e1493 100644 --- a/crates/xcl-gui/README.md +++ b/crates/xcl-gui/README.md @@ -37,8 +37,11 @@ cargo build --release -p xcl-gui # target\release\xcl-gui.exe, next to xcl. count; each step has a button of its own too. Only `xcl` is built: `xcl-gui.exe` is running and cannot be written over. - **Shaders (on Home, under *Play*; its choices are on the XCL page):** *Precompile shaders* runs - `xcl shaders --precompile --only cs --pipelines` (with - `--used-only` unless unticked), so a title does not wait for the graphics driver's compiler + `xcl shaders --precompile --pipelines --used-only`: every shader + of the package is compiled into XCL's cache (vertex and pixel too; `--only cs` is added when + that is unticked) and the compute pipelines an earlier run used are built (all of them when + `--used-only` is unticked), so a title does not compile shaders itself on a black screen or + wait for the graphics driver's compiler while its world loads. The pass's own reports become a progress bar with the pipelines built and the time left, taken from the speed between its last reports, beside the button, with *Stop* next to it. It can be stopped and goes diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index a7b5c8c4c3..b10b7da633 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -303,6 +303,9 @@ pub struct Settings { pub shader_pack: String, /// `--used-only`: precompile only the compute pipelines earlier runs of the title used. pub used_only: bool, + /// The precompile pass compiles the vertex and pixel shaders too (no `--only cs`): without + /// them the title compiles those itself, on a black screen. + pub all_stages: bool, /// An update changed XCL's shader translators since the last precompile pass. pub precompile_stale: bool, } @@ -332,6 +335,7 @@ impl Default for Settings { last_gpu: String::new(), shader_pack: String::new(), used_only: true, + all_stages: true, precompile_stale: false, } } @@ -731,15 +735,19 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { "xcl_program" => ("XCL itself", "El propio XCL"), "shader_pack" => ("Shader package", "Paquete de shaders"), "shader_pack_hint" => ("found in the game's folder", "se busca en la carpeta del juego"), + "all_stages" => ( + "All the shaders of the package: vertex and pixel too (without this, only compute, and the game compiles the rest itself)", + "Todos los shaders del paquete: también vértices y píxeles (sin esto, solo cómputo, y el juego compila el resto por dentro)", + ), "used_only" => ( - "Only what the game used in earlier runs (much faster; play once first)", - "Solo lo que el juego usó en ejecuciones anteriores (mucho más rápido; juega una vez antes)", + "Compute pipelines: only those the game used in earlier runs (much faster; play once first)", + "Pipelines de cómputo: solo los que el juego usó en ejecuciones anteriores (mucho más rápido; juega una vez antes)", ), "precompile" => ("Precompile shaders", "Precompilar shaders"), "shaders_where" => ("These are the choices of Precompile shaders, the button under Play on Home.", "Estas son las opciones de Precompilar shaders, el botón bajo Jugar en Inicio."), "precompile_note" => ( - "Builds the game's compute pipelines ahead, so the game does not wait for the graphics driver while its world loads. It can take hours. Stop it whenever you like: the next pass goes on from where this one stopped.", - "Compila por adelantado los pipelines de cómputo del juego, para que no espere al driver gráfico mientras carga el mundo. Puede tardar horas. Detenlo cuando quieras: la próxima pasada sigue desde donde quedó esta.", + "Compiles the game's shaders ahead (vertex, pixel and compute) and builds its compute pipelines, so the game does not compile them itself on a black screen. It can take hours. Stop it whenever you like: the next pass goes on from where this one stopped. The driver still builds the drawing pipelines inside the game, the first time.", + "Compila por adelantado los shaders del juego (vértices, píxeles y cómputo) y construye sus pipelines de cómputo, para que el juego no los compile por dentro con la pantalla en negro. Puede tardar horas. Detenlo cuando quieras: la próxima pasada sigue desde donde quedó esta. Los pipelines de dibujo los sigue construyendo el driver dentro del juego, la primera vez.", ), "precompile_warn" => ( "What is precompiled belongs to this build of XCL, this graphics card and this driver. After an update of XCL that changes its shader translators, or a new graphics driver, the pass starts from zero.", @@ -1075,7 +1083,7 @@ mod tests { #[test] fn settings_from_before_the_precompile_page_load() { let old: Settings = toml::from_str("game = 'D:\\Game'\ndark = false\n").unwrap(); - assert!(old.used_only && !old.precompile_stale && old.shader_pack.is_empty() && !old.dark); + assert!(old.used_only && old.all_stages && !old.precompile_stale && old.shader_pack.is_empty() && !old.dark); // the theme is told from the old switch until one is chosen by name assert_eq!(old.theme(), Theme::Light); assert_eq!(Settings::default().theme(), Theme::Xcl); diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index 2d2f2d9c95..47f8be05f3 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -445,6 +445,7 @@ struct App { pipelines: Option<(u32, u32)>, /// With --used-only: the pipelines the pass set out to build, and its speed in pipelines. pipelines_total: Option, + pipelines_measure: bool, pipeline_eta: logic::Eta, pipeline_eta_at: Instant, } @@ -490,6 +491,7 @@ impl App { eta_at: Instant::now(), pipelines: None, pipelines_total: None, + pipelines_measure: false, pipeline_eta: logic::Eta::default(), pipeline_eta_at: Instant::now(), }; @@ -687,7 +689,13 @@ impl App { return; }; self.save_settings(); - let mut args: Vec = ["shaders", &pack.to_string_lossy(), "--precompile", "--only", "cs", "--pipelines"].map(String::from).to_vec(); + let mut args: Vec = ["shaders", &pack.to_string_lossy(), "--precompile"].map(String::from).to_vec(); + if !self.settings.all_stages { + args.extend(["--only", "cs"].map(String::from)); + } + args.push("--pipelines".into()); + // a pass of compute programs an earlier run used reports only pipelines: they are its measure + self.pipelines_measure = !self.settings.all_stages && self.settings.used_only; if self.settings.used_only { args.push("--used-only".into()); } @@ -1098,7 +1106,7 @@ impl App { // a --used-only pass names the pipelines it set out to build: that count is its measure, // and it may never report shaders at all (they are translated already) let by_pipelines = match (p.label, self.pipelines, self.pipelines_total) { - ("step_precompile", Some((made, refused)), Some(total)) if total > 0 => Some((made + refused, total)), + ("step_precompile", Some((made, refused)), Some(total)) if total > 0 && self.pipelines_measure => Some((made + refused, total)), _ => None, }; let (fraction, text) = match p.units { @@ -1571,6 +1579,7 @@ impl App { ui.weak(format!("{}: {}", tr(lang, "using"), found(self.shader_pack()))); ui.end_row(); }); + ui.checkbox(&mut self.settings.all_stages, tr(lang, "all_stages")); ui.checkbox(&mut self.settings.used_only, tr(lang, "used_only")); ui.add_space(4.0); ui.weak(tr(lang, "shaders_where")); From 6fa6d6ff044311decbe651f4f51bce93d44dc666 Mon Sep 17 00:00:00 2001 From: nikitronick-crypto <316610621+nikitronick-crypto@users.noreply.github.com> Date: Wed, 25 Nov 2026 11:11:16 -0300 Subject: [PATCH 7/7] xcl-gui: Home says when the shaders were last precompiled A pass that ran to its end is kept in the settings (when, and its own count of shaders compiled, found in the cache and failed, and pipelines built) and said under the button, until an update makes it stale. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01TGbT9fA4dEjvKbZH8YDcL2 --- crates/xcl-gui/src/logic.rs | 24 ++++++++++++++++++++++++ crates/xcl-gui/src/main.rs | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/crates/xcl-gui/src/logic.rs b/crates/xcl-gui/src/logic.rs index b10b7da633..6f9ced3b9c 100644 --- a/crates/xcl-gui/src/logic.rs +++ b/crates/xcl-gui/src/logic.rs @@ -138,6 +138,16 @@ pub fn used_pipelines_line(line: &str) -> Option { line.trim().strip_prefix("--used-only:")?.split_whitespace().next()?.parse().ok() } +/// `compiled 812, already cached 25691, errors 0, skipped (GS ...) 3, time 512.3 s`, the pass's +/// last word on its shaders: compiled now, found in the cache, failed. +pub fn precompile_result(line: &str) -> Option<(u32, u32, u32)> { + let mut parts = line.trim().split(','); + let compiled = parts.next()?.trim().strip_prefix("compiled ")?.trim().parse().ok()?; + let cached = parts.next()?.trim().strip_prefix("already cached ")?.trim().parse().ok()?; + let errors = parts.next()?.trim().strip_prefix("errors ")?.trim().parse().ok()?; + Some((compiled, cached, errors)) +} + /// The time a pass still takes, from how fast its last reports came. A pass that goes on from /// an earlier one reports thousands of shaders done in its first seconds (they are skipped, /// not built), so the speed is taken between reports and never from zero. @@ -306,6 +316,10 @@ pub struct Settings { /// The precompile pass compiles the vertex and pixel shaders too (no `--only cs`): without /// them the title compiles those itself, on a black screen. pub all_stages: bool, + /// When the last precompile pass that ran to its end did so (UTC), and what it reported: + /// shaders compiled, already in the cache, errors. Empty = none finished from this window. + pub precompiled_at: String, + pub precompiled_result: String, /// An update changed XCL's shader translators since the last precompile pass. pub precompile_stale: bool, } @@ -336,6 +350,8 @@ impl Default for Settings { shader_pack: String::new(), used_only: true, all_stages: true, + precompiled_at: String::new(), + precompiled_result: String::new(), precompile_stale: false, } } @@ -765,6 +781,11 @@ pub fn tr(lang: Lang, key: &'static str) -> &'static str { ), "precompile_again" => ("The update changed the shader translators: precompile again", "La actualización cambió los traductores de shaders: precompila de nuevo"), "precompile_done" => ("Done: the shaders are precompiled", "Listo: los shaders quedaron precompilados"), + "precompiled" => ("Shaders precompiled", "Shaders precompilados"), + "precompiled_never" => ("Not precompiled from this window yet", "Aún no se ha precompilado desde esta ventana"), + "result_compiled" => ("compiled", "compilados"), + "result_cached" => ("already in the cache", "ya en la caché"), + "result_errors" => ("errors", "errores"), "no_pack" => ("No shader package (*shader*.rpf) in the game's folder: choose it", "No hay paquete de shaders (*shader*.rpf) en la carpeta del juego: elígelo"), "close_game" => ("Not while the game runs", "No mientras el juego corre"), "done" => ("Done: XCL is up to date and built", "Listo: XCL quedó actualizado y compilado"), @@ -1009,6 +1030,9 @@ mod tests { #[test] fn precompile_lines_are_read() { + assert_eq!(precompile_result("compiled 812, already cached 25691, errors 0, skipped (GS – paired at pipeline creation) 3, time 512.3 s"), Some((812, 25691, 0))); + assert_eq!(precompile_result("compiled, already cached"), None); + assert_eq!(precompile_result(" pipelines: 25 made, 0 refused"), None); assert_eq!(used_pipelines_line("--used-only: 499 pipelines earlier runs used (used-pipelines.txt); compute programs of other pipelines are passed over"), Some(499)); assert_eq!(used_pipelines_line("--used-only: no earlier run"), None); assert_eq!(used_pipelines_line("precompiling 26503 shaders into C:\\x"), None); diff --git a/crates/xcl-gui/src/main.rs b/crates/xcl-gui/src/main.rs index 47f8be05f3..bf637d0e65 100644 --- a/crates/xcl-gui/src/main.rs +++ b/crates/xcl-gui/src/main.rs @@ -446,6 +446,8 @@ struct App { /// With --used-only: the pipelines the pass set out to build, and its speed in pipelines. pipelines_total: Option, pipelines_measure: bool, + /// The running pass's last word: shaders compiled, found in the cache, failed. + pass_result: Option<(u32, u32, u32)>, pipeline_eta: logic::Eta, pipeline_eta_at: Instant, } @@ -492,6 +494,7 @@ impl App { pipelines: None, pipelines_total: None, pipelines_measure: false, + pass_result: None, pipeline_eta: logic::Eta::default(), pipeline_eta_at: Instant::now(), }; @@ -708,6 +711,7 @@ impl App { self.eta = logic::Eta::default(); self.pipelines = None; self.pipelines_total = None; + self.pass_result = None; self.pipeline_eta = logic::Eta::default(); self.progress = Some(Progress { label: "step_precompile", step: (1, 1), units: None, detail: String::new() }); self.start(Job::Tool, &xcl, args, env, None, ctx); @@ -761,6 +765,9 @@ impl App { self.pipeline_eta.report(made.0 + made.1, self.started.elapsed().as_secs()); self.pipeline_eta_at = Instant::now(); } + if let Some(result) = logic::precompile_result(&line) { + self.pass_result = Some(result); + } if let Some(total) = logic::used_pipelines_line(&line) { self.pipelines_total = Some(total); } @@ -835,6 +842,17 @@ impl App { } } else if precompiled { self.settings.precompile_stale = false; + // kept, and said on Home until an update makes it stale + let now = logic::stamp(SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |d| d.as_secs())); + self.settings.precompiled_at = match now.split_once('_') { + Some((day, time)) => format!("{day} {} UTC", time.get(..5).unwrap_or(time).replace('-', ":")), + None => now, + }; + self.settings.precompiled_result = match (self.pass_result, self.pipelines) { + (Some((c, k, e)), Some((made, _))) => format!("{c}/{k}/{e}/{made}"), + (Some((c, k, e)), None) => format!("{c}/{k}/{e}/0"), + _ => String::new(), + }; self.save_settings(); self.notice = tr(lang, "precompile_done").into(); } else if self.translators_changed { @@ -1041,6 +1059,23 @@ impl App { }); if self.settings.precompile_stale { ui.colored_label(warn, tr(lang, "precompile_stale")); + } else if !self.precompiling() { + // whether the pass was done, where it is looked for: under its button + ui.horizontal(|ui| { + if self.settings.precompiled_at.is_empty() { + ui.label(egui::RichText::new(tr(lang, "precompiled_never")).color(p.soft)); + return; + } + let green = egui::Color32::from_rgb(90, 200, 120); + let (dot, _) = ui.allocate_exact_size(egui::vec2(10.0, 10.0), egui::Sense::hover()); + ui.painter().circle_filled(dot.center(), 4.5, green); + let numbers: Vec<&str> = self.settings.precompiled_result.split('/').collect(); + let detail = match numbers[..] { + [c, k, e, made] => format!(" · {c} {}, {k} {}, {e} {}, {made} {}", tr(lang, "result_compiled"), tr(lang, "result_cached"), tr(lang, "result_errors"), tr(lang, "pipelines")), + _ => String::new(), + }; + ui.label(egui::RichText::new(format!("{}: {}{detail}", tr(lang, "precompiled"), self.settings.precompiled_at)).color(green).strong()); + }); } ui.label(egui::RichText::new(tr(lang, "precompile_note")).color(p.soft)); ui.colored_label(warn, tr(lang, "precompile_warn"));