diff --git a/Cargo.toml b/Cargo.toml index 3bbe4a4..8c3c19e 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,18 +19,33 @@ harness = false system-deps = "6" [package.metadata.system-deps] -libunshield = "1.4" +libunshield = { version = "1.4", feature = "game_install" } [dev-dependencies] +# used for patch install checking walkdir = "2" hmac-sha512 = "1" + +# used while rust doesn't have native benchmarking capability criterion = "0.4" + # used for testing our jamcrc implementation crc = "3" [features] +default = ["visual_data"] + +# enables game install support using unshield (only supported on Linux and macOS) +game_install = [] + +# enables support for extracting visual data, such as models, textures, materials, etc +# this enables a whole bunch of dependencies! +# tip: can be safely turned off for launchers and other tools that simply need to extract the bare minimum of data +visual_data = ["dep:half", "dep:hard-xml", "dep:serde_json", "dep:serde", "dep:glam", "dep:bitflags", "dep:texpresso"] + +# testing only features retail_game_testing = [] -patch_testing = [] +patch_testing = ["game_install"] [dependencies] # amazing binary parsing/writing library @@ -44,20 +59,20 @@ bitfield-struct = "0.1" paste = "1" # needed for half-float support which FFXIV uses in it's model data -half = "2" +half = { version = "2", optional = true } # needed for havok xml parsing -hard-xml = "1" +hard-xml = { version = "1", optional = true } # needed for textools skel parsing -serde_json = "1" -serde = { version = "1", features = ["derive"] } +serde_json = { version = "1", optional = true } +serde = { version = "1", optional = true, features = ["derive"] } # needed for deconstructing skeleton pose matrices -glam = "0.22" +glam = { version = "0.22", optional = true } # needed for c-style bitflags used in some formats (such as tex files) -bitflags = "1.3" +bitflags = { version = "1.3", optional = true } # needed for dxt/bc decompression -texpresso = "2" \ No newline at end of file +texpresso = { version = "2", optional = true } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 913d2e5..69312c1 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ mod compression; mod dat; /// Reading model (MDL) files. +#[cfg(feature = "visual_data")] pub mod model; /// All of the races in Eorzea in a nice enum package. @@ -45,6 +46,7 @@ pub mod blowfish; mod blowfish_constants; /// Initializing a new retail game install from the official retail installer. No execution required! +#[cfg(feature = "game_install")] pub mod installer; /// Reading Excel header files (EXH). @@ -54,6 +56,7 @@ pub mod exh; pub mod exd; /// Reading Havok XML sidecar files. +#[cfg(feature = "visual_data")] pub mod skeleton; /// Reading file into files (FIIN). @@ -63,9 +66,11 @@ pub mod fiin; pub mod log; /// Reading textures (TEX). +#[cfg(feature = "visual_data")] pub mod tex; /// Reading material files (MTRL) +#[cfg(feature = "visual_data")] pub mod mtrl; mod crc; diff --git a/src/sha1.rs b/src/sha1.rs index bd97928..43671b7 100644 --- a/src/sha1.rs +++ b/src/sha1.rs @@ -6,15 +6,6 @@ //! //! This implementation supports no_std. //! -//! ## Example -//! -//! ```rust -//! let mut m = sha1_smol::Sha1::new(); -//! m.update(b"Hello World!"); -//! assert_eq!(m.digest().to_string(), -//! "2ef7bde608ce5404e97d5f042f95f89f1c232871"); -//! ``` -//! //! The sha1 object can be updated multiple times. #![deny(missing_docs)] diff --git a/tests/integration_test.rs b/tests/integration_test.rs index f6fa205..8085e73 100755 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -1,7 +1,6 @@ use hmac_sha512::Hash; use physis::fiin::FileInfo; use physis::index; -use physis::installer::install_game; use physis::patch::apply_patch; use std::collections::HashMap; use std::env; @@ -44,7 +43,10 @@ fn test_fiin() { assert_eq!(fiin.entries[1].file_name, "steam_api64.dll"); } +#[cfg(feature = "patch_testing")] fn make_temp_install_dir(name: &str) -> String { + use physis::installer::install_game; + let installer_exe = env::var("FFXIV_INSTALLER").unwrap(); let mut game_dir = env::home_dir().unwrap(); @@ -63,6 +65,7 @@ fn make_temp_install_dir(name: &str) -> String { game_dir.as_path().to_str().unwrap().parse().unwrap() } +#[cfg(feature = "patch_testing")] fn fill_dir_hash(game_dir: &str) -> HashMap { let mut file_hashes: HashMap = HashMap::new(); @@ -86,6 +89,7 @@ fn fill_dir_hash(game_dir: &str) -> HashMap { file_hashes } +#[cfg(feature = "patch_testing")] fn physis_install_patch(game_directory: &str, data_directory: &str, patch_name: &str) { let patch_dir = env::var("FFXIV_PATCH_DIR").unwrap(); @@ -95,6 +99,7 @@ fn physis_install_patch(game_directory: &str, data_directory: &str, patch_name: apply_patch(&data_dir, &patch_path).unwrap(); } +#[cfg(feature = "patch_testing")] fn xivlauncher_install_patch(game_directory: &str, data_directory: &str, patch_name: &str) { let patch_dir = env::var("FFXIV_PATCH_DIR").unwrap(); let patcher_exe = env::var("FFXIV_XIV_LAUNCHER_PATCHER").unwrap(); @@ -110,7 +115,7 @@ fn xivlauncher_install_patch(game_directory: &str, data_directory: &str, patch_n } #[test] -#[cfg_attr(not(feature = "patch_testing"), ignore)] +#[cfg(feature = "patch_testing")] fn test_patching() { println!("Beginning game installation...");