1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-20 11:47:46 +00:00

Remove the padding "fixes" for Dawntrail materials

According to https://github.com/TexTools/xivModdingFramework/pull/60 the
amount of color sets changed in Dawntrail.
This commit is contained in:
Joshua Goins 2024-04-17 21:40:32 -04:00
parent 774740c470
commit 370b6ac009

View file

@ -41,10 +41,11 @@ struct ColorSet {
} }
#[binrw] #[binrw]
#[br(import {set_count: usize})]
#[derive(Debug)] #[derive(Debug)]
#[allow(dead_code)] #[allow(dead_code)]
struct ColorSetInfo { struct ColorSetInfo {
#[br(count = 256)] #[br(count = set_count)]
data: Vec<u16>, data: Vec<u16>,
} }
@ -153,17 +154,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 && file_header.version < 0x1030000))] #[br(if(file_header.data_set_size > 0))]
// Dawntrail doubled the amount of color sets.
// The MTRL version is the same (why square enix?) so we check the data set size instead
#[br(args { set_count: if file_header.data_set_size < 2048 { 256 } else { 1024 } })]
color_set_info: Option<ColorSetInfo>, color_set_info: Option<ColorSetInfo>,
#[br(if(file_header.data_set_size > 512 && file_header.version < 0x1030000))] #[br(if(file_header.data_set_size >
if file_header.data_set_size < 2048 { 512 } else { 2048 }
))]
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)]