mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 10:30:14 +01:00
update to servicepoint2 v0.4.0
This commit is contained in:
parent
e5c6734339
commit
3578a279c5
42
Cargo.lock
generated
42
Cargo.lock
generated
|
@ -1018,26 +1018,6 @@ version = "0.4.21"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
|
@ -1527,6 +1507,16 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
|
@ -1632,14 +1622,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servicepoint2"
|
||||
version = "0.2.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d434890b6d1a4c886f384639bf79ba7f127221cad7bff45acabf99d2fccee5f"
|
||||
checksum = "e271ff29f683581a14d1712f76c0cf2dad956725cc1f36228ddde8ea783055cf"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"flate2",
|
||||
"log",
|
||||
"lz4",
|
||||
"rust-lzma",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
|
@ -1872,6 +1862,12 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
|
|
@ -7,7 +7,7 @@ license = "GPL-3.0-or-later"
|
|||
|
||||
[dependencies]
|
||||
# packet parsing
|
||||
servicepoint2 = "0.2.0"
|
||||
servicepoint2 = "0.4.0"
|
||||
|
||||
# gui
|
||||
winit = { version = "0.30", features = ["rwh_05"] } # for creating a window
|
||||
|
|
|
@ -23,7 +23,7 @@ pub(crate) fn execute_command(
|
|||
warn!("display shutting down");
|
||||
return false;
|
||||
}
|
||||
Command::BitmapLinearWin(Origin(x, y), pixels) => {
|
||||
Command::BitmapLinearWin(Origin(x, y), pixels, _) => {
|
||||
let mut display = display_ref.write().unwrap();
|
||||
print_pixel_grid(x as usize, y as usize, &pixels, &mut display);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::sync::mpsc::Sender;
|
|||
use std::sync::RwLock;
|
||||
|
||||
use log::{info, warn};
|
||||
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
|
||||
use pixels::wgpu::TextureFormat;
|
||||
use pixels::{Pixels, PixelsBuilder, SurfaceTexture};
|
||||
use servicepoint2::{
|
||||
ByteGrid, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_SIZE,
|
||||
ByteGrid, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_SIZE,
|
||||
};
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::dpi::{LogicalSize, Size};
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -8,7 +8,7 @@ use std::time::Duration;
|
|||
use clap::Parser;
|
||||
use log::{info, warn};
|
||||
use servicepoint2::{
|
||||
ByteGrid, Command, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH, TILE_HEIGHT,
|
||||
ByteGrid, Command, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, TILE_HEIGHT,
|
||||
TILE_WIDTH,
|
||||
};
|
||||
use winit::event_loop::{ControlFlow, EventLoop};
|
||||
|
@ -102,8 +102,13 @@ fn run(
|
|||
);
|
||||
}
|
||||
|
||||
let vec = buf[..amount].to_vec();
|
||||
let package = servicepoint2::Packet::from(vec);
|
||||
let package = match servicepoint2::Packet::try_from(&buf[..amount]) {
|
||||
Err(_) => {
|
||||
warn!("could not load packet with length {amount} into header");
|
||||
continue;
|
||||
}
|
||||
Ok(package) => package,
|
||||
};
|
||||
|
||||
let command = match Command::try_from(package) {
|
||||
Err(err) => {
|
||||
|
|
Loading…
Reference in a new issue