Support custom file parsing
This commit is contained in:
26
examples/PoolBox/application/src/Custom/file_parser.cpp
Normal file
26
examples/PoolBox/application/src/Custom/file_parser.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "custom_files.hpp"
|
||||
#include <PSX/File/file_processor_helper.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
struct JingleState {
|
||||
uint32_t sfx_id;
|
||||
};
|
||||
|
||||
static Progress parse_jingle(State::Configuration& config, JingleState& jingle) {
|
||||
printf("Playing jingle: %i\n", jingle.sfx_id);
|
||||
return Progress::Done;
|
||||
}
|
||||
|
||||
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload) {
|
||||
switch(static_cast<FileType>(file_type)) {
|
||||
case FileType::Jingle:
|
||||
return State::from(JingleState{.sfx_id = payload.raw}, reinterpret_cast<const uint8_t*>(data_adr), parse_jingle);
|
||||
|
||||
default:
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user