Reconstruct raw save company debt and capacity

This commit is contained in:
Jan Petykiewicz 2026-04-17 14:56:41 -07:00
commit a58680481f
6 changed files with 1185 additions and 73 deletions

View file

@ -29,16 +29,16 @@ chairman ordinals remain explicit frontier. Checked-in save-slice
documents can now also carry explicit company rosters and chairman-profile tables, so the current
company-targeted and chairman-targeted descriptor and condition batches can execute from standalone
save-slice fixtures without overlay snapshots when that context is present; raw `.gms` inspection
still does not reconstruct those company/chairman collections automatically, but it now does
reconstruct selection-only company/chairman context from the fixed save-side `0x32c8` world block.
Those raw selected ids can flow through save-slice export/import and override overlay-backed base
selection even while the full raw rosters remain absent, and a tracked overlay fixture now pins
that selection-only override path explicitly. The same fixed block now also exports the grounded
campaign override byte plus the raw chairman slot selector and role-gate bytes as analysis-only
save fields. Raw `.gms` inspection now also lifts the save-side tagged header counts for the
company and chairman/profile collections into `observed_entry_count`, so save-slice exports carry
header-level roster counts alongside the selected ids even while per-entry payload remains
unreconstructed. A checked-in
now reconstructs both collections automatically: the fixed save-side `0x32c8` world block still
supplies selected company/chairman ids plus the campaign override byte and chairman slot/role-gate
analysis bytes, and the tagged company / chairman-profile direct-record families now populate
save-native roster entries for real `.gms` imports and exports. The current raw-save boundary is
narrower now: company/chairman identity, active flags, links, chairman cash, chairman holdings,
company debt, and company track-laying capacity are grounded directly from save records, while
broader company finance/governance scalars and controller-kind reconstruction still remain
conservative defaults until their raw lanes are pinned more strongly. The offline runtime analysis
surface also now exposes `runtime inspect-save-company-chairman <save.gms>` for those remaining raw
company/chairman scalar candidates. A checked-in
`EventEffects` export now exists too in
`artifacts/exports/rt3-1.06/event-effects-table.json`, and a checked-in semantic closure layer now
exists beside it in `artifacts/exports/rt3-1.06/event-effects-semantic-catalog.json`. Recovered

View file

@ -26,11 +26,12 @@ use rrt_runtime::{
SNAPSHOT_FORMAT_VERSION, SmpClassicPackedProfileBlock, SmpInspectionReport, SmpLoadedSaveSlice,
SmpRt3105PackedProfileBlock, SmpSaveLoadSummary, WinInspectionReport, execute_step_command,
extract_pk4_entry_file, inspect_campaign_exe_file, inspect_cargo_economy_sources_with_bindings,
inspect_cargo_skin_pk4, inspect_cargo_types_dir, inspect_pk4_file, inspect_smp_file,
inspect_win_file, load_runtime_snapshot_document, load_runtime_state_import,
load_save_slice_file, project_save_slice_to_runtime_state_import,
save_runtime_overlay_import_document, save_runtime_save_slice_document,
save_runtime_snapshot_document, validate_runtime_snapshot_document,
inspect_cargo_skin_pk4, inspect_cargo_types_dir, inspect_pk4_file,
inspect_save_company_and_chairman_analysis_file, inspect_smp_file, inspect_win_file,
load_runtime_snapshot_document, load_runtime_state_import, load_save_slice_file,
project_save_slice_to_runtime_state_import, save_runtime_overlay_import_document,
save_runtime_save_slice_document, save_runtime_snapshot_document,
validate_runtime_snapshot_document,
};
use serde::Serialize;
use serde_json::Value;
@ -126,6 +127,9 @@ enum Command {
RuntimeLoadSaveSlice {
smp_path: PathBuf,
},
RuntimeInspectSaveCompanyChairman {
smp_path: PathBuf,
},
RuntimeImportSaveState {
smp_path: PathBuf,
output_path: PathBuf,
@ -272,6 +276,12 @@ struct RuntimeLoadedSaveSliceOutput {
save_slice: SmpLoadedSaveSlice,
}
#[derive(Debug, Serialize)]
struct RuntimeSaveCompanyChairmanAnalysisOutput {
path: String,
analysis: rrt_runtime::SmpSaveCompanyChairmanAnalysisReport,
}
#[derive(Debug, Serialize)]
struct RuntimeSaveSliceExportOutput {
path: String,
@ -840,6 +850,9 @@ fn real_main() -> Result<(), Box<dyn std::error::Error>> {
Command::RuntimeLoadSaveSlice { smp_path } => {
run_runtime_load_save_slice(&smp_path)?;
}
Command::RuntimeInspectSaveCompanyChairman { smp_path } => {
run_runtime_inspect_save_company_chairman(&smp_path)?;
}
Command::RuntimeImportSaveState {
smp_path,
output_path,
@ -1036,6 +1049,13 @@ fn parse_command() -> Result<Command, Box<dyn std::error::Error>> {
smp_path: PathBuf::from(path),
})
}
[command, subcommand, path]
if command == "runtime" && subcommand == "inspect-save-company-chairman" =>
{
Ok(Command::RuntimeInspectSaveCompanyChairman {
smp_path: PathBuf::from(path),
})
}
[command, subcommand, smp_path, output_path]
if command == "runtime" && subcommand == "import-save-state" =>
{
@ -1239,7 +1259,7 @@ fn parse_command() -> Result<Command, Box<dyn std::error::Error>> {
})
}
_ => Err(
"usage: rrt-cli [validate [repo-root] | finance eval <snapshot.json> | finance diff <left.json> <right.json> | runtime validate-fixture <fixture.json> | runtime summarize-fixture <fixture.json> | runtime export-fixture-state <fixture.json> <snapshot.json> | runtime diff-state <left.json> <right.json> | runtime summarize-state <snapshot.json> | runtime import-state <input.json> <snapshot.json> | runtime inspect-smp <file.smp> | runtime summarize-save-load <file.smp> | runtime load-save-slice <file.smp> | runtime import-save-state <file.smp> <snapshot.json> | runtime export-save-slice <file.smp> <save-slice.json> | runtime export-overlay-import <snapshot.json> <save-slice.json> <overlay-import.json> | runtime inspect-pk4 <file.pk4> | runtime inspect-cargo-types <CargoTypes-dir> | runtime inspect-cargo-skins <Cargo106.PK4> | runtime inspect-cargo-economy-sources <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-cargo-production-selector <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-cargo-price-selector <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-win <file.win> | runtime extract-pk4-entry <file.pk4> <entry-name> <output-path> | runtime inspect-campaign-exe <RT3.exe> | runtime compare-classic-profile <save1.gms> <save2.gms> [saveN.gms...] | runtime compare-105-profile <save1.gms> <save2.gms> [saveN.gms...] | runtime compare-candidate-table <file1> <file2> [fileN...] | runtime compare-recipe-book-lines <file1> <file2> [fileN...] | runtime compare-setup-payload-core <file1> <file2> [fileN...] | runtime compare-setup-launch-payload <file1> <file2> [fileN...] | runtime compare-post-special-conditions-scalars <file1> <file2> [fileN...] | runtime scan-candidate-table-headers <root-dir> | runtime scan-special-conditions <root-dir> | runtime scan-aligned-runtime-rule-band <root-dir> | runtime scan-post-special-conditions-scalars <root-dir> | runtime scan-post-special-conditions-tail <root-dir> | runtime scan-recipe-book-lines <root-dir> | runtime export-profile-block <save.gms> <profile.json>]"
"usage: rrt-cli [validate [repo-root] | finance eval <snapshot.json> | finance diff <left.json> <right.json> | runtime validate-fixture <fixture.json> | runtime summarize-fixture <fixture.json> | runtime export-fixture-state <fixture.json> <snapshot.json> | runtime diff-state <left.json> <right.json> | runtime summarize-state <snapshot.json> | runtime import-state <input.json> <snapshot.json> | runtime inspect-smp <file.smp> | runtime summarize-save-load <file.smp> | runtime load-save-slice <file.smp> | runtime inspect-save-company-chairman <file.smp> | runtime import-save-state <file.smp> <snapshot.json> | runtime export-save-slice <file.smp> <save-slice.json> | runtime export-overlay-import <snapshot.json> <save-slice.json> <overlay-import.json> | runtime inspect-pk4 <file.pk4> | runtime inspect-cargo-types <CargoTypes-dir> | runtime inspect-cargo-skins <Cargo106.PK4> | runtime inspect-cargo-economy-sources <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-cargo-production-selector <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-cargo-price-selector <CargoTypes-dir> <Cargo106.PK4> | runtime inspect-win <file.win> | runtime extract-pk4-entry <file.pk4> <entry-name> <output-path> | runtime inspect-campaign-exe <RT3.exe> | runtime compare-classic-profile <save1.gms> <save2.gms> [saveN.gms...] | runtime compare-105-profile <save1.gms> <save2.gms> [saveN.gms...] | runtime compare-candidate-table <file1> <file2> [fileN...] | runtime compare-recipe-book-lines <file1> <file2> [fileN...] | runtime compare-setup-payload-core <file1> <file2> [fileN...] | runtime compare-setup-launch-payload <file1> <file2> [fileN...] | runtime compare-post-special-conditions-scalars <file1> <file2> [fileN...] | runtime scan-candidate-table-headers <root-dir> | runtime scan-special-conditions <root-dir> | runtime scan-aligned-runtime-rule-band <root-dir> | runtime scan-post-special-conditions-scalars <root-dir> | runtime scan-post-special-conditions-tail <root-dir> | runtime scan-recipe-book-lines <root-dir> | runtime export-profile-block <save.gms> <profile.json>]"
.into(),
),
}
@ -1469,6 +1489,17 @@ fn run_runtime_load_save_slice(smp_path: &Path) -> Result<(), Box<dyn std::error
Ok(())
}
fn run_runtime_inspect_save_company_chairman(
smp_path: &Path,
) -> Result<(), Box<dyn std::error::Error>> {
let report = RuntimeSaveCompanyChairmanAnalysisOutput {
path: smp_path.display().to_string(),
analysis: inspect_save_company_and_chairman_analysis_file(smp_path)?,
};
println!("{}", serde_json::to_string_pretty(&report)?);
Ok(())
}
fn run_runtime_import_save_state(
smp_path: &Path,
output_path: &Path,

View file

@ -82,9 +82,13 @@ pub use smp::{
SmpRt3105SaveBridgePayloadProbe, SmpRt3105SaveNameTableEntry, SmpRt3105SaveNameTableProbe,
SmpRuntimeAnchorCycleBlock, SmpRuntimePostSpanHeaderCandidate, SmpRuntimePostSpanProbe,
SmpRuntimeTrailerBlock, SmpSaveAnchorRunBlock, SmpSaveBootstrapBlock,
SmpSaveLoadCandidateTableSummary, SmpSaveLoadSummary, SmpSaveTaggedCollectionHeaderProbe,
SmpSecondaryVariantProbe, SmpSharedHeader, SmpSpecialConditionEntry, SmpSpecialConditionsProbe,
inspect_smp_bytes, inspect_smp_file, load_save_slice_file, load_save_slice_from_report,
SmpSaveChairmanRecordAnalysisEntry, SmpSaveCompanyChairmanAnalysisReport,
SmpSaveCompanyRecordAnalysisEntry, SmpSaveLoadCandidateTableSummary, SmpSaveLoadSummary,
SmpSaveScalarCandidate, SmpSaveTaggedCollectionHeaderProbe, SmpSecondaryVariantProbe,
SmpSharedHeader, SmpSpecialConditionEntry, SmpSpecialConditionsProbe,
inspect_save_company_and_chairman_analysis_bytes,
inspect_save_company_and_chairman_analysis_file, inspect_smp_bytes, inspect_smp_file,
load_save_slice_file, load_save_slice_from_report,
};
pub use step::{BoundaryEvent, ServiceEvent, StepCommand, StepResult, execute_step_command};
pub use summary::RuntimeSummary;

File diff suppressed because it is too large Load diff

View file

@ -96,15 +96,16 @@ The highest-value next passes are now:
- checked-in save-slice documents can now carry explicit company rosters and chairman profile
tables too, so the current company-targeted and chairman-targeted descriptor/condition batches
can execute from standalone save-slice fixtures without overlay snapshots when that context is
present; raw `.gms` inspection/export still does not reconstruct full company/chairman rosters,
but it now does reconstruct selection-only company/chairman context from the fixed save-side
`0x32c8` world block, so overlay imports can reuse base rosters while honoring raw save-native
selected company/chairman ids, and a tracked overlay fixture now pins that selection-only
override path explicitly; raw `.gms` inspection now also lifts the save-side tagged collection
header counts for the company and chairman/profile families into `observed_entry_count`, so
save-slice exports carry header-level roster counts even while per-entry payload remains absent;
the same fixed block now also exports the grounded campaign override byte plus the raw chairman
slot selector and role-gate bytes as analysis-only save fields
present; raw `.gms` inspection/export now reconstructs those company/chairman collections
directly from save-side tagged record families, while the fixed save-side `0x32c8` world block
still provides selected company/chairman ids plus the grounded campaign-override and
chairman-slot / role-gate analysis bytes; the current raw-save frontier is narrower now:
company/chairman identity, active flags, links, chairman cash, chairman holdings, company debt,
company track-laying capacity, and collection counts are grounded, while broader company
finance/governance scalar lanes plus controller-kind reconstruction still remain conservative
defaults until their raw offsets are pinned more strongly; the offline analysis command
`runtime inspect-save-company-chairman <save.gms>` now dumps those remaining raw record
candidates directly from the rehosted parser
- a checked-in `EventEffects` export now exists at
`artifacts/exports/rt3-1.06/event-effects-table.json`, and a checked-in semantic closure layer
now exists at `artifacts/exports/rt3-1.06/event-effects-semantic-catalog.json`

View file

@ -58,16 +58,15 @@ Implemented today:
tables too, and runtime projection/import will seed or replace company/chairman context from
those save-owned surfaces; that lets the currently supported company-targeted and
chairman-targeted descriptor/condition batches execute from standalone save-slice fixtures
without overlay snapshots when the checked-in documents include that context, while raw `.gms`
inspection/export still leaves full company/chairman rosters absent; the grounded raw-save
tranche now covers only selection-only company/chairman context from the fixed `0x32c8` world
block, which overlay import can use to replace selected ids while preserving base rosters; raw
save inspection now also lifts the save-side tagged company and chairman/profile collection
header counts into `observed_entry_count`, so save-slice exports carry header-level roster
counts even though per-entry payload still remains absent; that same fixed block now also
exports the grounded campaign override byte plus the raw chairman slot selector and role-gate
bytes as analysis-only fields, and a tracked overlay fixture now pins the selection-only
override path explicitly
without overlay snapshots when the checked-in documents include that context, and raw `.gms`
inspection/export now reconstructs company/chairman direct-record entries too; the fixed
`0x32c8` world block still contributes selected ids plus the grounded campaign-override and
chairman slot / role-gate analysis bytes, while the tagged company and chairman/profile
collections now provide save-native roster entries and `observed_entry_count`; raw company debt
from the bond table and raw company track-laying capacity from the record tail are grounded too,
and `runtime inspect-save-company-chairman <save.gms>` now exposes the remaining raw
company/chairman scalar candidates directly from the rehosted parser; the remaining raw-save
boundary is company-finance/governance scalar depth plus controller-kind closure, not roster absence
- a checked-in `EventEffects` export now exists too at
`artifacts/exports/rt3-1.06/event-effects-table.json`, and a checked-in semantic closure layer
now exists at `artifacts/exports/rt3-1.06/event-effects-semantic-catalog.json`