diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml
index 683a589a..fa2cc9af 100644
--- a/examples/PoolBox/iso/Config.xml
+++ b/examples/PoolBox/iso/Config.xml
@@ -31,6 +31,6 @@
../assets/bin/TexturePage.bin
../assets/bin/IconTexture.bin
-
+ ../assets/audio/Evacuation_cdda.wav
\ No newline at end of file
diff --git a/src/Tools/cdtypes/Cargo.toml b/src/Tools/cdtypes/Cargo.toml
index 9cbbcef7..eb41236c 100644
--- a/src/Tools/cdtypes/Cargo.toml
+++ b/src/Tools/cdtypes/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cdtypes"
-version = "0.5.5"
+version = "0.6.0"
edition = "2021"
[profile.release]
diff --git a/src/Tools/cdtypes/src/cd/sector.rs b/src/Tools/cdtypes/src/cd/sector.rs
index 303f9f64..8549d754 100644
--- a/src/Tools/cdtypes/src/cd/sector.rs
+++ b/src/Tools/cdtypes/src/cd/sector.rs
@@ -1,4 +1,4 @@
-use super::super::{types::{error_correction::*, sector::*}};
+use super::super::types::{error_correction::*, sector::*};
#[derive(Clone)]
pub enum Sector {
diff --git a/src/Tools/cdtypes/src/types/dir_record.rs b/src/Tools/cdtypes/src/types/dir_record.rs
index 783f4349..2eb46dd7 100644
--- a/src/Tools/cdtypes/src/types/dir_record.rs
+++ b/src/Tools/cdtypes/src/types/dir_record.rs
@@ -1,4 +1,4 @@
-use super::{date::SmallDate, helper::{force_convert_ascii_to_str}, lsb_msb::{ReadWriteEndian, BigEndianU16, LittleBigEndianU32, LittleBigEndianU16}};
+use super::{date::SmallDate, helper::force_convert_ascii_to_str, lsb_msb::{ReadWriteEndian, BigEndianU16, LittleBigEndianU32, LittleBigEndianU16}};
use crate::read_write_bit_getter_setter;
use std::concat;
diff --git a/src/Tools/cdtypes/src/types/helper.rs b/src/Tools/cdtypes/src/types/helper.rs
index ad2538b5..f3f667c0 100644
--- a/src/Tools/cdtypes/src/types/helper.rs
+++ b/src/Tools/cdtypes/src/types/helper.rs
@@ -39,6 +39,10 @@ pub fn force_convert_ascii_to_str(bytes: &[u8]) -> &str {
}
}
+pub const fn sector_count_audio(audio_samples: usize) -> usize {
+ multiple_of_round_up(audio_samples, sector::Audio::SAMPLE_SIZE)
+}
+
pub const fn sector_count_mode2_form1(data_size: usize) -> usize {
multiple_of_round_up(data_size, sector::Mode2Form1::DATA_SIZE)
}
diff --git a/src/Tools/cdtypes/src/types/sector.rs b/src/Tools/cdtypes/src/types/sector.rs
index 3357f06c..c5bee669 100644
--- a/src/Tools/cdtypes/src/types/sector.rs
+++ b/src/Tools/cdtypes/src/types/sector.rs
@@ -309,7 +309,7 @@ impl std::default::Default for AudioSample {
#[repr(packed(1))]
#[derive(Clone)]
pub struct Audio {
- samples: [AudioSample; Self::SAMPLE_SIZE]
+ pub samples: [AudioSample; Self::SAMPLE_SIZE]
}
impl Audio {
diff --git a/src/Tools/psxcdgen_ex/Cargo.toml b/src/Tools/psxcdgen_ex/Cargo.toml
index b3e84b29..8ecceb95 100644
--- a/src/Tools/psxcdgen_ex/Cargo.toml
+++ b/src/Tools/psxcdgen_ex/Cargo.toml
@@ -1,16 +1,17 @@
[package]
name = "psxcdgen_ex"
-version = "0.2.3"
+version = "0.3.0"
edition = "2021"
[profile.release]
panic = "abort"
[dependencies]
-cdtypes = {path = "../cdtypes"}
-clap = {version = "4.4.11", features = ["derive"]}
-colored = "2.1.0"
-no-comment = "0.0.3"
-paste = "1.0.14"
-roxmltree = "0.19.0"
-tool_helper = {path = "../tool_helper"}
+cdtypes = {path = "../cdtypes"}
+clap = {version = "4.4.11", features = ["derive"]}
+colored = "2.1.0"
+no-comment = "0.0.3"
+paste = "1.0.14"
+roxmltree = "0.19.0"
+tool_helper = {path = "../tool_helper"}
+wav = "1.0.0"
diff --git a/src/Tools/psxcdgen_ex/src/config_reader/mod.rs b/src/Tools/psxcdgen_ex/src/config_reader/mod.rs
index 566db654..380ec0b8 100644
--- a/src/Tools/psxcdgen_ex/src/config_reader/mod.rs
+++ b/src/Tools/psxcdgen_ex/src/config_reader/mod.rs
@@ -9,14 +9,15 @@ pub enum LZ4State {
}
pub struct Configuration {
- pub publisher: Option,
- pub license_path: Option,
- pub root: Directory,
+ pub publisher: Option,
+ pub license_path: Option,
+ pub root: Directory,
+ pub cd_audio_files: Vec,
}
impl Configuration {
pub fn new() -> Configuration {
- Configuration{publisher: None, license_path: None, root: Directory::new("root", false)}
+ Configuration{publisher: None, license_path: None, root: Directory::new("root", false), cd_audio_files: Vec::new()}
}
}
diff --git a/src/Tools/psxcdgen_ex/src/config_reader/xml.rs b/src/Tools/psxcdgen_ex/src/config_reader/xml.rs
index 234d2726..d05c4a1a 100644
--- a/src/Tools/psxcdgen_ex/src/config_reader/xml.rs
+++ b/src/Tools/psxcdgen_ex/src/config_reader/xml.rs
@@ -32,11 +32,11 @@ fn parse_iso_project(iso_project: roxmltree::Node, config: &mut Configuration) -
match node.tag_name().name() {
"Description" => parse_description(node, config),
"Track" => parse_track(node, config),
+ "CD_Audio" => parse_cd_audio(node, config),
_ => Ok(())
}?;
}
}
-
Ok(())
}
@@ -110,6 +110,11 @@ fn parse_track(track: roxmltree::Node, config: &mut Configuration) -> Result<(),
parse_file_system(track, &mut config.root, false)
}
+fn parse_cd_audio(cdda: roxmltree::Node, config: &mut Configuration) -> Result<(), Error> {
+ config.cd_audio_files.push(path_from_node(&cdda, "CD Audio file")?);
+ Ok(())
+}
+
fn read_common_properties(xml: &roxmltree::Node, is_hidden: bool, force_lz4_state: Option) -> Result {
let lz4_state = {
if let Some(forced_lz4_state) = force_lz4_state {
diff --git a/src/Tools/psxcdgen_ex/src/encoder/builder.rs b/src/Tools/psxcdgen_ex/src/encoder/builder.rs
index fe00ec3e..bbe6bcc2 100644
--- a/src/Tools/psxcdgen_ex/src/encoder/builder.rs
+++ b/src/Tools/psxcdgen_ex/src/encoder/builder.rs
@@ -24,6 +24,20 @@ impl SubModeBuilder {
}
}
+pub fn create_audio_for_vec(audio_samples: &Vec) -> Vec