Added ability to read WAD directory

This commit is contained in:
2025-03-27 17:43:52 -04:00
parent b2028e0207
commit 98cfdb93a6
15 changed files with 208 additions and 0 deletions

21
src/wad/header.rs Normal file
View File

@@ -0,0 +1,21 @@
pub struct Header {
pub wad_id: String,
pub num_lumps: u32,
pub dir_offset: u32,
}
use crate::utils::{read_ascii, read_u32_le};
impl Header {
pub fn read_data(data: &[u8]) -> Self {
let id = read_ascii(&data[..4]);
let lumps = read_u32_le(&data[4..8]);
let offset = read_u32_le(&data[8..12]);
Self {
wad_id: id,
num_lumps: lumps,
dir_offset: offset,
}
}
}