Support CopyTo now

This commit is contained in:
2023-03-27 22:20:42 +02:00
parent 206c95f295
commit 2882ddfc34
4 changed files with 91 additions and 27 deletions

View File

@@ -15,6 +15,13 @@ namespace JabyEngine {
struct JobArray {
const CDFile* files = nullptr;
size_t size = 0;
bool next() {
this->files += 1;
this->size -= 1;
return this->size > 0;
}
};
private:
@@ -22,16 +29,27 @@ namespace JabyEngine {
CircularBuffer<CD_IO::DataSector> circular_buffer;
LZ4Decompressor lz4_decomp;
JobArray jobs;
uint8_t* work_area = nullptr;
const AutoLBAEntry* lba = nullptr;
uint32_t*const tmp_area = nullptr; //< The start of the area to copy data to
uint32_t* dst_area = nullptr; //< Current target for copying the data
void start_cur_job();
void start_cur_job();
void reading_state(const CDFile& file);
void done_state(const CDFile& file);
public:
CDFileProcessor() = default;
void setup(const volatile AutoLBAEntry* lba, JobArray jobs, uint8_t* work_area = reinterpret_cast<uint8_t*>(&__heap_base));
void setup(const volatile AutoLBAEntry* lba, JobArray jobs, uint32_t* tmp_area = &__heap_base);
Progress process();
bool next() {
if(this->jobs.next()) {
CDFileProcessor::start_cur_job();
return true;
}
return false;
}
};
}