Skip to content

Commit

Permalink
don't require vers header
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Nov 9, 2024
1 parent 55e9f0c commit 44b1100
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 0 additions & 3 deletions libs/pbo/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ pub enum Error {
/// [`std::io::Error`]
Io(#[from] std::io::Error),

#[error("Missing Vers header")]
/// Missing Vers header
NoVersHeader,
#[error("HEMTT does not support the encountered PBO Mime type: {0}")]
/// HEMTT does not support the encountered PBO Mime type
UnsupportedMime(u32),
Expand Down
8 changes: 5 additions & 3 deletions libs/pbo/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
/// An existing PBO file that can be read from
pub struct ReadablePbo<I: Seek + Read> {
properties: IndexMap<String, String>,
vers_header: Header,
vers_header: Option<Header>,
headers: Vec<Header>,
checksum: Checksum,
input: I,
Expand Down Expand Up @@ -54,7 +54,7 @@ impl<I: Seek + Read> ReadablePbo<I> {
}
}

let vers_header = vers_header.ok_or(Error::NoVersHeader)?;
let vers_header = vers_header;

for header in &headers {
input.seek(SeekFrom::Current(i64::from(header.size())))?;
Expand Down Expand Up @@ -177,7 +177,9 @@ impl<I: Seek + Read> ReadablePbo<I> {
/// if a file does not exist, but a header for it does
pub fn gen_checksum(&mut self) -> Result<Checksum, Error> {
let mut headers: Cursor<Vec<u8>> = Cursor::new(Vec::new());
self.vers_header.write_pbo(&mut headers)?;
if let Some(vers_header) = &self.vers_header {
vers_header.write_pbo(&mut headers)?;
}

if let Some(prefix) = self.properties.get("prefix") {
headers.write_cstring(b"prefix")?;
Expand Down

0 comments on commit 44b1100

Please sign in to comment.