Replace License Logo with TMD but results are bad?
This commit is contained in:
parent
f133b26283
commit
54f2b43b4f
|
@ -9,7 +9,8 @@
|
||||||
</Defaults>-->
|
</Defaults>-->
|
||||||
<Description>
|
<Description>
|
||||||
<Publisher>Jaby</Publisher>
|
<Publisher>Jaby</Publisher>
|
||||||
<License>%PSX_LICENSE_PATH%/%PSX_LICENSE%.DAT</License>
|
<!--<License>%PSX_LICENSE_PATH%/%PSX_LICENSE%.DAT</License>-->
|
||||||
|
<AltLicense>%JABY_ENGINE_DIR%/bin/extern/32BIT.TMD</AltLicense>
|
||||||
</Description>
|
</Description>
|
||||||
<Filesystem lead-out="0:2:0">
|
<Filesystem lead-out="0:2:0">
|
||||||
<File name = "SYSTEM.CNF">System.cnf.subst</File>
|
<File name = "SYSTEM.CNF">System.cnf.subst</File>
|
||||||
|
|
|
@ -64,11 +64,11 @@ fn parse_root(root: roxmltree::Node, config: &mut Configuration) -> Result<(), E
|
||||||
|
|
||||||
fn parse_description(description: roxmltree::Node, config: &mut Configuration) -> Result<(), Error> {
|
fn parse_description(description: roxmltree::Node, config: &mut Configuration) -> Result<(), Error> {
|
||||||
fn parse_license_path(license: roxmltree::Node) -> LicenseFile {
|
fn parse_license_path(license: roxmltree::Node) -> LicenseFile {
|
||||||
LicenseFile::from_option(path_from_node(&license, tag_names::LICENSE).ok())
|
LicenseFile::from_authentic_option(path_from_node(&license, tag_names::LICENSE).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_altlicense_path(license: roxmltree::Node) -> LicenseFile {
|
fn parse_altlicense_path(license: roxmltree::Node) -> LicenseFile {
|
||||||
LicenseFile::from_option(path_from_node(&license, tag_names::ALTLICENSE).ok())
|
LicenseFile::from_tmd_option(path_from_node(&license, tag_names::ALTLICENSE).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
for node in description.descendants() {
|
for node in description.descendants() {
|
||||||
|
@ -77,7 +77,7 @@ fn parse_description(description: roxmltree::Node, config: &mut Configuration) -
|
||||||
"Publisher" => config.publisher = Some(String::from(node.text().unwrap_or_default())),
|
"Publisher" => config.publisher = Some(String::from(node.text().unwrap_or_default())),
|
||||||
tag_names::LICENSE => config.license_file = parse_license_path(node),
|
tag_names::LICENSE => config.license_file = parse_license_path(node),
|
||||||
tag_names::ALTLICENSE => config.license_file = parse_altlicense_path(node),
|
tag_names::ALTLICENSE => config.license_file = parse_altlicense_path(node),
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,11 +237,19 @@ fn process_system_area(system_area: &SystemArea, sec_writer: &mut dyn SectorWrit
|
||||||
|
|
||||||
fn write_tmd_file(sec_writer: &mut dyn SectorWriter, tmd_file: BufferedInputFile) -> Result<(), Error> {
|
fn write_tmd_file(sec_writer: &mut dyn SectorWriter, tmd_file: BufferedInputFile) -> Result<(), Error> {
|
||||||
fn write_license_string(sec_writer: &mut dyn SectorWriter, text: &str) -> Result<(), Error> {
|
fn write_license_string(sec_writer: &mut dyn SectorWriter, text: &str) -> Result<(), Error> {
|
||||||
let mut license_string_buffer = [0u8; Mode2Form1::DATA_SIZE];
|
let text_len = text.len();
|
||||||
|
|
||||||
license_string_buffer[..Mode2Form1::DATA_SIZE].copy_from_slice(text[0..text.len()].as_bytes());
|
if text_len <= Mode2Form1::DATA_SIZE {
|
||||||
write_license_string_raw(sec_writer, &license_string_buffer)?;
|
let mut license_string_buffer = [0u8; Mode2Form1::DATA_SIZE];
|
||||||
Ok(())
|
|
||||||
|
license_string_buffer[..text_len].copy_from_slice(text[0..text_len].as_bytes());
|
||||||
|
write_license_string_raw(sec_writer, &license_string_buffer)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
Err(Error::from_text(format!("License string \"{}\" is longer then supported length {}", text, Mode2Form1::DATA_SIZE)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_license_logo(sec_writer: &mut dyn SectorWriter, mut tmd_file: BufferedInputFile) -> Result<(), Error> {
|
fn write_license_logo(sec_writer: &mut dyn SectorWriter, mut tmd_file: BufferedInputFile) -> Result<(), Error> {
|
||||||
|
|
|
@ -112,7 +112,7 @@ pub enum LicenseFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LicenseFile {
|
impl LicenseFile {
|
||||||
pub fn from_option(option: Option<PathBuf>) -> LicenseFile {
|
pub fn from_authentic_option(option: Option<PathBuf>) -> LicenseFile {
|
||||||
if let Some(path) = option {
|
if let Some(path) = option {
|
||||||
LicenseFile::Authentic(path)
|
LicenseFile::Authentic(path)
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,16 @@ impl LicenseFile {
|
||||||
LicenseFile::None
|
LicenseFile::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn from_tmd_option(option: Option<PathBuf>) -> LicenseFile {
|
||||||
|
if let Some(path) = option {
|
||||||
|
LicenseFile::TMD(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
LicenseFile::None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SystemArea {
|
pub struct SystemArea {
|
||||||
|
|
Loading…
Reference in New Issue