namespace SplashEdit.RuntimeCode
{
///
/// Pre-computed data for one UI canvas and its elements,
/// ready for binary serialization by .
/// Populated by during the export pipeline.
///
public struct PSXCanvasData
{
/// Canvas name (max 24 chars, truncated on export).
public string Name;
/// Initial visibility flag.
public bool StartVisible;
/// Sort order (0 = back, 255 = front).
public byte SortOrder;
/// Exported elements belonging to this canvas.
public PSXUIElementData[] Elements;
}
///
/// Pre-computed data for one UI element, ready for binary serialization.
/// Matches the 48-byte on-disk element record parsed by uisystem.cpp.
///
public struct PSXUIElementData
{
// Identity
public PSXUIElementType Type;
public bool StartVisible;
public string Name; // max 24 chars
// Layout (PS1 pixel coords, already Y-inverted)
public short X, Y, W, H;
// Anchors (8.8 fixed-point: 0=0.0, 128=0.5, 255≈1.0)
public byte AnchorMinX, AnchorMinY;
public byte AnchorMaxX, AnchorMaxY;
// Primary color (RGB)
public byte ColorR, ColorG, ColorB;
// Type-specific: Image
public byte TexpageX, TexpageY;
public ushort ClutX, ClutY;
public byte U0, V0, U1, V1;
public byte BitDepthIndex; // 0=4bit, 1=8bit, 2=16bit
// Type-specific: Progress
public byte BgR, BgG, BgB;
public byte ProgressValue;
// Type-specific: Text
public string DefaultText; // max 63 chars
public byte FontIndex; // 0 = system font, 1+ = custom font
}
///
/// Export data for a custom font to be embedded in the splashpack.
///
public struct PSXFontData
{
/// Source font asset (for identification/dedup).
public PSXFontAsset Source;
/// Glyph cell width in pixels.
public byte GlyphWidth;
/// Glyph cell height in pixels.
public byte GlyphHeight;
/// VRAM X position for upload (16-bit pixel units).
public ushort VramX;
/// VRAM Y position for upload (16-bit pixel units).
public ushort VramY;
/// Texture height in pixels (width is always 256 in 4bpp = 64 VRAM hwords).
public ushort TextureHeight;
/// Packed 4bpp pixel data ready for VRAM upload.
public byte[] PixelData;
/// Per-character advance widths (96 entries, ASCII 0x20-0x7F) for proportional rendering.
public byte[] AdvanceWidths;
}
}