diff options
author | metamuffin <metamuffin@disroot.org> | 2025-03-14 14:58:38 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-03-14 14:58:38 +0100 |
commit | 7ff78cff53eba1da60b8beb851732e2f8197c221 (patch) | |
tree | fa6d914270ba1acdeddbc3aa1ce1cf7cf0824a7b /exporter/src/bin/debug.rs | |
parent | 6debd2c0a230d623c06869ca4c4f13519f53eb5d (diff) | |
download | unity-tools-7ff78cff53eba1da60b8beb851732e2f8197c221.tar unity-tools-7ff78cff53eba1da60b8beb851732e2f8197c221.tar.bz2 unity-tools-7ff78cff53eba1da60b8beb851732e2f8197c221.tar.zst |
move files around
Diffstat (limited to 'exporter/src/bin/debug.rs')
-rw-r--r-- | exporter/src/bin/debug.rs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/exporter/src/bin/debug.rs b/exporter/src/bin/debug.rs new file mode 100644 index 0000000..92713ba --- /dev/null +++ b/exporter/src/bin/debug.rs @@ -0,0 +1,61 @@ +use std::{env::args, fs::File, io::BufReader}; +use unity_tools::{serialized_file::SerializedFile, unityfs::UnityFS}; + +fn main() -> anyhow::Result<()> { + env_logger::init_from_env("LOG"); + let file = BufReader::new(File::open(args().nth(1).unwrap())?); + let mut fs = UnityFS::open(file)?; + + let node = fs.find_main_file().unwrap().to_owned(); + let mut cab = fs.read(&node)?; + let file = SerializedFile::read(&mut cab)?; + + for ob in file.objects { + // eprintln!("{:#?}", ob); + let typetree = if ob.type_id < 0 { + unimplemented!() + } else { + // file.types + // .iter() + // .find(|t| t.class_id == ob.type_id) + // .expect("unknown type") + &file.types[ob.type_id as usize] + }; + // fn print_types(tt: &TypeTreeNode) { + // println!("{}", tt.type_string); + // for c in &tt.children { + // print_types(&c); + // } + // } + // fn print_crit_types(tt: &TypeTreeNode) { + // let mut crit = tt.byte_size == -1 || tt.children.is_empty(); + // for c in &tt.children { + // print_crit_types(&c); + // crit &= c.byte_size != -1 + // } + // if crit { + // println!("{}", tt.type_string); + // } + // } + if let Some(tree) = &typetree.type_tree { + println!("{}", tree.type_string); + // print_crit_types(tree); + // print_types(tree); + } + // eprintln!("{typetree:#?}"); + + // let value = read_value(typetree.type_tree.as_ref().unwrap(), e, &mut cab)?; + + // if let Value::Object { class, .. } = &value { + // println!("{class}") + // } + + // debug!( + // "{}", + // serde_json::to_string_pretty(&value.to_json()).unwrap() + // ) + } + // eprintln!("{:#?}", file.types); + + Ok(()) +} |