Fix CD image for PKG files
This commit is contained in:
parent
bf67b83629
commit
5ed8b76902
|
@ -5,7 +5,8 @@
|
|||
</Description>
|
||||
<Track>
|
||||
<File name = "SYSTEM.CNF">System.cnf</File>
|
||||
<Main name = "XXXX_AAA.AA" lba_source = "../application/src/asset_mgr.cpp">../application/bin/%TV_FORMAT%/PSX-release/PoolBox.psexe</Main>
|
||||
<!--Use SLES_000.25;1 for pkg generation otherwise leave as "XXXX_AAA.AA"-->
|
||||
<Main name = "SLES_000.25" lba_source = "../application/src/asset_mgr.cpp">../application/bin/%TV_FORMAT%/PSX-release/PoolBox.psexe</Main>
|
||||
<Overlay name = "CTO.BIN" lba_source = "../application/src/Overlay/ControllerTest/controller_test_assets.cpp">../application/bin/%TV_FORMAT%/PSX-release/Overlay.controller_tests</Overlay>
|
||||
<Overlay name = "GTO.BIN" lba_source = "../application/src/Overlay/GPUTest/gpu_test_assets.cpp">../application/bin/%TV_FORMAT%/PSX-release/Overlay.gpu_tests</Overlay>
|
||||
<Overlay name = "GTE.BIN">../application/bin/%TV_FORMAT%/PSX-release/Overlay.gte_tests</Overlay>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
BOOT=cdrom:\XXXX_AAA.AA;1
|
||||
BOOT=cdrom:\SLES_000.25;1
|
||||
TCB=4
|
||||
EVENT=10
|
||||
STACK=801FFFF0
|
|
@ -121,6 +121,7 @@ namespace JabyEngine {
|
|||
__debug_boot_color_at(::JabyEngine::GPU::Color24::Red(), DebugX, DebugY, DebugScale);
|
||||
SPU::stop_voices();
|
||||
|
||||
// TODO: v Might be the PS3 crash
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::Green(), DebugX, DebugY, DebugScale);
|
||||
CD::setup();
|
||||
__debug_boot_color_at(::JabyEngine::GPU::Color24::Blue(), DebugX, DebugY, DebugScale);
|
||||
|
|
|
@ -108,7 +108,7 @@ pub fn encode_psx_image(cd_desc: &CDDesc, sec_writer: &mut dyn SectorWriter) ->
|
|||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
process_end_dummy_section(cd_desc.end_dummy_padding, sec_writer)
|
||||
}
|
||||
|
||||
fn process_system_area(system_area: &SystemArea, sec_writer: &mut dyn SectorWriter) -> Result<(), Error> {
|
||||
|
@ -353,6 +353,14 @@ fn process_file(file: &File, sec_writer: &mut dyn SectorWriter) -> Result<(), Er
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn process_end_dummy_section(padding: usize, sec_writer: &mut dyn SectorWriter) -> Result<(), Error> {
|
||||
for _ in 0..sector_count_mode2_form1(padding) {
|
||||
sec_writer.write_cd_xa_data(builder::create_xa_data_zero())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_path_table(path_table: &PathTable) -> Result<(), Error> {
|
||||
if path_table.size_bytes > Mode2Form1::DATA_SIZE {
|
||||
Err(Error::from_text(format!("Path Tables are not allowed to be bigger then {} bytes - Path Table has {} bytes", Mode2Form1::DATA_SIZE, path_table.size_bytes)))
|
||||
|
|
|
@ -29,7 +29,9 @@ pub fn process(config: config_reader::Configuration, calculate_lba: LbaCalculato
|
|||
Ok((cd_desc, lba_embedded_files))
|
||||
}
|
||||
|
||||
pub fn process_files(file_map: FileSystemMap, lba_embedded_files: LBAEmbeddedFiles, length_func: LengthCalculatorFunction) -> Result<(), Error> {
|
||||
pub fn process_files(file_map: FileSystemMap, lba_embedded_files: LBAEmbeddedFiles, length_func: LengthCalculatorFunction) -> Result<usize, Error> {
|
||||
let mut size_bytes = 0;
|
||||
|
||||
for lba_embedded_file_raw in lba_embedded_files {
|
||||
let new_content_info = {
|
||||
let mut lba_embedded_file = lba_embedded_file_raw.borrow_mut();
|
||||
|
@ -59,9 +61,10 @@ pub fn process_files(file_map: FileSystemMap, lba_embedded_files: LBAEmbeddedFil
|
|||
}
|
||||
}
|
||||
}
|
||||
size_bytes += lba_embedded_file_raw.borrow().get_extended_size();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(size_bytes)
|
||||
}
|
||||
|
||||
pub fn dump_content(cd_desc: &CDDesc, mut out: Output) -> Result<(), Error> {
|
||||
|
|
|
@ -36,11 +36,21 @@ impl SystemType {
|
|||
}
|
||||
|
||||
fn run_main(cmd_line: CommandLine) -> Result<(), Error> {
|
||||
let encoding_functions = cmd_line.system_type.get_encoding_functions();
|
||||
let (desc, lba_embedded_files) = psxcdgen_ex::process(config_reader::parse_xml(read_file_to_string(&cmd_line.input_file)?)?, encoding_functions.lba_calculator)?;
|
||||
let file_map = desc.create_file_map();
|
||||
const PKG_MINIMUM_CONTENT_SIZE:usize = 512*1024;
|
||||
|
||||
psxcdgen_ex::process_files(file_map, lba_embedded_files, encoding_functions.length_calculator)?;
|
||||
let encoding_functions = cmd_line.system_type.get_encoding_functions();
|
||||
let (mut desc, lba_embedded_files) = psxcdgen_ex::process(config_reader::parse_xml(read_file_to_string(&cmd_line.input_file)?)?, encoding_functions.lba_calculator)?;
|
||||
let file_map = desc.create_file_map();
|
||||
|
||||
let content_size = psxcdgen_ex::process_files(file_map, lba_embedded_files, encoding_functions.length_calculator)?;
|
||||
if content_size < PKG_MINIMUM_CONTENT_SIZE {
|
||||
let missing_size = PKG_MINIMUM_CONTENT_SIZE - content_size;
|
||||
|
||||
desc.set_end_padding(missing_size);
|
||||
tool_helper::print_warning(format!("Content size {}b smaller then {}b.\nCD will be padded with {}b to work as a .pkg", content_size, PKG_MINIMUM_CONTENT_SIZE, missing_size));
|
||||
|
||||
}
|
||||
|
||||
write_image(&desc, encoding_functions.encoder, cmd_line.output_type, cmd_line.output_file)?;
|
||||
|
||||
if let Some(list_content_option) = cmd_line.list_content {
|
||||
|
|
|
@ -15,17 +15,25 @@ pub fn new_shared_ptr<T>(value: T) -> SharedPtr<T> {
|
|||
}
|
||||
|
||||
pub struct CDDesc {
|
||||
pub(super) system_area: SharedPtr<SystemArea>,
|
||||
pub(super) path_table: SharedPtr<PathTable>,
|
||||
pub(super) pvd: SharedPtr<PrimaryVolumeDescriptor>,
|
||||
pub(super) root: SharedPtr<Directory>,
|
||||
pub(super) vol_sector_count: usize,
|
||||
pub(super) system_area: SharedPtr<SystemArea>,
|
||||
pub(super) path_table: SharedPtr<PathTable>,
|
||||
pub(super) pvd: SharedPtr<PrimaryVolumeDescriptor>,
|
||||
pub(super) root: SharedPtr<Directory>,
|
||||
pub(super) vol_sector_count: usize,
|
||||
pub(super) end_dummy_padding: usize
|
||||
}
|
||||
|
||||
impl CDDesc {
|
||||
pub fn new() -> CDDesc {
|
||||
match Directory::new("\x00") {
|
||||
Ok(root) => CDDesc{system_area: new_shared_ptr(SystemArea::new()), path_table: new_shared_ptr(PathTable::new()), pvd: new_shared_ptr(PrimaryVolumeDescriptor::new()), root: new_shared_ptr(root), vol_sector_count: 0},
|
||||
Ok(root) => CDDesc{
|
||||
system_area: new_shared_ptr(SystemArea::new()),
|
||||
path_table: new_shared_ptr(PathTable::new()),
|
||||
pvd: new_shared_ptr(PrimaryVolumeDescriptor::new()),
|
||||
root: new_shared_ptr(root),
|
||||
vol_sector_count: 0,
|
||||
end_dummy_padding: 0
|
||||
},
|
||||
Err(error) => panic!("Creating root directory failed with: {}", error)
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +50,10 @@ impl CDDesc {
|
|||
self.root.borrow_mut().add_file(file);
|
||||
}
|
||||
|
||||
pub fn set_end_padding(&mut self, padding: usize) {
|
||||
self.end_dummy_padding = padding
|
||||
}
|
||||
|
||||
pub fn create_file_map(&self) -> FileSystemMap {
|
||||
file_map::new_file_map(&self.root.borrow())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue