Fully support Full16 TIM
This commit is contained in:
@@ -23,11 +23,21 @@ namespace JabyEngine {
|
||||
static constexpr auto HEADER_SIZE = 2*sizeof(uint32_t);
|
||||
|
||||
if(config.data_bytes >= (HEADER_SIZE + sizeof(BlockInfo))) {
|
||||
BlockInfo block_info;
|
||||
uint32_t flag;
|
||||
|
||||
config.processed(sizeof(uint32_t));
|
||||
Helper::simple_read(flag, config);
|
||||
|
||||
if(flag & (0x1 << 3)) {
|
||||
BlockInfo block_info;
|
||||
|
||||
config.processed(HEADER_SIZE);
|
||||
Helper::simple_read(block_info, config);
|
||||
this->clut_area = AreaU16::create(block_info.x, block_info.y, block_info.w, block_info.h);
|
||||
Helper::simple_read(block_info, config);
|
||||
this->clut_area = AreaU16::create(block_info.x, block_info.y, block_info.w, block_info.h);
|
||||
}
|
||||
|
||||
else {
|
||||
this->clut_area = AreaU16::create(0, 0, 0, 0);
|
||||
}
|
||||
return Progress::Done;
|
||||
}
|
||||
return Progress::Error;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "psxfileconv"
|
||||
version = "0.8.6"
|
||||
version = "0.8.7"
|
||||
edition = "2021"
|
||||
|
||||
[profile.release]
|
||||
|
@@ -28,9 +28,9 @@ impl Default for Header {
|
||||
impl HeaderEncoder for Header {
|
||||
fn encode_settings(&mut self, color_type: ColorType, tex_rect: Rect, clut_rect: Rect) -> Result<(), Error> {
|
||||
self.flag = match color_type {
|
||||
ColorType::Clut4 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x0) | Self::FLAG_CF_BIT.as_value(true)) as u32,
|
||||
ColorType::Clut8 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x1) | Self::FLAG_CF_BIT.as_value(true)) as u32,
|
||||
ColorType::Full16 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x2) | Self::FLAG_CF_BIT.as_value(true)) as u32,
|
||||
ColorType::Clut4 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x0) | Self::FLAG_CF_BIT.as_value(true)) as u32,
|
||||
ColorType::Clut8 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x1) | Self::FLAG_CF_BIT.as_value(true)) as u32,
|
||||
ColorType::Full16 => (Self::FLAG_PMODE_BIT_RANGE.as_value(0x2) | Self::FLAG_CF_BIT.as_value(false)) as u32,
|
||||
};
|
||||
|
||||
self.clut_block = DataBlock::new(clut_rect);
|
||||
@@ -44,7 +44,13 @@ impl HeaderEncoder for Header {
|
||||
}
|
||||
|
||||
fn write_clut_header(&self, output: &mut dyn Write) -> Result<usize, Error> {
|
||||
Ok(output.write(&self.clut_block.convert_to_raw())?)
|
||||
if self.clut_block.w > 0 {
|
||||
Ok(output.write(&self.clut_block.convert_to_raw())?)
|
||||
}
|
||||
|
||||
else {
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
|
||||
fn write_pixel_header(&self, output: &mut dyn Write) -> Result<usize, Error> {
|
||||
|
Reference in New Issue
Block a user