physis/
phyb.rs

1// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4use std::io::Cursor;
5
6use crate::ByteSpan;
7use binrw::BinRead;
8use binrw::binread;
9
10#[binread]
11#[derive(Debug)]
12#[brw(little)]
13#[allow(dead_code)]
14struct PhybHeader {
15    version: [u8; 4],
16
17    // TODO: this is definitely wrong
18    #[br(if(version[0] > 0))]
19    data_type: u32,
20
21    collision_offset: u32,
22    simulator_offset: u32,
23}
24
25#[derive(Debug)]
26pub struct Phyb {}
27
28impl Phyb {
29    /// Reads an existing ULD file
30    pub fn from_existing(buffer: ByteSpan) -> Option<Self> {
31        let mut cursor = Cursor::new(buffer);
32        PhybHeader::read(&mut cursor).ok()?;
33
34        Some(Phyb {})
35    }
36}