From 39d3070d0fb4f1b65377f669a02e9b5c9a3afd49 Mon Sep 17 00:00:00 2001 From: Jaby Date: Thu, 4 Jan 2024 12:30:17 -0600 Subject: [PATCH] Prepare ControllerTest state with art and back functionality --- .../ControllerTest/controller_test.cpp | 26 +++++++++++++++++++ .../ControllerTest/controller_test_assets.cpp | 18 +++++++++++++ .../include/controller_test_assets.hpp | 8 ++++++ .../src/Overlay/GPUTest/gpu_test.cpp | 2 +- .../application/src/Overlay/Overlays.hpp | 3 +++ .../PoolBox/application/src/asset_mgr.cpp | 3 ++- examples/PoolBox/assets/Controller.png | 3 +++ examples/PoolBox/assets/Makefile | 5 +++- examples/PoolBox/iso/Config.xml | 6 ++++- 9 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 examples/PoolBox/application/src/Overlay/ControllerTest/controller_test_assets.cpp create mode 100644 examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp create mode 100644 examples/PoolBox/assets/Controller.png diff --git a/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test.cpp b/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test.cpp index 6e63e838..17c6e234 100644 --- a/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test.cpp +++ b/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test.cpp @@ -1,7 +1,33 @@ +#include "../../../include/shared.hpp" +#include #include namespace ControllerTest { + using namespace JabyEngine; + + static bool update_or_exit() { + Periphery::query_controller(); + if(Shared::back_menu.update(Make::PositionI16(0, GPU::Display::Height - 32))) { + return true; + } + + return false; + } + + static void render() { + Shared::back_menu.render(); + } + void main() { printf("CONT: BlubbBlubbBlubb!!\n"); + Shared::back_menu.reset(); + + while(true) { + if(update_or_exit()) { + break; + } + GPU::swap_buffers_vsync(1); + Shared::back_menu.render(); + } } } \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test_assets.cpp b/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test_assets.cpp new file mode 100644 index 00000000..82e3a3de --- /dev/null +++ b/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test_assets.cpp @@ -0,0 +1,18 @@ +#include "include/controller_test_assets.hpp" +#include +#include + +namespace ControllerTest { + using namespace JabyEngine; + + enum LBA { + __jabyengine_start_lba_request + __jabyengine_request_lba_for(CONT, "ASSETS/CONT/CONT.BIN"), + __jabyengine_end_lba_request + }; + __declare_lba_header(LBA); + + CDFile Assets[1] = { + CDFileBuilder::simple_tim(LBA::CONT, ControllerButtonTIM), + }; +} diff --git a/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp b/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp new file mode 100644 index 00000000..0117f36d --- /dev/null +++ b/examples/PoolBox/application/src/Overlay/ControllerTest/include/controller_test_assets.hpp @@ -0,0 +1,8 @@ +#pragma once +#include + +namespace ControllerTest { + using namespace JabyEngine; + + static constexpr auto ControllerButtonTIM = SimpleTIM(384, 0, 384, 511); +} \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test.cpp b/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test.cpp index 3c3c0949..e2305328 100644 --- a/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test.cpp +++ b/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test.cpp @@ -129,7 +129,7 @@ namespace GPUTest { break; } - GPU::swap_buffers_vsync(2); + GPU::swap_buffers_vsync(1); GPU::render(triangle1); GPU::render(triangle2); diff --git a/examples/PoolBox/application/src/Overlay/Overlays.hpp b/examples/PoolBox/application/src/Overlay/Overlays.hpp index d6ca936c..6579cded 100644 --- a/examples/PoolBox/application/src/Overlay/Overlays.hpp +++ b/examples/PoolBox/application/src/Overlay/Overlays.hpp @@ -2,6 +2,9 @@ #include namespace ControllerTest { + extern const volatile JabyEngine::AutoLBAEntry lba[]; + extern JabyEngine::CDFile Assets[1]; + void main(); } diff --git a/examples/PoolBox/application/src/asset_mgr.cpp b/examples/PoolBox/application/src/asset_mgr.cpp index 9d8abc93..d5268bd4 100644 --- a/examples/PoolBox/application/src/asset_mgr.cpp +++ b/examples/PoolBox/application/src/asset_mgr.cpp @@ -66,7 +66,8 @@ namespace Assets { }; void load_controller_test() { - ::Assets::load(lba, ControllerFiles); + ::Assets::load(lba, ControllerFiles); + ::Assets::load(ControllerTest::lba, ControllerTest::Assets); } void load_gpu_test() { diff --git a/examples/PoolBox/assets/Controller.png b/examples/PoolBox/assets/Controller.png new file mode 100644 index 00000000..21394a06 --- /dev/null +++ b/examples/PoolBox/assets/Controller.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c23c3da333a9f2a313afe8408dc244dbf1ec3cd1163c5ba990445e41e39776fd +size 4951 diff --git a/examples/PoolBox/assets/Makefile b/examples/PoolBox/assets/Makefile index 6ac738d9..938a8ad0 100644 --- a/examples/PoolBox/assets/Makefile +++ b/examples/PoolBox/assets/Makefile @@ -2,7 +2,7 @@ include $(JABY_ENGINE_DIR)/mkfile/ExportPath.mk include $(JABY_ENGINE_DIR)/mkfile/RebuildTarget.mk OUTPUT_DIR = bin -INPUT = $(OUTPUT_DIR)/TexturePage.bin $(OUTPUT_DIR)/IconTexture.bin $(OUTPUT_DIR)/Paco.bin +INPUT = $(OUTPUT_DIR)/TexturePage.bin $(OUTPUT_DIR)/IconTexture.bin $(OUTPUT_DIR)/Paco.bin $(OUTPUT_DIR)/Controller.bin $(OUTPUT_DIR)/TexturePage.bin: TexturePage.png @mkdir -p $(OUTPUT_DIR) @@ -15,6 +15,9 @@ $(OUTPUT_DIR)/IconTexture.bin: IconTexture.png $(OUTPUT_DIR)/Paco.bin: Paco.png jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4 --color-trans +$(OUTPUT_DIR)/Controller.bin: Controller.png + jaby_engine_fconv --lz4 $< -o $@ simple-tim clut4 --color-trans + all: $(INPUT) clean: diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml index 7b6bb1e9..71f86ed8 100644 --- a/examples/PoolBox/iso/Config.xml +++ b/examples/PoolBox/iso/Config.xml @@ -6,7 +6,7 @@ System.cnf
../application/bin/PSX-release/PoolBox.psexe
- ../application/bin/PSX-release/Overlay.controller_tests + ../application/bin/PSX-release/Overlay.controller_tests ../application/bin/PSX-release/Overlay.gpu_tests + + ../assets/bin/Controller.bin + + ../assets/bin/TexturePage.bin ../assets/bin/IconTexture.bin