Support for loading TIM

This commit is contained in:
2024-12-29 21:57:38 +01:00
parent 542669470a
commit 586b1e8124
19 changed files with 286 additions and 125 deletions

View File

@@ -7,7 +7,7 @@ namespace JabyEngine {
class State {
public:
struct Reserved {
uint32_t reserved[4];
uint32_t reserved[8];
};
struct Configuration;
@@ -17,6 +17,7 @@ namespace JabyEngine {
typedef GenericProcessRoutine<Reserved> ProcessRoutine;
// TODO: Better name!!!!
struct Configuration {
ProcessRoutine process_routine = nullptr;
const uint8_t* data_adr = nullptr;
@@ -52,6 +53,7 @@ namespace JabyEngine {
// The nothing state
State create(const uint32_t* data_adr, const Nothing& nothing);
State create(const uint32_t* data_adr, const SimpleTIM& file);
State create(const uint32_t* data_adr, const TIM& file);
State create(const uint32_t* data_adr, const VAG& file);
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload);

View File

@@ -10,6 +10,7 @@ namespace JabyEngine {
enum struct CDFileType : CDFileType_t {
CopyTo = 0,
SimpleTIM,
SonyTIM,
SonyVAG,
Custom,
};
@@ -20,6 +21,7 @@ namespace JabyEngine {
RawPayload_t raw;
CopyTo copy_to;
SimpleTIM simple_tim;
TIM tim;
VAG vag;
Overlay overlay;
};
@@ -49,6 +51,10 @@ namespace JabyEngine {
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::SimpleTIM, .payload = {.simple_tim = simple_tim}};
}
static constexpr CDFile sony_tim(uint8_t rel_lba_idx, TIM tim) {
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::SonyTIM, .payload = {.tim = tim}};
}
static constexpr CDFile sony_vag(uint8_t lba_idx, VAG vag) {
return CDFile{.rel_lba_idx = lba_idx, .type = CDFileType::SonyVAG, .payload = {.vag = vag}};
}

View File

@@ -65,6 +65,14 @@ namespace JabyEngine {
}
};
struct TIM {
uint32_t zero;
static constexpr TIM create() {
return TIM{.zero = 0};
}
};
struct VAG {
uint8_t voice_number;
SPU::SimpleVolume inital_stereo_vol;

View File

@@ -293,9 +293,9 @@ namespace JabyEngine {
static constexpr POLY_FT4 create(const AreaI16& area, const PageOffset& tex_offset, TPage tpage, PageClut clut, Color24 color = Color24::Grey()) {
return POLY_FT4::create({
{POLY_FT4::vertex0_from(area), tex_offset},
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width, 0)},
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height)},
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width, area.size.height)}
{POLY_FT4::vertex1_from(area), tex_offset.move(area.size.width - 1, 0)},
{POLY_FT4::vertex2_from(area), tex_offset.move(0, area.size.height - 1)},
{POLY_FT4::vertex3_from(area), tex_offset.move(area.size.width - 1, area.size.height - 1)}
}, tpage, clut, color);
}
};

View File

@@ -250,7 +250,7 @@ namespace JabyEngine {
return creator_template<GPU::POLY_FT4>(vertices_ex, tpage, clut, color);
}
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::AreaI16& area, const GPU::PageOffset& tex_offset, GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color) {
static constexpr GPU::POLY_FT4 POLY_FT4(const GPU::AreaI16& area, const GPU::PageOffset& tex_offset, GPU::TPage tpage, GPU::PageClut clut, GPU::Color24 color = GPU::Color24::Grey()) {
return creator_template<GPU::POLY_FT4>(area, tex_offset, tpage, clut, color);
}