Skip to content

Commit

Permalink
logic for metadata manual import
Browse files Browse the repository at this point in the history
  • Loading branch information
rirurin committed Mar 8, 2024
1 parent f4d9262 commit 97a9a9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions UtocEmulator/fileemu-utoc-stream-emulator/src/io_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,11 @@ impl ContainerHeaderPackage {
}
// If required, import ids can be manually specified from the metadata file. Trying to generate a
// UCAS file with no external metadata was always going to be a challenge
fn import_from_metadata_file(meta_guard: &mut MutexGuard<Option<UtocMetadata>>) -> Vec<u64> {
vec![]
fn import_from_metadata_file(meta: &UtocMetadata, hash: u64) -> Vec<u64> {
match meta.get_manual_import(hash) {
Some(n) => n.clone(),
None => vec![]
}
}
// Parse the package file to extract the values needed to build a store entry in the container header
pub fn from_package_summary<
Expand All @@ -487,7 +490,7 @@ impl ContainerHeaderPackage {
//println!("VALIDATE PACKAGE {} ({:X})", path, hash);
ContainerHeaderPackage::import_from_graph_packages_validated::<TReader, TByteOrder>(file_reader, &package_summary, &graph_packages)
},
UtocMetaImportType::Manual => ContainerHeaderPackage::import_from_metadata_file(meta_guard),
UtocMetaImportType::Manual => ContainerHeaderPackage::import_from_metadata_file(m, hash),
UtocMetaImportType::GraphPackageUnvalidated => ContainerHeaderPackage::imports_from_graph_packges_unvalidated(&graph_packages)
}
},
Expand Down
3 changes: 3 additions & 0 deletions UtocEmulator/fileemu-utoc-stream-emulator/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ impl UtocMetadata {
}
return UtocMetaImportType::GraphPackageUnvalidated;
}
pub fn get_manual_import(&self, hash: u64) -> Option<&Vec<u64>> {
self.manual_import_assets.get(&hash)
}
}

0 comments on commit 97a9a9f

Please sign in to comment.