Classify nonzero stock building header family
This commit is contained in:
parent
6c7ebb75b5
commit
c9026bd1a0
4 changed files with 89 additions and 8 deletions
|
|
@ -92,6 +92,15 @@ pub struct BuildingTypeRecoveredTableSummary {
|
|||
pub present_style_station_entries: Vec<String>,
|
||||
pub present_standalone_entries: Vec<String>,
|
||||
pub bare_port_warehouse_files: Vec<String>,
|
||||
pub nonzero_bty_header_dword_summaries: Vec<BuildingTypeBtyHeaderDwordSummary>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BuildingTypeBtyHeaderDwordSummary {
|
||||
pub dword_0xbb: u32,
|
||||
pub dword_0xbb_hex: String,
|
||||
pub file_count: usize,
|
||||
pub sample_file_names: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
@ -437,6 +446,33 @@ fn summarize_recovered_table_families(
|
|||
bare_port_warehouse_files.sort();
|
||||
bare_port_warehouse_files.dedup();
|
||||
|
||||
let mut nonzero_bty_header_dword_groups = BTreeMap::<u32, Vec<String>>::new();
|
||||
for file in files {
|
||||
let Some(probe) = &file.bty_header_probe else {
|
||||
continue;
|
||||
};
|
||||
if probe.dword_0xbb == 0 {
|
||||
continue;
|
||||
}
|
||||
nonzero_bty_header_dword_groups
|
||||
.entry(probe.dword_0xbb)
|
||||
.or_default()
|
||||
.push(file.file_name.clone());
|
||||
}
|
||||
let nonzero_bty_header_dword_summaries = nonzero_bty_header_dword_groups
|
||||
.into_iter()
|
||||
.map(|(dword_0xbb, mut file_names)| {
|
||||
file_names.sort();
|
||||
file_names.dedup();
|
||||
BuildingTypeBtyHeaderDwordSummary {
|
||||
dword_0xbb,
|
||||
dword_0xbb_hex: format!("0x{dword_0xbb:08x}"),
|
||||
file_count: file_names.len(),
|
||||
sample_file_names: file_names.into_iter().take(24).collect(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
BuildingTypeRecoveredTableSummary {
|
||||
recovered_style_themes: RECOVERED_STYLE_THEMES
|
||||
.into_iter()
|
||||
|
|
@ -449,6 +485,7 @@ fn summarize_recovered_table_families(
|
|||
present_style_station_entries,
|
||||
present_standalone_entries,
|
||||
bare_port_warehouse_files,
|
||||
nonzero_bty_header_dword_summaries,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -549,7 +586,24 @@ mod tests {
|
|||
source_kind: BuildingTypeSourceKind::Bty,
|
||||
byte_len: None,
|
||||
bca_selector_probe: None,
|
||||
bty_header_probe: None,
|
||||
bty_header_probe: Some(BuildingTypeBtyHeaderProbe {
|
||||
type_id: 0x03ec,
|
||||
type_id_hex: "0x000003ec".to_string(),
|
||||
name_0x04: "Port".to_string(),
|
||||
name_0x22: "Port".to_string(),
|
||||
name_0x40: "Port".to_string(),
|
||||
name_0x5e: "TextileMill".to_string(),
|
||||
name_0x7c: "Port".to_string(),
|
||||
name_0x9a: "Port".to_string(),
|
||||
byte_0xb8: 0x06,
|
||||
byte_0xb8_hex: "0x06".to_string(),
|
||||
byte_0xb9: 0x06,
|
||||
byte_0xb9_hex: "0x06".to_string(),
|
||||
byte_0xba: 0x30,
|
||||
byte_0xba_hex: "0x30".to_string(),
|
||||
dword_0xbb: 0x01f4,
|
||||
dword_0xbb_hex: "0x000001f4".to_string(),
|
||||
}),
|
||||
},
|
||||
BuildingTypeSourceFile {
|
||||
file_name: "Warehouse.bca".to_string(),
|
||||
|
|
@ -577,5 +631,14 @@ mod tests {
|
|||
summary.bare_port_warehouse_files,
|
||||
vec!["Port.bty".to_string(), "Warehouse.bca".to_string()]
|
||||
);
|
||||
assert_eq!(summary.nonzero_bty_header_dword_summaries.len(), 1);
|
||||
assert_eq!(
|
||||
summary.nonzero_bty_header_dword_summaries[0].dword_0xbb_hex,
|
||||
"0x000001f4"
|
||||
);
|
||||
assert_eq!(
|
||||
summary.nonzero_bty_header_dword_summaries[0].sample_file_names,
|
||||
vec!["Port.bty".to_string()]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue