diff --git a/Cargo.lock b/Cargo.lock index d1b0f69..609e01d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,7 +31,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom 0.2.16", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -53,7 +53,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" dependencies = [ "android-properties", - "bitflags 2.9.0", + "bitflags 2.8.0", "cc", "cesu8", "jni", @@ -161,9 +161,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "bitvec" @@ -194,18 +194,18 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.9.3" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ecc273b49b3205b83d648f0690daa588925572cc5063745bfe547fe7ec8e1a1" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", @@ -220,26 +220,27 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" [[package]] name = "bzip2" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47" +checksum = "75b89e7c29231c673a61a46e722602bcd138298f6b9e81e71119693534585f5c" dependencies = [ "bzip2-sys", ] [[package]] name = "bzip2-sys" -version = "0.1.13+1.0.8" +version = "0.1.12+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +checksum = "72ebc2f1a417f01e1da30ef264ee86ae31d2dcd2d603ea283d3c244a883ca2a9" dependencies = [ "cc", + "libc", "pkg-config", ] @@ -249,7 +250,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "log", "polling", "rustix", @@ -271,9 +272,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.21" +version = "1.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +checksum = "0c3d1b2e905a3a7b00a6141adb0e4c0bb941d11caf55349d863942a1cc44e3c9" dependencies = [ "jobserver", "libc", @@ -300,9 +301,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "clap" -version = "4.5.37" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +checksum = "92b7b18d71fad5313a1e320fa9897994228ce274b60faa4d694fe0ea89cd9e6d" dependencies = [ "clap_builder", "clap_derive", @@ -310,9 +311,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.37" +version = "4.5.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +checksum = "a35db2071778a7344791a4fb4f95308b5673d219dee3ae348b86642574ecc90c" dependencies = [ "anstream", "anstyle", @@ -322,9 +323,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" dependencies = [ "heck", "proc-macro2", @@ -408,7 +409,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "core-foundation 0.10.0", "core-graphics-types 0.2.0", "foreign-types", @@ -432,7 +433,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "core-foundation 0.10.0", "libc", ] @@ -520,9 +521,9 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dpi" -version = "0.1.2" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" [[package]] name = "drm" @@ -530,7 +531,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "bytemuck", "drm-ffi", "drm-fourcc", @@ -565,9 +566,9 @@ dependencies = [ [[package]] name = "dwrote" -version = "0.11.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe1f192fcce01590bd8d839aca53ce0d11d803bf291b2a6c4ad925a8f0024be" +checksum = "70182709525a3632b2ba96b6569225467b18ecb4a77f46d255f713a6bebf05fd" dependencies = [ "lazy_static", "libc", @@ -587,14 +588,14 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.8" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +checksum = "dcaee3d8e3cfc3fd92428d477bc97fc29ec8716d180c0d74c643bb26166660e0" dependencies = [ "anstream", "anstyle", "env_filter", - "jiff", + "humantime", "log", ] @@ -606,9 +607,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.11" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", "windows-sys 0.59.0", @@ -622,9 +623,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "flate2" -version = "1.1.1" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -642,7 +643,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b64b34f4efd515f905952d91bc185039863705592c0c53ae6d979805dd154520" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "byteorder", "core-foundation 0.9.4", "core-graphics 0.23.2", @@ -717,32 +718,20 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasi", ] [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" @@ -757,10 +746,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] -name = "indexmap" -version = "2.9.0" +name = "humantime" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "indexmap" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown", @@ -772,30 +767,6 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[package]] -name = "jiff" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e77966151130221b079bcec80f1f34a9e414fa489d99152a201c07fd2182bc" -dependencies = [ - "jiff-static", - "log", - "portable-atomic", - "portable-atomic-util", - "serde", -] - -[[package]] -name = "jiff-static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97265751f8a9a4228476f2fc17874a9e7e70e96b893368e42619880fe143b48a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "jni" version = "0.21.1" @@ -820,11 +791,10 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.33" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ - "getrandom 0.3.2", "libc", ] @@ -846,9 +816,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libloading" @@ -866,9 +836,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "libc", - "redox_syscall 0.5.11", + "redox_syscall 0.5.8", ] [[package]] @@ -885,9 +855,9 @@ checksum = "2a385b1be4e5c3e362ad2ffa73c392e53f031eaa5b7d648e64cd87f27f6063d7" [[package]] name = "log" -version = "0.4.27" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "memchr" @@ -906,9 +876,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.8.8" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "b3b1c9bd4fe1f0f8b387f6eb9eb3b4a1aa26185e5750efb9140301703f62cd1b" dependencies = [ "adler2", ] @@ -919,7 +889,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "jni-sys", "log", "ndk-sys", @@ -986,7 +956,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "libc", "objc2", @@ -1002,7 +972,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-core-location", @@ -1026,7 +996,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-foundation", @@ -1068,7 +1038,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "dispatch", "libc", @@ -1093,7 +1063,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-foundation", @@ -1105,7 +1075,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-foundation", @@ -1128,7 +1098,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-cloud-kit", @@ -1160,7 +1130,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "objc2", "objc2-core-location", @@ -1169,9 +1139,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "option-ext" @@ -1224,18 +1194,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.10" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.10" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67" dependencies = [ "proc-macro2", "quote", @@ -1250,9 +1220,9 @@ checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pkg-config" -version = "0.3.32" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "polling" @@ -1269,63 +1239,42 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "portable-atomic" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" - -[[package]] -name = "portable-atomic-util" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" -dependencies = [ - "portable-atomic", -] - [[package]] name = "proc-macro-crate" -version = "3.3.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" -version = "0.37.5" +version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" +checksum = "165859e9e55f79d67b96c5d96f4e88b6f2695a1972849c15a6a3f5c59fc2c003" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" - [[package]] name = "radium" version = "0.7.0" @@ -1349,11 +1298,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.11" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", ] [[package]] @@ -1362,7 +1311,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom 0.2.16", + "getrandom", "libredox", "thiserror 1.0.69", ] @@ -1421,7 +1370,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys 0.4.15", @@ -1430,9 +1379,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "same-file" @@ -1464,24 +1413,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", @@ -1490,9 +1439,9 @@ dependencies = [ [[package]] name = "servicepoint" -version = "0.14.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce70bae3641ccafdeb9832ac367efd51243e0708ef35151ad8c2c4ee578aa4a" +checksum = "33abd53582a995aaf5d387be4a1f7eb294a084185f88f8cf61652b6272041660" dependencies = [ "bitvec", "bzip2", @@ -1500,13 +1449,13 @@ dependencies = [ "log", "once_cell", "rust-lzma", - "thiserror 2.0.12", + "thiserror 2.0.11", "zstd", ] [[package]] name = "servicepoint-simulator" -version = "0.2.1" +version = "0.2.0" dependencies = [ "clap", "env_logger", @@ -1515,7 +1464,7 @@ dependencies = [ "pathfinder_geometry", "servicepoint", "softbuffer", - "thiserror 2.0.12", + "thiserror 2.0.11", "winit", ] @@ -1536,9 +1485,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "smithay-client-toolkit" @@ -1546,7 +1495,7 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "calloop", "calloop-wayland-source", "cursor-icon", @@ -1594,7 +1543,7 @@ dependencies = [ "objc2-foundation", "objc2-quartz-core", "raw-window-handle", - "redox_syscall 0.5.11", + "redox_syscall 0.5.8", "rustix", "tiny-xlib", "wasm-bindgen", @@ -1620,9 +1569,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.101" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -1646,11 +1595,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.11", ] [[package]] @@ -1666,9 +1615,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", @@ -1715,15 +1664,15 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.9" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.22.26" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "toml_datetime", @@ -1754,9 +1703,9 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" [[package]] name = "unicode-segmentation" @@ -1798,15 +1747,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -1880,9 +1820,9 @@ dependencies = [ [[package]] name = "wayland-backend" -version = "0.3.10" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121" +checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf" dependencies = [ "cc", "downcast-rs", @@ -1894,11 +1834,11 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.10" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61" +checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "rustix", "wayland-backend", "wayland-scanner", @@ -1910,16 +1850,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "cursor-icon", "wayland-backend", ] [[package]] name = "wayland-cursor" -version = "0.31.10" +version = "0.31.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65317158dec28d00416cb16705934070aef4f8393353d41126c54264ae0f182" +checksum = "a93029cbb6650748881a00e4922b076092a6a08c11e7fbdb923f064b23968c5d" dependencies = [ "rustix", "wayland-client", @@ -1928,11 +1868,11 @@ dependencies = [ [[package]] name = "wayland-protocols" -version = "0.32.8" +version = "0.32.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a" +checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "wayland-backend", "wayland-client", "wayland-scanner", @@ -1940,11 +1880,11 @@ dependencies = [ [[package]] name = "wayland-protocols-plasma" -version = "0.3.8" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fd38cdad69b56ace413c6bcc1fbf5acc5e2ef4af9d5f8f1f9570c0c83eae175" +checksum = "7ccaacc76703fefd6763022ac565b590fcade92202492381c95b2edfdf7d46b3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "wayland-backend", "wayland-client", "wayland-protocols", @@ -1953,11 +1893,11 @@ dependencies = [ [[package]] name = "wayland-protocols-wlr" -version = "0.3.8" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cb6cdc73399c0e06504c437fe3cf886f25568dd5454473d565085b36d6a8bbf" +checksum = "248a02e6f595aad796561fa82d25601bd2c8c3b145b1c7453fc8f94c1a58f8b2" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "wayland-backend", "wayland-client", "wayland-protocols", @@ -2254,14 +2194,14 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.30.10" +version = "0.30.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d05bd8908e14618c9609471db04007e644fd9cce6529756046cfc577f9155e" +checksum = "a809eacf18c8eca8b6635091543f02a5a06ddf3dad846398795460e6e0ae3cc0" dependencies = [ "ahash", "android-activity", "atomic-waker", - "bitflags 2.9.0", + "bitflags 2.8.0", "block2", "bytemuck", "calloop", @@ -2306,9 +2246,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.7.9" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3" +checksum = "59690dea168f2198d1a3b0cac23b8063efcd11012f10ae4698f284808c8ef603" dependencies = [ "memchr", ] @@ -2322,15 +2262,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.9.0", -] - [[package]] name = "wyz" version = "0.5.1" @@ -2384,7 +2315,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.8.0", "dlib", "log", "once_cell", @@ -2430,27 +2361,27 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.2.4" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.15+zstd.1.5.7" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 02d3406..ac7b5a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "servicepoint-simulator" -version = "0.2.1" +version = "0.2.0" edition = "2021" publish = true license = "GPL-3.0-or-later" @@ -20,7 +20,7 @@ clap = { version = "4.5", features = ["derive"] } thiserror = "2.0" # package parsing -servicepoint = { features = ["all_compressions"], version = "0.14.0" } +servicepoint = { version = "0.13.2", features = ["all_compressions"] } # font rendering font-kit = "0.14.2" @@ -31,8 +31,3 @@ pathfinder_geometry = "0.5.1" winit = "0.30" # for drawing pixels onto the surface of the window softbuffer = "0.4.6" - -[profile.release] -lto = true # Enable link-time optimization -codegen-units = 1 # Reduce number of codegen units to increase optimizations -strip = true # Strip symbols from binary diff --git a/README.md b/README.md index 17d5be5..a4bc2af 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ # servicepoint-simulator -[![Releases](https://git.berlin.ccc.de/servicepoint/servicepoint-simulator/badges/release.svg)](https://git.berlin.ccc.de/servicepoint/servicepoint-simulator/releases) -[![crates.io](https://img.shields.io/crates/v/servicepoint-simulator.svg)](https://crates.io/crates/servicepoint-simulator) -[![Crates.io Total Downloads](https://img.shields.io/crates/d/servicepoint-simulator)](https://crates.io/crates/servicepoint-simulator) -[![GPLv3 licensed](https://img.shields.io/crates/l/servicepoint-simulator)](./LICENSE) -[![CI](https://git.berlin.ccc.de/servicepoint/servicepoint-simulator/badges/workflows/rust.yml/badge.svg)](https://git.berlin.ccc.de/servicepoint/servicepoint-simulator) - -A simulator for the CCCB service point display. +A simulator for the CCCB airport display. ![example render](example_render.png) @@ -23,10 +17,6 @@ Use cases: Uses the [servicepoint](https://github.com/cccb/servicepoint) library for reading the packets. The screenshot above shows the output of two example projects running in parallel (game_of_life and random_brightness). -This repository moved -to [git.berlin.ccc.de/servicepoint/servicepoint-simulator](https://git.berlin.ccc.de/servicepoint/servicepoint-simulator/). -The [GitHub repository](https://github.com/kaesaecracker/servicepoint-simulator) will remain as a mirror. - ## Running With cargo installed: `cargo install servicepoint-simulator` @@ -54,8 +44,7 @@ Options: See [env_logger](https://docs.rs/env_logger/latest/env_logger/) to configure logging. -Because this program renders to an RGB pixel buffer, you can enjoy the following additional features not available on -the real display: +Because this program renders to an RGB pixel buffer, you can enjoy the following additional features not available on the real display: - enable or disable the empty space between tile rows (`./servicepoint-simulator --spacers` to enable) - render pixels in red, green, blue or a combination of the three (`./servicepoint-simulator -rgb` for white pixels) @@ -75,7 +64,6 @@ All creatures welcome. ## Legal stuff -The included font is https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_bios (included in the download -from https://int10h.org/oldschool-pc-fonts/download/). The font is CC BY-SA 4.0. +The included font is https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_bios (included in the download from https://int10h.org/oldschool-pc-fonts/download/). The font is CC BY-SA 4.0. For everything else see the LICENSE file. diff --git a/flake.lock b/flake.lock index 578e72d..5da2725 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1745925850, - "narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=", + "lastModified": 1739824009, + "narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=", "owner": "nix-community", "repo": "naersk", - "rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f", + "rev": "e5130d37369bfa600144c2424270c96f0ef0e11d", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1746183838, - "narHash": "sha256-kwaaguGkAqTZ1oK0yXeQ3ayYjs8u/W7eEfrFpFfIDFA=", + "lastModified": 1739758141, + "narHash": "sha256-uq6A2L7o1/tR6VfmYhZWoVAwb3gTy7j4Jx30MIrH0rE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bf3287dac860542719fe7554e21e686108716879", + "rev": "c618e28f70257593de75a7044438efc1c1fc0791", "type": "github" }, "original": { diff --git a/src/command_executor.rs b/src/command_executor.rs index f24a5fe..51ed9e1 100644 --- a/src/command_executor.rs +++ b/src/command_executor.rs @@ -1,22 +1,16 @@ -use crate::{ - command_executor::ExecutionResult::{Failure, Shutdown, Success}, - cp437_font::Cp437Font, - font_renderer::FontRenderer8x8, -}; +use crate::command_executor::ExecutionResult::{Failure, Shutdown, Success}; +use crate::cp437_font::Cp437Font; +use crate::font_renderer::FontRenderer8x8; use log::{debug, error, info, trace, warn}; use servicepoint::{ - BinaryOperation, BitVecCommand, Bitmap, BitmapCommand, GlobalBrightnessCommand, - BrightnessGrid, BrightnessGridCommand, CharGridCommand, ClearCommand, - CompressionCode, Cp437GridCommand, FadeOutCommand, Grid, HardResetCommand, - Origin, TypedCommand, PIXEL_COUNT, PIXEL_WIDTH, TILE_SIZE, -}; -use std::{ - ops::{BitAnd, BitOr, BitXor}, - sync::RwLock, + BitVec, Bitmap, BrightnessGrid, CharGrid, Command, Cp437Grid, Grid, Offset, + Origin, Tiles, PIXEL_COUNT, PIXEL_WIDTH, TILE_SIZE, }; +use std::ops::{BitAnd, BitOr, BitXor}; +use std::sync::RwLock; #[derive(Debug)] -pub struct CommandExecutionContext<'t> { +pub struct CommandExecutor<'t> { display: &'t RwLock, luma: &'t RwLock, cp437_font: Cp437Font, @@ -30,36 +24,201 @@ pub enum ExecutionResult { Shutdown, } -pub trait CommandExecute { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult; -} +impl<'t> CommandExecutor<'t> { + pub fn new( + display: &'t RwLock, + luma: &'t RwLock, + font_renderer: FontRenderer8x8, + ) -> Self { + CommandExecutor { + display, + luma, + font_renderer, + cp437_font: Cp437Font::default(), + } + } -impl CommandExecute for ClearCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - info!("clearing display"); - context.display.write().unwrap().fill(false); + pub(crate) fn execute(&self, command: Command) -> ExecutionResult { + debug!("received {command:?}"); + match command { + Command::Clear => { + info!("clearing display"); + self.display.write().unwrap().fill(false); + Success + } + Command::HardReset => { + warn!("display shutting down"); + Shutdown + } + Command::BitmapLinearWin(Origin { x, y, .. }, pixels, _) => { + self.print_pixel_grid(x, y, &pixels) + } + Command::Cp437Data(origin, grid) => { + self.print_cp437_data(origin, &grid) + } + #[allow(deprecated)] + Command::BitmapLegacy => { + warn!("ignoring deprecated command {:?}", command); + Failure + } + Command::BitmapLinearAnd(offset, vec, _) => { + self.execute_bitmap_linear(offset, vec, BitAnd::bitand) + } + Command::BitmapLinearOr(offset, vec, _) => { + self.execute_bitmap_linear(offset, vec, BitOr::bitor) + } + Command::BitmapLinearXor(offset, vec, _) => { + self.execute_bitmap_linear(offset, vec, BitXor::bitxor) + } + Command::BitmapLinear(offset, vec, _) => { + self.execute_bitmap_linear(offset, vec, move |_, new| new) + } + Command::CharBrightness(origin, grid) => { + self.execute_char_brightness(origin, grid) + } + Command::Brightness(brightness) => { + self.luma.write().unwrap().fill(brightness); + Success + } + Command::FadeOut => { + error!("command not implemented: {command:?}"); + Success + } + Command::Utf8Data(origin, grid) => { + self.print_utf8_data(origin, &grid) + } + } + } + + fn execute_char_brightness( + &self, + origin: Origin, + grid: BrightnessGrid, + ) -> ExecutionResult { + let mut luma = self.luma.write().unwrap(); + for inner_y in 0..grid.height() { + for inner_x in 0..grid.width() { + let brightness = grid.get(inner_x, inner_y); + luma.set(origin.x + inner_x, origin.y + inner_y, brightness); + } + } Success } -} -impl CommandExecute for BitmapCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - let Self { - origin: - Origin { - x: offset_x, - y: offset_y, - .. - }, - bitmap: pixels, - .. - } = self; + fn execute_bitmap_linear( + &self, + offset: Offset, + vec: BitVec, + op: Op, + ) -> ExecutionResult + where + Op: Fn(bool, bool) -> bool, + { + if !Self::check_bitmap_valid(offset as u16, vec.len()) { + return Failure; + } + let mut display = self.display.write().unwrap(); + for bitmap_index in 0..vec.len() { + let (x, y) = Self::get_coordinates_for_index(offset, bitmap_index); + let old_value = display.get(x, y); + display.set(x, y, op(old_value, vec[bitmap_index])); + } + Success + } + + fn check_bitmap_valid(offset: u16, payload_len: usize) -> bool { + if offset as usize + payload_len > PIXEL_COUNT { + error!( + "bitmap with offset {offset} is too big ({payload_len} bytes)" + ); + return false; + } + + true + } + + fn print_cp437_data( + &self, + origin: Origin, + grid: &Cp437Grid, + ) -> ExecutionResult { + let font = &self.cp437_font; + let Origin { x, y, .. } = origin; + for char_y in 0usize..grid.height() { + for char_x in 0usize..grid.width() { + let char_code = grid.get(char_x, char_y); + trace!( + "drawing char_code {char_code:#04x} (if this was UTF-8, it would be {})", + char::from(char_code) + ); + + let tile_x = char_x + x; + let tile_y = char_y + y; + + match self.print_pixel_grid( + tile_x * TILE_SIZE, + tile_y * TILE_SIZE, + &font[char_code], + ) { + Success => {} + Failure => { + error!( + "stopping drawing text because char draw failed" + ); + return Failure; + } + Shutdown => return Shutdown, + } + } + } + + Success + } + + fn print_utf8_data( + &self, + origin: Origin, + grid: &CharGrid, + ) -> ExecutionResult { + let mut display = self.display.write().unwrap(); + + let Origin { x, y, .. } = origin; + for char_y in 0usize..grid.height() { + for char_x in 0usize..grid.width() { + let char = grid.get(char_x, char_y); + trace!("drawing {char}"); + + let tile_x = char_x + x; + let tile_y = char_y + y; + + if let Err(e) = self.font_renderer.render( + char, + &mut display, + Origin::new(tile_x * TILE_SIZE, tile_y * TILE_SIZE), + ) { + error!( + "stopping drawing text because char draw failed: {e}" + ); + return Failure; + } + } + } + + Success + } + + fn print_pixel_grid( + &self, + offset_x: usize, + offset_y: usize, + pixels: &Bitmap, + ) -> ExecutionResult { debug!( "printing {}x{} grid at {offset_x} {offset_y}", pixels.width(), pixels.height() ); - let mut display = context.display.write().unwrap(); + let mut display = self.display.write().unwrap(); for inner_y in 0..pixels.height() { for inner_x in 0..pixels.width() { let is_set = pixels.get(inner_x, inner_y); @@ -77,186 +236,12 @@ impl CommandExecute for BitmapCommand { Success } -} -impl CommandExecute for HardResetCommand { - fn execute(&self, _: &CommandExecutionContext) -> ExecutionResult { - warn!("display shutting down"); - Shutdown - } -} - -impl CommandExecute for BitVecCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - let BitVecCommand { - offset, - bitvec, - operation, - .. - } = self; - fn overwrite(_: bool, new: bool) -> bool { - new - } - let operation = match operation { - BinaryOperation::Overwrite => overwrite, - BinaryOperation::And => BitAnd::bitand, - BinaryOperation::Or => BitOr::bitor, - BinaryOperation::Xor => BitXor::bitxor, - }; - - if self.offset + bitvec.len() > PIXEL_COUNT { - error!( - "bitmap with offset {offset} is too big ({} bytes)", - bitvec.len() - ); - return Failure; - } - - let mut display = context.display.write().unwrap(); - for bitmap_index in 0..bitvec.len() { - let pixel_index = offset + bitmap_index; - let (x, y) = (pixel_index % PIXEL_WIDTH, pixel_index / PIXEL_WIDTH); - let old_value = display.get(x, y); - display.set(x, y, operation(old_value, bitvec[bitmap_index])); - } - Success - } -} - -impl CommandExecute for Cp437GridCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - let Cp437GridCommand { origin, grid } = self; - let Origin { x, y, .. } = origin; - for char_y in 0usize..grid.height() { - for char_x in 0usize..grid.width() { - let char_code = grid.get(char_x, char_y); - trace!( - "drawing char_code {char_code:#04x} (if this was UTF-8, it would be {})", - char::from(char_code) - ); - - let tile_x = char_x + x; - let tile_y = char_y + y; - - let execute_result = BitmapCommand { - origin: Origin::new(tile_x * TILE_SIZE, tile_y * TILE_SIZE), - bitmap: context.cp437_font[char_code].clone(), - compression: CompressionCode::default(), - } - .execute(context); - match execute_result { - Success => {} - Failure => { - error!( - "stopping drawing text because char draw failed" - ); - return Failure; - } - Shutdown => return Shutdown, - } - } - } - - Success - } -} - -#[allow(deprecated)] -impl CommandExecute for servicepoint::BitmapLegacyCommand { - fn execute(&self, _: &CommandExecutionContext) -> ExecutionResult { - warn!("ignoring deprecated command {:?}", self); - Failure - } -} - -impl CommandExecute for BrightnessGridCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - let BrightnessGridCommand { origin, grid } = self; - let mut luma = context.luma.write().unwrap(); - for inner_y in 0..grid.height() { - for inner_x in 0..grid.width() { - let brightness = grid.get(inner_x, inner_y); - luma.set(origin.x + inner_x, origin.y + inner_y, brightness); - } - } - Success - } -} - -impl CommandExecute for CharGridCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - let CharGridCommand { origin, grid } = self; - let mut display = context.display.write().unwrap(); - - let Origin { x, y, .. } = origin; - for char_y in 0usize..grid.height() { - for char_x in 0usize..grid.width() { - let char = grid.get(char_x, char_y); - trace!("drawing {char}"); - - let tile_x = char_x + x; - let tile_y = char_y + y; - - if let Err(e) = context.font_renderer.render( - char, - &mut display, - Origin::new(tile_x * TILE_SIZE, tile_y * TILE_SIZE), - ) { - error!( - "stopping drawing text because char draw failed: {e}" - ); - return Failure; - } - } - } - - Success - } -} - -impl CommandExecute for GlobalBrightnessCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - context.luma.write().unwrap().fill(self.brightness); - Success - } -} - -impl CommandExecute for FadeOutCommand { - fn execute(&self, _: &CommandExecutionContext) -> ExecutionResult { - error!("command not implemented: {self:?}"); - Success - } -} - -impl CommandExecute for TypedCommand { - fn execute(&self, context: &CommandExecutionContext) -> ExecutionResult { - match self { - TypedCommand::Clear(command) => command.execute(context), - TypedCommand::HardReset(command) => command.execute(context), - TypedCommand::Bitmap(command) => command.execute(context), - TypedCommand::Cp437Grid(command) => command.execute(context), - #[allow(deprecated)] - TypedCommand::BitmapLegacy(command) => command.execute(context), - TypedCommand::BitVec(command) => command.execute(context), - TypedCommand::BrightnessGrid(command) => command.execute(context), - TypedCommand::Brightness(command) => command.execute(context), - TypedCommand::FadeOut(command) => command.execute(context), - TypedCommand::CharGrid(command) => command.execute(context), - } - } -} - -impl<'t> CommandExecutionContext<'t> { - pub fn new( - display: &'t RwLock, - luma: &'t RwLock, - font_renderer: FontRenderer8x8, - ) -> Self { - CommandExecutionContext { - display, - luma, - font_renderer, - cp437_font: Cp437Font::default(), - } + fn get_coordinates_for_index( + offset: usize, + index: usize, + ) -> (usize, usize) { + let pixel_index = offset + index; + (pixel_index % PIXEL_WIDTH, pixel_index / PIXEL_WIDTH) } } diff --git a/src/cp437_font.rs b/src/cp437_font.rs index ac43508..7c1e3ff 100644 --- a/src/cp437_font.rs +++ b/src/cp437_font.rs @@ -16,9 +16,8 @@ impl Cp437Font { impl Default for Cp437Font { fn default() -> Self { - let mut bitmaps = core::array::from_fn(|_| { - Bitmap::new(TILE_SIZE, TILE_SIZE).unwrap() - }); + let mut bitmaps = + core::array::from_fn(|_| Bitmap::new(TILE_SIZE, TILE_SIZE)); for (char_code, bitmap) in bitmaps.iter_mut().enumerate() { let bits = CP437_FONT_LINEAR[char_code]; diff --git a/src/gui.rs b/src/gui.rs index e5f08d4..315af42 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -1,6 +1,7 @@ +use std::{sync::mpsc::Sender, sync::RwLock}; + use log::{info, warn}; use servicepoint::*; -use std::{sync::mpsc::Sender, sync::RwLock}; use winit::{ application::ApplicationHandler, dpi::LogicalSize, event::WindowEvent, event_loop::ActiveEventLoop, keyboard::KeyCode::KeyC, window::WindowId, diff --git a/src/main.rs b/src/main.rs index 06e0b28..d124abe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use crate::font_renderer::FontRenderer8x8; use crate::udp_server::UdpServer; -use crate::{command_executor::CommandExecutionContext, gui::Gui}; +use crate::{command_executor::CommandExecutor, gui::Gui}; use clap::Parser; use cli::Cli; use log::{info, LevelFilter}; @@ -32,18 +32,18 @@ fn main() { .expect("could not create event loop"); event_loop.set_control_flow(ControlFlow::Wait); - let display = RwLock::new(Bitmap::max_sized()); + let display = RwLock::new(Bitmap::new(PIXEL_WIDTH, PIXEL_HEIGHT)); let luma = RwLock::new(BrightnessGrid::new(TILE_WIDTH, TILE_HEIGHT)); let (stop_udp_tx, stop_udp_rx) = mpsc::channel(); let font_renderer = cli .font .map(FontRenderer8x8::from_name) .unwrap_or_else(FontRenderer8x8::default); - let context = CommandExecutionContext::new(&display, &luma, font_renderer); + let command_executor = CommandExecutor::new(&display, &luma, font_renderer); let mut udp_server = UdpServer::new( cli.bind, stop_udp_rx, - context, + command_executor, event_loop.create_proxy(), ); let mut gui = Gui::new(&display, &luma, stop_udp_tx, cli.gui); diff --git a/src/udp_server.rs b/src/udp_server.rs index 26c2510..449ad84 100644 --- a/src/udp_server.rs +++ b/src/udp_server.rs @@ -1,22 +1,20 @@ -use crate::command_executor::CommandExecute; -use crate::{ - command_executor::{CommandExecutionContext, ExecutionResult}, - gui::AppEvents, -}; -use log::{debug, error, warn}; -use servicepoint::TypedCommand; -use std::{ - io::ErrorKind, net::UdpSocket, sync::mpsc::Receiver, time::Duration, -}; +use crate::command_executor::{CommandExecutor, ExecutionResult}; +use crate::gui::AppEvents; +use log::{error, warn}; +use servicepoint::Command; +use std::io::ErrorKind; +use std::net::UdpSocket; +use std::sync::mpsc::Receiver; +use std::time::Duration; use winit::event_loop::EventLoopProxy; -const BUF_SIZE: usize = 8985 * 2; +const BUF_SIZE: usize = 8985; #[derive(Debug)] pub struct UdpServer<'t> { socket: UdpSocket, stop_rx: Receiver<()>, - command_executor: CommandExecutionContext<'t>, + command_executor: CommandExecutor<'t>, app_events: EventLoopProxy, buf: [u8; BUF_SIZE], } @@ -25,7 +23,7 @@ impl<'t> UdpServer<'t> { pub fn new( bind: String, stop_rx: Receiver<()>, - command_executor: CommandExecutionContext<'t>, + command_executor: CommandExecutor<'t>, app_events: EventLoopProxy, ) -> Self { let socket = UdpSocket::bind(bind).expect("could not bind socket"); @@ -47,8 +45,7 @@ impl<'t> UdpServer<'t> { if let Some(cmd) = self.receive_into_buf().and_then(|amount| { Self::command_from_slice(&self.buf[..amount]) }) { - debug!("received {cmd:?}"); - match cmd.execute(&self.command_executor) { + match self.command_executor.execute(cmd) { ExecutionResult::Success => { self.app_events .send_event(AppEvents::UdpPacketHandled) @@ -68,13 +65,13 @@ impl<'t> UdpServer<'t> { } } - fn command_from_slice(slice: &[u8]) -> Option { + fn command_from_slice(slice: &[u8]) -> Option { let packet = servicepoint::Packet::try_from(slice) .inspect_err(|_| { warn!("could not load packet with length {}", slice.len()) }) .ok()?; - TypedCommand::try_from(packet) + Command::try_from(packet) .inspect_err(move |err| { warn!("could not read command for packet: {:?}", err) })