Increase PoolBox to Version 0.9.0
This commit is contained in:
parent
7b189445af
commit
e609d2b406
|
@ -23,6 +23,7 @@ namespace Assets {
|
|||
void load_bios_info();
|
||||
void load_controller_test();
|
||||
void load_gpu_test();
|
||||
void load_large_gpu_test();
|
||||
void load_gte_test();
|
||||
void load_font_cycler();
|
||||
void load_screen_center();
|
||||
|
|
|
@ -13,10 +13,32 @@ namespace GPUTest {
|
|||
};
|
||||
__declare_lba_header(LBA);
|
||||
|
||||
CDFile Assets[18] = {
|
||||
CDFile Assets[2] = {
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
};
|
||||
|
||||
CDFile LargeAssets[36] = {
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::TEX, TexPageTIM),
|
||||
CDFileBuilder::simple_tim(LBA::ICON, IconTIM),
|
||||
|
|
|
@ -14,7 +14,8 @@ namespace ControllerTest {
|
|||
|
||||
namespace GPUTest {
|
||||
extern const volatile JabyEngine::AutoLBAEntry lba[];
|
||||
extern JabyEngine::CDFile Assets[18];
|
||||
extern JabyEngine::CDFile Assets[2];
|
||||
extern JabyEngine::CDFile LargeAssets[36];
|
||||
|
||||
void main();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "Overlay/Overlays.hpp"
|
||||
#include <FontWriter/fonts.hpp>
|
||||
#include <FontWriter/font_writer.hpp>
|
||||
//#include <PSX/Audio/CDDA.hpp>
|
||||
#include <PSX/Audio/CDDA.hpp>
|
||||
#include <PSX/Audio/CDXA.hpp>
|
||||
#include <PSX/Periphery/periphery.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
@ -13,36 +13,69 @@
|
|||
using namespace JabyEngine;
|
||||
using DigitalButton = Periphery::GenericController::Button;
|
||||
|
||||
struct XAPlayer {
|
||||
struct CDPlayer {
|
||||
static constexpr auto MaxChannels = 2;
|
||||
|
||||
uint8_t channel;
|
||||
bool is_xa;
|
||||
|
||||
static XAPlayer create() {
|
||||
return XAPlayer{0};
|
||||
static constexpr CDPlayer create() {
|
||||
return CDPlayer{.channel = 0, .is_xa = true};
|
||||
}
|
||||
|
||||
void play() {
|
||||
this->channel = 0;
|
||||
if(this->is_xa) {
|
||||
Assets::XAAudio::play_fox();
|
||||
}
|
||||
|
||||
else {
|
||||
const auto [first_track, last_track] = CDDA::get_tracks();
|
||||
CDDA::play(first_track);
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
if(this->is_xa) {
|
||||
CDXA::stop();
|
||||
}
|
||||
|
||||
else {
|
||||
CDDA::stop();
|
||||
}
|
||||
}
|
||||
|
||||
void change_channel(int8_t step) {
|
||||
if(this->is_xa) {
|
||||
this->channel = static_cast<uint8_t>((this->channel + step))%MaxChannels;
|
||||
CDXA::set_channel(this->channel);
|
||||
}
|
||||
}
|
||||
|
||||
void change_audio() {
|
||||
CDPlayer::stop();
|
||||
this->is_xa = !this->is_xa;
|
||||
CDPlayer::play();
|
||||
}
|
||||
|
||||
void push() {
|
||||
if(this->is_xa) {
|
||||
CDXA::push_play();
|
||||
}
|
||||
|
||||
else {
|
||||
CDDA::push_play();
|
||||
}
|
||||
}
|
||||
|
||||
void pop() {
|
||||
if(this->is_xa) {
|
||||
CDXA::pop_play();
|
||||
}
|
||||
|
||||
else {
|
||||
CDDA::pop_play();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct StateChange {
|
||||
|
@ -80,7 +113,7 @@ static const auto doener_fish = Make::SPRT(
|
|||
GPU::Color24::Grey()
|
||||
);
|
||||
|
||||
static XAPlayer xa = XAPlayer::create();
|
||||
static CDPlayer cd_player = CDPlayer::create();
|
||||
static object::Paco paco;
|
||||
static Menu::SimpleMenu menu;
|
||||
static StateChange state_changer;
|
||||
|
@ -101,8 +134,9 @@ static void setup() {
|
|||
|
||||
const auto& controller = Periphery::get_primary_controller_as<JabyEngine::Periphery::GenericController>();
|
||||
// With this approach we can default load_test to true for debugging reasons
|
||||
if(controller.button.is_down(DigitalButton::R2) && controller.button.is_down(DigitalButton::L2)) {
|
||||
Shared::load_test = true;
|
||||
if(controller.is_connected()) {
|
||||
// TODO: Make this work on the PS3
|
||||
Shared::load_test = controller.button.is_down(DigitalButton::R2) && controller.button.is_down(DigitalButton::L2);
|
||||
}
|
||||
|
||||
Assets::Main::load();
|
||||
|
@ -144,11 +178,7 @@ static void setup() {
|
|||
}
|
||||
},MenuEntries);
|
||||
|
||||
// TODO: CDDA?
|
||||
// const auto [first_track, last_track] = CDDA::get_tracks();
|
||||
// CDDA::play(first_track);
|
||||
|
||||
xa.play();
|
||||
cd_player.play();
|
||||
}
|
||||
|
||||
namespace NormalScene {
|
||||
|
@ -161,12 +191,16 @@ namespace NormalScene {
|
|||
Periphery::query_controller();
|
||||
const auto& controller = Periphery::get_primary_controller_as<JabyEngine::Periphery::GenericController>();
|
||||
|
||||
if(controller.button.went_down(DigitalButton::SEL)) {
|
||||
cd_player.change_audio();
|
||||
}
|
||||
|
||||
if(controller.button.went_down(DigitalButton::R1)) {
|
||||
xa.change_channel(1);
|
||||
cd_player.change_channel(1);
|
||||
}
|
||||
|
||||
if(controller.button.went_down(DigitalButton::L1)) {
|
||||
xa.change_channel(-1);
|
||||
cd_player.change_channel(-1);
|
||||
}
|
||||
|
||||
auto cursor = FontWriter::update(Make::PositionI16((GPU::Display::Width-TitleLength)/2, 16));
|
||||
|
@ -176,10 +210,9 @@ namespace NormalScene {
|
|||
FontWriter::new_font_writer.write(cursor.change_position(Make::PositionI16((GPU::Display::Width-VersionLength)/2, 16 + DefaultFont::Info.get_kern_size().height)), Version, GPU::Color24::Green(0xD0), &FontWriter::wiggle);
|
||||
menu.update(FontWriter::bios_font_writer, cursor, Make::PositionI16(8, 64));
|
||||
|
||||
|
||||
if(Shared::load_test) {
|
||||
// Force state change if we are in the load_test state
|
||||
state_changer.asset_load = Assets::Overlay::load_gpu_test;
|
||||
state_changer.asset_load = Assets::Overlay::load_large_gpu_test;
|
||||
state_changer.main = GPUTest::main;
|
||||
}
|
||||
|
||||
|
@ -220,10 +253,10 @@ namespace LoadingScene {
|
|||
render();
|
||||
GPU::swap_buffers_vsync(1);
|
||||
|
||||
xa.push();
|
||||
cd_player.push();
|
||||
state_changer.asset_load();
|
||||
old_state_changer = state_changer;
|
||||
xa.pop();
|
||||
cd_player.pop();
|
||||
}
|
||||
|
||||
state_changer.main();
|
||||
|
|
|
@ -96,6 +96,10 @@ namespace Assets {
|
|||
load(CDFileBuilder::overlay(LBA::GPU_TEST_OVL, &__gpu_tests_start), GPUTest::lba, GPUTest::Assets);
|
||||
}
|
||||
|
||||
void load_large_gpu_test() {
|
||||
load(CDFileBuilder::overlay(LBA::GPU_TEST_OVL, &__gpu_tests_start), GPUTest::lba, GPUTest::LargeAssets);
|
||||
}
|
||||
|
||||
void load_gte_test() {
|
||||
load(CDFileBuilder::overlay(LBA::GTE_TEST_OVL, &__gpu_tests_start), GTETest::lba, GTETest::Assets);
|
||||
}
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
<Defaults>
|
||||
<Data lead-out="0:2:0"\>
|
||||
<Directory hidden="true"\>
|
||||
<File lz4="already"\><<<<>
|
||||
<File lz4="already"\>
|
||||
<CD_Audio Alignment="True"\>
|
||||
</Defaults>-->
|
||||
<Description>
|
||||
<Publisher>Jaby</Publisher>
|
||||
<License>%PSX_LICENSE_PATH%/%PSX_LICENSE%.DAT</License>
|
||||
</Description>
|
||||
<!--TODO: Rename `Track` to `Data`-->
|
||||
<Filesystem lead-out="0:2:0">
|
||||
<File name = "SYSTEM.CNF">System.cnf.subst</File>
|
||||
<Main name = "%PSX_BOOT_FILE%" lba_source = "../application/src/asset_mgr.cpp" >../application/bin/%PSX_TV_FORMAT%/PSX-release/PoolBox.psexe</Main>
|
||||
|
|
|
@ -1,32 +1,30 @@
|
|||
#pragma once
|
||||
#include "../../stdint.hpp"
|
||||
|
||||
namespace JabyEngine {
|
||||
static constexpr int8_t operator""_i8(unsigned long long int value) {
|
||||
static constexpr int8_t operator""_i8(unsigned long long int value) {
|
||||
return static_cast<int8_t>(value);
|
||||
}
|
||||
|
||||
static constexpr uint8_t operator""_u8(unsigned long long int value) {
|
||||
return static_cast<uint8_t>(value);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr int16_t operator""_i16(unsigned long long int value) {
|
||||
return static_cast<int16_t>(value);
|
||||
}
|
||||
|
||||
static constexpr uint16_t operator""_u16(unsigned long long int value) {
|
||||
return static_cast<uint16_t>(value);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr int32_t operator""_i32(unsigned long long int value) {
|
||||
return static_cast<int32_t>(value);
|
||||
}
|
||||
|
||||
static constexpr uint32_t operator""_u32(unsigned long long int value) {
|
||||
return static_cast<uint32_t>(value);
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr uint8_t operator""_u8(unsigned long long int value) {
|
||||
return static_cast<uint8_t>(value);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr int16_t operator""_i16(unsigned long long int value) {
|
||||
return static_cast<int16_t>(value);
|
||||
}
|
||||
|
||||
static constexpr uint16_t operator""_u16(unsigned long long int value) {
|
||||
return static_cast<uint16_t>(value);
|
||||
}
|
||||
|
||||
// ###################################################################
|
||||
|
||||
static constexpr int32_t operator""_i32(unsigned long long int value) {
|
||||
return static_cast<int32_t>(value);
|
||||
}
|
||||
|
||||
static constexpr uint32_t operator""_u32(unsigned long long int value) {
|
||||
return static_cast<uint32_t>(value);
|
||||
}
|
|
@ -3,9 +3,6 @@
|
|||
|
||||
namespace JabyEngine {
|
||||
namespace Make {
|
||||
using JabyEngine::operator""_i16;
|
||||
using JabyEngine::operator""_u16;
|
||||
|
||||
template<typename T, typename...ARGS>
|
||||
static constexpr T creator_template(const ARGS&...args) {
|
||||
return T::create(args...);
|
||||
|
|
|
@ -50,6 +50,10 @@ namespace JabyEngine {
|
|||
return RawController::header.rumble1;
|
||||
}
|
||||
|
||||
bool is_connected() const {
|
||||
return RawController::header.state != RawController::State::Disconnected;
|
||||
}
|
||||
|
||||
bool is_useable() const {
|
||||
const auto type = RawController::get_type();
|
||||
return ((RawController::header.state == RawController::State::Stable) && (type == ControllerType::Controller || type == ControllerType::DualShock));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "Auxiliary/literals.hpp"
|
||||
#include <stddef.hpp>
|
||||
|
||||
#define __used __attribute__((used))
|
||||
|
|
|
@ -30,7 +30,10 @@ namespace JabyEngine {
|
|||
playing_track.min = CD_IO::PortIndex0::ResponseFifo.read().raw;
|
||||
playing_track.sec = CD_IO::PortIndex0::ResponseFifo.read().raw;
|
||||
|
||||
CD::Command::send(CD_IO::Command::Play, track);
|
||||
CD::Command::send(CD_IO::Command::SetLoc, playing_track.min, playing_track.sec, 0x0_u8);
|
||||
CD::Command::send(CD_IO::Command::Play);
|
||||
// The PS3 does not support playing a track by track id
|
||||
//CD::Command::send(CD_IO::Command::Play, track);
|
||||
}
|
||||
|
||||
void stop() {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <PSX/System/syscalls.hpp>
|
||||
#include <stdio.hpp>
|
||||
|
||||
// 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?
|
||||
namespace JabyEngine {
|
||||
namespace CDDA {
|
||||
extern CD::internal::BCDTimeStamp playing_track;
|
||||
|
|
Loading…
Reference in New Issue