Skip to content

Commit

Permalink
dev: pre-read cams
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabwhy committed Jun 15, 2024
1 parent 7b29469 commit 40de342
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 40de342

Please sign in to comment.