Box in Tier-2 source family rows

This commit is contained in:
Jan Petykiewicz 2026-04-19 16:18:10 -07:00
commit 07ae8b693a
5 changed files with 485 additions and 10 deletions

View file

@ -244,6 +244,248 @@
"Maintenance",
"Service Tower"
],
"recovered_source_family_summaries": [
{
"canonical_stem": "clpbrdstationlrg",
"sample_raw_stem": "ClpbrdStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "ClpbrdStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "ClpbrdStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "clpbrdstationmed",
"sample_raw_stem": "ClpbrdStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "ClpbrdStationMed",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "ClpbrdStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "clpbrdstationsml",
"sample_raw_stem": "ClpbrdStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "ClpbrdStationSml",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "ClpbrdStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "kyotostationlrg",
"sample_raw_stem": "KyotoStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "KyotoStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "KyotoStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "kyotostationmed",
"sample_raw_stem": "KyotoStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "KyotoStationMed",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "KyotoStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "kyotostationsml",
"sample_raw_stem": "KyotoStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "KyotoStationSml",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "KyotoStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "maintenance",
"sample_raw_stem": "Maintenance",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "Maintenance",
"name_0x5e": "SmlTudorStation",
"name_0x7c": "Maintenance",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "persianstationlrg",
"sample_raw_stem": "PersianStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "PersianStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "PersianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "persianstationmed",
"sample_raw_stem": "PersianStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "PersianStationMed",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "PersianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "persianstationsml",
"sample_raw_stem": "PersianStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "PersianStationSml",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "PersianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "servicetower",
"sample_raw_stem": "Service Tower",
"has_bca_pair": true,
"type_id_hex": "0x000003ec",
"name_0x40": "ServiceTower",
"name_0x5e": "SmlTudorStation",
"name_0x7c": "ServiceTower",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": "0x00",
"byte_0xbb_hex": "0x00"
},
{
"canonical_stem": "soweststationlrg",
"sample_raw_stem": "SoWestStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "SoWestStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "SoWestStation",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "soweststationmed",
"sample_raw_stem": "SoWestStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "SoWestStationMed",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "SoWestStation",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "soweststationsml",
"sample_raw_stem": "SoWestStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "SoWestStationSml",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "SoWestStation",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "tudorstationlrg",
"sample_raw_stem": "TudorStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "TudorStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "TudorStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "tudorstationmed",
"sample_raw_stem": "TudorStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "TudorStationMed",
"name_0x5e": "MedTudorStation",
"name_0x7c": "TudorStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "tudorstationsml",
"sample_raw_stem": "TudorStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "TudorStationSml",
"name_0x5e": "SmlTudorStation",
"name_0x7c": "TudorStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "victorianstationlrg",
"sample_raw_stem": "VictorianStationLrg",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "VictorianStationLrg",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "VictorianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "victorianstationmed",
"sample_raw_stem": "VictorianStationMed",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "VictorianStationMed",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "VictorianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
},
{
"canonical_stem": "victorianstationsml",
"sample_raw_stem": "VictorianStationSml",
"has_bca_pair": false,
"type_id_hex": "0x000003ec",
"name_0x40": "VictorianStationSml",
"name_0x5e": "LrgTudorStation",
"name_0x7c": "VictorianStations",
"dword_0xbb_hex": "0x00000000",
"byte_0xba_hex": null,
"byte_0xbb_hex": null
}
],
"bare_port_warehouse_files": [
"Port.bca",
"Port.bty",

View file

@ -91,6 +91,7 @@ pub struct BuildingTypeRecoveredTableSummary {
pub recovered_source_kinds: Vec<String>,
pub present_style_station_entries: Vec<String>,
pub present_standalone_entries: Vec<String>,
pub recovered_source_family_summaries: Vec<BuildingTypeRecoveredSourceFamilySummary>,
pub bare_port_warehouse_files: Vec<String>,
pub nonzero_bty_header_dword_summaries: Vec<BuildingTypeBtyHeaderDwordSummary>,
pub nonzero_bty_header_name_0x40_summaries: Vec<BuildingTypeBtyHeaderNameSummary>,
@ -109,6 +110,22 @@ pub struct BuildingTypeBtyHeaderDwordSummary {
pub sample_file_names: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BuildingTypeRecoveredSourceFamilySummary {
pub canonical_stem: String,
pub sample_raw_stem: String,
pub has_bca_pair: bool,
pub type_id_hex: String,
pub name_0x40: String,
pub name_0x5e: String,
pub name_0x7c: String,
pub dword_0xbb_hex: String,
#[serde(default)]
pub byte_0xba_hex: Option<String>,
#[serde(default)]
pub byte_0xbb_hex: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BuildingTypeBtyHeaderNameSummary {
pub header_offset_hex: String,
@ -482,6 +499,13 @@ fn summarize_recovered_table_families(
present_standalone_entries.sort();
present_standalone_entries.dedup();
let recovered_source_family_summaries = summarize_recovered_source_family_rows(
entries,
files,
&present_style_station_entries,
&present_standalone_entries,
);
let mut bare_port_warehouse_files = files
.iter()
.filter(|file| matches!(file.canonical_stem.as_str(), "port" | "warehouse"))
@ -541,6 +565,7 @@ fn summarize_recovered_table_families(
.collect(),
present_style_station_entries,
present_standalone_entries,
recovered_source_family_summaries,
bare_port_warehouse_files,
nonzero_bty_header_dword_summaries,
nonzero_bty_header_name_0x40_summaries,
@ -598,6 +623,75 @@ fn summarize_nonzero_bty_header_name_lane(
summaries
}
fn summarize_recovered_source_family_rows(
entries: &[BuildingTypeSourceEntry],
files: &[BuildingTypeSourceFile],
present_style_station_entries: &[String],
present_standalone_entries: &[String],
) -> Vec<BuildingTypeRecoveredSourceFamilySummary> {
let file_by_name = files
.iter()
.map(|file| (file.file_name.as_str(), file))
.collect::<BTreeMap<_, _>>();
let mut canonical_stems = present_style_station_entries
.iter()
.chain(present_standalone_entries.iter())
.map(|raw_stem| canonicalize_building_stem(raw_stem))
.collect::<Vec<_>>();
canonical_stems.sort();
canonical_stems.dedup();
let mut summaries = Vec::new();
for canonical_stem in canonical_stems {
let Some(entry) = entries
.iter()
.find(|entry| entry.canonical_stem == canonical_stem)
else {
continue;
};
let bty_file = entry
.file_names
.iter()
.filter_map(|name| file_by_name.get(name.as_str()))
.find(|file| matches!(file.source_kind, BuildingTypeSourceKind::Bty));
let Some(bty_file) = bty_file else {
continue;
};
let Some(bty_probe) = &bty_file.bty_header_probe else {
continue;
};
let bca_file = entry
.file_names
.iter()
.filter_map(|name| file_by_name.get(name.as_str()))
.find(|file| matches!(file.source_kind, BuildingTypeSourceKind::Bca));
let bca_probe = bca_file.and_then(|file| file.bca_selector_probe.as_ref());
summaries.push(BuildingTypeRecoveredSourceFamilySummary {
canonical_stem: canonical_stem.clone(),
sample_raw_stem: entry
.raw_stems
.first()
.cloned()
.unwrap_or_else(|| canonical_stem.clone()),
has_bca_pair: bca_file.is_some(),
type_id_hex: bty_probe.type_id_hex.clone(),
name_0x40: bty_probe.name_0x40.clone(),
name_0x5e: bty_probe.name_0x5e.clone(),
name_0x7c: bty_probe.name_0x7c.clone(),
dword_0xbb_hex: bty_probe.dword_0xbb_hex.clone(),
byte_0xba_hex: bca_probe.map(|probe| probe.byte_0xba_hex.clone()),
byte_0xbb_hex: bca_probe.map(|probe| probe.byte_0xbb_hex.clone()),
});
}
summaries.sort_by(|left, right| {
left.canonical_stem
.cmp(&right.canonical_stem)
.then_with(|| left.sample_raw_stem.cmp(&right.sample_raw_stem))
});
summaries
}
fn summarize_bty_header_name_lane_by_dword(
files: &[BuildingTypeSourceFile],
offset: u32,
@ -921,6 +1015,110 @@ mod tests {
},
];
let files = vec![
BuildingTypeSourceFile {
file_name: "VictorianStationSml.bty".to_string(),
raw_stem: "VictorianStationSml".to_string(),
canonical_stem: canonicalize_building_stem("VictorianStationSml"),
source_kind: BuildingTypeSourceKind::Bty,
byte_len: None,
bca_selector_probe: None,
bty_header_probe: Some(BuildingTypeBtyHeaderProbe {
type_id: 0x03ec,
type_id_hex: "0x000003ec".to_string(),
name_0x04: "VictorianStationSml".to_string(),
name_0x22: "VictorianStationSml".to_string(),
name_0x40: "VictorianStations".to_string(),
name_0x5e: "SmallTudorHouse".to_string(),
name_0x7c: "VictorianStations".to_string(),
name_0x9a: "VictorianStationSml".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: 0,
dword_0xbb_hex: "0x00000000".to_string(),
}),
},
BuildingTypeSourceFile {
file_name: "ClpbrdStationLrg.bty".to_string(),
raw_stem: "ClpbrdStationLrg".to_string(),
canonical_stem: canonicalize_building_stem("ClpbrdStationLrg"),
source_kind: BuildingTypeSourceKind::Bty,
byte_len: None,
bca_selector_probe: None,
bty_header_probe: Some(BuildingTypeBtyHeaderProbe {
type_id: 0x03ec,
type_id_hex: "0x000003ec".to_string(),
name_0x04: "ClpbrdStationLrg".to_string(),
name_0x22: "ClpbrdStationLrg".to_string(),
name_0x40: "ClpBrdStations".to_string(),
name_0x5e: "SmallTudorHouse".to_string(),
name_0x7c: "ClpBrdStations".to_string(),
name_0x9a: "ClpbrdStationLrg".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: 0,
dword_0xbb_hex: "0x00000000".to_string(),
}),
},
BuildingTypeSourceFile {
file_name: "Maintenance.bty".to_string(),
raw_stem: "Maintenance".to_string(),
canonical_stem: canonicalize_building_stem("Maintenance"),
source_kind: BuildingTypeSourceKind::Bty,
byte_len: None,
bca_selector_probe: None,
bty_header_probe: Some(BuildingTypeBtyHeaderProbe {
type_id: 0x03ec,
type_id_hex: "0x000003ec".to_string(),
name_0x04: "Maintenance".to_string(),
name_0x22: "Maintenance".to_string(),
name_0x40: "Maintenance Facility".to_string(),
name_0x5e: "200FtRulerCross".to_string(),
name_0x7c: "Maintenance Facility".to_string(),
name_0x9a: "Maintenance".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: 0,
dword_0xbb_hex: "0x00000000".to_string(),
}),
},
BuildingTypeSourceFile {
file_name: "ServiceTower.bty".to_string(),
raw_stem: "ServiceTower".to_string(),
canonical_stem: canonicalize_building_stem("ServiceTower"),
source_kind: BuildingTypeSourceKind::Bty,
byte_len: None,
bca_selector_probe: None,
bty_header_probe: Some(BuildingTypeBtyHeaderProbe {
type_id: 0x03ec,
type_id_hex: "0x000003ec".to_string(),
name_0x04: "ServiceTower".to_string(),
name_0x22: "ServiceTower".to_string(),
name_0x40: "Service Tower".to_string(),
name_0x5e: "200FtRulerCross".to_string(),
name_0x7c: "Service Tower".to_string(),
name_0x9a: "ServiceTower".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: 0,
dword_0xbb_hex: "0x00000000".to_string(),
}),
},
BuildingTypeSourceFile {
file_name: "Port.bty".to_string(),
raw_stem: "Port".to_string(),
@ -982,6 +1180,18 @@ mod tests {
summary.present_standalone_entries,
vec!["Maintenance".to_string(), "ServiceTower".to_string()]
);
assert_eq!(summary.recovered_source_family_summaries.len(), 4);
assert!(summary.recovered_source_family_summaries.iter().any(|row| {
row.canonical_stem == canonicalize_building_stem("Maintenance")
&& row.name_0x40 == "Maintenance Facility"
&& row.dword_0xbb_hex == "0x00000000"
&& row.byte_0xba_hex.is_none()
}));
assert!(summary.recovered_source_family_summaries.iter().any(|row| {
row.canonical_stem == canonicalize_building_stem("VictorianStationSml")
&& row.name_0x40 == "VictorianStations"
&& row.dword_0xbb_hex == "0x00000000"
}));
assert_eq!(
summary.bare_port_warehouse_files,
vec!["Port.bca".to_string(), "Port.bty".to_string()]
@ -1022,16 +1232,14 @@ mod tests {
sample_file_names: vec!["Port.bty".to_string()],
}]
);
assert_eq!(
summary.bty_header_name_0x5e_dword_summaries,
vec![BuildingTypeBtyHeaderNameDwordSummary {
header_offset_hex: "0x5e".to_string(),
header_value: "TextileMill".to_string(),
dword_0xbb: 0x01f4,
dword_0xbb_hex: "0x000001f4".to_string(),
file_count: 1,
sample_file_names: vec!["Port.bty".to_string()],
}]
assert!(
summary.bty_header_name_0x5e_dword_summaries.iter().any(|row| {
row.header_offset_hex == "0x5e"
&& row.header_value == "TextileMill"
&& row.dword_0xbb == 0x01f4
&& row.file_count == 1
&& row.sample_file_names == vec!["Port.bty".to_string()]
})
);
assert_eq!(
summary.nonzero_bty_header_alias_selector_summaries,

View file

@ -116,6 +116,14 @@
all-zero. So the remaining load-side question is no longer whether the bare `Port` / `Warehouse`
row carries the stock exception; it is why one warehouse-shaped industrial peer in that same
alias family carries the lone selector while the bare rows do not.
The exact stock resolver-family strip is boxed in now too. The checked-in
`recovered_source_family_summaries` report shows every `0x00419590` source-family row
(`VictorianStation*`, `TudorStation*`, `SoWestStation*`, `PersianStation*`, `KyotoStation*`,
`ClpBrdStation*`, `Maintenance`, and `ServiceTower`) staying on `type_id = 0x000003ec` with
`dword_0xbb = 0`; almost all of them have no `.bca` pair at all, and the only paired standalone
row `ServiceTower` still has `byte_0xba = 0x00`, `byte_0xbb = 0x00`. So the remaining
load-side question is no longer whether the exact `0x00419590` strip itself carries the seeded
nonzero selector; current evidence says it does not.
The global stock selector report tightens that further: the full `MachineShop.bca` signature
(`0x00/0x80/0x3f/0x00` across `0xb8..0xbb`) is unique across the checked-in stock `.bca`
corpus. So the remaining load-side Tier-2 frontier is one surfaced stock-file outlier plus the

View file

@ -1364,6 +1364,14 @@
all-zero. So the remaining Tier-2 source question is no longer whether the bare `Port` or
`Warehouse` row carries the seeded selector; it is why one warehouse-shaped industrial peer in
that alias family carries the lone seeded selector while the bare rows do not.
The exact stock resolver-family strip is boxed in now too. The checked-in
`recovered_source_family_summaries` report shows every `0x00419590` source-family row
(`VictorianStation*`, `TudorStation*`, `SoWestStation*`, `PersianStation*`, `KyotoStation*`,
`ClpBrdStation*`, `Maintenance`, and `ServiceTower`) stays on `type_id = 0x000003ec` with
`dword_0xbb = 0`, and almost all of them have no `.bca` pair at all; the only paired standalone
row is `ServiceTower`, and it still carries `byte_0xba = 0x00`, `byte_0xbb = 0x00`. So the
remaining Tier-2 source question is no longer whether the exact `0x00419590` strip itself
carries seeded nonzero bank bytes; current evidence says it does not.
The global stock `.bca` selector report narrows that again: the exact `MachineShop.bca`
signature (`byte_0xb8 = 0x00`, `byte_0xb9 = 0x80`, `byte_0xba = 0x3f`, `byte_0xbb = 0x00`) is
unique across the checked-in stock corpus. So the remaining Tier-2 source frontier is not a

View file

@ -1323,6 +1323,15 @@ Working rule:
all-zero. So the remaining Tier-2 question is no longer “does the bare `Port` or
`Warehouse` row carry the seeded selector?”; it is “why does one warehouse-shaped industrial
peer in that alias family carry the lone seeded selector while the bare rows do not?”
- the exact stock resolver-family strip is boxed in now too:
the checked-in `recovered_source_family_summaries` report shows every `0x00419590`
source-family row (`VictorianStation*`, `TudorStation*`, `SoWestStation*`,
`PersianStation*`, `KyotoStation*`, `ClpBrdStation*`, `Maintenance`, and `ServiceTower`)
stays on `type_id = 0x000003ec` with `dword_0xbb = 0`, and almost all of them have no `.bca`
pair at all; the only paired standalone row is `ServiceTower`, and it still carries
`byte_0xba = 0x00`, `byte_0xbb = 0x00`. So the remaining Tier-2 question is no longer
whether the exact `0x00419590` source-family strip itself carries the seeded nonzero bank
bytes; current evidence says it does not.
- the global stock `.bca` selector report narrows that one step further still: the exact
`MachineShop.bca` signature (`byte_0xb8 = 0x00`, `byte_0xb9 = 0x80`, `byte_0xba = 0x3f`,
`byte_0xbb = 0x00`) is unique across the checked-in stock corpus. So the current Tier-2