diff --git a/src/lib.rs b/src/lib.rs index d8200d8..26a9600 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -159,3 +159,6 @@ pub mod pap; /// Reading AVFX files pub mod avfx; + +/// Reading STM files +pub mod stm; diff --git a/src/stm.rs b/src/stm.rs new file mode 100644 index 0000000..e00f146 --- /dev/null +++ b/src/stm.rs @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +use std::io::Cursor; + +use crate::ByteSpan; +use binrw::binrw; +use binrw::BinRead; + +#[binrw] +#[derive(Debug)] +#[brw(little)] +struct StmHeader { + #[br(pad_before = 1)] // TODO: what is this byte? + entry_count: i32 +} + +#[derive(Debug)] +pub struct Stm { + +} + +impl Stm { + /// Reads an existing ULD file + pub fn from_existing(buffer: ByteSpan) -> Option { + let mut cursor = Cursor::new(buffer); + let header = StmHeader::read(&mut cursor).ok()?; + + Some(Stm{}) + } +}