Support custom file parsing
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
// TODO: Outsource the interrupt handler to new source file?
|
||||
// TODO: Do not spawn a new thread for handling the CD interrupt but use that thread for loading files or something?
|
||||
// TODO: Can you use the GPU IO Port while also using DMA?
|
||||
namespace JabyEngine {
|
||||
namespace CDDA {
|
||||
extern CD::internal::BCDTimeStamp playing_track;
|
||||
|
@@ -39,10 +39,11 @@ namespace JabyEngine {
|
||||
switch(file.type) {
|
||||
case CDFileType::SimpleTIM:
|
||||
return FileProcessor::create(data_adr, file.payload.simple_tim);
|
||||
|
||||
case CDFileType::CopyTo:
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
|
||||
default:
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
return FileProcessor::create_custom(data_adr, static_cast<CDFileType_t>(file.type) - static_cast<CDFileType_t>(CDFileType::Custom), file.payload);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,7 +57,6 @@ namespace JabyEngine {
|
||||
return self.circular_buffer.allocate();
|
||||
}));
|
||||
|
||||
//printf(">>> 0x%p\n", this->jobs.files);
|
||||
//printf(">>> %i.) CD needs to load LBA: %i -> %i (is LZ4: [%s])\n", cur_job.rel_lba_idx, cur_lba.get_lba(), cur_lba.get_size_in_sectors(), cur_lba.is_lz4() ? "Yes" : "No");
|
||||
}
|
||||
|
||||
|
10
src/Library/src/File/Processor/custom_processor.cpp
Normal file
10
src/Library/src/File/Processor/custom_processor.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <PSX/File/file_processor_helper.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
State __weak create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload) {
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
#include "simplehelper.hpp"
|
||||
#include <PSX/File/file_processor_helper.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
|
@@ -1,25 +0,0 @@
|
||||
#ifndef __JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
||||
#define __JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
||||
|
||||
#include <PSX/File/Processor/file_processor.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
namespace Helper {
|
||||
template<typename T>
|
||||
static void simple_read(T& dst, State::Configuration& config) {
|
||||
static constexpr size_t T_SIZE = sizeof(T);
|
||||
|
||||
dst = *reinterpret_cast<const T*>(config.data_adr);
|
||||
config.processed(T_SIZE);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static Progress exchange_and_execute_process_function(State::GenericProcessRoutine<T> process_routine, State::Configuration& config, T& state) {
|
||||
config.process_routine = reinterpret_cast<State::ProcessRoutine>(process_routine);
|
||||
return process_routine(config, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !__JABYENGINE_INTERNAL_SIMPLE_HELPER_HPP__
|
@@ -1,5 +1,5 @@
|
||||
#include "../../../internal-include/GPU/gpu_internal.hpp"
|
||||
#include "simplehelper.hpp"
|
||||
#include <PSX/File/file_processor_helper.hpp>
|
||||
#include <PSX/GPU/gpu_types.hpp>
|
||||
#include <limits.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
Reference in New Issue
Block a user