From 12e0f0155b32940bc34d13b5ba2b63a3e7306dca Mon Sep 17 00:00:00 2001 From: Jaby Date: Mon, 22 Jul 2024 20:09:47 +0200 Subject: [PATCH] Hold R2 and L2 to active load test --- .../PoolBox/application/include/shared.hpp | 1 + .../src/Overlay/GTETest/gte_test.cpp | 1 - .../PoolBox/application/src/application.cpp | 22 ++++++++++++++----- examples/PoolBox/application/src/menu.cpp | 3 ++- examples/PoolBox/iso/Config.xml | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/examples/PoolBox/application/include/shared.hpp b/examples/PoolBox/application/include/shared.hpp index d902f1e5..f22ac265 100644 --- a/examples/PoolBox/application/include/shared.hpp +++ b/examples/PoolBox/application/include/shared.hpp @@ -6,4 +6,5 @@ namespace Shared { extern Menu::BackMenu back_menu; extern JabyEngine::GPU::POLY_G4 background; + extern bool load_test; } \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/GTETest/gte_test.cpp b/examples/PoolBox/application/src/Overlay/GTETest/gte_test.cpp index c751cd1a..1c683d11 100644 --- a/examples/PoolBox/application/src/Overlay/GTETest/gte_test.cpp +++ b/examples/PoolBox/application/src/Overlay/GTETest/gte_test.cpp @@ -57,7 +57,6 @@ namespace GTETest { } static auto star_base = Make::SPRT( - // TODO: improve magic numbers Make::AreaI16(Position, Make::SizeI16(64, 64)), Make::OffsetPageWithClut(JabySTARTim.get_page_offset_clut4(), Make::PageClut(JabySTARTim.get_clut_position())) ).linked(); diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp index 7064bf56..9b67e55d 100644 --- a/examples/PoolBox/application/src/application.cpp +++ b/examples/PoolBox/application/src/application.cpp @@ -11,6 +11,7 @@ #include using namespace JabyEngine; +using DigitalButton = Periphery::GenericController::Button; struct XAPlayer { static constexpr auto MaxChannels = 2; @@ -91,12 +92,19 @@ namespace Shared { Make::AreaI16(0, 0, GPU::Display::Width, GPU::Display::Height), {GPU::Color24::Red(0xA0), GPU::Color24::Green(0xA0), GPU::Color24::Blue(0xA0), GPU::Color24::Black()} ); + bool load_test = false; } static void setup() { // Use this size for the doener fish state? // doener_fish.set_rect_size_fast(Make::SizeI16(64, 32)); + const auto& controller = Periphery::get_primary_controller_as(); + // 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; + } + Assets::Main::load(); FontWriter::setup(); paco.setup(); @@ -145,8 +153,6 @@ static void setup() { namespace NormalScene { static void update() { - using DigitalButton = Periphery::GenericController::Button; - static const char Title[] = ">> Pool Box <<"; static const char Version[] = "Ver. 0.8.5"; static constexpr auto TitleLength = DefaultFont::Info.estimate_str_render_length(Title); @@ -170,10 +176,13 @@ 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)); - // TODO: Make this a feature - // Force state change for now - /*state_changer.asset_load = Assets::Overlay::load_gpu_test; - state_changer.main = GPUTest::main;*/ + + 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.main = GPUTest::main; + } + } static void render() { @@ -226,6 +235,7 @@ namespace LoadingScene { } void main() { + Periphery::query_controller(); setup(); while(true) { diff --git a/examples/PoolBox/application/src/menu.cpp b/examples/PoolBox/application/src/menu.cpp index 724fe131..2eace68f 100644 --- a/examples/PoolBox/application/src/menu.cpp +++ b/examples/PoolBox/application/src/menu.cpp @@ -1,3 +1,4 @@ +#include "../include/shared.hpp" #include "include/menu.hpp" #include @@ -49,7 +50,7 @@ namespace Menu { bool BackMenu :: update(const GPU::PositionI16& position, bool auto_clear) { const auto& controller = Periphery::get_primary_controller_as(); - if(true/*controller.button.is_down(DigitalButton::Circle)*/) { + if(Shared::load_test || controller.button.is_down(DigitalButton::Circle)) { this->waiting = true; if(this->timeout.is_expired_for(2500_ms)) { return true; diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml index eb57a721..0b331162 100644 --- a/examples/PoolBox/iso/Config.xml +++ b/examples/PoolBox/iso/Config.xml @@ -32,8 +32,8 @@