diff --git a/Cargo.toml b/Cargo.toml index 8c3c19e..1646b73 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,13 +49,13 @@ patch_testing = ["game_install"] [dependencies] # amazing binary parsing/writing library -binrw = "0.10" +binrw = "0.11.1" # used for zlib compression in sqpack files libz-sys = { version = "1.1", default-features = false } # nice to have features rust is lacking at the moment -bitfield-struct = "0.1" +bitfield-struct = "0.3.2" paste = "1" # needed for half-float support which FFXIV uses in it's model data @@ -69,9 +69,10 @@ serde_json = { version = "1", optional = true } serde = { version = "1", optional = true, features = ["derive"] } # needed for deconstructing skeleton pose matrices -glam = { version = "0.22", optional = true } +glam = { version = "0.23.0", optional = true } # needed for c-style bitflags used in some formats (such as tex files) +# cannot upgrade to 2.0.0, breaking changes that aren't recoverable: https://github.com/bitflags/bitflags/issues/314 bitflags = { version = "1.3", optional = true } # needed for dxt/bc decompression diff --git a/src/dat.rs b/src/dat.rs index 3dd5d5b..708bae5 100755 --- a/src/dat.rs +++ b/src/dat.rs @@ -39,15 +39,13 @@ struct TextureLodBlock { block_count: u32, } -#[binrw] -pub struct ModelMemorySizes< - T: 'static - + binrw::BinRead - + binrw::BinWrite - + Default - + std::ops::AddAssign - + Copy, -> { +pub trait AnyNumberType<'a>: BinRead = ()> + BinWrite = ()> + std::ops::AddAssign + Copy + Default + 'static {} + +impl<'a, T> AnyNumberType<'a> for T where T: BinRead = ()> + BinWrite = ()> + std::ops::AddAssign + Copy + Default + 'static {} + +#[derive(BinRead, BinWrite)] +pub struct ModelMemorySizes AnyNumberType<'a>> +{ pub stack_size: T, pub runtime_size: T, @@ -56,14 +54,7 @@ pub struct ModelMemorySizes< pub index_buffer_size: [T; 3], } -impl< - T: 'static - + binrw::BinRead - + binrw::BinWrite - + Default - + std::ops::AddAssign - + Copy, - > ModelMemorySizes +impl AnyNumberType<'a>> ModelMemorySizes { pub fn total(&self) -> T { let mut total: T = T::default(); diff --git a/src/exd.rs b/src/exd.rs index 89b1ff0..332e5c8 100644 --- a/src/exd.rs +++ b/src/exd.rs @@ -2,7 +2,7 @@ use crate::common::Language; use crate::exh::{ColumnDataType, ExcelColumnDefinition, ExcelDataPagination, EXH}; use crate::gamedata::MemoryBuffer; use binrw::binrw; -use binrw::{BinRead, Endian, ReadOptions}; +use binrw::{BinRead, Endian}; use std::io::{Cursor, Seek, SeekFrom}; #[binrw] @@ -65,15 +65,13 @@ pub struct ExcelRow { } impl EXD { - fn read_data_raw(cursor: &mut Cursor<&MemoryBuffer>) -> Option - where - ::Args: Default, + fn read_data_raw = ()>>(cursor: &mut Cursor<&MemoryBuffer>) -> Option { Some( Z::read_options( cursor, - &ReadOptions::new(Endian::Big), - ::Args::default(), + Endian::Big, + (), ) .unwrap(), )