Verify basic usage of FileProcessor
This commit is contained in:
parent
706f989f8f
commit
a9790688f5
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef __JABYENGINE_FILE_PROCESSOR_HPP__
|
||||||
|
#define __JABYENGINE_FILE_PROCESSOR_HPP__
|
||||||
|
#include "../File_Types.hpp"
|
||||||
|
|
||||||
|
namespace FileProcessor {
|
||||||
|
class State {
|
||||||
|
private:
|
||||||
|
struct Reserved {
|
||||||
|
uint32_t _reserved[2] = {0};
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef bool (*ProcessRoutine)(uint32_t*, size_t, Reserved&);
|
||||||
|
|
||||||
|
private:
|
||||||
|
ProcessRoutine process_adr = nullptr;
|
||||||
|
Reserved reserved;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool process(uint32_t* data, size_t size) {
|
||||||
|
return (*this->process_adr)(data, size, this->reserved);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
State create(const SimpleTIM& file);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !__JABYENGINE_FILE_PROCESSOR_HPP__
|
|
@ -1,4 +1,5 @@
|
||||||
#include "../../include/GPU/GPU.h"
|
#include "../../include/GPU/GPU.h"
|
||||||
|
#include <PSX/File/Processor/File_Processor.hpp>
|
||||||
#include <PSX/GPU/GPU.h>
|
#include <PSX/GPU/GPU.h>
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
@ -33,6 +34,10 @@ namespace GPU {
|
||||||
//DMA End
|
//DMA End
|
||||||
|
|
||||||
Display::enable();
|
Display::enable();
|
||||||
|
|
||||||
|
//For now
|
||||||
|
auto state = FileProcessor::create(SimpleTIM(0, 0, 0, 0));
|
||||||
|
while(state.process(nullptr, 0ull));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#define private public
|
||||||
|
#include <PSX/File/Processor/File_Processor.hpp>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
namespace FileProcessor {
|
||||||
|
union SimpleTIMState {
|
||||||
|
State::Reserved _reserved;
|
||||||
|
struct {
|
||||||
|
uint32_t test;
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr SimpleTIMState(uint32_t test = 0) : test(test) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static_assert(sizeof(SimpleTIMState) <= sizeof(State::Reserved));
|
||||||
|
|
||||||
|
static bool process(uint32_t*, size_t, SimpleTIMState &state) {
|
||||||
|
printf("Dino: %i\n", state.test);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
State create(const SimpleTIM& file) {
|
||||||
|
SimpleTIMState test(123);
|
||||||
|
|
||||||
|
return State{.process_adr = reinterpret_cast<State::ProcessRoutine>(process), .reserved = test._reserved};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef private
|
Loading…
Reference in New Issue