Pass lba calculation function as function
This commit is contained in:
parent
2e111ef6d0
commit
3995b95402
|
@ -5,14 +5,15 @@ pub mod encoder;
|
|||
pub mod file_writer;
|
||||
pub mod types;
|
||||
|
||||
use encoder::psx::calculate_psx_lbas;
|
||||
use tool_helper::read_file;
|
||||
use types::CDDesc;
|
||||
|
||||
pub fn process(config: config_reader::Configuration) -> Result<CDDesc, Error> {
|
||||
pub type CalculateLBAFunction = fn(&mut types::CDDesc);
|
||||
|
||||
pub fn process(config: config_reader::Configuration, calculate_lba: CalculateLBAFunction) -> Result<CDDesc, Error> {
|
||||
let mut cd_desc = parse_configuration(config)?;
|
||||
|
||||
calculate_psx_lbas(&mut cd_desc);
|
||||
calculate_lba(&mut cd_desc);
|
||||
Ok(cd_desc)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use psxcdgen_ex::{encoder::psx::encode_psx_image, file_writer::{ImageType, write_image}, types::{layout::Layout}, config_reader};
|
||||
use psxcdgen_ex::{encoder::psx::{encode_psx_image, calculate_psx_lbas}, file_writer::{ImageType, write_image}, types::{layout::Layout}, config_reader};
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
use tool_helper::Error;
|
||||
|
||||
fn run_main() -> Result<(), Error> {
|
||||
let desc = psxcdgen_ex::process(config_reader::parse_xml(std::fs::read_to_string("../Tests/ISO_Planschbecken.xml")?)?)?;
|
||||
let desc = psxcdgen_ex::process(config_reader::parse_xml(std::fs::read_to_string("../Tests/ISO_Planschbecken.xml")?)?, calculate_psx_lbas)?;
|
||||
|
||||
println!("\n<== Planschbecken ==>");
|
||||
for element in desc.get_memory_layout().iter() {
|
||||
|
|
Loading…
Reference in New Issue