Get rough shape of CD file processing code
This commit is contained in:
@@ -1,34 +1,35 @@
|
||||
#ifndef __JABYENGINE_CD_FILE_PROCESSOR_HPP__
|
||||
#define __JABYENGINE_CD_FILE_PROCESSOR_HPP__
|
||||
#include "../../AutoLBA/auto_lba.hpp"
|
||||
#include "../../Auxiliary/lz4_decompressor.hpp"
|
||||
#include "../cd_file_types.hpp"
|
||||
#include "file_processor.hpp"
|
||||
|
||||
extern "C" uint32_t __heap_base;
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace CDFileProcessor {
|
||||
class State {
|
||||
private:
|
||||
FileProcessor::State file_processor_state;
|
||||
const uint32_t* data_adr;
|
||||
|
||||
public:
|
||||
State() = default;
|
||||
|
||||
void setup(uint16_t lba, uint16_t size, const CDFile::Payload& payload);
|
||||
bool process();
|
||||
class CDFileProcessor {
|
||||
public:
|
||||
struct JobArray {
|
||||
const CDFile* files = nullptr;
|
||||
size_t size = 0;
|
||||
};
|
||||
|
||||
template<size_t Size>
|
||||
static void load_from_cd(const OverlayLBA* overlay_lbas, const CDFile (&cd_files)[Size]) {
|
||||
State state;
|
||||
private:
|
||||
FileProcessor::State file_pro_state;
|
||||
LZ4Decompressor lz4_decomp;
|
||||
JobArray jobs;
|
||||
uint8_t* work_area = nullptr;
|
||||
const AutoLBAEntry* lba = nullptr;
|
||||
|
||||
for(const auto& file : cd_files) {
|
||||
const auto& lba_info = overlay_lbas[file.rel_lba_idx];
|
||||
void start_cur_job();
|
||||
|
||||
state.setup(lba_info.lba, lba_info.size, file.payload);
|
||||
//while(state.process());???
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
CDFileProcessor() = default;
|
||||
|
||||
void setup(const volatile AutoLBAEntry* lba, JobArray jobs, uint8_t* work_area = reinterpret_cast<uint8_t*>(&__heap_base));
|
||||
Progress process();
|
||||
};
|
||||
}
|
||||
|
||||
// This will be used as the file processor but will work on cd types
|
||||
|
@@ -6,24 +6,31 @@
|
||||
namespace JabyEngine {
|
||||
enum struct CDFileType : uint8_t {
|
||||
SimpleTIM = 0,
|
||||
Custom
|
||||
CopyTo,
|
||||
};
|
||||
|
||||
struct __no_align CDFile {
|
||||
union __no_align Payload {
|
||||
uint32_t empty;
|
||||
SimpleTIM simple_tim;
|
||||
CopyTo copy_to;
|
||||
};
|
||||
|
||||
uint8_t rel_lba_idx;
|
||||
CDFileType type;
|
||||
Payload payload;
|
||||
|
||||
static_assert(sizeof(Payload) == sizeof(uint32_t));
|
||||
};
|
||||
|
||||
namespace CDFileBuilder {
|
||||
struct CDFileBuilder {
|
||||
static constexpr CDFile simple_tim(uint8_t rel_lba_idx, SimpleTIM simple_tim) {
|
||||
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::SimpleTIM, .payload = {.simple_tim = simple_tim}};
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr CDFile copy_to(uint8_t rel_lba_idx, uint32_t* dst) {
|
||||
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::CopyTo, .payload = {.copy_to = CopyTo{dst}}};
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif //!__JABYENGINE_CD_FILE_TYPES_HPP__
|
@@ -33,5 +33,9 @@ namespace JabyEngine {
|
||||
return ComplexBitMap<uint32_t>::get_value(SimpleTIM::ClutY);
|
||||
}
|
||||
};
|
||||
|
||||
struct __no_align CopyTo {
|
||||
uint32_t* dst;
|
||||
};
|
||||
}
|
||||
#endif // !__JABYENGINE_FILE_TYPES_HPP__
|
Reference in New Issue
Block a user