#ifndef __JABYENGINE_CD_FILE_PROCESSOR_HPP__ #define __JABYENGINE_CD_FILE_PROCESSOR_HPP__ #include "../../AutoLBA/auto_lba.hpp" #include "../../Auxiliary/circular_buffer.hpp" #include "../../Auxiliary/lz4_decompressor.hpp" #include "../../System/IOPorts/cd_io.hpp" #include "../cd_file_types.hpp" #include "file_processor.hpp" extern "C" uint32_t __heap_base; namespace JabyEngine { class CDFileProcessor { public: struct JobArray { const CDFile* files = nullptr; size_t size = 0; bool next() { this->files += 1; this->size -= 1; return this->size > 0; } }; private: FileProcessor::State file_state; CircularBuffer circular_buffer; LZ4Decompressor lz4_decomp; JobArray jobs; const AutoLBAEntry* lba = nullptr; uint32_t* tmp_area = nullptr; void start_cur_job(); bool process_data(); public: CDFileProcessor() = default; void setup(const volatile AutoLBAEntry* lba, JobArray jobs, uint32_t* tmp_area = &__heap_base); template void setup(const volatile AutoLBAEntry* lba, const CDFile (&file_array)[N], uint32_t* tmp_area = &__heap_base) { CDFileProcessor::setup(lba, JobArray{file_array, N}, tmp_area); } Progress process(); bool next() { if(this->jobs.next()) { CDFileProcessor::start_cur_job(); return true; } return false; } }; } // This will be used as the file processor but will work on cd types // Will probably use file_processor // Will also setup the circular buffer for the CD code #endif //!__JABYENGINE_CD_FILE_PROCESSOR_HPP__