fix: work around textools bug by zero-filling

This commit is contained in:
Anna 2022-09-27 18:07:30 -04:00
parent 95c90ef66e
commit e62421cf0d
2 changed files with 5 additions and 3 deletions

View File

@ -16,6 +16,4 @@ pub enum Error {
SqPackError(#[from] sqpack::binrw::Error),
#[error("error writing to output")]
BinRwWrite(sqpack::binrw::Error),
#[error("a bug in textools corrupted this mod pack")]
TexToolsBug,
}

View File

@ -349,7 +349,11 @@ impl<R: Read> TtmpExtractor<R> {
(read, read)
} else if header.compressed_size == 0 {
// https://github.com/TexTools/xivModdingFramework/issues/51
return Err(Error::TexToolsBug);
let zeroes: Vec<u8> = std::iter::repeat(0)
.take(header.uncompressed_size as usize)
.collect();
std::io::copy(&mut Cursor::new(zeroes), &mut writer).map_err(Error::Io)?;
(0, 0)
} else {
// compressed
let reader = (&mut reader).take(header.compressed_size as u64);