Load Overlay
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"pattern": "bin/*/src/Overlay/TimerTests/*.o"
|
||||
},
|
||||
"gpu_tests": {
|
||||
"pattern": "bin/*/src/Overlay/GPUTests/*.o"
|
||||
"pattern": "bin/*/src/Overlay/GPUTest/*.o"
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,4 +9,8 @@ namespace Assets {
|
||||
|
||||
void load();
|
||||
}
|
||||
|
||||
namespace Overlay {
|
||||
void load_gpu_test();
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
#include <PSX/AutoLBA/auto_lba.hpp>
|
||||
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
4
examples/PoolBox/application/src/Overlay/Overlays.hpp
Normal file
4
examples/PoolBox/application/src/Overlay/Overlays.hpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
namespace GPUTest {
|
||||
void main();
|
||||
}
|
@@ -2,6 +2,7 @@
|
||||
#include "include/font_writer.hpp"
|
||||
#include "include/menu.hpp"
|
||||
#include "include/paco.hpp"
|
||||
#include "Overlay/Overlays.hpp"
|
||||
#include <FontWriter/fonts.hpp>
|
||||
#include <FontWriter/font_writer.hpp>
|
||||
#include <PSX/Periphery/periphery.hpp>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -4,10 +4,13 @@
|
||||
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
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<size_t N>
|
||||
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?!
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user