maraiah: fix old wad type entry headers
parent
b16b2a7ff1
commit
9dcf487d18
|
@ -8,18 +8,29 @@ use std::collections::BTreeMap;
|
|||
pub fn read(map: &head::Map, i: usize) -> ResultS<(u16, Entry<'_>)>
|
||||
{
|
||||
let size = map.head().size_entry();
|
||||
let b = map.dir();
|
||||
let sta = size * i;
|
||||
|
||||
read_data! {
|
||||
endian: BIG, buf: map.dir(), size: size, start: size * i, data {
|
||||
endian: BIG, buf: b, size: size, start: sta, data {
|
||||
let offset = u32[0] usize;
|
||||
let dsize = u32[4] usize;
|
||||
let index = u16[8];
|
||||
let app_data = u8[10; map.head().size_appl()];
|
||||
}
|
||||
}
|
||||
|
||||
let (index, app_data) = if !map.head().old_wad() {
|
||||
read_data! {
|
||||
endian: BIG, buf: b, size: size, start: sta, data {
|
||||
let index = u16[8];
|
||||
let app_data = u8[10; map.head().size_appl()];
|
||||
}
|
||||
}
|
||||
(index, app_data)
|
||||
} else {
|
||||
(i as u16, &b[0..0])
|
||||
};
|
||||
|
||||
let data = &map.data()[offset..offset + dsize];
|
||||
let index = if map.head().old_wad() {i as u16} else {index};
|
||||
|
||||
Ok((index, Entry{data, app_data}))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue