This commit is contained in:
Jan Racek
2026-03-24 13:01:47 +01:00
parent 55c1d2c39b
commit e51c06b012
51 changed files with 8111 additions and 491 deletions

View File

@@ -8,9 +8,8 @@
#include "renderer.hh"
#include "scenemanager.hh"
// Data from the splashpack
extern uint8_t _binary_output_bin_start[];
#include "sceneloader.hh"
#include "pcdrv_handler.hh"
namespace {
@@ -29,6 +28,9 @@ class MainScene final : public psyqo::Scene {
uint32_t m_lastFrameCounter;
psxsplash::SceneManager m_sceneManager;
// PCdrv-loaded scene data (owned)
uint8_t* m_sceneData = nullptr;
};
PSXSplash app;
@@ -53,7 +55,28 @@ void PSXSplash::createScene() {
pushScene(&mainScene);
}
void MainScene::start(StartReason reason) { m_sceneManager.InitializeScene(_binary_output_bin_start); }
void MainScene::start(StartReason reason) {
// On real hardware: register break handler for PCDRV over SIO1 + redirect printf
// On emulator: no-op (pcsx-redux handles PCDRV natively)
psxsplash::pcdrv_sio1_init();
// Initialize PCdrv (break instructions - handled by emulator or our break handler)
psxsplash::SceneLoader::Init();
// Load the first scene via PCdrv.
// Files are relative to the pcdrvbase directory (PSXBuild/).
int fileSize = 0;
m_sceneData = psxsplash::SceneLoader::LoadFile("scene_0.splashpack", fileSize);
if (!m_sceneData) {
// Fallback: try legacy name for backwards compatibility
m_sceneData = psxsplash::SceneLoader::LoadFile("output.bin", fileSize);
}
if (m_sceneData) {
m_sceneManager.InitializeScene(m_sceneData);
}
}
void MainScene::frame() {
uint32_t beginFrame = gpu().now();
@@ -73,8 +96,6 @@ void MainScene::frame() {
gpu().getRefreshRate() / deltaTime);
gpu().pumpCallbacks();
uint32_t endFrame = gpu().now();
uint32_t spent = endFrame - beginFrame;
}
int main() { return app.run(); }