mirror of
https://github.com/G2-Games/lbee-utils.git
synced 2025-04-19 07:12:55 -05:00
Added utils for binary utilities
This commit is contained in:
parent
64c1ee6e91
commit
a77e68b554
6 changed files with 37 additions and 3 deletions
|
@ -1,5 +1,12 @@
|
|||
[workspace]
|
||||
|
||||
resolver = "2"
|
||||
members = [
|
||||
"cz",
|
||||
"utils",
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
authors = ["G2"]
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_code = "forbid"
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
name = "cz"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description="""
|
||||
A encoder/decoder for CZ# image files used in
|
||||
[RealLive Engine](https://www.pcgamingwiki.com/wiki/Engine:RealLive).
|
||||
"""
|
||||
|
||||
[dependencies]
|
||||
image = "0.25"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Shared types and traits between CZ# files
|
||||
|
||||
use std::{
|
||||
io::{self, Cursor, Read, Seek, Write}, path::PathBuf
|
||||
io::{self, Read, Seek, Write}, path::PathBuf
|
||||
};
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||
|
@ -133,7 +133,7 @@ impl CzHeader for CommonHeader {
|
|||
pub trait CzImage {
|
||||
type Header;
|
||||
|
||||
/// Create a [CZImage] from bytes
|
||||
/// Create a [crate::CzImage] from bytes
|
||||
fn decode<T: Seek + ReadBytesExt + Read>(bytes: &mut T) -> Result<Self, CzError>
|
||||
where
|
||||
Self: Sized;
|
||||
|
|
|
@ -6,9 +6,13 @@ pub mod formats {
|
|||
pub mod cz3;
|
||||
}
|
||||
|
||||
#[doc(inline)]
|
||||
pub use formats::cz0::Cz0Image;
|
||||
#[doc(inline)]
|
||||
pub use formats::cz1::Cz1Image;
|
||||
#[doc(inline)]
|
||||
pub use formats::cz3::Cz3Image;
|
||||
|
||||
/// Traits for CZ# images
|
||||
#[doc(inline)]
|
||||
pub use common::CzImage;
|
||||
|
|
9
utils/Cargo.toml
Normal file
9
utils/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "utils"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
cz = { path = "../cz" }
|
10
utils/src/main.rs
Normal file
10
utils/src/main.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use std::fs;
|
||||
|
||||
use cz::{Cz3Image, CzImage};
|
||||
|
||||
fn main() {
|
||||
let mut input = fs::File::open("../../test_files/Old_TestFiles/129.CZ3").unwrap();
|
||||
let img_file = Cz3Image::decode(&mut input).unwrap();
|
||||
|
||||
img_file.save_as_png("test1.png").unwrap();
|
||||
}
|
Loading…
Reference in a new issue