update to servicepoint2 v0.4.0

This commit is contained in:
Vinzenz Schroeter 2024-05-16 23:26:57 +02:00
parent e5c6734339
commit 3578a279c5
5 changed files with 31 additions and 30 deletions

42
Cargo.lock generated
View file

@ -1018,26 +1018,6 @@ version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "lz4"
version = "1.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1"
dependencies = [
"libc",
"lz4-sys",
]
[[package]]
name = "lz4-sys"
version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "malloc_buf" name = "malloc_buf"
version = "0.0.6" version = "0.0.6"
@ -1527,6 +1507,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
[[package]]
name = "rust-lzma"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d62915608f6cee1d7f2fc00f28b4f058ff79d6e4ec3c2fe0006b09b52437c84"
dependencies = [
"pkg-config",
"vcpkg",
]
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.24" version = "0.1.24"
@ -1632,14 +1622,14 @@ dependencies = [
[[package]] [[package]]
name = "servicepoint2" name = "servicepoint2"
version = "0.2.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d434890b6d1a4c886f384639bf79ba7f127221cad7bff45acabf99d2fccee5f" checksum = "e271ff29f683581a14d1712f76c0cf2dad956725cc1f36228ddde8ea783055cf"
dependencies = [ dependencies = [
"bzip2", "bzip2",
"flate2", "flate2",
"log", "log",
"lz4", "rust-lzma",
"zstd", "zstd",
] ]
@ -1872,6 +1862,12 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"

View file

@ -7,7 +7,7 @@ license = "GPL-3.0-or-later"
[dependencies] [dependencies]
# packet parsing # packet parsing
servicepoint2 = "0.2.0" servicepoint2 = "0.4.0"
# gui # gui
winit = { version = "0.30", features = ["rwh_05"] } # for creating a window winit = { version = "0.30", features = ["rwh_05"] } # for creating a window

View file

@ -23,7 +23,7 @@ pub(crate) fn execute_command(
warn!("display shutting down"); warn!("display shutting down");
return false; return false;
} }
Command::BitmapLinearWin(Origin(x, y), pixels) => { Command::BitmapLinearWin(Origin(x, y), pixels, _) => {
let mut display = display_ref.write().unwrap(); let mut display = display_ref.write().unwrap();
print_pixel_grid(x as usize, y as usize, &pixels, &mut display); print_pixel_grid(x as usize, y as usize, &pixels, &mut display);
} }

View file

@ -2,10 +2,10 @@ use std::sync::mpsc::Sender;
use std::sync::RwLock; use std::sync::RwLock;
use log::{info, warn}; use log::{info, warn};
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
use pixels::wgpu::TextureFormat; use pixels::wgpu::TextureFormat;
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
use servicepoint2::{ use servicepoint2::{
ByteGrid, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_SIZE, ByteGrid, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_SIZE,
}; };
use winit::application::ApplicationHandler; use winit::application::ApplicationHandler;
use winit::dpi::{LogicalSize, Size}; use winit::dpi::{LogicalSize, Size};

View file

@ -8,7 +8,7 @@ use std::time::Duration;
use clap::Parser; use clap::Parser;
use log::{info, warn}; use log::{info, warn};
use servicepoint2::{ use servicepoint2::{
ByteGrid, Command, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_HEIGHT, ByteGrid, Command, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_HEIGHT,
TILE_WIDTH, TILE_WIDTH,
}; };
use winit::event_loop::{ControlFlow, EventLoop}; use winit::event_loop::{ControlFlow, EventLoop};
@ -102,8 +102,13 @@ fn run(
); );
} }
let vec = buf[..amount].to_vec(); let package = match servicepoint2::Packet::try_from(&buf[..amount]) {
let package = servicepoint2::Packet::from(vec); Err(_) => {
warn!("could not load packet with length {amount} into header");
continue;
}
Ok(package) => package,
};
let command = match Command::try_from(package) { let command = match Command::try_from(package) {
Err(err) => { Err(err) => {