Reconstruct raw save company debt and capacity
This commit is contained in:
parent
0fbe03e470
commit
a58680481f
6 changed files with 1185 additions and 73 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue