mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Fix Dawntrail materials not loading
They changed the color set structures of course, so make sure not to completely crash and burn on newer material versions.
This commit is contained in:
parent
b86eb29d81
commit
58f411005d
1 changed files with 12 additions and 6 deletions
16
src/mtrl.rs
16
src/mtrl.rs
|
@ -117,7 +117,10 @@ enum TextureUsage
|
||||||
#[brw(magic = 0x20491240u32)]
|
#[brw(magic = 0x20491240u32)]
|
||||||
SamplerWaveletMap1,
|
SamplerWaveletMap1,
|
||||||
#[brw(magic = 0x95E1F64Du32)]
|
#[brw(magic = 0x95E1F64Du32)]
|
||||||
SamplerWhitecapMap
|
SamplerWhitecapMap,
|
||||||
|
|
||||||
|
#[brw(magic = 0x565f8fd8u32)]
|
||||||
|
UnknownDawntrail1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
|
@ -150,12 +153,17 @@ struct MaterialData {
|
||||||
#[br(pad_after = file_header.additional_data_size)]
|
#[br(pad_after = file_header.additional_data_size)]
|
||||||
strings: Vec<u8>,
|
strings: Vec<u8>,
|
||||||
|
|
||||||
#[br(if(file_header.data_set_size > 0))]
|
#[br(if(file_header.data_set_size > 0 && file_header.version < 0x1030000))]
|
||||||
color_set_info: Option<ColorSetInfo>,
|
color_set_info: Option<ColorSetInfo>,
|
||||||
|
|
||||||
#[br(if(file_header.data_set_size > 512))]
|
#[br(if(file_header.data_set_size > 512 && file_header.version < 0x1030000))]
|
||||||
color_set_due_info: Option<ColorSetDyeInfo>,
|
color_set_due_info: Option<ColorSetDyeInfo>,
|
||||||
|
|
||||||
|
// Dawntrail unknown stuff
|
||||||
|
#[br(if(file_header.version == 0x1030000))]
|
||||||
|
#[br(count = file_header.data_set_size)]
|
||||||
|
unknown1: Vec<u8>,
|
||||||
|
|
||||||
header: MaterialHeader,
|
header: MaterialHeader,
|
||||||
|
|
||||||
#[br(count = header.shader_key_count)]
|
#[br(count = header.shader_key_count)]
|
||||||
|
@ -180,8 +188,6 @@ impl Material {
|
||||||
let mut cursor = Cursor::new(buffer);
|
let mut cursor = Cursor::new(buffer);
|
||||||
let mat_data = MaterialData::read(&mut cursor).ok()?;
|
let mat_data = MaterialData::read(&mut cursor).ok()?;
|
||||||
|
|
||||||
println!("{:#?}", mat_data);
|
|
||||||
|
|
||||||
let mut texture_paths = vec![];
|
let mut texture_paths = vec![];
|
||||||
|
|
||||||
let mut offset = 0;
|
let mut offset = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue