Directory Loading

Added the ability to parse the directory and store it in a
Directory struct. This data has utility functions that can be used
to work with the directory to find any lump we could need. This
patch should fix up issue #3.
This commit is contained in:
Wesley Irvin
2023-04-26 19:43:40 -04:00
parent 9afd99a02c
commit 1645dc16b4
4 changed files with 99 additions and 3 deletions

View File

@@ -9,10 +9,29 @@ fn main() {
Header:
Identifier: {}
Lump Count: {}
Initial Offset: {}",
Initial Offset: {}
Number of Found Lumps: {}",
wadutils::get_wad_path(&wad_file),
wadutils::get_wad_type(&wad_file),
wadutils::get_num_lumps(&wad_file),
wadutils::get_init_offset(&wad_file)
wadutils::get_init_offset(&wad_file),
wadutils::get_directory_len(&wad_file)
);
println!("First 15 Directory Entries:");
for i in 0..15 {
println!(
"\t{}\tName {}\tPosition {}\tSize {}",
i,
wadutils::get_lump_name(&wad_file, i),
wadutils::get_lump_offset(&wad_file, i),
wadutils::get_lump_size(&wad_file, i)
);
}
println!(
"Index of e1m1 is: {}",
wadutils::get_index_from_name(&wad_file, "e1m1").unwrap()
);
}