Improve lba_source handling

This commit is contained in:
jaby 2024-07-21 20:46:29 +02:00
parent aaab604f61
commit a624de92a1
3 changed files with 23 additions and 13 deletions

View File

@ -4,15 +4,14 @@
<License>%PSX_LICENSE_PATH%/%PSX_LICENSE%.DAT</License>
</Description>
<Track lead-out="0:2:0">
<!--TODO: JabyEngine should warn at runtime that I did not apply lba_source!-->
<File name = "SYSTEM.CNF">System.cnf.subst</File>
<Main name = "%PSX_BOOT_FILE%" lba_source = "../application/src/asset_mgr.cpp" >../application/bin/%PSX_TV_FORMAT%/PSX-release/PoolBox.psexe</Main>
<Overlay name = "BIO.BIN">../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.bios_info</Overlay>
<Overlay name = "BIO.BIN" lba_source = "" >../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.bios_info</Overlay>
<Overlay name = "CTO.BIN" lba_source = "../application/src/Overlay/ControllerTest/controller_test_assets.cpp">../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.controller_tests</Overlay>
<Overlay name = "GTO.BIN" lba_source = "../application/src/Overlay/GPUTest/gpu_test_assets.cpp" >../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.gpu_tests</Overlay>
<Overlay name = "GTE.BIN" lba_source = "../application/src/Overlay/GTETest/gte_test_assets.cpp" >../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.gte_tests</Overlay>
<Overlay name = "FCO.BIN">../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.font_cycler</Overlay>
<Overlay name = "SCO.BIN">../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.screen_center</Overlay>
<Overlay name = "FCO.BIN" lba_source = "" >../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.font_cycler</Overlay>
<Overlay name = "SCO.BIN" lba_source = "" >../application/bin/%PSX_TV_FORMAT%/PSX-release/Overlay.screen_center</Overlay>
<Directory name = "ASSETS" hidden = "true">
<Directory name = "MAIN">

View File

@ -1,6 +1,6 @@
[package]
name = "psxcdgen_ex"
version = "0.6.0"
version = "1.0.0"
edition = "2021"
[profile.release]

View File

@ -1,3 +1,4 @@
use attribute_names::LBA_SOURCE;
use cdtypes::types::time::Time;
use std::path::PathBuf;
use tool_helper::{format_if_error, path_with_env_from, print_warning, string_with_env_from};
@ -86,6 +87,7 @@ fn parse_track(track: roxmltree::Node, config: &mut Configuration) -> Result<(),
}
else {
tool_helper::print_warning(format!("The main file should always contain the \"{}\" attribute, even when just empty", LBA_SOURCE));
parse_regular_file(file, false)
}
}
@ -94,8 +96,17 @@ fn parse_track(track: roxmltree::Node, config: &mut Configuration) -> Result<(),
// v They will be compressed automatically
let common = read_common_properties(&file, is_hidden, Some(LZ4State::AlreadyCompressed))?;
let path = path_from_node(&file, &common.name)?;
let lba_source = {
if let Some(lba_source) = file.attribute(attribute_names::LBA_SOURCE) {
lba_source
}
Ok(File{common, path, kind: FileKind::Overlay(PathBuf::from(file.attribute(attribute_names::LBA_SOURCE).unwrap_or_default()))})
else {
tool_helper::print_warning(format!("Overlays should always contain the \"{}\" attribute, even when just empty", LBA_SOURCE));
""
}
};
Ok(File{common, path, kind: FileKind::Overlay(PathBuf::from(lba_source))})
}
fn parse_xa_audio(file: roxmltree::Node, is_hidden: bool) -> Result<File, Error> {