Improve psxcdread

This commit is contained in:
2024-07-28 13:22:39 -05:00
parent 27287773b7
commit 5ec7acb803
6 changed files with 43 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "psxcdread"
version = "0.5.0"
version = "0.7.0"
edition = "2021"
[profile.release]

View File

@@ -1,5 +1,5 @@
use psxcdread::{*};
use cdtypes::{Error, cd::CD, types::{cue, sector::SECTOR_SIZE}};
use cdtypes::{cd::{reader::UnknownSectorBehavior, CD}, types::{cue, sector::SECTOR_SIZE}, Error};
use std::{fs::OpenOptions, io::{stdin, stdout, Write}, path::{Path, PathBuf}};
fn open_file(path: &Path, write_access: bool) -> Result<std::fs::File, Error> {
@@ -48,7 +48,7 @@ fn open_cue(file: std::fs::File, cue_path: &Path) -> Result<CD, Error> {
}
let specifier = cue::read::read(file)?;
if let Some(bin_path) = get_bin_path(&specifier, cue_path)? {
Ok(CD::from_file(open_file(bin_path.as_path(), false)?, Some(specifier))?)
Ok(CD::from_file(open_file(bin_path.as_path(), false)?, Some(specifier), UnknownSectorBehavior::CauseError)?)
}
else {
@@ -74,7 +74,7 @@ fn open_cd(path: &str) -> Result<CD, Error> {
}
else {
Ok(CD::from_file(file, None)?)
Ok(CD::from_file(file, None, UnknownSectorBehavior::TreatAsAudio)?)
}
}