Add ControllerTest Overlay and support not loading new state if previous loaded
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
namespace ControllerTest {
|
||||
void main() {
|
||||
printf("CONT: BlubbBlubbBlubb!!\n");
|
||||
}
|
||||
}
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace GPUTest {
|
||||
void main() {
|
||||
printf("BlubbBlubbBlubb!!\n");
|
||||
while(true);
|
||||
printf("GPU: BlubbBlubbBlubb!!\n");
|
||||
}
|
||||
}
|
@@ -1,4 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
namespace ControllerTest {
|
||||
void main();
|
||||
}
|
||||
|
||||
namespace GPUTest {
|
||||
void main();
|
||||
}
|
@@ -26,11 +26,13 @@ struct StateChange {
|
||||
bool contains_state() const {
|
||||
return this->main;
|
||||
}
|
||||
|
||||
auto operator<=>(const StateChange&) const = default;
|
||||
};
|
||||
|
||||
static const Menu::SimpleMenu::Entry MenuEntries[] = {
|
||||
{"Menu 1"},
|
||||
{"Menu 2"},
|
||||
{"Controller Test"},
|
||||
{"GPU Test"},
|
||||
{"Menu 3"},
|
||||
{"Menu 4"},
|
||||
{"Menu 5"}
|
||||
@@ -41,14 +43,24 @@ static const Menu::SimpleMenu::Entry MenuEntries[] = {
|
||||
static object::Paco paco;
|
||||
static Menu::SimpleMenu menu;
|
||||
static StateChange state_changer;
|
||||
static StateChange old_state_changer;
|
||||
|
||||
static void setup() {
|
||||
Assets::Main::load();
|
||||
FontWriter::setup();
|
||||
paco.setup();
|
||||
menu.setup([](uint32_t selection) {
|
||||
state_changer.asset_load = Assets::Overlay::load_gpu_test;
|
||||
state_changer.main = GPUTest::main;
|
||||
switch(selection) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -92,18 +104,19 @@ namespace LoadingScene {
|
||||
}
|
||||
|
||||
static void run() {
|
||||
update();
|
||||
GPU::swap_buffers_vsync(1);
|
||||
render();
|
||||
GPU::swap_buffers_vsync(1);
|
||||
if(old_state_changer != state_changer) {
|
||||
printf("Loading new state...\n");
|
||||
|
||||
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.main();
|
||||
printf("Done in state!\n");
|
||||
|
||||
while(true);
|
||||
|
||||
state_changer.clear();
|
||||
}
|
||||
}
|
||||
|
@@ -4,13 +4,15 @@
|
||||
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" uint32_t __controller_tests_start;
|
||||
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(GPU_TEST_OVL, "GTO.BIN"),
|
||||
__jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.BIN"),
|
||||
__jabyengine_request_lba_for(GPU_TEST_OVL, "GTO.BIN"),
|
||||
__jabyengine_request_lba_for(CONT_TEST_OVL, "CTO.BIN"),
|
||||
__jabyengine_end_lba_request
|
||||
};
|
||||
__declare_lba_header(LBA);
|
||||
@@ -54,12 +56,20 @@ namespace Assets {
|
||||
}
|
||||
|
||||
namespace Overlay {
|
||||
static const CDFile Files[] = {
|
||||
static const CDFile GPUFiles[] = {
|
||||
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() {
|
||||
::Assets::load(Files);
|
||||
::Assets::load(GPUFiles);
|
||||
// Load Overlay assets?!
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user