Include SplashImage and detect right type
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include <PSX/File/Processor/File_Processor.hpp>
|
||||
#include <PSX/GPU/GPU.h>
|
||||
|
||||
#include "splash_image_boot.hpp"
|
||||
|
||||
namespace GPU {
|
||||
static const Color TestSequence[] = {
|
||||
Color::from(Color24::Blue()), Color::from(Color24::Red()), Color::from(Color24::Green()), Color::from(Color24::Blue()), Color::from(Color24::Red()), Color::from(Color24::Green()), Color::from(Color24::Blue()), Color::from(Color24::Red()), Color::from(Color24::Green()), Color::from(Color24::Blue()), Color::from(Color24::Red()), Color::from(Color24::Green()),
|
||||
@@ -36,8 +38,8 @@ namespace GPU {
|
||||
Display::enable();
|
||||
|
||||
//For now
|
||||
auto state = FileProcessor::create(nullptr, SimpleTIM(0, 0, 0, 0));
|
||||
while(state.process(0ull));
|
||||
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(SplashScreen), SimpleTIM(0, 0, 0, 0));
|
||||
while(state.process((sizeof(SplashScreen)/sizeof(uint32_t))));
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
18
src/Library/src/File/Processor/SimpleRead.hpp
Normal file
18
src/Library/src/File/Processor/SimpleRead.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __JABYENGINE_INTERNAL_SIMPLE_READ_HPP__
|
||||
#define __JABYENGINE_INTERNAL_SIMPLE_READ_HPP__
|
||||
#include <PSX/File/Processor/File_Processor.hpp>
|
||||
|
||||
namespace FileProcessor {
|
||||
template<typename T>
|
||||
static size_t simple_read(T& dst, State::Configuration& config) {
|
||||
static constexpr size_t UINT32_SIZE = (sizeof(T)/sizeof(uint32_t));
|
||||
|
||||
dst = *reinterpret_cast<const T*>(config.data_adr);
|
||||
config.data_adr += UINT32_SIZE;
|
||||
|
||||
return UINT32_SIZE;
|
||||
static_assert((UINT32_SIZE*sizeof(uint32_t)) == sizeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !__JABYENGINE_INTERNAL_SIMPLE_READ_HPP__
|
@@ -1,28 +1,70 @@
|
||||
#define private public
|
||||
#include <PSX/File/Processor/File_Processor.hpp>
|
||||
#include "../../../include/GPU/GPU.h"
|
||||
#include "SimpleRead.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace FileProcessor {
|
||||
union SimpleTIMState {
|
||||
State::Reserved _reserved;
|
||||
struct {
|
||||
uint32_t test;
|
||||
};
|
||||
using GPU::PositionU16;
|
||||
using GPU::SizeU16;
|
||||
|
||||
constexpr SimpleTIMState(uint32_t test = 0) : test(test) {
|
||||
struct SimpleTIMSize : private SimpleTIM {
|
||||
constexpr SimpleTIMSize() {
|
||||
}
|
||||
|
||||
constexpr uint16_t getTextureWidth() const {
|
||||
return SimpleTIM::getTextureX();
|
||||
}
|
||||
|
||||
constexpr uint16_t getTextureHeight() const {
|
||||
return SimpleTIM::getTextureY();
|
||||
}
|
||||
|
||||
constexpr uint16_t getClutWidth() const {
|
||||
return SimpleTIM::getClutX();
|
||||
}
|
||||
|
||||
constexpr uint16_t getClutHeight() const {
|
||||
return SimpleTIM::getClutY();
|
||||
}
|
||||
};
|
||||
|
||||
struct SimpleTIMState {
|
||||
SimpleTIM dst_info;
|
||||
SimpleTIMSize size_info;
|
||||
|
||||
constexpr SimpleTIMState(const SimpleTIM& dst_info) : dst_info(dst_info) {
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(SimpleTIMState) <= sizeof(State::Reserved));
|
||||
|
||||
static bool process(State::Configuration& config, SimpleTIMState& state, size_t size) {
|
||||
printf("Dino: %i\n", state.test);
|
||||
return false;
|
||||
static void set_gpu_receive(const uint32_t* src, uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
|
||||
GPU::DMA::Receive::prepare();
|
||||
GPU::DMA::Receive::set_dst(PositionU16(x, y), SizeU16(w, h));
|
||||
GPU::DMA::Receive::set_src(reinterpret_cast<const uintptr_t>(src));
|
||||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
||||
SimpleTIMState test(123);
|
||||
|
||||
return State{.config = State::Configuration::from(process, data_adr), .reserved = test._reserved};
|
||||
static bool parse_header(State::Configuration& config, SimpleTIMState& state, size_t size) {
|
||||
if(size >= sizeof(SimpleTIMSize)) {
|
||||
size -= simple_read(state.size_info, config);
|
||||
|
||||
//Check if we have a clut to care about
|
||||
if(state.size_info.getClutWidth() > 0) {
|
||||
//CLUTs are 16bit full color anyway
|
||||
printf("We found a CLUT!\n");
|
||||
}
|
||||
|
||||
//We have direct data
|
||||
else {
|
||||
printf("We found direct data!\n");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
static_assert(sizeof(SimpleTIMSize) == sizeof(uint32_t));
|
||||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
||||
return State::from(SimpleTIMState(file), data_adr, parse_header);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user