Add ControllerTest Overlay and support not loading new state if previous loaded

This commit is contained in:
Jaby 2024-01-03 20:38:43 -06:00
parent 17a6b6e223
commit 5e050f3ffd
8 changed files with 57 additions and 21 deletions

View File

@ -1,7 +1,7 @@
{ {
"slot_0": { "slot_0": {
"!timer_tests": { "controller_tests": {
"pattern": "bin/*/src/Overlay/TimerTests/*.o" "pattern": "bin/*/src/Overlay/ControllerTest/*.o"
}, },
"gpu_tests": { "gpu_tests": {
"pattern": "bin/*/src/Overlay/GPUTest/*.o" "pattern": "bin/*/src/Overlay/GPUTest/*.o"

View File

@ -11,6 +11,7 @@ namespace Assets {
} }
namespace Overlay { namespace Overlay {
void load_controller_test();
void load_gpu_test(); void load_gpu_test();
} }
} }

View File

@ -0,0 +1,7 @@
#include <stdio.h>
namespace ControllerTest {
void main() {
printf("CONT: BlubbBlubbBlubb!!\n");
}
}

View File

@ -2,7 +2,6 @@
namespace GPUTest { namespace GPUTest {
void main() { void main() {
printf("BlubbBlubbBlubb!!\n"); printf("GPU: BlubbBlubbBlubb!!\n");
while(true);
} }
} }

View File

@ -1,4 +1,9 @@
#pragma once #pragma once
namespace ControllerTest {
void main();
}
namespace GPUTest { namespace GPUTest {
void main(); void main();
} }

View File

@ -26,11 +26,13 @@ struct StateChange {
bool contains_state() const { bool contains_state() const {
return this->main; return this->main;
} }
auto operator<=>(const StateChange&) const = default;
}; };
static const Menu::SimpleMenu::Entry MenuEntries[] = { static const Menu::SimpleMenu::Entry MenuEntries[] = {
{"Menu 1"}, {"Controller Test"},
{"Menu 2"}, {"GPU Test"},
{"Menu 3"}, {"Menu 3"},
{"Menu 4"}, {"Menu 4"},
{"Menu 5"} {"Menu 5"}
@ -41,14 +43,24 @@ static const Menu::SimpleMenu::Entry MenuEntries[] = {
static object::Paco paco; static object::Paco paco;
static Menu::SimpleMenu menu; static Menu::SimpleMenu menu;
static StateChange state_changer; static StateChange state_changer;
static StateChange old_state_changer;
static void setup() { static void setup() {
Assets::Main::load(); Assets::Main::load();
FontWriter::setup(); FontWriter::setup();
paco.setup(); paco.setup();
menu.setup([](uint32_t selection) { menu.setup([](uint32_t selection) {
state_changer.asset_load = Assets::Overlay::load_gpu_test; switch(selection) {
state_changer.main = GPUTest::main; case 0:
state_changer.asset_load = Assets::Overlay::load_controller_test;
state_changer.main = ControllerTest::main;
break;
case 1:
state_changer.asset_load = Assets::Overlay::load_gpu_test;
state_changer.main = GPUTest::main;
break;
}
},MenuEntries); },MenuEntries);
} }
@ -92,18 +104,19 @@ namespace LoadingScene {
} }
static void run() { static void run() {
update(); if(old_state_changer != state_changer) {
GPU::swap_buffers_vsync(1); printf("Loading new state...\n");
render();
GPU::swap_buffers_vsync(1); update();
GPU::swap_buffers_vsync(1);
render();
GPU::swap_buffers_vsync(1);
old_state_changer = state_changer;
}
printf("End of execution!\n");
state_changer.asset_load(); state_changer.asset_load();
state_changer.main(); state_changer.main();
printf("Done in state!\n");
while(true);
state_changer.clear(); state_changer.clear();
} }
} }

View File

@ -4,13 +4,15 @@
#include <PSX/AutoLBA/auto_lba_declaration.hpp> #include <PSX/AutoLBA/auto_lba_declaration.hpp>
#include <stdio.h> #include <stdio.h>
extern "C" uint32_t __controller_tests_start;
extern "C" uint32_t __gpu_tests_start; extern "C" uint32_t __gpu_tests_start;
namespace Assets { namespace Assets {
enum LBA { enum LBA {
__jabyengine_start_lba_request __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_request_lba_for(GPU_TEST_OVL, "GTO.BIN"),
__jabyengine_request_lba_for(CONT_TEST_OVL, "CTO.BIN"),
__jabyengine_end_lba_request __jabyengine_end_lba_request
}; };
__declare_lba_header(LBA); __declare_lba_header(LBA);
@ -54,12 +56,20 @@ namespace Assets {
} }
namespace Overlay { namespace Overlay {
static const CDFile Files[] = { static const CDFile GPUFiles[] = {
CDFileBuilder::overlay(LBA::GPU_TEST_OVL, &__gpu_tests_start) CDFileBuilder::overlay(LBA::GPU_TEST_OVL, &__gpu_tests_start)
}; };
static const CDFile ControllerFiles[] = {
CDFileBuilder::overlay(LBA::CONT_TEST_OVL, &__controller_tests_start)
};
void load_controller_test() {
::Assets::load(ControllerFiles);
}
void load_gpu_test() { void load_gpu_test() {
::Assets::load(Files); ::Assets::load(GPUFiles);
// Load Overlay assets?! // Load Overlay assets?!
} }
} }

View File

@ -6,6 +6,7 @@
<Track> <Track>
<File name = "SYSTEM.CNF">System.cnf</File> <File name = "SYSTEM.CNF">System.cnf</File>
<Main name = "XXXX_AAA.AA" lba_source = "../application/src/asset_mgr.cpp">../application/bin/PSX-release/PoolBox.psexe</Main> <Main name = "XXXX_AAA.AA" lba_source = "../application/src/asset_mgr.cpp">../application/bin/PSX-release/PoolBox.psexe</Main>
<Overlay name = "CTO.BIN">../application/bin/PSX-release/Overlay.controller_tests</Overlay>
<Overlay name = "GTO.BIN">../application/bin/PSX-release/Overlay.gpu_tests</Overlay> <Overlay name = "GTO.BIN">../application/bin/PSX-release/Overlay.gpu_tests</Overlay>
<Directory name="ASSETS" hidden = "true"> <Directory name="ASSETS" hidden = "true">