Fully support Full16 TIM

This commit is contained in:
Jaby 2024-12-29 22:59:51 +01:00
parent c66b68a0e8
commit 85ae5629cd
8 changed files with 57 additions and 23 deletions

View File

@ -77,12 +77,10 @@ namespace ScreenCenter {
Formular{.name = PSYQ::Name, .function = PSYQ::set_offset} Formular{.name = PSYQ::Name, .function = PSYQ::set_offset}
}; };
static constexpr const auto background_img = Make::POLY_FT4( static constexpr const GPU::VRAM2VRAM background_img[] = { // TODO: Shouldn't current_id 0 be 0 and not 256?
Make::AreaI16(Make::PositionI16((GPU::Display::Width - 256)/2, (GPU::Display::Height - 240)/2), Make::SizeI16(256, 240)), GPU::VRAM2VRAM::create(Make::AreaU16(384, 240, 256, 240), Make::PositionU16(32, GPU::Display::Height)),
Make::PageOffset(0, 0), GPU::VRAM2VRAM::create(Make::AreaU16(384, 240, 256, 240), Make::PositionU16(32, 0)),
Make::TPage(Make::PositionU16(384, 256), GPU::SemiTransparency::B_Half_add_F_Half, GPU::TextureColorMode::clut4), };
Make::PageClut(Make::PositionU16(384, 255))
);
static auto frame = Frame::create(); static auto frame = Frame::create();
@ -112,8 +110,8 @@ namespace ScreenCenter {
} }
auto cursor = FontWriter::update(CenterPoint); auto cursor = FontWriter::update(CenterPoint);
FontWriter::bios_font_writer.write(cursor, IntroductionTest, GPU::Color24::Red()); FontWriter::bios_font_writer.write(cursor, IntroductionTest, GPU::Color24::White());
FontWriter::bios_font_writer.write(cursor, ScreenFormulars[formular_sel].name, GPU::Color24::Red()); FontWriter::bios_font_writer.write(cursor, ScreenFormulars[formular_sel].name, GPU::Color24::White());
} }
static void update_interactive() { static void update_interactive() {
@ -190,7 +188,7 @@ namespace ScreenCenter {
} }
static void render() { static void render() {
GPU::render(background_img); GPU::render(background_img[GPU::Display::current_id]);
frame.render(); frame.render();
Shared::back_menu.render(); Shared::back_menu.render();
} }

BIN
examples/PoolBox/assets/IMG_6921.png (Stored with Git LFS)

Binary file not shown.

View File

@ -35,7 +35,7 @@ INPUT += $(OUTPUT_DIR)/JabyTails.img
JabyTails_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS) JabyTails_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS)
INPUT += $(OUTPUT_DIR)/IMG_6921.tim INPUT += $(OUTPUT_DIR)/IMG_6921.tim
IMG_6921_TIM_FLAGS = tim clut4 --clut-pos {384,255} --tex-pos {384,256} IMG_6921_TIM_FLAGS = tim full16 --clut-pos {384,255} --tex-pos {384,256}
$(OUTPUT_DIR)/fox.xa: audio/temp/fox.wav $(OUTPUT_DIR)/fox.xa: audio/temp/fox.wav
@mkdir -p $(OUTPUT_DIR) @mkdir -p $(OUTPUT_DIR)
@ -55,7 +55,7 @@ $(OUTPUT_DIR)/%.img: %.png
$(OUTPUT_DIR)/%.tim: %.png $(OUTPUT_DIR)/%.tim: %.png
@mkdir -p $(OUTPUT_DIR) @mkdir -p $(OUTPUT_DIR)
psxfileconv $< -o $@ $($*_TIM_FLAGS) psxfileconv --lz4 $< -o $@ $($*_TIM_FLAGS)
all: $(INPUT) all: $(INPUT)

View File

@ -41,7 +41,7 @@
<File name = "TEX.IMG" lz4 = "already">../assets/bin/TexturePage.img</File> <File name = "TEX.IMG" lz4 = "already">../assets/bin/TexturePage.img</File>
<File name = "ICON.IMG" lz4 = "already">../assets/bin/IconTexture.img</File> <File name = "ICON.IMG" lz4 = "already">../assets/bin/IconTexture.img</File>
<File name = "SAND.TIM" lz4 = "none">../assets/bin/IMG_6921.tim</File> <File name = "SAND.TIM" lz4 = "already">../assets/bin/IMG_6921.tim</File>
</Directory> </Directory>
<Directory name = "XAAUDIO" hidden = "true"> <Directory name = "XAAUDIO" hidden = "true">
<InterleavedFile name = "MIX.XA"> <InterleavedFile name = "MIX.XA">

View File

@ -16,6 +16,8 @@ namespace JabyEngine {
}; };
struct CPU2VRAM { struct CPU2VRAM {
static constexpr bool is_render_primitive = true;
GPU_IO_Values::GP0 cmd; GPU_IO_Values::GP0 cmd;
GPU_IO_Values::GP0 pos; GPU_IO_Values::GP0 pos;
GPU_IO_Values::GP0 size; GPU_IO_Values::GP0 size;
@ -28,5 +30,23 @@ namespace JabyEngine {
}; };
} }
}; };
struct VRAM2VRAM {
static constexpr bool is_render_primitive = true;
GPU_IO_Values::GP0 cmd;
GPU_IO_Values::GP0 src_pos;
GPU_IO_Values::GP0 dst_pos;
GPU_IO_Values::GP0 size;
static constexpr VRAM2VRAM create(const AreaU16& src, const PositionU16& dst) {
return VRAM2VRAM{
.cmd = GPU_IO_Values::GP0::VRAM2VRAMBlitting(),
.src_pos = GPU_IO_Values::GP0::PostionTopLeft(src.position),
.dst_pos = GPU_IO_Values::GP0::PostionTopLeft(dst),
.size = GPU_IO_Values::GP0::WidthHeight(src.size)
};
}
};
} }
} }

View File

@ -23,11 +23,21 @@ namespace JabyEngine {
static constexpr auto HEADER_SIZE = 2*sizeof(uint32_t); static constexpr auto HEADER_SIZE = 2*sizeof(uint32_t);
if(config.data_bytes >= (HEADER_SIZE + sizeof(BlockInfo))) { 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);
Helper::simple_read(block_info, config); this->clut_area = AreaU16::create(block_info.x, block_info.y, block_info.w, block_info.h);
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::Done;
} }
return Progress::Error; return Progress::Error;

View File

@ -1,6 +1,6 @@
[package] [package]
name = "psxfileconv" name = "psxfileconv"
version = "0.8.6" version = "0.8.7"
edition = "2021" edition = "2021"
[profile.release] [profile.release]

View File

@ -28,9 +28,9 @@ impl Default for Header {
impl HeaderEncoder for Header { impl HeaderEncoder for Header {
fn encode_settings(&mut self, color_type: ColorType, tex_rect: Rect, clut_rect: Rect) -> Result<(), Error> { fn encode_settings(&mut self, color_type: ColorType, tex_rect: Rect, clut_rect: Rect) -> Result<(), Error> {
self.flag = match color_type { 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::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::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::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); 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> { 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> { fn write_pixel_header(&self, output: &mut dyn Write) -> Result<usize, Error> {