mirror of
https://github.com/redstrate/Physis.git
synced 2025-07-01 08:37:46 +00:00
Fix parsing of certain LGB files
These have unknown instance objects, and were tripping up our parsing. I don't know what these are yet, but I added them anyway. I also made sure that the parser doesn't return None for technically valid but empty LGB files.
This commit is contained in:
parent
70ebe7d03d
commit
21a5ddc763
2 changed files with 12 additions and 4 deletions
|
@ -10,6 +10,7 @@ use super::TriggerBoxInstanceObject;
|
|||
#[derive(Debug, PartialEq)]
|
||||
pub enum ExitType {
|
||||
ZoneLine = 0x1,
|
||||
Unk = 0x2, // seen in bg/ex5/02_ykt_y6/fld/y6f1/level/planmap.lgb
|
||||
}
|
||||
|
||||
#[binread]
|
||||
|
|
|
@ -298,6 +298,8 @@ pub enum LayerEntryType {
|
|||
StableChocobo = 0x4F,
|
||||
MaxAssetType = 0x50,
|
||||
Unk1 = 90,
|
||||
Unk2 = 86, // seen in bg/ex5/02_ykt_y6/fld/y6f1/level/bg.lgb
|
||||
Unk3 = 89, // seen in bg/ffxiv/sea_s1/fld/s1f3/level/planevent.lgb
|
||||
}
|
||||
|
||||
#[binread]
|
||||
|
@ -362,6 +364,10 @@ pub enum LayerEntryData {
|
|||
FateRange(FateRangeInstanceObject),
|
||||
#[br(pre_assert(*magic == LayerEntryType::Unk1))]
|
||||
Unk1(),
|
||||
#[br(pre_assert(*magic == LayerEntryType::Unk2))]
|
||||
Unk2(),
|
||||
#[br(pre_assert(*magic == LayerEntryType::Unk3))]
|
||||
Unk3(),
|
||||
}
|
||||
|
||||
#[binread]
|
||||
|
@ -659,9 +665,11 @@ impl LayerGroup {
|
|||
|
||||
let chunk_header =
|
||||
LayerChunkHeader::read_le_args(&mut cursor, (&chunk_string_heap,)).unwrap();
|
||||
|
||||
if chunk_header.chunk_size <= 0 {
|
||||
return None;
|
||||
return Some(LayerGroup {
|
||||
file_id: file_header.file_id,
|
||||
chunks: Vec::new(),
|
||||
});
|
||||
}
|
||||
|
||||
let old_pos = cursor.position();
|
||||
|
@ -706,8 +714,7 @@ impl LayerGroup {
|
|||
let start = cursor.stream_position().unwrap();
|
||||
let string_heap = StringHeap::from(start);
|
||||
|
||||
objects
|
||||
.push(InstanceObject::read_le_args(&mut cursor, (&string_heap,)).ok()?);
|
||||
objects.push(InstanceObject::read_le_args(&mut cursor, (&string_heap,)).ok()?);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue