Slowly come up with design for loading from CD
This commit is contained in:
parent
20ffbc5fa9
commit
01148b8c52
|
@ -1,5 +1,32 @@
|
|||
#ifndef __JABYENGINE_CD_FILE_PROCESSOR_HPP__
|
||||
#define __JABYENGINE_CD_FILE_PROCESSOR_HPP__
|
||||
#include "../cd_file_types.hpp"
|
||||
#include "file_processor.hpp"
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
template<size_t Size>
|
||||
static void load_from_cd(const OverlayLBA* overlay_lbas, const CDFile (&cd_files)[Size]) {
|
||||
State state;
|
||||
|
||||
for(const auto& file : cd_files) {
|
||||
const auto& lba_info = overlay_lbas[file.rel_lba_idx];
|
||||
|
||||
state.setup(lba_info.lba, lba_info.size, file.payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This will be used as the file processor but will work on cd types
|
||||
// Will probably use file_processor
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
#ifndef __JABYENGINE_CD_FILE_TYPES_HPP__
|
||||
#define __JABYENGINE_CD_FILE_TYPES_HPP__
|
||||
#include "../Overlay/overlay.hpp"
|
||||
#include "file_types.hpp"
|
||||
|
||||
// Will extend the file_types for using cd types
|
||||
enum struct CDFileType : uint8_t {
|
||||
SimpleTIM = 0,
|
||||
Custom
|
||||
};
|
||||
|
||||
struct __no_align CDFile {
|
||||
union __no_align Payload {
|
||||
uint32_t empty;
|
||||
SimpleTIM simple_tim;
|
||||
};
|
||||
|
||||
uint8_t rel_lba_idx;
|
||||
CDFileType type;
|
||||
Payload payload;
|
||||
};
|
||||
|
||||
namespace 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}};
|
||||
}
|
||||
}
|
||||
#endif //!__JABYENGINE_CD_FILE_TYPES_HPP__
|
|
@ -2,13 +2,14 @@
|
|||
#define __JABYENGINE_OVERLAY__HPP__
|
||||
#include "../../stdint.h"
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
struct __attribute__((packed)) OverlayHeader {
|
||||
void (*execute)();
|
||||
uint16_t lba_size;
|
||||
} OverlayHeader;
|
||||
};
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
// Maybe encode attributes like "isLZ4" into size parameter
|
||||
struct __attribute__((packed)) OverlayLBA {
|
||||
uint16_t lba;
|
||||
uint16_t size;
|
||||
} OverlayLBA;
|
||||
};
|
||||
#endif //!__JABYENGINE_OVERLAY__HPP__
|
|
@ -0,0 +1 @@
|
|||
#include <PSX/File/Processor/cd_file_processor.hpp>
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../../include/GPU/gpu.hpp"
|
||||
#include "SimpleHelper.hpp"
|
||||
#include "simplehelper.hpp"
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
Loading…
Reference in New Issue