Rehost offline cargo economy sources
This commit is contained in:
parent
b06abb24a7
commit
517b01cd35
8 changed files with 1991 additions and 5 deletions
|
|
@ -17,13 +17,15 @@ use rrt_model::{
|
|||
load_binary_summary, load_function_map,
|
||||
};
|
||||
use rrt_runtime::{
|
||||
CAMPAIGN_SCENARIO_COUNT, CampaignExeInspectionReport, OBSERVED_CAMPAIGN_SCENARIO_NAMES,
|
||||
CAMPAIGN_SCENARIO_COUNT, CampaignExeInspectionReport, CargoEconomySourceReport,
|
||||
CargoSkinInspectionReport, CargoTypeInspectionReport, OBSERVED_CAMPAIGN_SCENARIO_NAMES,
|
||||
OVERLAY_IMPORT_DOCUMENT_FORMAT_VERSION, Pk4ExtractionReport, Pk4InspectionReport,
|
||||
RuntimeOverlayImportDocument, RuntimeOverlayImportDocumentSource, RuntimeSaveSliceDocument,
|
||||
RuntimeSaveSliceDocumentSource, RuntimeSnapshotDocument, RuntimeSnapshotSource, RuntimeSummary,
|
||||
SAVE_SLICE_DOCUMENT_FORMAT_VERSION, SNAPSHOT_FORMAT_VERSION, SmpClassicPackedProfileBlock,
|
||||
SmpInspectionReport, SmpLoadedSaveSlice, SmpRt3105PackedProfileBlock, SmpSaveLoadSummary,
|
||||
WinInspectionReport, execute_step_command, extract_pk4_entry_file, inspect_campaign_exe_file,
|
||||
inspect_cargo_economy_sources, 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,
|
||||
|
|
@ -139,6 +141,16 @@ enum Command {
|
|||
RuntimeInspectPk4 {
|
||||
pk4_path: PathBuf,
|
||||
},
|
||||
RuntimeInspectCargoTypes {
|
||||
cargo_types_dir: PathBuf,
|
||||
},
|
||||
RuntimeInspectCargoSkins {
|
||||
cargo_skin_pk4_path: PathBuf,
|
||||
},
|
||||
RuntimeInspectCargoEconomySources {
|
||||
cargo_types_dir: PathBuf,
|
||||
cargo_skin_pk4_path: PathBuf,
|
||||
},
|
||||
RuntimeInspectWin {
|
||||
win_path: PathBuf,
|
||||
},
|
||||
|
|
@ -272,6 +284,25 @@ struct RuntimePk4InspectionOutput {
|
|||
inspection: Pk4InspectionReport,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct RuntimeCargoTypeInspectionOutput {
|
||||
path: String,
|
||||
inspection: CargoTypeInspectionReport,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct RuntimeCargoSkinInspectionOutput {
|
||||
path: String,
|
||||
inspection: CargoSkinInspectionReport,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct RuntimeCargoEconomyInspectionOutput {
|
||||
cargo_types_dir: String,
|
||||
cargo_skin_pk4_path: String,
|
||||
inspection: CargoEconomySourceReport,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct RuntimeWinInspectionOutput {
|
||||
path: String,
|
||||
|
|
@ -815,6 +846,20 @@ fn real_main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
Command::RuntimeInspectPk4 { pk4_path } => {
|
||||
run_runtime_inspect_pk4(&pk4_path)?;
|
||||
}
|
||||
Command::RuntimeInspectCargoTypes { cargo_types_dir } => {
|
||||
run_runtime_inspect_cargo_types(&cargo_types_dir)?;
|
||||
}
|
||||
Command::RuntimeInspectCargoSkins {
|
||||
cargo_skin_pk4_path,
|
||||
} => {
|
||||
run_runtime_inspect_cargo_skins(&cargo_skin_pk4_path)?;
|
||||
}
|
||||
Command::RuntimeInspectCargoEconomySources {
|
||||
cargo_types_dir,
|
||||
cargo_skin_pk4_path,
|
||||
} => {
|
||||
run_runtime_inspect_cargo_economy_sources(&cargo_types_dir, &cargo_skin_pk4_path)?;
|
||||
}
|
||||
Command::RuntimeInspectWin { win_path } => {
|
||||
run_runtime_inspect_win(&win_path)?;
|
||||
}
|
||||
|
|
@ -993,6 +1038,28 @@ fn parse_command() -> Result<Command, Box<dyn std::error::Error>> {
|
|||
pk4_path: PathBuf::from(path),
|
||||
})
|
||||
}
|
||||
[command, subcommand, path]
|
||||
if command == "runtime" && subcommand == "inspect-cargo-types" =>
|
||||
{
|
||||
Ok(Command::RuntimeInspectCargoTypes {
|
||||
cargo_types_dir: PathBuf::from(path),
|
||||
})
|
||||
}
|
||||
[command, subcommand, path]
|
||||
if command == "runtime" && subcommand == "inspect-cargo-skins" =>
|
||||
{
|
||||
Ok(Command::RuntimeInspectCargoSkins {
|
||||
cargo_skin_pk4_path: PathBuf::from(path),
|
||||
})
|
||||
}
|
||||
[command, subcommand, cargo_types_dir, cargo_skin_pk4_path]
|
||||
if command == "runtime" && subcommand == "inspect-cargo-economy-sources" =>
|
||||
{
|
||||
Ok(Command::RuntimeInspectCargoEconomySources {
|
||||
cargo_types_dir: PathBuf::from(cargo_types_dir),
|
||||
cargo_skin_pk4_path: PathBuf::from(cargo_skin_pk4_path),
|
||||
})
|
||||
}
|
||||
[command, subcommand, path] if command == "runtime" && subcommand == "inspect-win" => {
|
||||
Ok(Command::RuntimeInspectWin {
|
||||
win_path: PathBuf::from(path),
|
||||
|
|
@ -1128,7 +1195,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-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 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-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(),
|
||||
),
|
||||
}
|
||||
|
|
@ -1490,6 +1557,41 @@ fn run_runtime_inspect_pk4(pk4_path: &Path) -> Result<(), Box<dyn std::error::Er
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn run_runtime_inspect_cargo_types(
|
||||
cargo_types_dir: &Path,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let report = RuntimeCargoTypeInspectionOutput {
|
||||
path: cargo_types_dir.display().to_string(),
|
||||
inspection: inspect_cargo_types_dir(cargo_types_dir)?,
|
||||
};
|
||||
println!("{}", serde_json::to_string_pretty(&report)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_runtime_inspect_cargo_skins(
|
||||
cargo_skin_pk4_path: &Path,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let report = RuntimeCargoSkinInspectionOutput {
|
||||
path: cargo_skin_pk4_path.display().to_string(),
|
||||
inspection: inspect_cargo_skin_pk4(cargo_skin_pk4_path)?,
|
||||
};
|
||||
println!("{}", serde_json::to_string_pretty(&report)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_runtime_inspect_cargo_economy_sources(
|
||||
cargo_types_dir: &Path,
|
||||
cargo_skin_pk4_path: &Path,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let report = RuntimeCargoEconomyInspectionOutput {
|
||||
cargo_types_dir: cargo_types_dir.display().to_string(),
|
||||
cargo_skin_pk4_path: cargo_skin_pk4_path.display().to_string(),
|
||||
inspection: inspect_cargo_economy_sources(cargo_types_dir, cargo_skin_pk4_path)?,
|
||||
};
|
||||
println!("{}", serde_json::to_string_pretty(&report)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn run_runtime_inspect_win(win_path: &Path) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let report = RuntimeWinInspectionOutput {
|
||||
path: win_path.display().to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue