diff --git a/examples/PoolBox/application/Overlays.json b/examples/PoolBox/application/Overlays.json index 61ab6a89..00a14b6c 100644 --- a/examples/PoolBox/application/Overlays.json +++ b/examples/PoolBox/application/Overlays.json @@ -4,7 +4,7 @@ "pattern": "bin/*/src/Overlay/TimerTests/*.o" }, "gpu_tests": { - "pattern": "bin/*/src/Overlay/GPUTests/*.o" + "pattern": "bin/*/src/Overlay/GPUTest/*.o" } } } \ No newline at end of file diff --git a/examples/PoolBox/application/include/asset_mgr.hpp b/examples/PoolBox/application/include/asset_mgr.hpp index ee771562..fab276b2 100644 --- a/examples/PoolBox/application/include/asset_mgr.hpp +++ b/examples/PoolBox/application/include/asset_mgr.hpp @@ -9,4 +9,8 @@ namespace Assets { void load(); } + + namespace Overlay { + void load_gpu_test(); + } } \ 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 new file mode 100644 index 00000000..15f64116 --- /dev/null +++ b/examples/PoolBox/application/src/Overlay/GPUTest/gpu_test.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +enum LBA { + __jabyengine_start_lba_request + __jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.BIN"), + __jabyengine_end_lba_request +}; +__declare_lba_header(LBA); + +namespace GPUTest { + void main() { + printf("BlubbBlubbBlubb!!\n"); + while(true); + } +} \ No newline at end of file diff --git a/examples/PoolBox/application/src/Overlay/Overlays.hpp b/examples/PoolBox/application/src/Overlay/Overlays.hpp new file mode 100644 index 00000000..e61b02db --- /dev/null +++ b/examples/PoolBox/application/src/Overlay/Overlays.hpp @@ -0,0 +1,4 @@ +#pragma once +namespace GPUTest { + void main(); +} \ No newline at end of file diff --git a/examples/PoolBox/application/src/application.cpp b/examples/PoolBox/application/src/application.cpp index 8b2a3177..cbedb764 100644 --- a/examples/PoolBox/application/src/application.cpp +++ b/examples/PoolBox/application/src/application.cpp @@ -2,6 +2,7 @@ #include "include/font_writer.hpp" #include "include/menu.hpp" #include "include/paco.hpp" +#include "Overlay/Overlays.hpp" #include #include #include @@ -9,6 +10,24 @@ using namespace JabyEngine; +struct StateChange { + void (*asset_load)(); + void (*main)(); + + static constexpr StateChange empty() { + return StateChange{.asset_load = nullptr, .main = nullptr}; + } + + void clear() { + this->asset_load = nullptr; + this->main = nullptr; + } + + bool contains_state() const { + return this->main; + } +}; + static const Menu::SimpleMenu::Entry MenuEntries[] = { {"Menu 1"}, {"Menu 2"}, @@ -21,14 +40,15 @@ static const Menu::SimpleMenu::Entry MenuEntries[] = { // Do we want Paco to be HERE?! static object::Paco paco; static Menu::SimpleMenu menu; -static bool enter_loading = false; +static StateChange state_changer; static void setup() { Assets::Main::load(); FontWriter::setup(); paco.setup(); menu.setup([](uint32_t selection) { - enter_loading = true; + state_changer.asset_load = Assets::Overlay::load_gpu_test; + state_changer.main = GPUTest::main; },MenuEntries); } @@ -72,14 +92,19 @@ namespace LoadingScene { } static void run() { - enter_loading = false; update(); GPU::swap_buffers_vsync(1); render(); GPU::swap_buffers_vsync(1); printf("End of execution!\n"); - while(true); + state_changer.asset_load(); + state_changer.main(); + printf("Done in state!\n"); + + while(true); + + state_changer.clear(); } } @@ -87,7 +112,7 @@ void main() { setup(); while(true) { - if(enter_loading) { + if(state_changer.contains_state()) { LoadingScene::run(); } diff --git a/examples/PoolBox/application/src/asset_mgr.cpp b/examples/PoolBox/application/src/asset_mgr.cpp index aeec8c67..ce78bc3f 100644 --- a/examples/PoolBox/application/src/asset_mgr.cpp +++ b/examples/PoolBox/application/src/asset_mgr.cpp @@ -4,10 +4,13 @@ #include #include +extern "C" uint32_t __gpu_tests_start; + namespace Assets { enum LBA { __jabyengine_start_lba_request - __jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.BIN"), + __jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.BIN"), + __jabyengine_request_lba_for(GPU_TEST_OVL, "GTO.BIN"), __jabyengine_end_lba_request }; __declare_lba_header(LBA); @@ -35,13 +38,29 @@ namespace Assets { } } + template + static void load(const CDFile (&files)[N]) { + return load(files, N); + } + namespace Main { static const CDFile Files[] = { CDFileBuilder::simple_tim(LBA::PACO, PacoTIM) }; void load() { - ::Assets::load(Files, sizeof(Files)/sizeof(Files[0])); + ::Assets::load(Files); + } + } + + namespace Overlay { + static const CDFile Files[] = { + CDFileBuilder::overlay(LBA::GPU_TEST_OVL, &__gpu_tests_start) + }; + + void load_gpu_test() { + ::Assets::load(Files); + // Load Overlay assets?! } } } \ No newline at end of file diff --git a/examples/PoolBox/iso/Config.xml b/examples/PoolBox/iso/Config.xml index 282edeed..d46642c5 100644 --- a/examples/PoolBox/iso/Config.xml +++ b/examples/PoolBox/iso/Config.xml @@ -4,8 +4,10 @@ %PSX_LICENSE_PATH%/LICENSEE.DAT - System.cnf -
../application/bin/PSX-release/PoolBox.psexe
+ System.cnf +
../application/bin/PSX-release/PoolBox.psexe
+ ../application/bin/PSX-release/Overlay.gpu_tests +