Compare commits

..

No commits in common. "main" and "forgejo-pipeline" have entirely different histories.

10 changed files with 405 additions and 527 deletions

View file

@ -24,7 +24,7 @@ jobs:
- name: Update repos
run: sudo apt-get update -qq
- name: Install rust toolchain
run: sudo apt-get install -qy cargo-1.80 rust-1.80-clippy
run: sudo apt-get install -qy cargo rust-clippy
- name: Install system dependencies
run: sudo apt-get install -qy liblzma-dev libfontconfig1-dev

398
Cargo.lock generated
View file

@ -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"
@ -188,24 +188,24 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.17.0"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[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,28 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.10.1"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
[[package]]
name = "bzip2"
version = "0.5.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47"
checksum = "bafdbf26611df8c14810e268ddceda071c297570a5fb360ceddf617fe417ef58"
dependencies = [
"bzip2-sys",
"libc",
]
[[package]]
name = "bzip2-sys"
version = "0.1.13+1.0.8"
version = "0.1.11+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14"
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
dependencies = [
"cc",
"libc",
"pkg-config",
]
@ -249,7 +251,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 +273,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.21"
version = "1.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0"
checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b"
dependencies = [
"jobserver",
"libc",
@ -300,9 +302,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "clap"
version = "4.5.37"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
dependencies = [
"clap_builder",
"clap_derive",
@ -310,9 +312,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.37"
version = "4.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
dependencies = [
"anstream",
"anstyle",
@ -322,9 +324,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.32"
version = "4.5.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c"
dependencies = [
"heck",
"proc-macro2",
@ -408,7 +410,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 +434,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 +522,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 +532,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 +567,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,28 +589,28 @@ 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",
]
[[package]]
name = "equivalent"
version = "1.0.2"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[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 +624,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 +644,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 +719,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 +747,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.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [
"equivalent",
"hashbrown",
@ -772,30 +768,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 +792,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 +817,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 +837,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 +856,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 +877,9 @@ dependencies = [
[[package]]
name = "miniz_oxide"
version = "0.8.8"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924"
dependencies = [
"adler2",
]
@ -919,7 +890,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 +957,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 +973,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 +997,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",
@ -1058,9 +1029,9 @@ dependencies = [
[[package]]
name = "objc2-encode"
version = "4.1.0"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
[[package]]
name = "objc2-foundation"
@ -1068,7 +1039,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 +1064,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 +1076,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 +1099,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 +1131,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 +1140,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.21.3"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "option-ext"
@ -1224,18 +1195,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.10"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.10"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb"
dependencies = [
"proc-macro2",
"quote",
@ -1250,9 +1221,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 +1240,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.36.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe"
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 +1299,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 +1312,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",
]
@ -1417,11 +1367,11 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.44"
version = "0.38.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
dependencies = [
"bitflags 2.9.0",
"bitflags 2.8.0",
"errno",
"libc",
"linux-raw-sys 0.4.15",
@ -1430,9 +1380,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 +1414,24 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.26"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba"
[[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 +1440,9 @@ dependencies = [
[[package]]
name = "servicepoint"
version = "0.14.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce70bae3641ccafdeb9832ac367efd51243e0708ef35151ad8c2c4ee578aa4a"
checksum = "3a8bc9e40503ece07e3f12232f648484191323b8126e74abce3d1644ba04dbd0"
dependencies = [
"bitvec",
"bzip2",
@ -1500,13 +1450,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.1.0"
dependencies = [
"clap",
"env_logger",
@ -1515,7 +1465,7 @@ dependencies = [
"pathfinder_geometry",
"servicepoint",
"softbuffer",
"thiserror 2.0.12",
"thiserror 2.0.11",
"winit",
]
@ -1536,9 +1486,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.15.0"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smithay-client-toolkit"
@ -1546,7 +1496,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 +1544,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 +1570,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "2.0.101"
version = "2.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
dependencies = [
"proc-macro2",
"quote",
@ -1646,11 +1596,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 +1616,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 +1665,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.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap",
"toml_datetime",
@ -1754,9 +1704,9 @@ checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
[[package]]
name = "unicode-ident"
version = "1.0.18"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "unicode-segmentation"
@ -1798,15 +1748,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 +1821,9 @@ dependencies = [
[[package]]
name = "wayland-backend"
version = "0.3.10"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121"
checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6"
dependencies = [
"cc",
"downcast-rs",
@ -1894,11 +1835,11 @@ dependencies = [
[[package]]
name = "wayland-client"
version = "0.31.10"
version = "0.31.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61"
checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280"
dependencies = [
"bitflags 2.9.0",
"bitflags 2.8.0",
"rustix",
"wayland-backend",
"wayland-scanner",
@ -1910,16 +1851,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.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a65317158dec28d00416cb16705934070aef4f8393353d41126c54264ae0f182"
checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c"
dependencies = [
"rustix",
"wayland-client",
@ -1928,11 +1869,11 @@ dependencies = [
[[package]]
name = "wayland-protocols"
version = "0.32.8"
version = "0.32.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a"
checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e"
dependencies = [
"bitflags 2.9.0",
"bitflags 2.8.0",
"wayland-backend",
"wayland-client",
"wayland-scanner",
@ -1940,11 +1881,11 @@ dependencies = [
[[package]]
name = "wayland-protocols-plasma"
version = "0.3.8"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fd38cdad69b56ace413c6bcc1fbf5acc5e2ef4af9d5f8f1f9570c0c83eae175"
checksum = "9b31cab548ee68c7eb155517f2212049dc151f7cd7910c2b66abfd31c3ee12bd"
dependencies = [
"bitflags 2.9.0",
"bitflags 2.8.0",
"wayland-backend",
"wayland-client",
"wayland-protocols",
@ -1953,11 +1894,11 @@ dependencies = [
[[package]]
name = "wayland-protocols-wlr"
version = "0.3.8"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cb6cdc73399c0e06504c437fe3cf886f25568dd5454473d565085b36d6a8bbf"
checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022"
dependencies = [
"bitflags 2.9.0",
"bitflags 2.8.0",
"wayland-backend",
"wayland-client",
"wayland-protocols",
@ -1966,9 +1907,9 @@ dependencies = [
[[package]]
name = "wayland-scanner"
version = "0.31.6"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3"
dependencies = [
"proc-macro2",
"quick-xml",
@ -1977,9 +1918,9 @@ dependencies = [
[[package]]
name = "wayland-sys"
version = "0.31.6"
version = "0.31.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09"
dependencies = [
"dlib",
"log",
@ -2254,14 +2195,14 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winit"
version = "0.30.10"
version = "0.30.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d05bd8908e14618c9609471db04007e644fd9cce6529756046cfc577f9155e"
checksum = "f5d74280aabb958072864bff6cfbcf9025cf8bfacdde5e32b5e12920ef703b0f"
dependencies = [
"ahash",
"android-activity",
"atomic-waker",
"bitflags 2.9.0",
"bitflags 2.8.0",
"block2",
"bytemuck",
"calloop",
@ -2306,9 +2247,9 @@ dependencies = [
[[package]]
name = "winnow"
version = "0.7.9"
version = "0.6.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9fb597c990f03753e08d3c29efbfcf2019a003b4bf4ba19225c158e1549f0f3"
checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a"
dependencies = [
"memchr",
]
@ -2322,15 +2263,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 +2316,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 +2362,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",

View file

@ -1,16 +1,9 @@
[package]
name = "servicepoint-simulator"
version = "0.2.1"
version = "0.1.0"
edition = "2021"
publish = true
publish = false
license = "GPL-3.0-or-later"
keywords = ["cccb", "cccb-servicepoint", "cli"]
description = "A simulator for the Service Point display."
homepage = "https://git.berlin.ccc.de/servicepoint/servicepoint-simulator"
repository = "https://git.berlin.ccc.de/servicepoint/servicepoint-simulator"
readme = "README.md"
rust-version = "1.80.0"
resolver = "2"
[dependencies]
# basics
@ -20,7 +13,7 @@ clap = { version = "4.5", features = ["derive"] }
thiserror = "2.0"
# package parsing
servicepoint = { features = ["all_compressions"], version = "0.14.0" }
servicepoint = { version = "0.13.0", features = ["all_compressions"] }
# font rendering
font-kit = "0.14.2"
@ -28,11 +21,6 @@ font-kit = "0.14.2"
pathfinder_geometry = "0.5.1"
# for opening a window
winit = "0.30"
winit = "0.30.8"
# 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

View file

@ -1,40 +1,25 @@
# 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.
An emulator for the CCCB airport display.
![example render](example_render.png)
In CCCB, there is a big LED matrix screen you can send images to via UDP.
This crate contains an application that can receive packages in the same binary format and display the contents to the
user.
In CCCB, there is a big LED matrix screen you can send images to via UDP.
This project aims to build a working an application that can receive packages in the same binary format and display the contents to the user.
Use cases:
- getting error messages for invalid packages (instead of nothing happening on the display)
- getting error messages for invalid packages
- test your project when outside CCCB
- test your project while other people are using the display
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`
With nix flakes: `nix run github:kaesaecracker/servicepoint-simulator`
You can also check out this repository and use `cargo run --release`.
Make sure to run a release build, because a debug build _way_ slower.
Without nix: check out this repository and use `cargo run --release`.
## Command line arguments
@ -54,19 +39,11 @@ 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)
## Known differences
- The font used for displaying UTF-8 text is your default system monospace font, rendered to 8x8 pixels
- The brightness levels will look linear in the simulator
- Some commands will be executed in part on the real display and then produce an error (in a console you cannot see)
while the simulator refuses to execute the whole command
## Contributing
Contributions are accepted in any form (issues, documentation, feature requests, code, reviews, ...).
@ -75,7 +52,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.

View file

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1745925850,
"narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=",
"lastModified": 1736429655,
"narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=",
"owner": "nix-community",
"repo": "naersk",
"rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f",
"rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce",
"type": "github"
},
"original": {
@ -37,11 +37,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1746183838,
"narHash": "sha256-kwaaguGkAqTZ1oK0yXeQ3ayYjs8u/W7eEfrFpFfIDFA=",
"lastModified": 1736200483,
"narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bf3287dac860542719fe7554e21e686108716879",
"rev": "3f0a8ac25fb674611b98089ca3a5dd6480175751",
"type": "github"
},
"original": {

View file

@ -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<Bitmap>,
luma: &'t RwLock<BrightnessGrid>,
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<Bitmap>,
luma: &'t RwLock<BrightnessGrid>,
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<Tiles>,
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<Op>(
&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<Tiles>,
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<Tiles>,
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<Bitmap>,
luma: &'t RwLock<BrightnessGrid>,
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)
}
}

View file

@ -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];

View file

@ -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,

View file

@ -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);

View file

@ -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<AppEvents>,
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<AppEvents>,
) -> 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<TypedCommand> {
fn command_from_slice(slice: &[u8]) -> Option<Command> {
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)
})