Integrate all the progress into master #6

Merged
jaby merged 595 commits from ToolBox into main 2025-01-01 13:17:44 +00:00
4 changed files with 38 additions and 26 deletions
Showing only changes of commit 3ce5dcff12 - Show all commits

View File

@ -33,7 +33,6 @@ namespace JabyEngine {
Command::send_wait<CD_IO::PortIndex0>(CD_IO::Command::SetLoc, loc.get_min_cd(), loc.get_sec_cd(), loc.get_sector_cd());
Command::send<CD_IO::PortIndex0>(desc);
current_state = State::Reading;
printf("Done??\n");
}
static void read_sector_dma(CD_IO::DataSector& sector) {
@ -160,7 +159,6 @@ namespace JabyEngine {
}
void read_s(uint32_t lba) {
printf("Now ReadS %i\n", lba);
read_cd(lba, CD_IO::Command::ReadS);
}

View File

@ -1,4 +1,4 @@
use crate::types::RawData;
use crate::types::{helper::InterleavedXASizes, RawData};
use cdtypes::types::{helper::*, sector::*};
pub struct SubModeBuilder {
@ -100,16 +100,9 @@ pub fn create_xa_data_for_vec(sub_mode: Option<SubMode>, data: &RawData) -> Vec<
}
pub fn create_xa_audio_for(data: &Vec<RawData>) -> Vec<Mode2Form2> {
let channel_count = data.len();
let sectors_to_parse = {
let mut biggest_size = 0;
for channel in data {
if channel.len() > biggest_size {
biggest_size = channel.len();
}
}
sector_count_mode2_form2(biggest_size)
let (channel_count, sectors_to_parse) = {
let size_info = InterleavedXASizes::new(data);
(size_info.channels, size_info.biggest_file_sectors)
};
let mut channels = {
let mut new_channel = Vec::new();

View File

@ -1,3 +1,5 @@
use cdtypes::types::helper::sector_count_mode2_form2;
use super::*;
const CURRENT_DIR_NAME:&'static str = "\x00";
@ -97,3 +99,29 @@ pub fn collect_directory_record_member(dir: &Directory) -> Vec<DirectoryRecordMe
collection.sort_by(|a, b| {a.get_name().cmp(b.get_name())});
collection
}
pub struct InterleavedXASizes {
pub channels: usize,
pub biggest_file_sectors: usize,
pub full_size_bytes: usize,
}
impl InterleavedXASizes {
pub fn new(content: &Vec<RawData>) -> InterleavedXASizes {
let biggest_file_size = {
let mut biggest_size = 0;
for channel in content {
if channel.len() > biggest_size {
biggest_size = channel.len();
}
}
biggest_size
};
let channels = content.len();
let biggest_file_sectors = sector_count_mode2_form2(biggest_file_size);
InterleavedXASizes{
channels, biggest_file_sectors, full_size_bytes: channels*biggest_file_sectors*Mode2Form2::DATA_SIZE
}
}
}

View File

@ -3,11 +3,13 @@ pub mod layout;
pub mod file_map;
pub mod overlay;
use cdtypes::types::{cdstring::DString, dir_record::DirectoryRecord, helper::xa_audio_interleave_count, path_table::PathTableL, sector::AudioSample};
use cdtypes::types::{cdstring::DString, dir_record::DirectoryRecord, helper::xa_audio_interleave_count, path_table::PathTableL, sector::{AudioSample, Mode2Form2}};
use std::{cell::RefCell, path::PathBuf, rc::Rc};
pub use file_map::FileSystemMap;
pub use tool_helper::Error;
use crate::types::helper::InterleavedXASizes;
pub type SharedPtr<T> = Rc<RefCell<T>>;
pub type RawData = Vec<u8>;
@ -258,19 +260,10 @@ impl File {
}
content
}
let content = increase_content(content);
let content_size = InterleavedXASizes::new(&content);
let content = increase_content(content);
let channel_count = content.len();
let highest_size = {
let mut size = 0;
for channel in &content {
if channel.len() > size {
size = channel.len();
}
}
size
};
Self::new_from_content(file_name, FileType::XAAudio(content), highest_size*channel_count)
Self::new_from_content(file_name, FileType::XAAudio(content), content_size.full_size_bytes)
}
pub fn is_streaming_file(&self) -> bool {