From 887244b9ef296278581a622a51443b05ef0b0240 Mon Sep 17 00:00:00 2001 From: cohaereo Date: Sun, 4 Aug 2024 21:15:53 +0200 Subject: [PATCH] audio: Fix DLLs not being copied --- Cargo.lock | 6 ++-- Cargo.toml | 2 +- src/gui/texture.rs | 68 +++++++++++++++++++++++++++++++++++++++++----- src/scanner.rs | 1 - src/tagtypes.rs | 2 +- 5 files changed, 66 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ad2752..347a2e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3453,8 +3453,8 @@ dependencies = [ [[package]] name = "vgmstream" -version = "0.1.4" -source = "git+https://github.com/cohaereo/vgmstream-rs/#4f14acc9b092d9ae6cbc7fc28ce3807ba3d71419" +version = "0.1.5" +source = "git+https://github.com/cohaereo/vgmstream-rs/#3575deb148c145b55db5820d055476eb893fe353" dependencies = [ "anyhow", "vgmstream-sys", @@ -3463,7 +3463,7 @@ dependencies = [ [[package]] name = "vgmstream-sys" version = "0.1.0" -source = "git+https://github.com/cohaereo/vgmstream-rs/#4f14acc9b092d9ae6cbc7fc28ce3807ba3d71419" +source = "git+https://github.com/cohaereo/vgmstream-rs/#3575deb148c145b55db5820d055476eb893fe353" [[package]] name = "virtue" diff --git a/Cargo.toml b/Cargo.toml index 2a38aca..afba35f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ binrw = "0.13.3" destiny-pkg = { version = "0.12.2", features = ["bincode"] } serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.108" -vgmstream = { git = "https://github.com/cohaereo/vgmstream-rs/", version = "0.1.4" } +vgmstream = { git = "https://github.com/cohaereo/vgmstream-rs/", version = "0.1.5" } wav = "1.0.0" zstd = { version = "0.13.0", features = ["zstdmt"] } either = "1.10.0" diff --git a/src/gui/texture.rs b/src/gui/texture.rs index 46338ec..d8fdb67 100644 --- a/src/gui/texture.rs +++ b/src/gui/texture.rs @@ -81,7 +81,7 @@ pub struct TextureHeaderRoiPs4 { } #[derive(Debug, BinRead)] -pub struct TextureHeaderRoiXbox { +pub struct TextureHeaderDevAlphaX360 { pub format: DxgiFormat, #[br(seek_before = SeekFrom::Start(0x2c), assert(beefcafe == 0xbeefcafe))] @@ -96,6 +96,21 @@ pub struct TextureHeaderRoiXbox { // pub flags3: u32, } +#[derive(Debug, BinRead)] +pub struct TextureHeaderRoiXbox { + pub format: DxgiFormat, + + #[br(seek_before = SeekFrom::Start(0x36))] + pub width: u16, + pub height: u16, + pub depth: u16, + // pub flags1: u32, + // pub flags2: u32, + // pub flags3: u32, + #[br(seek_before = SeekFrom::Start(0x48), assert(beefcafe == 0xbeefcafe))] + pub beefcafe: u32, +} + pub struct Texture { pub view: wgpu::TextureView, pub handle: wgpu::Texture, @@ -294,14 +309,29 @@ impl Texture { if package_manager().version.is_d1() && !matches!( package_manager().platform, - PackagePlatform::PS4 | PackagePlatform::XboxOne + PackagePlatform::PS4 | PackagePlatform::XboxOne | PackagePlatform::X360 ) { anyhow::bail!("Textures are not supported for D1"); } match package_manager().version { - GameVersion::DestinyInternalAlpha | GameVersion::DestinyTheTakenKing => todo!(), + GameVersion::DestinyInternalAlpha | GameVersion::DestinyTheTakenKing => { + match package_manager().platform { + PackagePlatform::X360 => { + let texture: TextureHeaderDevAlphaX360 = + package_manager().read_tag_binrw(hash)?; + Ok(TextureDesc { + format: texture.format.to_wgpu()?, + width: texture.width as u32, + height: texture.height as u32, + depth: texture.depth as u32, + premultiply_alpha: false, + }) + } + _ => unreachable!("Unsupported platform for legacy D1 textures"), + } + } GameVersion::DestinyRiseOfIron => match package_manager().platform { PackagePlatform::PS4 => { let texture: TextureHeaderRoiPs4 = package_manager().read_tag_binrw(hash)?; @@ -364,14 +394,38 @@ impl Texture { if package_manager().version.is_d1() && !matches!( package_manager().platform, - PackagePlatform::PS4 | PackagePlatform::XboxOne + PackagePlatform::PS4 | PackagePlatform::XboxOne | PackagePlatform::X360 ) { - anyhow::bail!("Textures are not supported for D1"); + anyhow::bail!( + "Textures are not supported for D1 on platform {}", + package_manager().platform + ); } match package_manager().version { - GameVersion::DestinyInternalAlpha | GameVersion::DestinyTheTakenKing => todo!(), + GameVersion::DestinyInternalAlpha | GameVersion::DestinyTheTakenKing => { + match package_manager().platform { + // PackagePlatform::X360 => { + // let (texture, texture_data, comment) = + // Self::load_data_roi_x360(hash, true)?; + // Self::create_texture( + // rs, + // hash, + // TextureDesc { + // format: texture.format.to_wgpu()?, + // width: texture.width as u32, + // height: texture.height as u32, + // depth: texture.depth as u32, + // premultiply_alpha, + // }, + // texture_data, + // Some(comment), + // ) + // } + _ => anyhow::bail!("Unsupported platform for legacy D1 textures"), + } + } GameVersion::DestinyRiseOfIron => match package_manager().platform { PackagePlatform::PS4 => { let (texture, texture_data, comment) = Self::load_data_roi_ps4(hash, true)?; @@ -390,7 +444,7 @@ impl Texture { ) } PackagePlatform::XboxOne => { - anyhow::bail!("Xbox One textures are not supported yet"); + // anyhow::bail!("Xbox One textures are not supported yet"); let (texture, texture_data, comment) = Self::load_data_roi_xone(hash, true)?; Self::create_texture( rs, diff --git a/src/scanner.rs b/src/scanner.rs index ec2dffa..a81640b 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -287,7 +287,6 @@ lazy_static::lazy_static! { static ref SCANNER_PROGRESS: RwLock = RwLock::new(ScanStatus::None); } -/// Returns Some((current_package, total_packages)) if there's a scan in progress pub fn scanner_progress() -> ScanStatus { *SCANNER_PROGRESS.read() } diff --git a/src/tagtypes.rs b/src/tagtypes.rs index 23c840e..b7083be 100644 --- a/src/tagtypes.rs +++ b/src/tagtypes.rs @@ -203,7 +203,7 @@ impl TagType { (128, 0) => TagType::TagGlobal, (0, 15) => TagType::WwiseBank, (2, 16) => TagType::WwiseStream, - (32 | 0, _) => { + (32 | 64 | 1, _) => { let is_header = t == 32; match st { 1 => TagType::Texture2D { is_header },