Load Overlay

This commit is contained in:
jaby 2024-01-03 17:23:23 -06:00
parent f2183b3a99
commit c142f3b0d6
7 changed files with 82 additions and 10 deletions

View File

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

View File

@ -9,4 +9,8 @@ namespace Assets {
void load(); 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/font_writer.hpp"
#include "include/menu.hpp" #include "include/menu.hpp"
#include "include/paco.hpp" #include "include/paco.hpp"
#include "Overlay/Overlays.hpp"
#include <FontWriter/fonts.hpp> #include <FontWriter/fonts.hpp>
#include <FontWriter/font_writer.hpp> #include <FontWriter/font_writer.hpp>
#include <PSX/Periphery/periphery.hpp> #include <PSX/Periphery/periphery.hpp>
@ -9,6 +10,24 @@
using namespace JabyEngine; 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[] = { static const Menu::SimpleMenu::Entry MenuEntries[] = {
{"Menu 1"}, {"Menu 1"},
{"Menu 2"}, {"Menu 2"},
@ -21,14 +40,15 @@ static const Menu::SimpleMenu::Entry MenuEntries[] = {
// Do we want Paco to be HERE?! // Do we want Paco to be HERE?!
static object::Paco paco; static object::Paco paco;
static Menu::SimpleMenu menu; static Menu::SimpleMenu menu;
static bool enter_loading = false; static StateChange 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) {
enter_loading = true; state_changer.asset_load = Assets::Overlay::load_gpu_test;
state_changer.main = GPUTest::main;
},MenuEntries); },MenuEntries);
} }
@ -72,14 +92,19 @@ namespace LoadingScene {
} }
static void run() { static void run() {
enter_loading = false;
update(); update();
GPU::swap_buffers_vsync(1); GPU::swap_buffers_vsync(1);
render(); render();
GPU::swap_buffers_vsync(1); GPU::swap_buffers_vsync(1);
printf("End of execution!\n"); 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(); setup();
while(true) { while(true) {
if(enter_loading) { if(state_changer.contains_state()) {
LoadingScene::run(); LoadingScene::run();
} }

View File

@ -4,10 +4,13 @@
#include <PSX/AutoLBA/auto_lba_declaration.hpp> #include <PSX/AutoLBA/auto_lba_declaration.hpp>
#include <stdio.h> #include <stdio.h>
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_end_lba_request __jabyengine_end_lba_request
}; };
__declare_lba_header(LBA); __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 { namespace Main {
static const CDFile Files[] = { static const CDFile Files[] = {
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM) CDFileBuilder::simple_tim(LBA::PACO, PacoTIM)
}; };
void load() { 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> <License>%PSX_LICENSE_PATH%/LICENSEE.DAT</License>
</Description> </Description>
<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 = "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="ASSETS" hidden = "true">
<Directory name = "MAIN"> <Directory name = "MAIN">
<File name = "PACO.BIN" lz4 = "already">../assets/bin/Paco.bin</File> <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 = "FONT.BIN" lz4 = "already">../assets/bin/TexturePage.bin</File>
<File name = "ICON.BIN" lz4 = "already">../assets/bin/IconTexture.bin</File> <File name = "ICON.BIN" lz4 = "already">../assets/bin/IconTexture.bin</File>
</Directory> </Directory>
</Track> </Track>
</ISO_Project> </ISO_Project>