aboutsummaryrefslogtreecommitdiff
path: root/src/serialized_file.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-03-15 15:18:40 +0100
committermetamuffin <metamuffin@disroot.org>2025-03-15 15:18:40 +0100
commitd836e24357b81496c61f3cc9195ba36758523578 (patch)
tree0028aee5a453cc761dd39e92430a35c55147537f /src/serialized_file.rs
parent07fc3656274117c211ca0d6a54926d390a4d9b68 (diff)
downloadunity-tools-d836e24357b81496c61f3cc9195ba36758523578.tar
unity-tools-d836e24357b81496c61f3cc9195ba36758523578.tar.bz2
unity-tools-d836e24357b81496c61f3cc9195ba36758523578.tar.zst
more abstraction around unityfs to read multiple files from a single reader
Diffstat (limited to 'src/serialized_file.rs')
-rw-r--r--src/serialized_file.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/serialized_file.rs b/src/serialized_file.rs
index b3c1e3c..a6514ee 100644
--- a/src/serialized_file.rs
+++ b/src/serialized_file.rs
@@ -2,6 +2,7 @@ use crate::{
common_strings::COMMON_STRINGS,
helper::{AlignExt, Endianness, ReadExt},
object::Value,
+ unityfs::{UnityFS, header::NodeInfo},
};
use anyhow::{Result, anyhow, bail};
use log::{debug, info, trace, warn};
@@ -307,6 +308,18 @@ impl<T: Read + Seek> SerializedFile<T> {
})
}
+ pub fn find_fs_shared_assets(&self, fs: &UnityFS<impl Read + Seek>) -> Option<NodeInfo> {
+ let s = self
+ .externals
+ .iter()
+ .find(|e| e.path_name.starts_with("archive:"))?;
+ fs.header
+ .nodes()
+ .iter()
+ .find(|n| n.name.ends_with(&s.path_name))
+ .cloned()
+ }
+
pub fn get_object_type_tree(&self, ob: &ObjectInfo) -> Result<&'_ TypeTreeNode> {
let r#type = if ob.type_id < 0 {
unimplemented!()