Integrate all the progress into master #6
|
@ -16,7 +16,7 @@ namespace JabyEngine {
|
|||
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);
|
||||
return State::from(JingleState{.sfx_id = payload.raw}, data_adr, parse_jingle);
|
||||
|
||||
default:
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace Assets {
|
|||
__jabyengine_start_lba_request
|
||||
__jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.IMG"),
|
||||
__jabyengine_request_lba_for(DFISH, "ASSETS/MAIN/DFISH.IMG"),
|
||||
__jabyengine_request_lba_for(APPLE_SFX, "SFX/APPLE.VAG"),
|
||||
__jabyengine_request_lba_for(MIX_XA, "XAAUDIO/MIX.XA"),
|
||||
__jabyengine_request_lba_for(BIOS_INFO_OVL, "BIO.BIN"),
|
||||
__jabyengine_request_lba_for(GPU_TEST_OVL, "GTO.BIN"),
|
||||
|
@ -61,6 +62,7 @@ namespace Assets {
|
|||
static const CDFile Files[] = {
|
||||
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM),
|
||||
CDFileBuilder::simple_tim(LBA::DFISH, DoenerFishInfo.tim),
|
||||
CDFileBuilder::sony_vag(LBA::APPLE_SFX, VAG::create(0)),
|
||||
CustomCDFileBuilder::jingle(32),
|
||||
};
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace JabyEngine {
|
|||
Reserved reserved;
|
||||
|
||||
template<typename T>
|
||||
static __always_inline State from(const T& state, const uint8_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
||||
return {Configuration::from(process_routine, data_adr), *reinterpret_cast<const Reserved*>(&state)};
|
||||
static __always_inline State from(const T& state, const uint32_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
||||
return {Configuration::from(process_routine, reinterpret_cast<const uint8_t*>(data_adr)), *reinterpret_cast<const Reserved*>(&state)};
|
||||
static_assert(sizeof(T) <= sizeof(Reserved));
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ namespace JabyEngine {
|
|||
// The nothing state
|
||||
State create(const uint32_t* data_adr, const Nothing& nothing);
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file);
|
||||
State create(const uint32_t* data_adr, const VAG& file);
|
||||
|
||||
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <PSX/jabyengine_config.hpp>
|
||||
#include "../Overlay/overlay.hpp"
|
||||
#include "file_types.hpp"
|
||||
|
||||
|
@ -7,8 +8,11 @@ namespace JabyEngine {
|
|||
using RawPayload_t = uint32_t;
|
||||
|
||||
enum struct CDFileType : CDFileType_t {
|
||||
SimpleTIM = 0,
|
||||
CopyTo,
|
||||
CopyTo = 0,
|
||||
SimpleTIM,
|
||||
#ifdef __SUPPORT_VAG__
|
||||
SonyVAG,
|
||||
#endif // __SUPPORT_VAG__
|
||||
Custom,
|
||||
};
|
||||
|
||||
|
@ -16,8 +20,9 @@ namespace JabyEngine {
|
|||
struct CDFile {
|
||||
union Payload {
|
||||
RawPayload_t raw;
|
||||
SimpleTIM simple_tim;
|
||||
CopyTo copy_to;
|
||||
SimpleTIM simple_tim;
|
||||
VAG vag;
|
||||
Overlay overlay;
|
||||
};
|
||||
|
||||
|
@ -38,13 +43,19 @@ namespace JabyEngine {
|
|||
#pragma pack(pop)
|
||||
|
||||
struct CDFileBuilder {
|
||||
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}}};
|
||||
}
|
||||
|
||||
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}}};
|
||||
#ifdef __SUPPORT_VAG__
|
||||
static constexpr CDFile sony_vag(uint8_t lba_idx, VAG vag) {
|
||||
return CDFile{.rel_lba_idx = lba_idx, .type = CDFileType::SonyVAG, .payload = {.vag = vag}};
|
||||
}
|
||||
#endif //__SUPPORT_VAG__
|
||||
|
||||
static constexpr CDFile overlay(uint8_t rel_lba_idx, uint32_t* overlay_dst) {
|
||||
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::CopyTo, .payload = {.overlay = Overlay{overlay_dst}}};
|
||||
|
|
|
@ -8,6 +8,12 @@ namespace JabyEngine {
|
|||
struct Nothing {
|
||||
};
|
||||
|
||||
struct CopyTo {
|
||||
uint32_t* dst;
|
||||
};
|
||||
|
||||
// TODO: Call TIM?
|
||||
// TODO: Add create function?
|
||||
struct SimpleTIM {
|
||||
static constexpr auto TextureX = BitRange::from_to(0, 8);
|
||||
static constexpr auto TextureY = BitRange::from_to(9, 16);
|
||||
|
@ -61,9 +67,14 @@ namespace JabyEngine {
|
|||
}
|
||||
};
|
||||
|
||||
struct CopyTo {
|
||||
uint32_t* dst;
|
||||
struct VAG {
|
||||
uint8_t voice_number;
|
||||
|
||||
static constexpr VAG create(uint8_t voice_num) {
|
||||
return VAG{.voice_number = voice_num};
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef CopyTo Overlay;
|
||||
|
|
|
@ -37,11 +37,17 @@ namespace JabyEngine {
|
|||
}(file, buf_cfg, is_lz4);
|
||||
|
||||
switch(file.type) {
|
||||
case CDFileType::SimpleTIM:
|
||||
return FileProcessor::create(data_adr, file.payload.simple_tim);
|
||||
case CDFileType::CopyTo:
|
||||
return FileProcessor::create(data_adr, Nothing());
|
||||
|
||||
|
||||
case CDFileType::SimpleTIM:
|
||||
return FileProcessor::create(data_adr, file.payload.simple_tim);
|
||||
|
||||
#ifdef __SUPPORT_VAG__
|
||||
case CDFileType::SonyVAG:
|
||||
return FileProcessor::create(data_adr, file.payload.vag);
|
||||
#endif //__SUPPORT_VAG__
|
||||
|
||||
default:
|
||||
return FileProcessor::create_custom(data_adr, static_cast<CDFileType_t>(file.type) - static_cast<CDFileType_t>(CDFileType::Custom), file.payload);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const Nothing& nothing) {
|
||||
return State::from(NothingState(), reinterpret_cast<const uint8_t*>(data_adr), parse_nothing);
|
||||
return State::from(NothingState(), data_adr, parse_nothing);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -139,7 +139,7 @@ namespace JabyEngine {
|
|||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const SimpleTIM& file) {
|
||||
return State::from(SimpleTIMState(file), reinterpret_cast<const uint8_t*>(data_adr), parse_header);
|
||||
return State::from(SimpleTIMState(file), data_adr, parse_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#include <PSX/File/file_processor_helper.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
||||
#ifdef __SUPPORT_VAG__
|
||||
namespace JabyEngine {
|
||||
namespace FileProcessor {
|
||||
struct VAGState {
|
||||
static constexpr VAGState create() {
|
||||
return VAGState{};
|
||||
}
|
||||
};
|
||||
|
||||
static Progress parse_header(State::Configuration& config, VAGState& state) {
|
||||
printf("What am I supposed to do?!\n");
|
||||
return Progress::Error;
|
||||
}
|
||||
|
||||
State create(const uint32_t* data_adr, const VAG& file) {
|
||||
return State::from(VAGState::create(), data_adr, parse_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // __SUPPORT_VAG__
|
Loading…
Reference in New Issue