Prepare VAG loading
This commit is contained in:
parent
07327fd646
commit
10c394aeba
|
@ -16,7 +16,7 @@ namespace JabyEngine {
|
||||||
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload) {
|
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload) {
|
||||||
switch(static_cast<FileType>(file_type)) {
|
switch(static_cast<FileType>(file_type)) {
|
||||||
case FileType::Jingle:
|
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:
|
default:
|
||||||
return FileProcessor::create(data_adr, Nothing());
|
return FileProcessor::create(data_adr, Nothing());
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace Assets {
|
||||||
__jabyengine_start_lba_request
|
__jabyengine_start_lba_request
|
||||||
__jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.IMG"),
|
__jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.IMG"),
|
||||||
__jabyengine_request_lba_for(DFISH, "ASSETS/MAIN/DFISH.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(MIX_XA, "XAAUDIO/MIX.XA"),
|
||||||
__jabyengine_request_lba_for(BIOS_INFO_OVL, "BIO.BIN"),
|
__jabyengine_request_lba_for(BIOS_INFO_OVL, "BIO.BIN"),
|
||||||
__jabyengine_request_lba_for(GPU_TEST_OVL, "GTO.BIN"),
|
__jabyengine_request_lba_for(GPU_TEST_OVL, "GTO.BIN"),
|
||||||
|
@ -61,6 +62,7 @@ namespace Assets {
|
||||||
static const CDFile Files[] = {
|
static const CDFile Files[] = {
|
||||||
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM),
|
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM),
|
||||||
CDFileBuilder::simple_tim(LBA::DFISH, DoenerFishInfo.tim),
|
CDFileBuilder::simple_tim(LBA::DFISH, DoenerFishInfo.tim),
|
||||||
|
CDFileBuilder::sony_vag(LBA::APPLE_SFX, VAG::create(0)),
|
||||||
CustomCDFileBuilder::jingle(32),
|
CustomCDFileBuilder::jingle(32),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace JabyEngine {
|
||||||
Reserved reserved;
|
Reserved reserved;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static __always_inline State from(const T& state, const uint8_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
static __always_inline State from(const T& state, const uint32_t* data_adr, GenericProcessRoutine<T> process_routine) {
|
||||||
return {Configuration::from(process_routine, data_adr), *reinterpret_cast<const Reserved*>(&state)};
|
return {Configuration::from(process_routine, reinterpret_cast<const uint8_t*>(data_adr)), *reinterpret_cast<const Reserved*>(&state)};
|
||||||
static_assert(sizeof(T) <= sizeof(Reserved));
|
static_assert(sizeof(T) <= sizeof(Reserved));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ namespace JabyEngine {
|
||||||
// The nothing state
|
// The nothing state
|
||||||
State create(const uint32_t* data_adr, const Nothing& nothing);
|
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 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);
|
State create_custom(const uint32_t* data_adr, const CDFileType_t& file_type, const CDFile::Payload& payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <PSX/jabyengine_config.hpp>
|
||||||
#include "../Overlay/overlay.hpp"
|
#include "../Overlay/overlay.hpp"
|
||||||
#include "file_types.hpp"
|
#include "file_types.hpp"
|
||||||
|
|
||||||
|
@ -7,8 +8,11 @@ namespace JabyEngine {
|
||||||
using RawPayload_t = uint32_t;
|
using RawPayload_t = uint32_t;
|
||||||
|
|
||||||
enum struct CDFileType : CDFileType_t {
|
enum struct CDFileType : CDFileType_t {
|
||||||
SimpleTIM = 0,
|
CopyTo = 0,
|
||||||
CopyTo,
|
SimpleTIM,
|
||||||
|
#ifdef __SUPPORT_VAG__
|
||||||
|
SonyVAG,
|
||||||
|
#endif // __SUPPORT_VAG__
|
||||||
Custom,
|
Custom,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,8 +20,9 @@ namespace JabyEngine {
|
||||||
struct CDFile {
|
struct CDFile {
|
||||||
union Payload {
|
union Payload {
|
||||||
RawPayload_t raw;
|
RawPayload_t raw;
|
||||||
SimpleTIM simple_tim;
|
|
||||||
CopyTo copy_to;
|
CopyTo copy_to;
|
||||||
|
SimpleTIM simple_tim;
|
||||||
|
VAG vag;
|
||||||
Overlay overlay;
|
Overlay overlay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,13 +43,19 @@ namespace JabyEngine {
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
struct CDFileBuilder {
|
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) {
|
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}};
|
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) {
|
#ifdef __SUPPORT_VAG__
|
||||||
return CDFile{.rel_lba_idx = rel_lba_idx, .type = CDFileType::CopyTo, .payload = {.copy_to = CopyTo{dst}}};
|
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) {
|
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}}};
|
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 Nothing {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CopyTo {
|
||||||
|
uint32_t* dst;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: Call TIM?
|
||||||
|
// TODO: Add create function?
|
||||||
struct SimpleTIM {
|
struct SimpleTIM {
|
||||||
static constexpr auto TextureX = BitRange::from_to(0, 8);
|
static constexpr auto TextureX = BitRange::from_to(0, 8);
|
||||||
static constexpr auto TextureY = BitRange::from_to(9, 16);
|
static constexpr auto TextureY = BitRange::from_to(9, 16);
|
||||||
|
@ -61,9 +67,14 @@ namespace JabyEngine {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CopyTo {
|
struct VAG {
|
||||||
uint32_t* dst;
|
uint8_t voice_number;
|
||||||
|
|
||||||
|
static constexpr VAG create(uint8_t voice_num) {
|
||||||
|
return VAG{.voice_number = voice_num};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
typedef CopyTo Overlay;
|
typedef CopyTo Overlay;
|
||||||
|
|
|
@ -37,11 +37,17 @@ namespace JabyEngine {
|
||||||
}(file, buf_cfg, is_lz4);
|
}(file, buf_cfg, is_lz4);
|
||||||
|
|
||||||
switch(file.type) {
|
switch(file.type) {
|
||||||
case CDFileType::SimpleTIM:
|
|
||||||
return FileProcessor::create(data_adr, file.payload.simple_tim);
|
|
||||||
case CDFileType::CopyTo:
|
case CDFileType::CopyTo:
|
||||||
return FileProcessor::create(data_adr, Nothing());
|
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:
|
default:
|
||||||
return FileProcessor::create_custom(data_adr, static_cast<CDFileType_t>(file.type) - static_cast<CDFileType_t>(CDFileType::Custom), file.payload);
|
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) {
|
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) {
|
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