aboutsummaryrefslogtreecommitdiff
path: root/src/unityfs.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-03-13 19:50:50 +0100
committermetamuffin <metamuffin@disroot.org>2025-03-13 19:50:50 +0100
commit58186bb96e38b92e426e75e08b0e0c95d05d319c (patch)
tree17d4dfe37a6a7c06f108e4331d37101e42757e4f /src/unityfs.rs
parent918adb796ebe5099c32148542469b647ee6dec28 (diff)
downloadunity-tools-58186bb96e38b92e426e75e08b0e0c95d05d319c.tar
unity-tools-58186bb96e38b92e426e75e08b0e0c95d05d319c.tar.bz2
unity-tools-58186bb96e38b92e426e75e08b0e0c95d05d319c.tar.zst
main file finder helper
Diffstat (limited to 'src/unityfs.rs')
-rw-r--r--src/unityfs.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/unityfs.rs b/src/unityfs.rs
index 0f3cab6..a23114d 100644
--- a/src/unityfs.rs
+++ b/src/unityfs.rs
@@ -142,6 +142,15 @@ impl<T: Read + Seek> UnityFS<T> {
pub fn nodes(&self) -> &[NodeInfo] {
&self.nodes
}
+
+ pub fn find_main_file(&self) -> Option<&NodeInfo> {
+ self.nodes().iter().find(|n| {
+ !n.name.ends_with(".resource")
+ && !n.name.ends_with(".resS")
+ && !n.name.ends_with(".sharedAssets")
+ })
+ }
+
pub fn read<'a>(&'a mut self, node: &NodeInfo) -> std::io::Result<NodeReader<'a, T>> {
self.reader.seek(SeekFrom::Start(node.offset))?;
Ok(NodeReader {