Play nice jingle and more clean-up

This commit is contained in:
Jaby 2024-10-05 17:43:16 +02:00
parent 6a1c5e704a
commit 74f3da97f6
12 changed files with 14 additions and 35 deletions

View File

@ -7,7 +7,7 @@ enum struct FileType : JabyEngine::CDFileType_t {
struct CustomCDFileBuilder {
static constexpr JabyEngine::CDFile jingle(uint32_t sfx_id) {
// TODO: This currently re-loads Paco; We should make this treat it's own file!
// v we reload Paco
return JabyEngine::CDFile::custom(0, FileType::Jingle, sfx_id);
}
};

View File

@ -9,7 +9,7 @@ namespace JabyEngine {
};
static Progress parse_jingle(State::Configuration& config, JingleState& jingle) {
printf("Playing jingle: %i\n", jingle.sfx_id);
SPU::voice[jingle.sfx_id].play();
return Progress::Done;
}

View File

@ -170,7 +170,6 @@ static void setup() {
break;
}
},MenuEntries);
cd_player.play();
}
@ -289,8 +288,8 @@ namespace LoadingScene {
void main() {
const auto& controller = Periphery::get_primary_controller_as<JabyEngine::Periphery::GenericController>();
setup();
setup();
while(true) {
if(state_changer.contains_state()) {
LoadingScene::run();

View File

@ -20,6 +20,7 @@ namespace Assets {
__jabyengine_request_lba_for(JABY_LOAD, "ASSETS/MAIN/LOAD.IMG"),
__jabyengine_request_lba_for(APPLE_SFX, "SFX/APPLE.VAG"),
__jabyengine_request_lba_for(BLUBB_SFX, "SFX/BLUBB.VAG"),
__jabyengine_request_lba_for(FRIEND_SFX, "SFX/FRIEND.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"),
@ -69,7 +70,8 @@ namespace Assets {
CDFileBuilder::simple_tim(LBA::JABY_LOAD, JabyLoader::TIMLoaction),
CDFileBuilder::sony_vag(LBA::APPLE_SFX, VAG::create(0, 1.0_vol)),
CDFileBuilder::sony_vag(LBA::BLUBB_SFX, VAG::create(1, 1.0_vol)),
CustomCDFileBuilder::jingle(32),
CDFileBuilder::sony_vag(LBA::FRIEND_SFX, VAG::create(2, 1.0_vol)),
CustomCDFileBuilder::jingle(2),
};
void load() {

BIN
examples/PoolBox/assets/JabyTails.png (Stored with Git LFS)

Binary file not shown.

View File

@ -14,6 +14,7 @@ INPUT += $(OUTPUT_DIR)/Evacuation_cdda.xa
INPUT += $(OUTPUT_DIR)/fox.xa
INPUT += $(OUTPUT_DIR)/apple.vag
INPUT += $(OUTPUT_DIR)/blubb.vag
INPUT += $(OUTPUT_DIR)/Friendship_samp.vag
## Images
INPUT += $(OUTPUT_DIR)/TexturePage.img

View File

@ -49,8 +49,9 @@
</InterleavedFile>
</Directory>
<Directory name = "SFX" hidden = "true">
<File name = "APPLE.VAG" lz4 = "already">../assets/bin/apple.vag</File>
<File name = "BLUBB.VAG" lz4 = "already">../assets/bin/blubb.vag</File>
<File name = "APPLE.VAG" lz4 = "already">../assets/bin/apple.vag</File>
<File name = "BLUBB.VAG" lz4 = "already">../assets/bin/blubb.vag</File>
<File name = "FRIEND.VAG">../assets/tmp.vag</File><!--TODO: Find working vag tool-->
</Directory>
</Filesystem>
<AudioTrack align = "true">../assets/audio/temp/breaking.wav</AudioTrack>

View File

@ -42,24 +42,6 @@ namespace JabyEngine {
}
}
static void test_spu_alloc() {
static const auto calculate_spu_adr = [](size_t size) -> const uint8_t* {
return reinterpret_cast<const uint8_t*>(SPU_IO_Values::MemoryMap::ADPCM + size);
};
static const auto simple_assert = [](uint32_t test_id, const uint8_t* adr, const uint8_t* expected) {
static const char* ok_text = "Test %i: 0x%p == 0x%p; OK\n";
static const char* failed_text = "Test %i: 0x%p != 0x%p; Failed\n";
printf(adr == expected ? ok_text : failed_text, test_id, adr, expected);
};
printf("=== SPU test ===\n");
simple_assert(0, SPU_MMU::allocate(0, 0x600), calculate_spu_adr(0x0));
simple_assert(1, SPU_MMU::allocate(1, 0x800), calculate_spu_adr(0x600));
simple_assert(2, SPU_MMU::allocate(0, 0x300), calculate_spu_adr(0x0));
simple_assert(3, SPU_MMU::allocate(2, 0x300), calculate_spu_adr(0x300));
}
namespace boot {
namespace Start {
// Thanks to Nicolas Noble!
@ -99,7 +81,6 @@ namespace JabyEngine {
GTE::setup();
test_bios_font();
test_gte_scale();
test_spu_alloc();
SPU::setup();
}

View File

@ -5,7 +5,6 @@
#include <PSX/System/syscalls.hpp>
#include <stdio.hpp>
// TODO: Can you use the GPU IO Port while also using DMA?
namespace JabyEngine {
namespace CD {
namespace internal {

View File

@ -44,6 +44,7 @@ namespace JabyEngine {
const auto words_used = Helper::DMA::send_words<SPU::internal::DMA>(words_to_use, is_last);
state.words_left -= words_used;
config.processed(words_used*sizeof(uint32_t));
return is_last ? Progress::Done : Progress::InProgress;
}

View File

@ -62,12 +62,6 @@ namespace JabyEngine {
void render(const uint32_t* data, size_t words) {
wait_ready_for_CMD();
#ifdef __SUPPORT_PS3__
// TODO: Doesn't matter anymore...?
// The PS3 needs explict change to FiFo
//GPU_IO::GP1.set_dma_direction(GPU_IO_Values::GPUSTAT::DMADirection::Fifo);
#endif // __SUPPORT_PS3__
for(size_t n = 0; n < words; n++) {
GPU_IO::GP0.write({data[n]});
}

View File

@ -2,6 +2,7 @@
#include <PSX/System/IOPorts/spu_io.hpp>
#include <PSX/Auxiliary/math_helper.hpp>
#include <PSX/SPU/spu.hpp>
#include <PSX/jabyengine_config.hpp>
#include <stddef.hpp>
#ifdef __DEBUG_SPU_MMU__
#include <stdio.hpp>