This commit is contained in:
Jan Racek
2026-03-27 21:29:01 +01:00
parent 85eb7e59d9
commit bfab154547
42 changed files with 118 additions and 1013 deletions

View File

@@ -8,7 +8,6 @@
namespace psxsplash {
/// Loader pack header — matches the binary written by PSXLoaderPackWriter.cs.
struct LoaderPackHeader {
char magic[2]; // "LP"
uint16_t version; // 2
@@ -22,7 +21,6 @@ struct LoaderPackHeader {
};
static_assert(sizeof(LoaderPackHeader) == 16, "LoaderPackHeader must be 16 bytes");
/// Atlas entry in the loader pack (matches SPLASHPACKTextureAtlas layout).
struct LoaderPackAtlas {
uint32_t pixelDataOffset; // absolute offset in file
uint16_t width, height;
@@ -30,7 +28,6 @@ struct LoaderPackAtlas {
};
static_assert(sizeof(LoaderPackAtlas) == 12, "LoaderPackAtlas must be 12 bytes");
/// CLUT entry in the loader pack (matches SPLASHPACKClut layout).
struct LoaderPackClut {
uint32_t clutDataOffset; // absolute offset in file
uint16_t clutX; // VRAM X (in 16-pixel units × 16)
@@ -40,25 +37,7 @@ struct LoaderPackClut {
};
static_assert(sizeof(LoaderPackClut) == 12, "LoaderPackClut must be 12 bytes");
/// Loading screen controller.
///
/// Loads a .loading file (tiny UI-only binary), renders the screen,
/// and provides progress updates during the main splashpack load.
///
/// Strategy:
/// 1. Blank the screen immediately (user sees black, not frozen frame).
/// 2. Load the .loading file (small, fast).
/// 3. Upload texture atlases, CLUTs, and custom font textures to VRAM.
/// 4. Render ALL elements to BOTH framebuffers using direct GPU commands:
/// - Images via sendPrimitive(GouraudTexturedTriangle)
/// - Custom font text via sendPrimitive(TPage) + sendPrimitive(Sprite)
/// - System font text via font.print()
/// - Boxes and progress bars via sendPrimitive(Rectangle)
/// 5. FREE all loaded data (loader pack) so the splashpack has room.
/// 6. During splashpack loading, call updateProgress() to redraw ONLY the
/// progress bar (simple rectangles in both framebuffers — no VRAM needed).
///
/// The progress bar is found by looking for a PSXUIProgressBar element named "loading".
class LoadingScreen {
public:
/// Try to load a loader pack from a file.