Integrate all the progress into master #6
|
@ -1,6 +1,5 @@
|
|||
use crate::types::RawData;
|
||||
use cdtypes::types::{helper::*, sector::*};
|
||||
use tool_helper::print_warning;
|
||||
|
||||
pub struct SubModeBuilder {
|
||||
sub_mode: SubMode
|
||||
|
@ -111,7 +110,7 @@ pub fn create_xa_audio_for(data: &Vec<RawData>) -> Vec<Mode2Form2> {
|
|||
}
|
||||
sector_count_mode2_form2(biggest_size)
|
||||
};
|
||||
let channels = {
|
||||
let mut channels = {
|
||||
let mut new_channel = Vec::new();
|
||||
for channel in data {
|
||||
new_channel.push(&channel[0..channel.len()]);
|
||||
|
@ -123,20 +122,35 @@ pub fn create_xa_audio_for(data: &Vec<RawData>) -> Vec<Mode2Form2> {
|
|||
|
||||
for sector_id in 0..sectors_to_parse {
|
||||
let mut channel_id = 0;
|
||||
let sub_mode = {
|
||||
let mut sub_mode = SubMode::default_form2();
|
||||
|
||||
for channel in &channels {
|
||||
if sector_id + 1 == sectors_to_parse {
|
||||
sub_mode.set_eof();
|
||||
sub_mode.set_eor();
|
||||
}
|
||||
sub_mode
|
||||
};
|
||||
|
||||
for channel in &mut channels {
|
||||
let raw_data = {
|
||||
if channel.is_empty() {
|
||||
[0u8; Mode2Form2::DATA_SIZE]
|
||||
}
|
||||
|
||||
else {
|
||||
print_warning(format!("Encoding XA-Audio sector #{} for file {} not supported yet", sector_id, channel_id));
|
||||
[0u8; Mode2Form2::DATA_SIZE]
|
||||
let mut raw_data = [0u8; Mode2Form2::DATA_SIZE];
|
||||
|
||||
// v Skip header stuff
|
||||
*channel = &channel[0x18..channel.len()];
|
||||
*channel = copy_array(&mut raw_data, &channel);
|
||||
*channel = &channel[0x4..channel.len()];
|
||||
// ^ Skip EDC
|
||||
raw_data
|
||||
}
|
||||
|
||||
};
|
||||
sectors[cur_sector_id] = create_xa_audio_for_raw(SubMode::default_form2(), channel_id, &raw_data);
|
||||
sectors[cur_sector_id] = create_xa_audio_for_raw(sub_mode, channel_id, &raw_data);
|
||||
channel_id += 1;
|
||||
cur_sector_id += 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue