From 194b1f0f9c74f1d70673fa9ba2dedaa59155dc5b Mon Sep 17 00:00:00 2001 From: jaby Date: Sun, 2 Oct 2022 14:18:35 +0200 Subject: [PATCH] Support CLUT (untested) --- src/Library/src/BootLoader/gpu_boot.cpp | 2 +- .../src/File/Processor/TIM_Processor.cpp | 22 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index 908421be..fd2b6846 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -11,7 +11,7 @@ namespace GPU { // Upload SplashScreen picture auto state = FileProcessor::create(reinterpret_cast(SplashScreen), SimpleTIM(93, 0, 0, 0)); - while(state.process((2048/sizeof(uint32_t)))); + while(state.process((sizeof(SplashScreen)/sizeof(uint32_t)))); Display::enable(); } diff --git a/src/Library/src/File/Processor/TIM_Processor.cpp b/src/Library/src/File/Processor/TIM_Processor.cpp index 76fa0b40..0e03d3f4 100644 --- a/src/Library/src/File/Processor/TIM_Processor.cpp +++ b/src/Library/src/File/Processor/TIM_Processor.cpp @@ -88,6 +88,21 @@ namespace FileProcessor { } } + static bool 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; + } + + else { + return switch_state_parse_data(config, state); + } + } + static bool parse_header(State::Configuration& config, SimpleTIMState& state) { if(config.data_word_size >= (sizeof(SimpleTIMSize)/sizeof(uint32_t))) { Helper::simple_read(state.size_info, config); @@ -95,14 +110,13 @@ namespace FileProcessor { //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 which is not yet implemented!\n"); - return false; + set_gpu_receive_data(config.data_adr, state, state.size_info.getClutWidth(), state.size_info.getClutHeight()); + return Helper::exchange_and_execute_process_function(parse_clut, config, state); } //We have direct data else { - 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); + return switch_state_parse_data(config, state); } }