mirror of
https://github.com/redstrate/Physis.git
synced 2025-06-06 14:47:46 +00:00
Add TMB and SKP modules
This commit is contained in:
parent
8a1430378e
commit
e588a9bbc9
3 changed files with 74 additions and 0 deletions
|
@ -141,3 +141,9 @@ pub mod hwc;
|
|||
|
||||
/// Reading IWC files
|
||||
pub mod iwc;
|
||||
|
||||
/// Reading TMB files
|
||||
pub mod tmb;
|
||||
|
||||
/// Reading SKP files
|
||||
pub mod skp;
|
||||
|
|
36
src/skp.rs
Normal file
36
src/skp.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
|
||||
// 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 SkpHeader {
|
||||
magic: i32, // TODO: what magic?
|
||||
|
||||
#[br(count = 4)]
|
||||
#[bw(pad_size_to = 4)]
|
||||
#[bw(map = |x : &String | x.as_bytes())]
|
||||
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Skp {
|
||||
|
||||
}
|
||||
|
||||
impl Skp {
|
||||
/// Reads an existing ULD file
|
||||
pub fn from_existing(buffer: ByteSpan) -> Option<Self> {
|
||||
let mut cursor = Cursor::new(buffer);
|
||||
let header = SkpHeader::read(&mut cursor).ok()?;
|
||||
|
||||
Some(Skp{})
|
||||
}
|
||||
}
|
32
src/tmb.rs
Normal file
32
src/tmb.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
|
||||
// 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 TmbHeader {
|
||||
magic: i32, // TODO: figure out what this
|
||||
size: i32,
|
||||
entry_count: i32
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Tmb {
|
||||
|
||||
}
|
||||
|
||||
impl Tmb {
|
||||
/// Reads an existing ULD file
|
||||
pub fn from_existing(buffer: ByteSpan) -> Option<Self> {
|
||||
let mut cursor = Cursor::new(buffer);
|
||||
let header = TmbHeader::read(&mut cursor).ok()?;
|
||||
|
||||
Some(Tmb{})
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue