1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-07-19 23:37:46 +00:00

Always return ExcelRowKind::Subrows in a subrow-enabled sheet

See #14
This commit is contained in:
Joshua Goins 2025-07-01 18:14:50 -04:00
parent 209e62e5b5
commit 056fdb52a0
3 changed files with 21 additions and 6 deletions

View file

@ -200,6 +200,7 @@ impl ColumnData {
}
}
// TODO: Rename to ExcelRow
#[derive(Debug, Clone, PartialEq)]
pub struct ExcelSingleRow {
pub columns: Vec<ColumnData>,
@ -293,7 +294,7 @@ impl EXD {
#[cfg(test)]
mod tests {
use crate::exh::EXHHeader;
use crate::exh::{EXHHeader, SheetRowKind};
use std::fs::read;
use std::path::PathBuf;
@ -314,6 +315,9 @@ mod tests {
language_count: 0,
row_count: 0,
unk1: 0,
row_kind: SheetRowKind::SingleRow,
unk2: 0,
unk3: 0,
},
column_definitions: vec![],
pages: vec![],

View file

@ -13,7 +13,7 @@ use crate::{
ColumnData, DataSection, DataSectionHeader, EXD, EXDHeader, ExcelDataOffset, ExcelRow,
ExcelRowKind, ExcelSingleRow, SubRowHeader,
},
exh::{ColumnDataType, EXH, ExcelColumnDefinition},
exh::{ColumnDataType, EXH, ExcelColumnDefinition, SheetRowKind},
};
#[binrw::parser(reader)]
@ -65,7 +65,7 @@ pub fn parse_rows(exh: &EXH, data_offsets: &Vec<ExcelDataOffset>) -> BinResult<V
let data_offset = reader.stream_position().unwrap() as u64;
let new_row = if row_header.row_count > 1 {
let new_row = if exh.header.row_kind == SheetRowKind::SubRows {
let mut rows = Vec::new();
for i in 0..row_header.row_count {
let subrow_offset = data_offset + i as u64 * (2 + exh.header.row_size as u64);

View file

@ -15,6 +15,14 @@ use crate::ByteBuffer;
use crate::ByteSpan;
use crate::common::Language;
#[binrw]
#[derive(Debug, PartialEq, Eq)]
#[brw(repr = u8)]
pub enum SheetRowKind {
SingleRow = 1,
SubRows = 2,
}
#[binrw]
#[brw(magic = b"EXHF")]
#[brw(big)]
@ -30,9 +38,12 @@ pub struct EXHHeader {
/// Usually 0
pub unk1: u16,
#[br(temp)]
#[bw(calc = 0x010000)] // always this value??
pub unk2: u32,
pub unk2: u8,
/// Whether this Excel sheet uses subrows or just single rows.
pub row_kind: SheetRowKind,
pub unk3: u16,
#[brw(pad_after = 8)] // padding
pub row_count: u32,