diff --git a/examples/connect_to_game.rs b/examples/connect_to_game.rs index 133fac6..886e4b4 100644 --- a/examples/connect_to_game.rs +++ b/examples/connect_to_game.rs @@ -6,8 +6,8 @@ use glacier2obj::connect::game_connection::GameConnection; pub fn main() { let args: Vec = env::args().collect(); if args.len() < 2 { - eprintln!("Usage: cargo run -- example connect_to_game "); + eprintln!("Usage: cargo run -- example connect_to_game "); return; } - GameConnection::get_entity_list_from_game(args[1].as_str(), args[2].as_str(), args[2].as_str()); + GameConnection::get_entity_list_from_game(args[1].as_str(), args[2].as_str()); } \ No newline at end of file diff --git a/examples/export_scenario.rs b/examples/export_scenario.rs index f1d8eeb..6a843bc 100644 --- a/examples/export_scenario.rs +++ b/examples/export_scenario.rs @@ -1,30 +1,23 @@ use std::env; -use glacier2obj::{connect::game_connection::GameConnection, extract::prim_extraction::PrimExtraction, json_serde::entities_json::EntitiesJson, package::package_scan::PackageScan, scene::scene_scan::SceneScan}; +use glacier2obj::{connect::game_connection::GameConnection, extract::aloc_extraction::AlocExtraction, json_serde::entities_json::EntitiesJson, package::package_scan::PackageScan}; -// Based on mount_game_files example from rpkg-rs pub fn main() { let args: Vec = env::args().collect(); - if args.len() < 9 { - eprintln!("Usage: cargo run -- example export_scenario "); + if args.len() < 7 { + eprintln!("Usage: cargo run -- example export_scenario "); return; } - let brick_tblu_hashes: Vec = EntitiesJson::get_brick_tblu_hashes(GameConnection::get_brick_hashes_from_game()); - println!("Scene tblu hashes: {:?}", brick_tblu_hashes); - let mut scan: SceneScan = SceneScan::new(brick_tblu_hashes, args[3].clone()); let partition_manager = PackageScan::scan_packages(args[1].clone(), args[2].clone()).unwrap(); - //scan.scan_scenario(&partition_manager); - //scan.output_to_file(args[4].clone()); - - GameConnection::get_entity_list_from_game(args[4].as_str(), args[5].as_str(), args[6].as_str()); - let prims_json = EntitiesJson::build_from_prims_file(args[5].clone()); - let needed_prim_hashes = PrimExtraction::get_needed_prim_hashes(&prims_json, args[8].clone()); + GameConnection::get_entity_list_from_game(args[3].as_str(), args[4].as_str()); + let prims_json = EntitiesJson::build_from_alocs_file(args[3].clone()); + let needed_prim_hashes = AlocExtraction::get_all_aloc_hashes(&prims_json, args[6].clone()); if needed_prim_hashes.is_empty() { println!("All prim files already exist. Skipping extraction."); } else { println!("Extracting {} prims.", needed_prim_hashes.len()); - PrimExtraction::extract_prims(args[7].clone(), needed_prim_hashes, &partition_manager, args[8].clone()); + AlocExtraction::extract_alocs(args[5].clone(), needed_prim_hashes, &partition_manager, args[6].clone()); } println!("Done building prims.json and extracting prims from scenario.") } diff --git a/examples/extract_prims.rs b/examples/extract_prims.rs index d9d4182..e69e64b 100644 --- a/examples/extract_prims.rs +++ b/examples/extract_prims.rs @@ -1,4 +1,4 @@ -use glacier2obj::extract::prim_extraction::PrimExtraction; +use glacier2obj::extract::aloc_extraction::AlocExtraction; use glacier2obj::json_serde::entities_json::EntitiesJson; use glacier2obj::package::package_scan::PackageScan; use std::env; @@ -10,13 +10,14 @@ fn main() { eprintln!("Usage: cargo run --example extract_prims -- "); return; } - let prims_json = EntitiesJson::build_from_prims_file(args[4].clone()); - let needed_prim_hashes = PrimExtraction::get_needed_prim_hashes(&prims_json, args[5].clone()); - if needed_prim_hashes.is_empty() { + let partition_manager = PackageScan::scan_packages(args[1].clone(), args[3].clone()).unwrap(); + let prims_json = EntitiesJson::build_from_alocs_file(args[4].clone()); + let needed_aloc_hashes = AlocExtraction::get_all_aloc_hashes(&prims_json, args[5].clone()); + if needed_aloc_hashes.is_empty() { println!("All prim files already exist. Skipping extraction."); return; } - println!("Extracting {} prims.", needed_prim_hashes.len()); + println!("Extracting {} prims.", needed_aloc_hashes.len()); let partition_manager = PackageScan::scan_packages(args[1].clone(), args[3].clone()).unwrap(); - PrimExtraction::extract_prims(args[2].clone(), needed_prim_hashes, &partition_manager, args[5].clone()); + AlocExtraction::extract_alocs(args[2].clone(), needed_aloc_hashes, &partition_manager, args[5].clone()); } \ No newline at end of file diff --git a/examples/read_prims.rs b/examples/read_prims.rs index 31ab32e..d0b5198 100644 --- a/examples/read_prims.rs +++ b/examples/read_prims.rs @@ -8,6 +8,6 @@ fn main() { eprintln!("Usage: cargo run --example read_prims -- "); return; } - let mut prims_json: EntitiesJson = EntitiesJson::build_from_prims_file(args[1].clone()); + let mut prims_json: EntitiesJson = EntitiesJson::build_from_alocs_file(args[1].clone()); prims_json.output_entities(); } \ No newline at end of file diff --git a/src/connect/game_connection.rs b/src/connect/game_connection.rs index 861049c..c0b6567 100644 --- a/src/connect/game_connection.rs +++ b/src/connect/game_connection.rs @@ -7,7 +7,7 @@ use url::Url; pub struct GameConnection; impl GameConnection { - pub fn get_brick_hashes_from_game() -> Vec { + pub fn get_entity_list_from_game(alocs_file_path: &str, pf_boxes_file_path: &str) { println!("Connecting to EditorServer on port 46735..."); io::stdout().flush().unwrap(); @@ -15,57 +15,16 @@ impl GameConnection { GameConnection::send_hello_message(&mut socket); GameConnection::send_message(&mut socket, "{\"type\":\"rebuildEntityTree\"}".to_string()); - GameConnection::send_message(&mut socket, "{\"type\":\"getBrickHashes\"}".to_string()); - return GameConnection::receive_brick_hashes_from_game(socket); - } - - fn receive_brick_hashes_from_game(mut socket: tungstenite::WebSocket>) -> Vec { - let mut welcome_received: bool = false; - let mut brick_messages: Vec = Vec::new(); - loop { - let msg = socket.read_message().expect("Error reading message"); - if msg.to_string().as_str() == "Done sending brick hashes." { - println!("Received scene hash. Closing connection to EditorServer and returning scene hash."); - io::stdout().flush().unwrap(); - break - } - if msg.to_string().as_str() == "{\"type\":\"entityTreeRebuilt\"}" { - println!("Entity Tree rebuilt. Sending prims to game..."); - io::stdout().flush().unwrap(); - continue - } - if welcome_received { - println!("Received scene hash from EditorServer: {}", msg); - io::stdout().flush().unwrap(); - brick_messages.push(msg.to_string()); - } else { - println!("Connected to EditorServer."); - println!("Rebuilding entity tree..."); - io::stdout().flush().unwrap(); - welcome_received = true; - } - } - return brick_messages; - } - - pub fn get_entity_list_from_game(prims_file_path: &str, pf_boxes_file_path: &str) { - println!("Connecting to EditorServer on port 46735..."); - io::stdout().flush().unwrap(); - - let mut socket = GameConnection::connect_to_game(); - - GameConnection::send_hello_message(&mut socket); - - GameConnection::send_message(&mut socket, r#"{"type":"listPrimEntities", "prims":[]}"#.to_string()); + GameConnection::send_message(&mut socket, r#"{"type":"listAlocEntities"}"#.to_string()); GameConnection::send_message(&mut socket, r#"{"type":"listPfBoxEntities"}"#.to_string()); - GameConnection::clear_file(prims_file_path); + GameConnection::clear_file(alocs_file_path); GameConnection::clear_file(pf_boxes_file_path); - let prims_file = OpenOptions::new() + let alocs_file = OpenOptions::new() .write(true) .append(true) - .open(prims_file_path) + .open(alocs_file_path) .unwrap(); let pf_boxes_file = OpenOptions::new() @@ -75,7 +34,7 @@ impl GameConnection { .unwrap(); - GameConnection::build_entity_list(socket, prims_file, pf_boxes_file); + GameConnection::build_entity_list(socket, alocs_file, pf_boxes_file); } fn connect_to_game() -> tungstenite::WebSocket> { @@ -94,33 +53,26 @@ impl GameConnection { let _ = socket.write_message(Message::Text(message.into())); } - fn get_input_file_contents(in_file_path: &str) -> String { - println!("Loading toFind.json file..."); - io::stdout().flush().unwrap(); - let in_file_contents = fs::read_to_string(in_file_path).expect(format!("Error opening {}. Run a scan to generate this file", in_file_path).as_str()); - in_file_contents - } - fn send_hello_message(socket: &mut tungstenite::WebSocket>) { println!("Sending hello message..."); io::stdout().flush().unwrap(); let _ = socket.write_message(Message::Text(r#"{"type":"hello","identifier":"glacier2obj"}"#.into())); } - fn build_entity_list(mut socket: tungstenite::WebSocket>, mut prims_file: fs::File, mut pf_boxes_file: fs::File) { + fn build_entity_list(mut socket: tungstenite::WebSocket>, mut alocs_file: fs::File, mut pf_boxes_file: fs::File) { let mut welcome_received: bool = false; let mut is_first: bool = true; - let mut reading_prims: bool = true; + let mut reading_alocs: bool = true; loop { let msg = socket.read_message().expect("Error reading message"); if msg.to_string().as_str() == "Done sending entities." { - if reading_prims { - reading_prims = false; - println!("Received Done message for prims. Finalizing prims.json output and getting pf boxes."); + if reading_alocs { + reading_alocs = false; + println!("Received Done message for alocs. Finalizing alocs.json output and getting pf boxes."); io::stdout().flush().unwrap(); - if let Err(e) = writeln!(prims_file, "]}}") { - eprintln!("Couldn't write to prims file: {}", e); + if let Err(e) = writeln!(alocs_file, "]}}") { + eprintln!("Couldn't write to alocs file: {}", e); io::stdout().flush().unwrap(); } is_first = true; @@ -136,15 +88,15 @@ impl GameConnection { } } if msg.to_string().as_str() == "{\"type\":\"entityTreeRebuilt\"}" { - println!("Entity Tree rebuilt. Sending prims to game..."); + println!("Entity Tree rebuilt."); io::stdout().flush().unwrap(); continue } if welcome_received { if !is_first { - if reading_prims { - if let Err(e) = writeln!(prims_file, ",") { - eprintln!("Couldn't write to prims file: {}", e); + if reading_alocs { + if let Err(e) = writeln!(alocs_file, ",") { + eprintln!("Couldn't write to alocs file: {}", e); io::stdout().flush().unwrap(); } } else { @@ -155,17 +107,17 @@ impl GameConnection { } } else { is_first = false; - if reading_prims { - println!("Received first PRIM transform from EditorServer. Continuing to process PRIM transforms..."); + if reading_alocs { + println!("Received first ALOC transform from EditorServer. Continuing to process ALOC transforms..."); io::stdout().flush().unwrap(); } else { println!("Received first pf box transform from EditorServer. Continuing to process pf box transforms..."); io::stdout().flush().unwrap(); } } - if reading_prims { - if let Err(e) = write!(prims_file, "{}", msg) { - eprintln!("Couldn't write to prims file: {}", e); + if reading_alocs { + if let Err(e) = write!(alocs_file, "{}", msg) { + eprintln!("Couldn't write to alocs file: {}", e); } } else { @@ -174,8 +126,8 @@ impl GameConnection { } } } else { - if let Err(e) = write!(prims_file, r#"{{"entities":["#) { - eprintln!("Couldn't write to prims file: {}", e); + if let Err(e) = write!(alocs_file, r#"{{"entities":["#) { + eprintln!("Couldn't write to alocs file: {}", e); } if let Err(e) = write!(pf_boxes_file, r#"{{"entities":["#) { eprintln!("Couldn't write to pf boxes file: {}", e); diff --git a/src/extract/prim_extraction.rs b/src/extract/aloc_extraction.rs similarity index 60% rename from src/extract/prim_extraction.rs rename to src/extract/aloc_extraction.rs index 371278f..8c8100d 100644 --- a/src/extract/prim_extraction.rs +++ b/src/extract/aloc_extraction.rs @@ -1,27 +1,29 @@ use std::thread::{self, ScopedJoinHandle}; use std::{collections::{HashMap, HashSet}, fs, io::{self, Write}, path::{Path, PathBuf}}; +use itertools::Itertools; +use rpkg_rs::misc::hash_path_list::PathList; use rpkg_rs::resource::{partition_manager::PartitionManager, resource_package::ResourcePackage, runtime_resource_id::RuntimeResourceID}; use crate::{json_serde::entities_json::EntitiesJson, package::package_scan::PackageScan}; -pub struct PrimExtraction; +pub struct AlocExtraction; -impl PrimExtraction { - pub fn extract_prims(runtime_folder: String, needed_prim_hashes: HashSet, partition_manager: &PartitionManager, prims_output_folder: String) { - let prim_count = needed_prim_hashes.len(); - let needed_prim_hashes_list = Vec::from_iter(needed_prim_hashes); +impl AlocExtraction { + pub fn extract_alocs(runtime_folder: String, needed_aloc_hashes: HashSet, partition_manager: &PartitionManager, alocs_output_folder: String) { + let aloc_count = needed_aloc_hashes.len(); + let needed_aloc_hashes_list = Vec::from_iter(needed_aloc_hashes); let target_num_threads = 10; - let prims_output_folder_ref = &prims_output_folder; + let alocs_output_folder_ref = &alocs_output_folder; let runtime_folder_ref = &runtime_folder; - println!("Creating directory '{}' if it doesn't exist.", prims_output_folder); - fs::create_dir_all(prims_output_folder_ref).expect("Failed to create prim folder"); - println!("Found {} needed prims. Using {} threads of ~{} prims per thread.", prim_count, target_num_threads, prim_count / target_num_threads); + println!("Creating directory '{}' if it doesn't exist.", alocs_output_folder); + fs::create_dir_all(alocs_output_folder_ref).expect("Failed to create aloc folder"); + println!("Found {} needed alocs. Using {} threads of ~{} alocs per thread.", aloc_count, target_num_threads, aloc_count / target_num_threads); thread::scope(|scope| { let mut handles: Vec> = Vec::new(); - for (thread_num, chunk) in needed_prim_hashes_list.chunks(prim_count.div_ceil(target_num_threads)).enumerate() { + for (thread_num, chunk) in needed_aloc_hashes_list.chunks(aloc_count.div_ceil(target_num_threads)).enumerate() { handles.push(scope.spawn(move || { - let prims_output_folder_path = PathBuf::from(String::from(prims_output_folder_ref)); + let alocs_output_folder_path = PathBuf::from(String::from(alocs_output_folder_ref)); let mut resource_packages: HashMap = HashMap::new(); let mut i = 0; @@ -37,7 +39,7 @@ impl PrimExtraction { io::stdout().flush().unwrap(); std::process::exit(0) })); - let prim_contents = rpkg + let aloc_contents = rpkg .read_resource(&package_path, &rrid) .unwrap_or_else(|e| { println!("Failed extract resource: {}", e); @@ -45,11 +47,11 @@ impl PrimExtraction { std::process::exit(0) }); - let prim_file_path_buf = prims_output_folder_path.join(hash.clone() + ".PRIM"); - let prim_file_path = prim_file_path_buf.as_os_str().to_str().unwrap(); - println!("Thread: {}: {} / {} Extracting {} from {} and saving to '{}'", thread_num, i, chunk.len(), hash, last_partition, prim_file_path); + let aloc_file_path_buf = alocs_output_folder_path.join(hash.clone() + ".ALOC"); + let aloc_file_path = aloc_file_path_buf.as_os_str().to_str().unwrap(); + println!("Thread: {}: {} / {} Extracting {} from {} and saving to '{}'", thread_num, i, chunk.len(), hash, last_partition, aloc_file_path); io::stdout().flush().unwrap(); - fs::write(prim_file_path, prim_contents).expect("File failed to be written"); + fs::write(aloc_file_path, aloc_contents).expect("File failed to be written"); } })); } @@ -61,20 +63,18 @@ impl PrimExtraction { } - pub fn get_needed_prim_hashes(prims_json: &EntitiesJson, prims_output_folder: String) -> HashSet { - let mut hashes: HashSet = HashSet::new(); + pub fn get_all_aloc_hashes(alocs_json: &EntitiesJson, alocs_output_folder: String) -> HashSet { + let mut aloc_hashes: HashSet = HashSet::new(); let mut needed_hashes: HashSet = HashSet::new(); - for entity in &prims_json.entities { - if entity.hash.clone() != "00724CDE424AFE76" { - hashes.insert(entity.hash.clone()); - } + for entity in &alocs_json.entities { + aloc_hashes.insert(entity.hash.clone()); } - let prims_output_folder_path = PathBuf::from(&prims_output_folder); - for hash in hashes { - let prim_file_path_buf = prims_output_folder_path.join(hash.clone() + ".PRIM"); - let prim_file_path = prim_file_path_buf.as_os_str().to_str().unwrap(); - if Path::new(prim_file_path).exists() { - println!("{} already exists, skipping extraction.", prim_file_path); + let alocs_output_folder_path = PathBuf::from(&alocs_output_folder); + for hash in aloc_hashes { + let aloc_file_path_buf = alocs_output_folder_path.join(hash.clone() + ".ALOC"); + let aloc_file_path = aloc_file_path_buf.as_os_str().to_str().unwrap(); + if Path::new(aloc_file_path).exists() { + println!("{} already exists, skipping extraction.", aloc_file_path); io::stdout().flush().unwrap(); continue; } diff --git a/src/extract/mod.rs b/src/extract/mod.rs index d88dad8..50a66b0 100644 --- a/src/extract/mod.rs +++ b/src/extract/mod.rs @@ -1 +1 @@ -pub mod prim_extraction; \ No newline at end of file +pub mod aloc_extraction; \ No newline at end of file diff --git a/src/json_serde/entities_json.rs b/src/json_serde/entities_json.rs index 2fe4fc9..795a581 100644 --- a/src/json_serde/entities_json.rs +++ b/src/json_serde/entities_json.rs @@ -1,32 +1,34 @@ -use serde::Deserialize; +use serde::{Serialize, Deserialize}; use std::{fs, io::{self, Write}}; -#[derive(Debug, Deserialize)] +use crate::json_serde::entities_json; + +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct EntitiesJson { pub entities: Vec, } impl EntitiesJson { - pub fn get_brick_tblu_hashes(brick_tblu_message_strings: Vec) -> Vec { - let mut brick_tblu_hashes: Vec = Vec::new(); - for brick_tblu_message_string in brick_tblu_message_strings { - let brick_message: BrickMessage = serde_json::from_str(&brick_tblu_message_string).expect("Error parsing scene hash."); - brick_tblu_hashes.push(brick_message.brick_hash); - } - return brick_tblu_hashes; + pub fn build_from_alocs_file(alocs_json_file: String) -> EntitiesJson { + println!("Building AlocsJson from alocs file: {}", alocs_json_file); + io::stdout().flush().unwrap(); + let alocs_json_string = fs::read_to_string(alocs_json_file.as_str()) + .expect("Should have been able to read the file"); + return EntitiesJson::build_from_alocs_json_string(alocs_json_string) } - pub fn build_from_prims_file(prims_json_file: String) -> EntitiesJson { - println!("Building PrimsJson from prims file: {}", prims_json_file); + pub fn write_to_alocs_file(&mut self, alocs_json_file: String) { + println!("Writing AlocsJson to alocs file: {}", alocs_json_file); io::stdout().flush().unwrap(); - let prims_json_string = fs::read_to_string(prims_json_file.as_str()) - .expect("Should have been able to read the file"); - return EntitiesJson::build_from_prims_json_string(prims_json_string) + let alocs_json_string = serde_json::to_string(&self.entities).unwrap(); + fs::write(alocs_json_file, alocs_json_string.as_str()) + .expect("Should have been able to write to the file"); + } - pub fn build_from_prims_json_string(prims_json_string: String) -> EntitiesJson { - return serde_json::from_str(&prims_json_string).expect("JSON was not well-formatted"); + pub fn build_from_alocs_json_string(alocs_json_string: String) -> EntitiesJson { + return serde_json::from_str(&alocs_json_string).expect("JSON was not well-formatted"); } pub fn output_entities(&mut self) { @@ -43,20 +45,20 @@ impl EntitiesJson { } } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct BrickMessage { pub brick_hash: String, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct EntityHashPair { pub hash: String, pub entity: Entity, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Entity { pub id: String, @@ -66,7 +68,7 @@ pub struct Entity { pub scale: Scale, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde()] pub struct Vec3 { pub x: f64, @@ -74,7 +76,7 @@ pub struct Vec3 { pub z: f64, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Rotation { pub yaw: f64, @@ -82,7 +84,7 @@ pub struct Rotation { pub roll: f64, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Scale { #[serde(rename = "type")] diff --git a/src/main.rs b/src/main.rs index d008843..4154fc8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,33 +1,32 @@ use std::{env, io::{self, Write}}; -use glacier2obj::{connect::game_connection::GameConnection, extract::prim_extraction::PrimExtraction, json_serde::entities_json::EntitiesJson, package::package_scan::PackageScan}; +use glacier2obj::{connect::game_connection::GameConnection, extract::aloc_extraction::AlocExtraction, json_serde::entities_json::EntitiesJson, package::package_scan::PackageScan}; -// Based on mount_game_files example from rpkg-rs pub fn main() { let args: Vec = env::args().collect(); if args.len() < 7 { - eprintln!("Usage: cargo run "); + eprintln!("Usage: cargo run "); return; } - let brick_tblu_hashes: Vec = EntitiesJson::get_brick_tblu_hashes(GameConnection::get_brick_hashes_from_game()); - println!("Scene tblu hashes: {:?}", brick_tblu_hashes); + io::stdout().flush().unwrap(); let partition_manager = PackageScan::scan_packages(args[1].clone(), args[2].clone()).unwrap(); GameConnection::get_entity_list_from_game(args[3].as_str(), args[4].as_str()); - let prims_json = EntitiesJson::build_from_prims_file(args[3].clone()); - let needed_prim_hashes = PrimExtraction::get_needed_prim_hashes(&prims_json, args[6].clone()); - if needed_prim_hashes.is_empty() { - println!("All prim files already exist. Skipping extraction."); + let alocs_json = EntitiesJson::build_from_alocs_file(args[3].clone()); + let needed_aloc_hashes = AlocExtraction::get_all_aloc_hashes(&alocs_json, args[6].clone()); + + if needed_aloc_hashes.is_empty() { + println!("All aloc files already exist. Skipping extraction."); io::stdout().flush().unwrap(); } else { - println!("Extracting {} prims.", needed_prim_hashes.len()); + println!("Extracting {} alocs.", needed_aloc_hashes.len()); io::stdout().flush().unwrap(); - PrimExtraction::extract_prims(args[5].clone(), needed_prim_hashes, &partition_manager, args[6].clone()); + AlocExtraction::extract_alocs(args[5].clone(), needed_aloc_hashes, &partition_manager, args[6].clone()); } - println!("Done building prims.json and extracting prims from scenario."); + println!("Done building alocs.json and extracting alocs from scenario."); io::stdout().flush().unwrap(); } diff --git a/src/scene/scene_scan.rs b/src/scene/scene_scan.rs index a80aecb..10d73c5 100644 --- a/src/scene/scene_scan.rs +++ b/src/scene/scene_scan.rs @@ -1,5 +1,4 @@ use rpkg_rs::misc::hash_path_list::PathList; -use rpkg_rs::misc::resource_id::ResourceID; use rpkg_rs::resource::partition_manager::PartitionManager; use rpkg_rs::resource::runtime_resource_id::RuntimeResourceID; use std::collections::{HashMap, HashSet, VecDeque}; @@ -79,8 +78,8 @@ impl SceneScan { let mut path_list = PathList::new(); path_list.parse_into(hash_list_path).unwrap(); - let brick_temp_hashes = SceneScan::get_brick_temp_hashes(self.bricks.clone(), partition_manager); - for brick_temp_hash in brick_temp_hashes { + let temp_hashes = SceneScan::get_brick_temp_hashes(self.bricks.clone(), partition_manager); + for brick_temp_hash in temp_hashes { let mut hash = brick_temp_hash; let mut hashes: VecDeque = VecDeque::from([String::from_str(&hash).unwrap()]); let mut found_hashes = HashSet::new();