From 4d75050ac0abc1567fd874573501869718591078 Mon Sep 17 00:00:00 2001 From: chayleaf Date: Sat, 30 Dec 2023 19:02:37 +0700 Subject: [PATCH] init --- .gitattributes | 3 + .gitignore | 1 + Cargo.lock | 2615 ++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 20 + data/Strut.mp3 | 3 + data/a.ppm | 3 + data/index.html | 11 + data/index1.html | 8 + data/master.js | 21 + data/sample.html | 8 + data/script.js | 57 + data/style.css | 3 + shell.nix | 24 + src/color.rs | 288 +++++ src/css.rs | 101 ++ src/html.rs | 626 +++++++++++ src/main.rs | 1607 ++++++++++++++++++++++++++++ src/ppm.rs | 68 ++ src/resampler.rs | 153 +++ src/unifont.bin | 3 + src/unifont.rs | 46 + unifont.py | 16 + 22 files changed, 5685 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 data/Strut.mp3 create mode 100644 data/a.ppm create mode 100644 data/index.html create mode 100644 data/index1.html create mode 100644 data/master.js create mode 100644 data/sample.html create mode 100644 data/script.js create mode 100644 data/style.css create mode 100644 shell.nix create mode 100644 src/color.rs create mode 100644 src/css.rs create mode 100644 src/html.rs create mode 100644 src/main.rs create mode 100644 src/ppm.rs create mode 100644 src/resampler.rs create mode 100644 src/unifont.bin create mode 100644 src/unifont.rs create mode 100644 unifont.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d2bace3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.ppm filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..cef5982 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2615 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ab_glyph" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "alsa" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2562ad8dcf0f789f65c6fdaad8a8a9708ed6b488e649da28c01656ad66b8b47" +dependencies = [ + "alsa-sys", + "bitflags 1.3.2", + "libc", + "nix 0.24.3", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "android-activity" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" +dependencies = [ + "android-properties", + "bitflags 1.3.2", + "cc", + "jni-sys", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum 0.6.1", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ash" +version = "0.37.3+1.3.251" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" +dependencies = [ + "libloading 0.7.4", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bindgen" +version = "0.69.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" +dependencies = [ + "bitflags 2.4.1", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.43", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "calloop" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +dependencies = [ + "bitflags 1.3.2", + "log", + "nix 0.25.1", + "slotmap", + "thiserror", + "vec_map", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading 0.7.4", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "com-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" + +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "memchr", +] + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +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 = "coreaudio-rs" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" +dependencies = [ + "bitflags 1.3.2", + "core-foundation-sys", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3120ebb80a9de008e638ad833d4127d50ea3d3a960ea23ea69bc66d9358a028" +dependencies = [ + "bindgen", +] + +[[package]] +name = "cpal" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c" +dependencies = [ + "alsa", + "core-foundation-sys", + "coreaudio-rs", + "dasp_sample", + "jni 0.19.0", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "oboe", + "once_cell", + "parking_lot", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.46.0", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "d3d12" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" +dependencies = [ + "bitflags 1.3.2", + "libloading 0.7.4", + "winapi", +] + +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading 0.8.1", +] + +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "env_logger" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fdeflate" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "209098dd6dfc4445aa6111f0e98653ac323eaa4dfd212c9ca3931bf9955c31bd" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "glow" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gpu-alloc" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62" +dependencies = [ + "bitflags 1.3.2", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "gpu-allocator" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" +dependencies = [ + "backtrace", + "log", + "thiserror", + "winapi", + "windows 0.44.0", +] + +[[package]] +name = "gpu-descriptor" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" +dependencies = [ + "bitflags 2.4.1", + "gpu-descriptor-types", + "hashbrown 0.14.3", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" +dependencies = [ + "bitflags 2.4.1", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hassle-rs" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" +dependencies = [ + "bitflags 1.3.2", + "com-rs", + "libc", + "libloading 0.7.4", + "thiserror", + "widestring", + "winapi", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +dependencies = [ + "libc", + "libloading 0.7.4", + "pkg-config", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "libredox" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metal" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "naga" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbcc2e0513220fd2b598e6068608d4462db20322c0e77e47f6f488dfcfc279cb" +dependencies = [ + "bit-set", + "bitflags 1.3.2", + "codespan-reporting", + "hexf-parse", + "indexmap 1.9.3", + "log", + "num-traits", + "rustc-hash", + "spirv", + "termcolor", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "ndk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys", + "num_enum 0.5.11", + "raw-window-handle", + "thiserror", +] + +[[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.4.1+23.1.7779620" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive 0.6.1", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.43", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3.patch-leaks.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "oboe" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" +dependencies = [ + "jni 0.20.0", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" +dependencies = [ + "cc", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +dependencies = [ + "parking_lot_core", +] + +[[package]] +name = "orbclient" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" +dependencies = [ + "libredox", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pixels" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba8189b31db4f12fbf0d4a8eab2d7d7343a504a8d8a7ea4b14ffb2e6129136a" +dependencies = [ + "bytemuck", + "pollster", + "raw-window-handle", + "thiserror", + "ultraviolet", + "wgpu", +] + +[[package]] +name = "pkg-config" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "png" +version = "0.17.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "pollster" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" + +[[package]] +name = "primal-check" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df7f93fd637f083201473dab4fee2db4c429d32e55e3299980ab3957ab916a0" +dependencies = [ + "num-integer", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135ede8821cf6376eb7a64148901e1690b788c11ae94dc297ae917dbc91dc0e" + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "randomize" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88c38c99b51f33c9fcc655252bf02ac8048eb70f35244e4697b0de9c473e940a" + +[[package]] +name = "range-alloc" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" + +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + +[[package]] +name = "realfft" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953d9f7e5cdd80963547b456251296efc2626ed4e3cbf36c869d9564e0220571" +dependencies = [ + "rustfft", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[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 = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "renderdoc-sys" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" + +[[package]] +name = "rquickjs" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de83ea57beee293520e2f93ac6d34a5596411e7841846a8e179a3623ea17e4e2" +dependencies = [ + "rquickjs-core", +] + +[[package]] +name = "rquickjs-core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a0af23e8116333509584b539f0cb65bcdbe5db019abe86e1159ad4f87f27f5e" +dependencies = [ + "async-lock", + "rquickjs-sys", +] + +[[package]] +name = "rquickjs-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb4766d7b7b291041d458ce3d587c61c365ddc6dc27e6827786e0daef2fd61b" +dependencies = [ + "cc", +] + +[[package]] +name = "rubato" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6dd52e80cfc21894deadf554a5673002938ae4625f7a283e536f9cf7c17b0d5" +dependencies = [ + "log", + "num-complex", + "num-integer", + "num-traits", + "realfft", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustfft" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17d4f6cbdb180c9f4b2a26bbf01c4e647f1e1dea22fe8eb9db54198b32f9434" +dependencies = [ + "num-complex", + "num-integer", + "num-traits", + "primal-check", + "strength_reduce", + "transpose", + "version_check", +] + +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + +[[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 = "sctk-adwaita" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia", +] + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "slotmap" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "smithay-client-toolkit" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" +dependencies = [ + "bitflags 1.3.2", + "calloop", + "dlib", + "lazy_static", + "log", + "memmap2", + "nix 0.24.3", + "pkg-config", + "wayland-client", + "wayland-cursor", + "wayland-protocols", +] + +[[package]] +name = "spirv" +version = "0.2.0+1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" +dependencies = [ + "bitflags 1.3.2", + "num-traits", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" + +[[package]] +name = "swarmos" +version = "0.1.0" +dependencies = [ + "arrayvec", + "cpal", + "env_logger", + "log", + "once_cell", + "pixels", + "rquickjs", + "rubato", + "serde", + "serde_json", + "symphonia", + "tokio", + "usfx", + "winit", +] + +[[package]] +name = "symphonia" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941" +dependencies = [ + "lazy_static", + "symphonia-bundle-flac", + "symphonia-bundle-mp3", + "symphonia-codec-adpcm", + "symphonia-codec-pcm", + "symphonia-codec-vorbis", + "symphonia-core", + "symphonia-format-mkv", + "symphonia-format-ogg", + "symphonia-format-wav", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-bundle-flac" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f23b0482a7cb18fcdf9981ab0b78df800ef0080187d294650023c462439058d" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-bundle-mp3" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f31d7fece546f1e6973011a9eceae948133bbd18fd3d52f6073b1e38ae6368a" +dependencies = [ + "bitflags 1.3.2", + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-codec-adpcm" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870e7dc1865d818c7b6318879d060553a73a3b2a3b8443dff90910f10ac41150" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-pcm" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47f1fbd220a06a641c8ce2ddad10f5ef6ee5cc0c54d9044d25d43b0d3119deaa" +dependencies = [ + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-codec-vorbis" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3953397e3506aa01350c4205817e4f95b58d476877a42f0458d07b665749e203" +dependencies = [ + "log", + "symphonia-core", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142" +dependencies = [ + "arrayvec", + "bitflags 1.3.2", + "bytemuck", + "lazy_static", + "log", +] + +[[package]] +name = "symphonia-format-mkv" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5c61dfc851ad25d4043d8c231d8617e8f7cd02a6cc0edad21ade21848d58895" +dependencies = [ + "lazy_static", + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-ogg" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bf1a00ccd11452d44048a0368828040f778ae650418dbd9d8765b7ee2574c8d" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", + "symphonia-utils-xiph", +] + +[[package]] +name = "symphonia-format-wav" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da76614728fa27c003bdcdfbac51396bd8fcbf94c95fe8e62f1d2bac58ef03a4" +dependencies = [ + "log", + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "symphonia-metadata" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89c3e1937e31d0e068bbe829f66b2f2bfaa28d056365279e0ef897172c3320c0" +dependencies = [ + "encoding_rs", + "lazy_static", + "log", + "symphonia-core", +] + +[[package]] +name = "symphonia-utils-xiph" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a450ca645b80d69aff8b35576cbfdc7f20940b29998202aab910045714c951f8" +dependencies = [ + "symphonia-core", + "symphonia-metadata", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", +] + +[[package]] +name = "tiny-skia" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "png", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tokio" +version = "1.35.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +dependencies = [ + "backtrace", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "transpose" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6522d49d03727ffb138ae4cbc1283d3774f0d10aa7f9bf52e6784c45daf9b23" +dependencies = [ + "num-integer", + "strength_reduce", +] + +[[package]] +name = "ttf-parser" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" + +[[package]] +name = "ultraviolet" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a28554d13eb5daba527cc1b91b6c341372a0ae45ed277ffb2c6fbc04f319d7e" +dependencies = [ + "wide", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "usfx" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd495c370b5ce73f8084ef82cff8d9ae97562b7a369ff0db7cb9208893ac6f46" +dependencies = [ + "randomize", + "serde", +] + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.43", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wayland-client" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" +dependencies = [ + "bitflags 1.3.2", + "downcast-rs", + "libc", + "nix 0.24.3", + "scoped-tls", + "wayland-commons", + "wayland-scanner", + "wayland-sys", +] + +[[package]] +name = "wayland-commons" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" +dependencies = [ + "nix 0.24.3", + "once_cell", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-cursor" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" +dependencies = [ + "nix 0.24.3", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" +dependencies = [ + "bitflags 1.3.2", + "wayland-client", + "wayland-commons", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + +[[package]] +name = "wayland-sys" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" +dependencies = [ + "dlib", + "lazy_static", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "480c965c9306872eb6255fa55e4b4953be55a8b64d57e61d7ff840d3dcc051cd" +dependencies = [ + "arrayvec", + "cfg-if", + "js-sys", + "log", + "naga", + "parking_lot", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2" +dependencies = [ + "arrayvec", + "bit-vec", + "bitflags 2.4.1", + "codespan-reporting", + "log", + "naga", + "parking_lot", + "profiling", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-hal" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ecb3258078e936deee14fd4e0febe1cfe9bbb5ffef165cb60218d2ee5eb4448" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.4.1", + "block", + "core-graphics-types", + "d3d12", + "foreign-types", + "glow", + "gpu-alloc", + "gpu-allocator", + "gpu-descriptor", + "hassle-rs", + "js-sys", + "khronos-egl", + "libc", + "libloading 0.8.1", + "log", + "metal", + "naga", + "objc", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "rustc-hash", + "smallvec", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types", + "winapi", +] + +[[package]] +name = "wgpu-types" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c153280bb108c2979eb5c7391cb18c56642dd3c072e55f52065e13e2a1252a" +dependencies = [ + "bitflags 2.4.1", + "js-sys", + "web-sys", +] + +[[package]] +name = "wide" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winit" +version = "0.28.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" +dependencies = [ + "android-activity", + "bitflags 1.3.2", + "cfg_aliases", + "core-foundation", + "core-graphics", + "dispatch", + "instant", + "libc", + "log", + "mio", + "ndk", + "objc2", + "once_cell", + "orbclient", + "percent-encoding", + "raw-window-handle", + "redox_syscall 0.3.5", + "sctk-adwaita", + "smithay-client-toolkit", + "wasm-bindgen", + "wayland-client", + "wayland-commons", + "wayland-protocols", + "wayland-scanner", + "web-sys", + "windows-sys 0.45.0", + "x11-dl", +] + +[[package]] +name = "winnow" +version = "0.5.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +dependencies = [ + "memchr", +] + +[[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 = "xcursor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" + +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.43", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..b97025d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "swarmos" +version = "0.1.0" +edition = "2021" + +[dependencies] +env_logger = "0.10.1" +cpal = "0.15.2" +log = "0.4.20" +once_cell = { version = "1.19.0", features = ["parking_lot"] } +pixels = "0.13.0" +rquickjs = { version = "0.4.0", features = ["parallel", "futures"] } +serde = { version = "1.0.193", features = ["derive"] } +serde_json = "1.0.108" +tokio = { version = "1.35.1", features = ["rt", "macros", "sync", "time"] } +usfx = { version = "0.1.5", features = ["serde"] } +winit = "0.28" +symphonia = { version = "0.5.3", features = ["mp3"] } +rubato = { version = "0.14.1", features = ["log"] } +arrayvec = "0.7.4" diff --git a/data/Strut.mp3 b/data/Strut.mp3 new file mode 100644 index 0000000..ebb510b --- /dev/null +++ b/data/Strut.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24b3d36c9ff6620a19cb7648fb241210ea9eff1ce8d7994053807cc2231dbde6 +size 1194299 diff --git a/data/a.ppm b/data/a.ppm new file mode 100644 index 0000000..a1d0f05 --- /dev/null +++ b/data/a.ppm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:32aa1769bc236f65a55aabcdd5e7390d3e3639d2a0d5807ef5b81a5d4266341e +size 4843 diff --git a/data/index.html b/data/index.html new file mode 100644 index 0000000..6720468 --- /dev/null +++ b/data/index.html @@ -0,0 +1,11 @@ + + + + + VIEW + YAY HTML +

idk

+ + + a b a b + diff --git a/data/index1.html b/data/index1.html new file mode 100644 index 0000000..1d2f7b5 --- /dev/null +++ b/data/index1.html @@ -0,0 +1,8 @@ + + +

TESTING STUFF

+ YAY HTML +

idk

+ + + diff --git a/data/master.js b/data/master.js new file mode 100644 index 0000000..e3cefe9 --- /dev/null +++ b/data/master.js @@ -0,0 +1,21 @@ +console.log('[js] starting'); +const bgm = { name: null, handle: null }; +globalThis.onmessage = (source, message) => { + console.log('[js] msg', source, message); + if (message == 'reload') { + game.loadFile(source, source + '.html'); + } else if (message == 'unload') { + game.unload(source); + } else if (message.kind) { + if (message.kind == 'bgm') { + if (message.bgm != bgm.name) { + if (bgm.handle != null) game.stop(bgm.handle); + bgm.handle = game.play(bgm.name = message.bgm, { loop: true, }); + } + } + } +}; +game.loadFile('index', 'index.html'); +//game.loadFile('index1', 'index1.html'); +//game.load('index', "

TESTING STUFF

YAY HTML

idk

"); +//game.load('index1', "

TESTING STUFF

YAY HTML

idk

"); diff --git a/data/sample.html b/data/sample.html new file mode 100644 index 0000000..0bbeb77 --- /dev/null +++ b/data/sample.html @@ -0,0 +1,8 @@ + + + I'm literally not alive?? + + + I'm fucking DEAD + + diff --git a/data/script.js b/data/script.js new file mode 100644 index 0000000..d5a100f --- /dev/null +++ b/data/script.js @@ -0,0 +1,57 @@ +let schedule = () => { + let samp = freq => game.sample({ + volume: 0.1, + osc_type: "Sine", + osc_frequency: freq, + osc_duty_cycle: "Eight", + env_attack: 0.1, + env_decay: 0.00, + env_sustain: 0.1, + env_release: 0.0, + dis_crunch: 0.9, + dis_drive: 0.9, + }); + game.sleep(0.00).then(()=>samp(1990)); + game.sleep(0.13).then(()=>samp(1990)); + game.sleep(0.26).then(()=>samp(1990)); + game.sleep(0.39).then(()=>samp(1990)); + game.sleep(1.166).then(schedule); +}; +schedule(); +game.message('master', { kind: 'bgm', bgm: 'Strut.mp3' }); + +globalThis.onkeydown = (code, _ch) => { + console.log('pressed', code, game.keycodes.F5); + game.message('master', 'idk'); + return false; +}; + +globalThis.handler1 = { + click: btn => { + game.select("html").append(btn ? 'd' : 'c'); + } +}; + +/*console.log('test'); +globalThis.handler1 = { + click: () => { + game.append('c'); + } +}; +const pressed = {}; +globalThis.onkeydown = (code, _ch) => { + pressed[code] = true; +}; +globalThis.onkeyup = (code, _ch) => { + pressed[code] = false; +}; +globalThis.ontext = (ch) => { + console.log(ch); + game.setOuter("a", `${ch}`); +}; + +game.append('');*/ +/*for (let i = 0; i < 1; ++i) { + game.append(''); +}*/ +//"

TESTING STUFF

YAY HTML

idk

", diff --git a/data/style.css b/data/style.css new file mode 100644 index 0000000..fc48a5e --- /dev/null +++ b/data/style.css @@ -0,0 +1,3 @@ +tabs { + color: 6; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..4a4e6ca --- /dev/null +++ b/shell.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { }, lib ? pkgs.lib }: + +pkgs.mkShell rec { + name = "rust-env"; + + nativeBuildInputs = with pkgs; [ + pkg-config + rustc + cargo + ]; + buildInputs = with pkgs; [ + openssl + alsa-lib + xorg.libX11 + xorg.libXcursor + xorg.libXrandr + xorg.libXi + wayland + libxkbcommon + libGL + ]; + + LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; +} diff --git a/src/color.rs b/src/color.rs new file mode 100644 index 0000000..548c08f --- /dev/null +++ b/src/color.rs @@ -0,0 +1,288 @@ +pub const COLORS: [[u8; 3]; 256] = [ + *b"\x00\x00\x00", + *b"\x80\x00\x00", + *b"\x00\x80\x00", + *b"\x80\x80\x00", + *b"\x00\x00\x80", + *b"\x80\x00\x80", + *b"\x00\x80\x80", + *b"\xc0\xc0\xc0", + *b"\x80\x80\x80", + *b"\xff\x00\x00", + *b"\x00\xff\x00", + *b"\xff\xff\x00", + *b"\x00\x00\xff", + *b"\xff\x00\xff", + *b"\x00\xff\xff", + *b"\xff\xff\xff", + *b"\x00\x00\x00", + *b"\x00\x00\x5f", + *b"\x00\x00\x87", + *b"\x00\x00\xaf", + *b"\x00\x00\xd7", + *b"\x00\x00\xff", + *b"\x00\x5f\x00", + *b"\x00\x5f\x5f", + *b"\x00\x5f\x87", + *b"\x00\x5f\xaf", + *b"\x00\x5f\xd7", + *b"\x00\x5f\xff", + *b"\x00\x87\x00", + *b"\x00\x87\x5f", + *b"\x00\x87\x87", + *b"\x00\x87\xaf", + *b"\x00\x87\xd7", + *b"\x00\x87\xff", + *b"\x00\xaf\x00", + *b"\x00\xaf\x5f", + *b"\x00\xaf\x87", + *b"\x00\xaf\xaf", + *b"\x00\xaf\xd7", + *b"\x00\xaf\xff", + *b"\x00\xd7\x00", + *b"\x00\xd7\x5f", + *b"\x00\xd7\x87", + *b"\x00\xd7\xaf", + *b"\x00\xd7\xd7", + *b"\x00\xd7\xff", + *b"\x00\xff\x00", + *b"\x00\xff\x5f", + *b"\x00\xff\x87", + *b"\x00\xff\xaf", + *b"\x00\xff\xd7", + *b"\x00\xff\xff", + *b"\x5f\x00\x00", + *b"\x5f\x00\x5f", + *b"\x5f\x00\x87", + *b"\x5f\x00\xaf", + *b"\x5f\x00\xd7", + *b"\x5f\x00\xff", + *b"\x5f\x5f\x00", + *b"\x5f\x5f\x5f", + *b"\x5f\x5f\x87", + *b"\x5f\x5f\xaf", + *b"\x5f\x5f\xd7", + *b"\x5f\x5f\xff", + *b"\x5f\x87\x00", + *b"\x5f\x87\x5f", + *b"\x5f\x87\x87", + *b"\x5f\x87\xaf", + *b"\x5f\x87\xd7", + *b"\x5f\x87\xff", + *b"\x5f\xaf\x00", + *b"\x5f\xaf\x5f", + *b"\x5f\xaf\x87", + *b"\x5f\xaf\xaf", + *b"\x5f\xaf\xd7", + *b"\x5f\xaf\xff", + *b"\x5f\xd7\x00", + *b"\x5f\xd7\x5f", + *b"\x5f\xd7\x87", + *b"\x5f\xd7\xaf", + *b"\x5f\xd7\xd7", + *b"\x5f\xd7\xff", + *b"\x5f\xff\x00", + *b"\x5f\xff\x5f", + *b"\x5f\xff\x87", + *b"\x5f\xff\xaf", + *b"\x5f\xff\xd7", + *b"\x5f\xff\xff", + *b"\x87\x00\x00", + *b"\x87\x00\x5f", + *b"\x87\x00\x87", + *b"\x87\x00\xaf", + *b"\x87\x00\xd7", + *b"\x87\x00\xff", + *b"\x87\x5f\x00", + *b"\x87\x5f\x5f", + *b"\x87\x5f\x87", + *b"\x87\x5f\xaf", + *b"\x87\x5f\xd7", + *b"\x87\x5f\xff", + *b"\x87\x87\x00", + *b"\x87\x87\x5f", + *b"\x87\x87\x87", + *b"\x87\x87\xaf", + *b"\x87\x87\xd7", + *b"\x87\x87\xff", + *b"\x87\xaf\x00", + *b"\x87\xaf\x5f", + *b"\x87\xaf\x87", + *b"\x87\xaf\xaf", + *b"\x87\xaf\xd7", + *b"\x87\xaf\xff", + *b"\x87\xd7\x00", + *b"\x87\xd7\x5f", + *b"\x87\xd7\x87", + *b"\x87\xd7\xaf", + *b"\x87\xd7\xd7", + *b"\x87\xd7\xff", + *b"\x87\xff\x00", + *b"\x87\xff\x5f", + *b"\x87\xff\x87", + *b"\x87\xff\xaf", + *b"\x87\xff\xd7", + *b"\x87\xff\xff", + *b"\xaf\x00\x00", + *b"\xaf\x00\x5f", + *b"\xaf\x00\x87", + *b"\xaf\x00\xaf", + *b"\xaf\x00\xd7", + *b"\xaf\x00\xff", + *b"\xaf\x5f\x00", + *b"\xaf\x5f\x5f", + *b"\xaf\x5f\x87", + *b"\xaf\x5f\xaf", + *b"\xaf\x5f\xd7", + *b"\xaf\x5f\xff", + *b"\xaf\x87\x00", + *b"\xaf\x87\x5f", + *b"\xaf\x87\x87", + *b"\xaf\x87\xaf", + *b"\xaf\x87\xd7", + *b"\xaf\x87\xff", + *b"\xaf\xaf\x00", + *b"\xaf\xaf\x5f", + *b"\xaf\xaf\x87", + *b"\xaf\xaf\xaf", + *b"\xaf\xaf\xd7", + *b"\xaf\xaf\xff", + *b"\xaf\xd7\x00", + *b"\xaf\xd7\x5f", + *b"\xaf\xd7\x87", + *b"\xaf\xd7\xaf", + *b"\xaf\xd7\xd7", + *b"\xaf\xd7\xff", + *b"\xaf\xff\x00", + *b"\xaf\xff\x5f", + *b"\xaf\xff\x87", + *b"\xaf\xff\xaf", + *b"\xaf\xff\xd7", + *b"\xaf\xff\xff", + *b"\xd7\x00\x00", + *b"\xd7\x00\x5f", + *b"\xd7\x00\x87", + *b"\xd7\x00\xaf", + *b"\xd7\x00\xd7", + *b"\xd7\x00\xff", + *b"\xd7\x5f\x00", + *b"\xd7\x5f\x5f", + *b"\xd7\x5f\x87", + *b"\xd7\x5f\xaf", + *b"\xd7\x5f\xd7", + *b"\xd7\x5f\xff", + *b"\xd7\x87\x00", + *b"\xd7\x87\x5f", + *b"\xd7\x87\x87", + *b"\xd7\x87\xaf", + *b"\xd7\x87\xd7", + *b"\xd7\x87\xff", + *b"\xd7\xaf\x00", + *b"\xd7\xaf\x5f", + *b"\xd7\xaf\x87", + *b"\xd7\xaf\xaf", + *b"\xd7\xaf\xd7", + *b"\xd7\xaf\xff", + *b"\xd7\xd7\x00", + *b"\xd7\xd7\x5f", + *b"\xd7\xd7\x87", + *b"\xd7\xd7\xaf", + *b"\xd7\xd7\xd7", + *b"\xd7\xd7\xff", + *b"\xd7\xff\x00", + *b"\xd7\xff\x5f", + *b"\xd7\xff\x87", + *b"\xd7\xff\xaf", + *b"\xd7\xff\xd7", + *b"\xd7\xff\xff", + *b"\xff\x00\x00", + *b"\xff\x00\x5f", + *b"\xff\x00\x87", + *b"\xff\x00\xaf", + *b"\xff\x00\xd7", + *b"\xff\x00\xff", + *b"\xff\x5f\x00", + *b"\xff\x5f\x5f", + *b"\xff\x5f\x87", + *b"\xff\x5f\xaf", + *b"\xff\x5f\xd7", + *b"\xff\x5f\xff", + *b"\xff\x87\x00", + *b"\xff\x87\x5f", + *b"\xff\x87\x87", + *b"\xff\x87\xaf", + *b"\xff\x87\xd7", + *b"\xff\x87\xff", + *b"\xff\xaf\x00", + *b"\xff\xaf\x5f", + *b"\xff\xaf\x87", + *b"\xff\xaf\xaf", + *b"\xff\xaf\xd7", + *b"\xff\xaf\xff", + *b"\xff\xd7\x00", + *b"\xff\xd7\x5f", + *b"\xff\xd7\x87", + *b"\xff\xd7\xaf", + *b"\xff\xd7\xd7", + *b"\xff\xd7\xff", + *b"\xff\xff\x00", + *b"\xff\xff\x5f", + *b"\xff\xff\x87", + *b"\xff\xff\xaf", + *b"\xff\xff\xd7", + *b"\xff\xff\xff", + *b"\x08\x08\x08", + *b"\x12\x12\x12", + *b"\x1c\x1c\x1c", + *b"\x26\x26\x26", + *b"\x30\x30\x30", + *b"\x3a\x3a\x3a", + *b"\x44\x44\x44", + *b"\x4e\x4e\x4e", + *b"\x58\x58\x58", + *b"\x62\x62\x62", + *b"\x6c\x6c\x6c", + *b"\x76\x76\x76", + *b"\x80\x80\x80", + *b"\x8a\x8a\x8a", + *b"\x94\x94\x94", + *b"\x9e\x9e\x9e", + *b"\xa8\xa8\xa8", + *b"\xb2\xb2\xb2", + *b"\xbc\xbc\xbc", + *b"\xc6\xc6\xc6", + *b"\xd0\xd0\xd0", + *b"\xda\xda\xda", + *b"\xe4\xe4\xe4", + *b"\xee\xee\xee", +]; + +pub fn rgb28(col: [u8; 3]) -> u8 { + let rgb = col.map(|c| { + const W: [u8; 6] = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff]; + for ab in W.windows(2) { + let a = *ab.first().unwrap(); + let b = *ab.last().unwrap(); + if c <= b { + return if c - a < b - c { a } else { b }; + } + } + 0 + }); + for (i, col) in COLORS.iter().enumerate() { + if rgb == *col { + return i as u8; + } + } + 1 +} + +#[cfg(test)] +mod test { + use crate::color::rgb28; + + #[test] + fn test() { + assert_eq!(rgb28([0x12, 0x34, 0x56]), 23); + } +} diff --git a/src/css.rs b/src/css.rs new file mode 100644 index 0000000..042661a --- /dev/null +++ b/src/css.rs @@ -0,0 +1,101 @@ +use std::collections::{HashMap, VecDeque}; + +#[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)] +pub enum Condition { + Class(String), + Id(String), + Tag(String), +} + +impl From<&str> for Condition { + fn from(value: &str) -> Self { + if let Some(id) = value.strip_prefix('#') { + Condition::Id(id.to_owned()) + } else if let Some(class) = value.strip_prefix('.') { + Condition::Class(class.to_owned()) + } else { + Condition::Tag(value.to_owned()) + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Rule { + pub cond: Vec>, + pub rule: HashMap, +} + +pub fn parse_rule<'a>(tokens: &mut impl Iterator) -> HashMap { + let mut rule = HashMap::::new(); + let mut k = None::<&str>; + let mut k2 = None::<&str>; + for token in tokens.by_ref() { + if token == "}" { + break; + } + if token == ":" { + k2 = k.take(); + continue; + } + if token == ";" { + k = None; + k2 = None; + continue; + } + if let Some(k) = k2.as_ref() { + if let Ok(v) = token.parse() { + rule.insert(k.to_string(), v); + } + } else { + k = Some(token); + } + } + rule +} + +pub fn parse<'a>(tokens: &mut impl Iterator) -> Vec { + let mut ret = vec![]; + while let Some(token) = tokens.next() { + let mut cond = Vec::>::new(); + cond.push([token.into()].into()); + for token in tokens.by_ref() { + if token == "{" { + break; + } + if token == "*" { + continue; + } + if token == "," { + cond.push([].into()); + continue; + } + cond.last_mut().unwrap().push_back(token.into()); + } + let rule = parse_rule(tokens); + ret.push(Rule { cond, rule }); + } + ret +} + +pub fn tokenize(s: &str) -> Vec { + let mut cur = "".to_owned(); + let mut ret = vec![]; + for ch in s.chars() { + let sep = matches!(ch, ';' | '{' | '}' | ':' | '*'); + if sep || ch.is_whitespace() { + if !cur.is_empty() { + ret.push(cur.clone()); + cur.clear(); + } + if sep { + ret.push(ch.to_string()); + } + } else { + cur.push(ch); + } + } + if !cur.is_empty() { + ret.push(cur); + } + ret +} diff --git a/src/html.rs b/src/html.rs new file mode 100644 index 0000000..d94e455 --- /dev/null +++ b/src/html.rs @@ -0,0 +1,626 @@ +use std::{ + collections::{HashMap, VecDeque, BTreeMap}, + fs, +}; + +use crate::{ + css::{self, Condition}, + ppm, unifont, +}; + +#[derive(Clone, Eq, PartialEq)] +pub struct Data(Vec); + +impl std::fmt::Debug for Data { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("Data(...)") + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum Node { + Complex { + tag: String, + attrs: HashMap, + contents: Vec, + rules: BTreeMap, HashMap>, + }, + Simple(String), + Bitmap(Data, usize), +} + +pub enum RenderData<'a> { + Bitmap { data: &'a [u8], width: usize }, + Text(&'a str, u8), +} + +impl<'a> RenderData<'a> { + fn height(&self) -> usize { + match self { + Self::Bitmap { data, width } => data.len() / width, + Self::Text(..) => 16, + } + } + fn width(&self) -> usize { + match self { + Self::Text(x, ..) => x.chars().map(|x| unifont::width(x) * 8).sum(), + Self::Bitmap { width, .. } => *width, + } + } +} + +#[derive(Copy, Clone, Debug)] +pub struct Rect { + pub x: isize, + pub y: isize, + pub skip_x: isize, + pub skip_y: isize, + pub w: isize, + pub h: isize, +} + +pub struct RenderNode<'a> { + pub data: RenderData<'a>, + pub rect: Rect, + pub handlers: Vec, +} + +pub struct Render<'a> { + node: &'a Node, + next_x: isize, + next_y: isize, + max_x: isize, + max_y: isize, + inner: Option>>, + rules: BTreeMap, HashMap>, + handlers: Vec, + n: usize, +} +impl<'a> Render<'a> { + pub fn style(&self, k: &str, d: isize) -> isize { + if let Some(rules) = self.rules.get(&VecDeque::new()) { + rules.get(k).copied().unwrap_or(d) + } else { + d + } + } +} + +impl<'a> Iterator for Render<'a> { + type Item = RenderNode<'a>; + fn next(&mut self) -> Option> { + let display = self.style("display", 1); + if display == 0 { + return None; + } + let x0 = self.style("x", 0); + let y0 = self.style("y", 0); + let skip_x = self.style("x_view", 0); + let skip_y = self.style("y_view", 0); + let max_w = self.style("width", 0xFFFFFF); + let max_h = self.style("height", 0xFFFFFF); + loop { + if let Some(inner) = &mut self.inner { + if let Some(mut w) = inner.next() { + w.rect.x += self.next_x; + w.rect.y += self.next_y; + if inner.style("display", 1) != 4 { + self.max_x = w.rect.x + w.rect.w; + self.max_y = w.rect.y + w.rect.h; + } + w.rect.x -= skip_x; + w.rect.y -= skip_y; + if w.rect.x < 0 { + w.rect.skip_x += -w.rect.x; + w.rect.w += w.rect.x; + w.rect.x = 0; + } + if w.rect.y < 0 { + w.rect.skip_y += -w.rect.y; + w.rect.h += w.rect.y; + w.rect.y = 0; + } + w.rect.w = w.rect.w.min(max_w - w.rect.x); + w.rect.h = w.rect.h.min(max_h - w.rect.y); + w.rect.x += x0; + w.rect.y += y0; + return Some(w); + } else { + self.inner = None; + } + } + match (self.node, self.n) { + (Node::Simple(x), 0) => { + self.n += 1; + let data = + RenderData::Text(x, u8::try_from(self.style("color", -1)).unwrap_or(0xFF)); + return Some(RenderNode { + rect: Rect { + x: x0 + self.next_x, + y: y0 + self.next_y, + skip_x, + skip_y, + w: (data.width() as isize).min(max_w - self.next_x), + h: (data.height() as isize).min(max_h - self.next_y), + }, + data, + handlers: self.handlers.clone(), + }); + } + (Node::Bitmap(data, width), 0) => { + self.n += 1; + let data = RenderData::Bitmap { + data: data.0.as_slice(), + width: *width, + }; + return Some(RenderNode { + rect: Rect { + x: x0 + self.next_x, + y: y0 + self.next_y, + skip_x, + skip_y, + w: (data.width() as isize).min(max_w - self.next_x), + h: (data.height() as isize).min(max_h - self.next_y), + }, + data, + handlers: self.handlers.clone(), + }); + } + ( + Node::Complex { + tag, + attrs: _, + contents, + rules: _, + }, + mut n, + ) if n < contents.len() + (if tag == "img" { 1 } else { 0 }) => { + if tag == "img" { + if n == 0 { + self.n += 1; + continue; + } else { + n -= 1; + } + } + let q = contents.get(n.wrapping_sub(1)); + let w = contents.get(n).unwrap(); + self.n += 1; + if display == 2 + || (display == 1 && matches!(q, Some(Node::Complex { .. })) + || matches!(w, Node::Complex { .. })) + { + self.next_x = 0; + self.next_y = self.max_y; + self.max_x = 0; + } else { + self.next_x = self.max_x; + if self.next_x > 0 { + self.next_x += 8; + } + } + self.inner = Some(Box::new( + w.render(self.rules.clone(), self.handlers.clone()), + )); + } + _ => return None, + } + } + } +} + +impl Node { + pub fn set_attr(&mut self, k: String, v: String) -> Vec + ", + from_js_tx.clone(), + ) + .unwrap(); + game.doms.insert("master".to_owned(), dom); + let mut changed = true; + let mut mpos = (0isize, 0isize); + let (audio_tx, audio_rx) = mpsc::channel(); + let (stop_tx, stop_rx) = mpsc::channel(); + STOP_TX.set(stop_tx).unwrap(); + let mixer = Arc::new(Mutex::new(usfx::Mixer::new(SAMPLE_RATE as usize))); + let mixer1 = mixer.clone(); + let audio = audio(mixer1, audio_rx, stop_rx); + let _ = audio.play().map_err(|err| log::error!("{err}")); + let (from_js_tx2, from_js_rx2) = mpsc::channel(); + let proxy = event_loop.create_proxy(); + std::thread::spawn(move || { + while let Ok(val) = from_js_rx.recv() { + if from_js_tx2.send(val).is_err() { + break; + } + let _ = proxy.send_event(()); + } + }); + event_loop.run(move |event, _, control_flow| { + while let Ok(msg) = from_js_rx2.try_recv() { + match msg { + FromJs::DomChanged => changed = true, + FromJs::Load(name, data) => { + changed = true; + if let Some(dom) = create_dom(&name, &data, from_js_tx.clone()) { + game.doms.insert(name, dom); + } + } + FromJs::Unload(name) => { + game.doms.remove(&name); + } + FromJs::Message { from, to, data } => { + if let Some(x) = game.doms.get(&to) { + let _ = x.tx.blocking_send(ToJs::Message { from, data }); + } + } + FromJs::Sample(sample) => { + mixer.lock().unwrap().play(sample); + let _ = audio.play().map_err(|err| log::error!("{err}")); + } + FromJs::Play(handle, path, settings) => { + let src = fs::File::open(&path).expect("failed to open media"); + let mss = MediaSourceStream::new(Box::new(src), Default::default()); + let mut hint = Hint::new(); + if let Some(ext) = path.extension().and_then(|x| x.to_str()) { + hint.with_extension(ext); + } + if let Ok(probed) = symphonia::default::get_probe() + .format(&hint, mss, &Default::default(), &Default::default()) + .map_err(|err| log::error!("unsupported format: {err}")) + { + let format = probed.format; + if let Some(track) = format + .tracks() + .iter() + .find(|t| t.codec_params.codec != CODEC_TYPE_NULL) + .cloned() + { + if let Ok(decoder) = symphonia::default::get_codecs() + .make(&track.codec_params, &Default::default()) + { + let _ = audio_tx.send((handle, format, decoder, track, settings)); + let _ = audio.play().map_err(|err| log::error!("{err}")); + } + } + } + } + } + } + // The one and only event that winit_input_helper doesn't have for us... + match event { + Event::RedrawRequested(_) => { + game.draw(pixels.frame_mut()); + if let Err(err) = pixels.render() { + log_error("pixels.render", &err); + *control_flow = ControlFlow::Exit; + return; + } + } + Event::WindowEvent { event, .. } => match event { + WindowEvent::Resized(size) => { + if let Err(err) = pixels.resize_surface(size.width, size.height) { + log_error("pixels.resize_surface", &err); + *control_flow = ControlFlow::Exit; + return; + } + } + WindowEvent::CursorMoved { position, .. } => { + mpos = pixels + .window_pos_to_pixel(position.into()) + .map(|(a, b)| (a as isize, b as isize)) + .unwrap_or_else(|x| x); + game.r#move(mpos.0, mpos.1); + } + WindowEvent::KeyboardInput { input, .. } => { + let pressed = input.state == ElementState::Pressed; + if let Some(kc) = input.virtual_keycode { + game.key(kc, pressed); + } + } + WindowEvent::MouseWheel { + delta, phase: _, .. + } => { + match delta { + winit::event::MouseScrollDelta::LineDelta(x, y) => { + game.scroll((x * 8.) as isize, (y * 16.) as isize); + } + winit::event::MouseScrollDelta::PixelDelta(d) => { + game.scroll(d.x as isize, d.y as isize); + } + } + changed = true; + } + WindowEvent::MouseInput { button, state, .. } => { + // Handle mouse. This is a bit involved since support some simple + // line drawing (mostly because it makes nice looking patterns). + /*let (mouse_cell, mouse_prev_cell) = input + .mouse() + .map(|(mx, my)| { + let (dx, dy) = input.mouse_diff(); + let prev_x = mx - dx; + let prev_y = my - dy; + + let (mx_i, my_i) = pixels + .window_pos_to_pixel((mx, my)) + .unwrap_or_else(|pos| pixels.clamp_pixel_pos(pos)); + + let (px_i, py_i) = pixels + .window_pos_to_pixel((prev_x, prev_y)) + .unwrap_or_else(|pos| pixels.clamp_pixel_pos(pos)); + + ( + (mx_i as isize, my_i as isize), + (px_i as isize, py_i as isize), + ) + }) + .unwrap_or_default();*/ + game.click(mpos.0, mpos.1, button, state == ElementState::Pressed); + } + WindowEvent::ReceivedCharacter(codepoint) => game.text(codepoint), + _ => {} + }, + _ => {} + } + + if changed { + game.update(); + window.request_redraw(); + } + changed = false; + }); +} + +fn log_error(msg: &str, mut err: &dyn std::error::Error) { + log::error!("{msg}: {err}"); + while let Some(src) = err.source() { + err = src; + log::error!(" Caused by: {err}"); + } +} + +struct Dom { + dom: Arc>, + tx: tokio::sync::mpsc::Sender, +} + +struct Renderer { + cells: Vec, + width: usize, + height: usize, + doms: BTreeMap, + last_click: RefCell, + last_move: RefCell, +} + +impl Renderer { + fn new_empty(width: usize, height: usize) -> Self { + assert!(width != 0 && height != 0); + let size = width.checked_mul(height).expect("too big"); + Self { + width, + height, + cells: vec![0u8; size], + doms: BTreeMap::new(), + last_click: "master".to_owned().into(), + last_move: "master".to_owned().into(), + } + } + + fn is_valid(&self, render: &html::Render) -> bool { + let (min_x, min_y, max_x, max_y) = ( + render.style("x", 0), + render.style("y", 0), + render.style("width", self.width as isize) + render.style("x", 0), + render.style("height", self.height as isize) + render.style("y", 0), + ); + max_x > min_x + && max_y > min_y + && max_x >= 0 + && max_y >= 0 + && min_x < self.width as isize + && min_y < self.height as isize + } + + fn last_move(&self) -> std::cell::Ref<'_, String> { + if !matches!( + self.doms.get(&*self.last_move.borrow()), + Some(dom) if self.is_valid(&dom.dom.read().unwrap().render(BTreeMap::new(), vec![])) + ) { + for (dom_id, dom) in &self.doms { + if self.is_valid(&dom.dom.read().unwrap().render(BTreeMap::new(), vec![])) { + *self.last_move.borrow_mut() = dom_id.clone(); + break; + } + } + } + return self.last_move.borrow(); + } + + fn last_click(&self) -> std::cell::Ref<'_, String> { + if !matches!( + self.doms.get(&*self.last_click.borrow()), + Some(dom) if self.is_valid(&dom.dom.read().unwrap().render(BTreeMap::new(), vec![])) + ) { + for (dom_id, dom) in &self.doms { + if self.is_valid(&dom.dom.read().unwrap().render(BTreeMap::new(), vec![])) { + *self.last_click.borrow_mut() = dom_id.clone(); + break; + } + } + } + return self.last_click.borrow(); + } + + fn r#move(&mut self, x: isize, y: isize) { + for (dom_id, dom1) in &self.doms { + let dom = dom1.dom.read().unwrap(); + let render = dom.render(BTreeMap::new(), vec![]); + let (min_x, min_y, max_x, max_y) = ( + render.style("x", 0), + render.style("y", 0), + render.style("width", self.width as isize) + render.style("x", 0), + render.style("height", self.height as isize) + render.style("y", 0), + ); + if self.is_valid(&render) && x >= min_x && x <= max_x && y >= min_y && y <= max_y { + *self.last_move.borrow_mut() = dom_id.clone(); + } + } + } + + fn click(&mut self, x: isize, y: isize, btn: MouseButton, pressed: bool) { + for (dom_id, dom1) in &self.doms { + let dom = dom1.dom.read().unwrap(); + let render = dom.render(BTreeMap::new(), vec![]); + let (min_x, min_y, max_x, max_y) = ( + render.style("x", 0), + render.style("y", 0), + render.style("width", self.width as isize) + render.style("x", 0), + render.style("height", self.height as isize) + render.style("y", 0), + ); + if self.is_valid(&render) && x >= min_x && x <= max_x && y >= min_y && y <= max_y { + let mut added = HashSet::::new(); + let mut handlers = Vec::::new(); + for w in render { + if x >= w.rect.x + && x <= w.rect.x + w.rect.w + && y >= w.rect.y + && y <= w.rect.y + w.rect.h + { + for handler in w.handlers { + if added.insert(handler.clone()) { + handlers.push(handler); + } + } + } + } + if !handlers.is_empty() { + handlers.reverse(); + let _ = dom1.tx.blocking_send(ToJs::Click( + handlers, + match btn { + MouseButton::Left => 0, + MouseButton::Right => 1, + MouseButton::Middle => 2, + MouseButton::Other(x) => x - 0x110, + }, + pressed, + )); + } + *self.last_click.borrow_mut() = dom_id.clone(); + *self.last_move.borrow_mut() = dom_id.clone(); + } + } + } + + fn update(&mut self) { + self.cells.fill(0); + for dom in self.doms.values() { + let dom = dom.dom.read().unwrap(); + let render = dom.render(BTreeMap::new(), vec![]); + /*let (min_x, min_y, max_x, max_y) = ( + render.style("x", 0), + render.style("y", 0), + render.style("width", self.width as isize) + render.style("x", 0), + render.style("height", self.height as isize) + render.style("y", 0), + );*/ + for w in render { + println!( + "rendering {} {:?}", + match w.data { + RenderData::Bitmap { .. } => "bitmap", + RenderData::Text(x, _) => x, + }, + w.rect + ); + let x1 = w.rect.x + w.rect.w; + let y1 = w.rect.y + w.rect.h; + if w.rect.x < 0 && x1 < 0 + || w.rect.x >= self.width as _ && x1 >= self.width as _ + || w.rect.y < 0 && y1 < 0 + || w.rect.y >= self.height as _ && y1 >= self.height as _ + || w.rect.w < 1 + || w.rect.h < 1 + { + continue; + } + if let Some(start) = self.grid_iidx(w.rect.x, w.rect.y) { + match w.data { + RenderData::Text(text, color) => { + let mut x = w.rect.x; + for char in text.chars() { + let data = unifont::data(char); + let width = unifont::width(char); + for (line_i, line) in data.chunks_exact(width).enumerate() { + for (ch_i, pix_chunk) in line.iter().enumerate() { + for pix_i in 0..8 { + if (pix_chunk << pix_i) & 0x80 == 0x80 { + let pix_x = + -w.rect.skip_x + x + ch_i as isize * 8 + pix_i; + let pix_y = + -w.rect.skip_y + w.rect.y + line_i as isize; + if pix_x > x1.min(self.width as isize) + || pix_y > y1.min(self.height as isize) + || pix_x < w.rect.x.max(0) + || pix_y < w.rect.y.max(0) + { + continue; + } + if let Some(q) = self.grid_idx(pix_x, pix_y) { + self.cells[q] = color; + } + } + } + } + } + x += width as isize * 8; + if x >= self.width as isize { + break; + } + } + } + RenderData::Bitmap { data, width } => { + let mut pos = start; + let start_x = w.rect.skip_x as usize; + let act_w = (width as isize - w.rect.skip_x) + .min(x1.min(self.width as isize) - w.rect.x); + let act_h = ((data.len() / width) as isize) + .min(y1.min(self.height as isize) - w.rect.y); + if let Ok(act_w) = usize::try_from(act_w) { + for line in data + .chunks_exact(width) + .skip(w.rect.skip_y.try_into().unwrap_or_default()) + .take(act_h.try_into().unwrap_or_default()) + { + if let Ok(pos) = usize::try_from(pos) { + self.cells[pos..pos + act_w] + .copy_from_slice(&line[start_x..start_x + act_w]); + } + pos += self.width as isize; + if pos >= self.cells.len() as isize { + break; + } + } + } + } + } + } + } + } + } + + fn draw(&self, screen: &mut [u8]) { + debug_assert_eq!(screen.len(), 4 * self.cells.len()); + for (c, pix) in self.cells.iter().zip(screen.chunks_exact_mut(4)) { + pix[..3].copy_from_slice(&color::COLORS[*c as usize]); + pix[3] = 0xFF; + } + } + + fn key(&mut self, key: VirtualKeyCode, pressed: bool) { + let _ = self + .doms + .get(self.last_click().as_str()) + .unwrap() + .tx + .blocking_send(ToJs::Key(key as u32, pressed, v2char(key))); + } + + fn text(&mut self, text: char) { + let _ = self + .doms + .get(self.last_click().as_str()) + .unwrap() + .tx + .blocking_send(ToJs::Text(text)); + } + + fn scroll(&mut self, x: isize, y: isize) { + let mut dom = self + .doms + .get(self.last_move().as_str()) + .unwrap() + .dom + .write() + .unwrap(); + match &mut *dom { + Node::Complex { rules, .. } => { + let rule = rules.entry(VecDeque::new()).or_default(); + let dst_x = rule.entry("x_view".to_owned()).or_default(); + *dst_x = (*dst_x - x).max(0); + let dst_y = rule.entry("y_view".to_owned()).or_default(); + *dst_y = (*dst_y - y).max(0); + } + _ => {} + } + } + + fn grid_idx>(&self, x: I, y: I) -> Option { + match (x.try_into(), y.try_into()) { + (Ok(x), Ok(y)) if x < self.width && y < self.height => Some(x + y * self.width), + _ => None, + } + } + fn grid_iidx>(&self, x: I, y: I) -> Option { + match (x.try_into(), y.try_into()) { + (Ok(x), Ok(y)) if x < self.width as isize && y < self.height as isize => { + Some(x + y * self.width as isize) + } + _ => None, + } + } +} diff --git a/src/ppm.rs b/src/ppm.rs new file mode 100644 index 0000000..15d00da --- /dev/null +++ b/src/ppm.rs @@ -0,0 +1,68 @@ +pub fn read(data: &[u8]) -> Option<(usize, Vec)> { + assert!(data.starts_with(b"P6")); + let mut data = data.split_at(2).1; + while let Some((a, b)) = data.split_first() { + if a.is_ascii_whitespace() { + data = b; + } else { + break; + } + } + let mut w = String::new(); + while let Some((a, b)) = data.split_first() { + data = b; + if a.is_ascii_whitespace() { + break; + } + w.push(*a as char); + } + while let Some((a, b)) = data.split_first() { + if a.is_ascii_whitespace() { + data = b; + } else { + break; + } + } + let mut h = String::new(); + while let Some((a, b)) = data.split_first() { + data = b; + if a.is_ascii_whitespace() { + break; + } + h.push(*a as char); + } + while let Some((a, b)) = data.split_first() { + if a.is_ascii_whitespace() { + data = b; + } else { + break; + } + } + let mut c = String::new(); + while let Some((a, b)) = data.split_first() { + data = b; + if a.is_ascii_whitespace() { + break; + } + c.push(*a as char); + } + let w: usize = w.parse().ok()?; + let h: usize = h.parse().ok()?; + let c: usize = c.parse().ok()?; + if c >= 256 { + return None; + } + let mut ret = vec![]; + for _ in 0..h { + for _ in 0..w { + let (r, d) = data.split_first()?; + data = d; + let (g, d) = data.split_first()?; + data = d; + let (b, d) = data.split_first()?; + data = d; + ret.push(crate::color::rgb28([*r, *g, *b])); + } + } + Some((w, ret)) +} diff --git a/src/resampler.rs b/src/resampler.rs new file mode 100644 index 0000000..e5d79b1 --- /dev/null +++ b/src/resampler.rs @@ -0,0 +1,153 @@ +// Symphonia +// Copyright (c) 2019-2022 The Project Symphonia Developers. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +use symphonia::core::audio::{AudioBuffer, AudioBufferRef, Signal, SignalSpec}; +use symphonia::core::conv::{FromSample, IntoSample}; +use symphonia::core::sample::Sample; + +pub struct Resampler { + resampler: rubato::FftFixedIn, + input: Vec>, + output: Vec>, + interleaved: Vec, + duration: usize, +} + +impl Resampler +where + T: Sample + FromSample + IntoSample, +{ + fn resample_inner(&mut self) -> &[T] { + { + let mut input: arrayvec::ArrayVec<&[f32], 32> = Default::default(); + + for channel in self.input.iter() { + input.push(&channel[..self.duration]); + } + + // Resample. + rubato::Resampler::process_into_buffer( + &mut self.resampler, + &input, + &mut self.output, + None, + ) + .unwrap(); + } + + // Remove consumed samples from the input buffer. + for channel in self.input.iter_mut() { + channel.drain(0..self.duration); + } + + // Interleave the planar samples from Rubato. + let num_channels = self.output.len(); + + self.interleaved + .resize(num_channels * self.output[0].len(), T::MID); + + for (i, frame) in self.interleaved.chunks_exact_mut(num_channels).enumerate() { + for (ch, s) in frame.iter_mut().enumerate() { + *s = self.output[ch][i].into_sample(); + } + } + + &self.interleaved + } +} + +impl Resampler +where + T: Sample + FromSample + IntoSample, +{ + pub fn new(spec: SignalSpec, to_sample_rate: usize, duration: u64) -> Self { + let duration = duration as usize; + let num_channels = spec.channels.count(); + + let resampler = rubato::FftFixedIn::::new( + spec.rate as usize, + to_sample_rate, + duration, + 2, + num_channels, + ) + .unwrap(); + + let output = rubato::Resampler::output_buffer_allocate(&resampler, true); + + let input = vec![Vec::with_capacity(duration); num_channels]; + + Self { + resampler, + input, + output, + duration, + interleaved: Default::default(), + } + } + + /// Resamples a planar/non-interleaved input. + /// + /// Returns the resampled samples in an interleaved format. + pub fn resample(&mut self, input: AudioBufferRef<'_>) -> Option<&[T]> { + // Copy and convert samples into input buffer. + convert_samples_any(&input, &mut self.input); + + // Check if more samples are required. + if self.input[0].len() < self.duration { + return None; + } + + Some(self.resample_inner()) + } + + /// Resample any remaining samples in the resample buffer. + pub fn flush(&mut self) -> Option<&[T]> { + let len = self.input[0].len(); + + if len == 0 { + return None; + } + + let partial_len = len % self.duration; + + if partial_len != 0 { + // Fill each input channel buffer with silence to the next multiple of the resampler + // duration. + for channel in self.input.iter_mut() { + channel.resize(len + (self.duration - partial_len), f32::MID); + } + } + + Some(self.resample_inner()) + } +} + +fn convert_samples_any(input: &AudioBufferRef<'_>, output: &mut [Vec]) { + match input { + AudioBufferRef::U8(input) => convert_samples(input, output), + AudioBufferRef::U16(input) => convert_samples(input, output), + AudioBufferRef::U24(input) => convert_samples(input, output), + AudioBufferRef::U32(input) => convert_samples(input, output), + AudioBufferRef::S8(input) => convert_samples(input, output), + AudioBufferRef::S16(input) => convert_samples(input, output), + AudioBufferRef::S24(input) => convert_samples(input, output), + AudioBufferRef::S32(input) => convert_samples(input, output), + AudioBufferRef::F32(input) => convert_samples(input, output), + AudioBufferRef::F64(input) => convert_samples(input, output), + } +} + +fn convert_samples(input: &AudioBuffer, output: &mut [Vec]) +where + S: Sample + IntoSample, +{ + for (c, dst) in output.iter_mut().enumerate() { + let src = input.chan(c); + dst.extend(src.iter().map(|&s| s.into_sample())); + } +} diff --git a/src/unifont.bin b/src/unifont.bin new file mode 100644 index 0000000..ac18fb8 --- /dev/null +++ b/src/unifont.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:926117f11493dd86b9318d14b549beca8e70db009d58c2e5a77ea92baef7fe44 +size 4158520 diff --git a/src/unifont.rs b/src/unifont.rs new file mode 100644 index 0000000..b53a628 --- /dev/null +++ b/src/unifont.rs @@ -0,0 +1,46 @@ +use std::collections::BTreeMap; + +use once_cell::sync::Lazy; + +const fn parse(mut data: &[u8]) -> [(u32, &[u8]); N] { + let mut ret = [(0, &[] as &[u8]); N]; + let mut i = 0; + while i < ret.len() { + let sz = data[0] as usize; + ret[i].0 = u32::from_be_bytes([0, data[1], data[2], data[3]]); + let (a, b) = data.split_at(4).1.split_at(16 * sz); + ret[i].1 = a; + data = b; + i += 1; + } + ret +} + +#[allow(long_running_const_eval)] +const RAW_DATA: [(u32, &[u8]); 256 /*123234*/] = parse(include_bytes!("unifont.bin")); +static DATA: Lazy> = Lazy::new(|| RAW_DATA.into_iter().collect()); + +pub fn width(c: char) -> usize { + DATA.get(&(c as u32)).map(|x| x.len() / 16).unwrap_or(0) +} + +pub fn data(c: char) -> &'static [u8] { + DATA.get(&(c as u32)).copied().unwrap_or(&[] as &[u8]) +} + +#[cfg(test)] +mod test { + use crate::unifont::{DATA, RAW_DATA}; + + #[test] + fn test() { + assert_eq!(RAW_DATA[5].0, 5); + assert_eq!(RAW_DATA[5].1, b"\xAA\xAA\x00\x01\x80\x00\x00\x01\x80\x00\x7A\x4D\xC2\x52\x7B\x53\xC2\xD6\x7A\x4F\x80\x00\x00\x01\x80\x00\x00\x01\x80\x00\x55\x55"); + assert_eq!(RAW_DATA[32].0, 32); + assert_eq!( + RAW_DATA[32].1, + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + ); + assert_eq!(RAW_DATA[32].1, DATA[&32],); + } +} diff --git a/unifont.py b/unifont.py new file mode 100644 index 0000000..94282e6 --- /dev/null +++ b/unifont.py @@ -0,0 +1,16 @@ +import struct +with open('unifont_all-15.1.04.hex', 'rt') as f: + data = f.readlines() +ret = [] +for w in data: + a, w = w.strip().split(':') + e = [int(w[i:i+2], 16) for i in range(0, len(w), 2)] + b = int(a, 16) + ret.append(bytes([len(e) // 16])) + ret.append(bytes([(b >> 16) & 0xFF])) + ret.append(bytes([(b >> 8) & 0xFF])) + ret.append(bytes([(b >> 0) & 0xFF])) + ret.append(bytes(e)) +with open('src/unifont.bin', 'wb') as f: + for x in ret: + f.write(x)