Improves return types with Progress type
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
#include <PSX/Auxiliary/lz4_decompressor.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
void LZ4Decompressor :: setup(uint8_t* dst_adr) {
|
||||
this->dst_adr = dst_adr;
|
||||
LZ4Decompressor::reset();
|
||||
}
|
||||
|
||||
void LZ4Decompressor :: reset() {
|
||||
|
||||
}
|
||||
|
||||
Progress LZ4Decompressor :: process(const uint8_t* data, size_t size) {
|
||||
return Progress::Error;
|
||||
}
|
||||
}
|
@@ -13,7 +13,7 @@ namespace JabyEngine {
|
||||
void display_logo() {
|
||||
// Upload SplashScreen picture
|
||||
auto state = FileProcessor::create(reinterpret_cast<const uint32_t*>(SplashScreen), SimpleTIM(32, 0, 0, 0));
|
||||
while(state.process((sizeof(SplashScreen)/sizeof(uint32_t))));
|
||||
while(state.process((sizeof(SplashScreen)/sizeof(uint32_t))) == Progress::InProgress);
|
||||
|
||||
Display::enable();
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#ifndef __JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
||||
#define __JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
||||
|
||||
// Instead of using friend we use this to access the private members
|
||||
#define private public
|
||||
#include <PSX/File/Processor/file_processor.hpp>
|
||||
|
||||
@@ -17,7 +19,7 @@ namespace JabyEngine {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static bool exchange_and_execute_process_function(bool (*process_routine)(State::Configuration&, T&), State::Configuration& config, T& state) {
|
||||
static Progress exchange_and_execute_process_function(State::GenericProcessRoutine<T> process_routine, State::Configuration& config, T& state) {
|
||||
config.process_routine = reinterpret_cast<State::ProcessRoutine>(process_routine);
|
||||
return process_routine(config, state);
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ namespace JabyEngine {
|
||||
set_gpu_receive(src, state.dst_info.getTextureX(), state.dst_info.getTextureY(), width, height);
|
||||
}
|
||||
|
||||
static bool parse_data(State::Configuration& config, SimpleTIMState& state) {
|
||||
static Progress parse_data(State::Configuration& config, SimpleTIMState& state) {
|
||||
const auto words_to_use = (config.data_word_size > state.words_left) ? state.words_left : config.data_word_size;
|
||||
bool is_last = (words_to_use == state.words_left);
|
||||
auto block_count = (words_to_use >> 4);
|
||||
@@ -77,7 +77,7 @@ namespace JabyEngine {
|
||||
state.words_left = 0;
|
||||
config.processed(words_to_use);
|
||||
|
||||
return false;
|
||||
return Progress::Done;
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -85,18 +85,18 @@ namespace JabyEngine {
|
||||
|
||||
state.words_left -= words_used;
|
||||
config.processed(words_used);
|
||||
return true;
|
||||
return Progress::InProgress;
|
||||
}
|
||||
}
|
||||
|
||||
static bool switch_state_parse_data(State::Configuration& config, SimpleTIMState& state) {
|
||||
static Progress switch_state_parse_data(State::Configuration& config, SimpleTIMState& state) {
|
||||
set_gpu_receive_data(config.data_adr, state, state.size_info.getTextureWidth(), state.size_info.getTextureHeight());
|
||||
return Helper::exchange_and_execute_process_function(parse_data, config, state);
|
||||
}
|
||||
|
||||
static bool parse_clut(State::Configuration& config, SimpleTIMState& state) {
|
||||
if(parse_data(config, state)) {
|
||||
return true;
|
||||
static Progress parse_clut(State::Configuration& config, SimpleTIMState& state) {
|
||||
if(const auto result = parse_data(config, state); result != Progress::Done) {
|
||||
return result;
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -104,7 +104,7 @@ namespace JabyEngine {
|
||||
}
|
||||
}
|
||||
|
||||
static bool parse_header(State::Configuration& config, SimpleTIMState& state) {
|
||||
static Progress parse_header(State::Configuration& config, SimpleTIMState& state) {
|
||||
if(config.data_word_size >= (sizeof(SimpleTIMSize)/sizeof(uint32_t))) {
|
||||
Helper::simple_read(state.size_info, config);
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace JabyEngine {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return Progress::InProgress;
|
||||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
||||
|
Reference in New Issue
Block a user