diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..06d6baf --- /dev/null +++ b/src/bin/main.rs @@ -0,0 +1,14 @@ +use std::fs::write; +use physis::common::Platform; +use physis::gamedata::GameData; +use physis::mtrl::Material; + +fn main() { + let game_data = GameData::from_existing(Platform::Win32, "/home/josh/.local/share/astra/game/{2bdefc9d-3382-45d6-952f-ae9b918c4764}/game"); + + let p = "bg/ffxiv/fst_f1/fld/f1f3/material/f1f3_w1_mizu4a.mtrl"; + let m_data = game_data.unwrap().extract(p).unwrap(); + write("/home/josh/test.mtrl", &m_data); + let m = Material::from_existing(&m_data); + println!("{:#?}", m); +} \ No newline at end of file diff --git a/src/existing_dirs.rs b/src/existing_dirs.rs index d873cfb..f3625f9 100644 --- a/src/existing_dirs.rs +++ b/src/existing_dirs.rs @@ -4,8 +4,7 @@ use std::env::home_dir; use std::fs; use std::fs::read_dir; -use std::path::{Path, PathBuf}; -use tracing::warn; +use std::path::PathBuf; /// Where the existing installation came from #[derive(Clone, Copy)] diff --git a/src/gamedata.rs b/src/gamedata.rs index f4d4cf1..9f22e4f 100755 --- a/src/gamedata.rs +++ b/src/gamedata.rs @@ -196,12 +196,7 @@ impl GameData { /// Finds the offset inside of the DAT file for `path`. pub fn find_offset(&mut self, path: &str) -> Option { let slice = self.find_entry(path); - match slice { - Some((entry, chunk)) => { - Some(entry.offset) - } - None => None, - } + slice.map(|(entry, _)| entry.offset) } /// Parses a path structure and spits out the corresponding category and repository. diff --git a/src/model.rs b/src/model.rs index 37474c2..3a59e69 100755 --- a/src/model.rs +++ b/src/model.rs @@ -752,8 +752,8 @@ impl MDL { for shape_value in shape_values { let old_vertex = vertices[indices[shape_value.base_indices_index as usize] as usize]; - let new_vertex = vertices[(shape_value.replacing_vertex_index - as usize)]; + let new_vertex = vertices[shape_value.replacing_vertex_index + as usize]; let vertex = &mut morphed_vertices [indices[shape_value.base_indices_index as usize] as usize]; diff --git a/src/stm.rs b/src/stm.rs index 8884733..c901d24 100644 --- a/src/stm.rs +++ b/src/stm.rs @@ -3,7 +3,6 @@ use std::io::{Cursor, Seek, SeekFrom}; -use crate::common_file_operations::{Half1, Half3}; use crate::ByteSpan; use binrw::BinRead; use binrw::{binrw, BinReaderExt}; @@ -67,6 +66,7 @@ impl StainingTemplate { Some(StainingTemplate {}) } + #[allow(unused)] fn read_array = ()> + Default + Clone + Copy>( cursor: &mut Cursor, offset: u64,