Load Overlay

This commit is contained in:
Jaby 2024-01-03 17:23:23 -06:00
parent 59c974ab17
commit 0e16ae4a45
7 changed files with 82 additions and 10 deletions

View File

@ -4,7 +4,7 @@
"pattern": "bin/*/src/Overlay/TimerTests/*.o"
},
"gpu_tests": {
"pattern": "bin/*/src/Overlay/GPUTests/*.o"
"pattern": "bin/*/src/Overlay/GPUTest/*.o"
}
}
}

View File

@ -9,4 +9,8 @@ namespace Assets {
void load();
}
namespace Overlay {
void load_gpu_test();
}
}

View File

@ -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);
}
}

View File

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

View File

@ -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();
}

View File

@ -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?!
}
}
}

View File

@ -4,8 +4,10 @@
<License>%PSX_LICENSE_PATH%/LICENSEE.DAT</License>
</Description>
<Track>
<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>
<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>
<Overlay name = "GTO.BIN" lba_source = "../application/src/Overlay/GPUTest/gpu_test.cpp">../application/bin/PSX-release/Overlay.gpu_tests</Overlay>
<Directory name="ASSETS" hidden = "true">
<Directory name = "MAIN">
<File name = "PACO.BIN" lz4 = "already">../assets/bin/Paco.bin</File>
@ -13,5 +15,6 @@
<File name = "FONT.BIN" lz4 = "already">../assets/bin/TexturePage.bin</File>
<File name = "ICON.BIN" lz4 = "already">../assets/bin/IconTexture.bin</File>
</Directory>
</Track>
</ISO_Project>