diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ed4bd1f..9ac2716 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3291,13 +3291,10 @@ dependencies = [ [[package]] name = "sourcepak" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c04d084e670e5227dd0c5a446515e861c102badc5987afb6737f439a1a2ba77" +version = "0.2.0" dependencies = [ "crc", "lzham-alpha-sys", - "once_cell", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 90b5334..fd53d86 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -14,7 +14,8 @@ tauri-build = { version = "2.0.0-beta", features = [] } tauri = { version = "2.0.0-beta.22", features = ["linux-ipc-protocol"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -sourcepak = { version = "0.1.1", features = ["respawn"] } +#sourcepak = { version = "0.1.1", features = ["respawn"] } +sourcepak = { path = "../../sourcepak-rs", features = ["respawn"] } urlencoding = "2.1.3" rayon = "1.8.1" tauri-plugin-dialog = "2.0.0-beta.9" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 6eceda7..ba039fb 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -92,11 +92,16 @@ async fn load_vpk(state: tauri::State<'_, AppState>, vpk_path: String) -> Result let vpk = VPKRespawn::try_from(&mut file); match vpk { - Ok(vpk) => { + Ok(mut vpk) => { let mut state_guard = state.inner.lock().unwrap(); println!("VPK loaded: {}", &vpk_path); + let archive_path = vpk_archive_path(&vpk_path); + let vpk_name = get_vpk_name(&vpk_path); + println!("Attempting to read VPK CAM files from: {}", &archive_path); + vpk.read_all_cams(&archive_path, &vpk_name)?; + state_guard.vpk_path = Some(vpk_path); state_guard.loaded_format = Some(PakFormat::VPKRespawn); state_guard.revpk = Some(vpk);