1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-25 13:57:45 +00:00

Switch from bitfield-struct to modular-bitfield

This commit is contained in:
Joshua Goins 2022-10-17 19:23:45 -04:00
parent 78856af0a5
commit 3615adac47
3 changed files with 35 additions and 24 deletions

40
Cargo.lock generated
View file

@ -55,17 +55,6 @@ 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"
@ -415,6 +404,27 @@ 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"
@ -469,7 +479,6 @@ name = "physis"
version = "0.1.0"
dependencies = [
"binrw",
"bitfield-struct",
"bitflags",
"crc",
"criterion",
@ -478,6 +487,7 @@ dependencies = [
"hard-xml",
"hmac-sha512",
"libz-sys",
"modular-bitfield",
"paste",
"serde",
"serde_json",
@ -635,6 +645,12 @@ 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"

View file

@ -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
bitfield-struct = "0.1"
modular-bitfield = "0.11"
paste = "1"
# needed for half-float support which FFXIV uses in it's model data

View file

@ -1,6 +1,6 @@
use binrw::binrw;
use binrw::BinRead;
use bitfield_struct::bitfield;
use modular_bitfield::prelude::*;
use std::io::SeekFrom;
#[binrw]
@ -31,18 +31,13 @@ pub struct SqPackIndexHeader {
index_data_size: u32,
}
#[bitfield(u32)]
#[bitfield]
#[binrw]
#[br(map = | x: u32 | Self::from(x))]
#[br(map = Self::from_bytes)]
pub struct IndexHashBitfield {
#[bits(1)]
pub size: u32,
#[bits(3)]
pub data_file_id: u32,
#[bits(28)]
pub offset: u32,
pub size: B1,
pub data_file_id: B3,
pub offset: B28,
}
#[binrw]