diff --git a/Cargo.lock b/Cargo.lock index 390fe9d..66ccdee 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,6 +55,17 @@ dependencies = [ "syn", ] +[[package]] +name = "bitfield-struct" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0baacb7d5b6e94369201d5807e086d3f36e2bd35057ca2c5a680af3737e35fa" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -404,27 +415,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "modular-bitfield" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" -dependencies = [ - "modular-bitfield-impl", - "static_assertions", -] - -[[package]] -name = "modular-bitfield-impl" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -479,6 +469,7 @@ name = "physis" version = "0.1.0" dependencies = [ "binrw", + "bitfield-struct", "bitflags", "crc", "criterion", @@ -487,7 +478,6 @@ dependencies = [ "hard-xml", "hmac-sha512", "libz-sys", - "modular-bitfield", "paste", "serde", "serde_json", @@ -645,12 +635,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "syn" version = "1.0.102" diff --git a/Cargo.toml b/Cargo.toml index f6f6b01..363eba2 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ binrw = "0.10" libz-sys = { version = "1.1", default-features = false } # nice to have features rust is lacking at the moment -modular-bitfield = "0.11" +bitfield-struct = "0.1" paste = "1" # needed for half-float support which FFXIV uses in it's model data diff --git a/src/index.rs b/src/index.rs index 34cc953..5baee1c 100755 --- a/src/index.rs +++ b/src/index.rs @@ -1,6 +1,6 @@ use binrw::binrw; use binrw::BinRead; -use modular_bitfield::prelude::*; +use bitfield_struct::bitfield; use std::io::SeekFrom; #[binrw] @@ -31,13 +31,18 @@ pub struct SqPackIndexHeader { index_data_size: u32, } -#[bitfield] +#[bitfield(u32)] #[binrw] -#[br(map = Self::from_bytes)] +#[br(map = | x: u32 | Self::from(x))] pub struct IndexHashBitfield { - pub size: B1, - pub data_file_id: B3, - pub offset: B28, + #[bits(1)] + pub size: u32, + + #[bits(3)] + pub data_file_id: u32, + + #[bits(28)] + pub offset: u32, } #[binrw]