Broken UI and Loading screens
This commit is contained in:
19
src/main.cpp
19
src/main.cpp
@@ -10,6 +10,7 @@
|
||||
#include "scenemanager.hh"
|
||||
#include "sceneloader.hh"
|
||||
#include "pcdrv_handler.hh"
|
||||
#include "loadingscreen.hh"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -29,6 +30,9 @@ class MainScene final : public psyqo::Scene {
|
||||
|
||||
psxsplash::SceneManager m_sceneManager;
|
||||
|
||||
// Loading screen (persists between scenes; owned here, passed to SceneManager)
|
||||
psxsplash::LoadingScreen m_loadingScreen;
|
||||
|
||||
// PCdrv-loaded scene data (owned)
|
||||
uint8_t* m_sceneData = nullptr;
|
||||
};
|
||||
@@ -64,6 +68,15 @@ void MainScene::start(StartReason reason) {
|
||||
// Initialize PCdrv (break instructions - handled by emulator or our break handler)
|
||||
psxsplash::SceneLoader::Init();
|
||||
|
||||
// Blank display immediately so the user never sees a frozen frame
|
||||
gpu().clear(psyqo::Color{.r = 0, .g = 0, .b = 0});
|
||||
gpu().pumpCallbacks();
|
||||
|
||||
// Try to load a loading screen for scene 0
|
||||
if (m_loadingScreen.load(gpu(), app.m_font, 0)) {
|
||||
m_loadingScreen.renderInitialAndFree(gpu());
|
||||
}
|
||||
|
||||
// Load the first scene via PCdrv.
|
||||
// Files are relative to the pcdrvbase directory (PSXBuild/).
|
||||
int fileSize = 0;
|
||||
@@ -74,8 +87,12 @@ void MainScene::start(StartReason reason) {
|
||||
m_sceneData = psxsplash::SceneLoader::LoadFile("output.bin", fileSize);
|
||||
}
|
||||
|
||||
if (m_loadingScreen.isActive()) {
|
||||
m_loadingScreen.updateProgress(gpu(), 30);
|
||||
}
|
||||
|
||||
if (m_sceneData) {
|
||||
m_sceneManager.InitializeScene(m_sceneData);
|
||||
m_sceneManager.InitializeScene(m_sceneData, &m_loadingScreen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user