1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-05-05 10:17:45 +00:00

Revert some of the EXD reading changes to fix Item sheet parsing

This commit is contained in:
Joshua Goins 2025-04-28 21:59:07 -04:00
parent 3049014247
commit e29e1bfde9

View file

@ -65,7 +65,7 @@ fn parse_rows(exh: &EXH, data_offsets: &Vec<ExcelDataOffset>) -> BinResult<Vec<E
subrow
.columns
.push(EXD::read_column(reader, exh, column).unwrap());
.push(EXD::read_column(reader, exh, row_offset, column).unwrap());
}
Some(subrow)
@ -182,7 +182,7 @@ pub struct EXD {
#[br(parse_with = parse_rows, args(&exh, &data_offsets))]
#[bw(write_with = write_rows, args(&exh))]
rows: Vec<ExcelRow>,
pub rows: Vec<ExcelRow>,
}
#[derive(Debug)]
@ -229,6 +229,7 @@ impl EXD {
fn read_column<T: Read + Seek>(
cursor: &mut T,
exh: &EXH,
row_offset: u32,
column: &ExcelColumnDefinition,
) -> Option<ColumnData> {
let mut read_packed_bool = |shift: i32| -> bool {
@ -242,12 +243,9 @@ impl EXD {
ColumnDataType::String => {
let string_offset: u32 = Self::read_data_raw(cursor).unwrap();
let old_pos = cursor.stream_position().unwrap();
// -4 to take into account reading string_offset
cursor
.seek(SeekFrom::Current(
(exh.header.data_offset as u32 + string_offset - 4).into(),
.seek(SeekFrom::Start(
(row_offset + exh.header.data_offset as u32 + string_offset).into(),
))
.ok()?;
@ -259,8 +257,6 @@ impl EXD {
byte = Self::read_data_raw(cursor).unwrap();
}
cursor.seek(SeekFrom::Start(old_pos)).unwrap();
Some(ColumnData::String(string))
}
ColumnDataType::Bool => {