feature: add boot splash screen with embedded TGA logo
- New splash unit (src/prog/splash.pas) displays a centered logo, progress bar and status label during kernel boot. Manually drives LVGL rendering + video.Flush since gfxd isn't running yet. - Embed img/asuro.tga into the kernel via NASM incbin stub (src/stub/splash_tga.asm), assembled in compile_stub.sh. - Build an lv_image_dsc_t at runtime from the decoded TGA pixel data and display it at 50% scale using lv_image_set_scale(128). - Move LVGL init earlier in kernel.pas (right after video enable) so the splash screen is available before VFS/drivers/network init. - Sprinkle splash.update() calls throughout kmain to show boot progress (VFS → drivers → buses → network → tests → desktop). - Fix targa.pas parser: rename Magic→IDLength, remove erroneous Data pointer field, compute pixel offset correctly (buffer+18+IDLength), advance source pointer per pixel, handle bottom-to-top origin flip. - Unit tests moved before desktop.init; splash.teardown called at 100% just before handing off to the desktop environment.
This commit is contained in:
1 parent
97244a2b95
commit
df71c59aea
6 files changed
+368
-50
No files matched your search
@@ -5,3 +5,4 @@ echo " "
|
|||||||
echo "Compiling Stub..."
|
echo "Compiling Stub..."
|
||||||
echo " "
|
echo " "
|
||||||
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
||||||
|
nasm -f elf src/stub/splash_tga.asm -o lib/splash_tga.o
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
+27
-17
@@ -12,7 +12,7 @@ type
|
|||||||
PTARGAColor = ^TTARGAColor;
|
PTARGAColor = ^TTARGAColor;
|
||||||
|
|
||||||
TTARGAHeader = packed record
|
TTARGAHeader = packed record
|
||||||
Magic: uint8;
|
IDLength: uint8;
|
||||||
ColorMapType: uint8;
|
ColorMapType: uint8;
|
||||||
ImageType: uint8;
|
ImageType: uint8;
|
||||||
ColorMapOrigin: uint16;
|
ColorMapOrigin: uint16;
|
||||||
@@ -24,7 +24,6 @@ type
|
|||||||
Height: uint16;
|
Height: uint16;
|
||||||
PixelDepth: uint8;
|
PixelDepth: uint8;
|
||||||
ImageDescriptor: uint8;
|
ImageDescriptor: uint8;
|
||||||
Data : PTARGAColor;
|
|
||||||
end;
|
end;
|
||||||
PTARGAHeader = ^TTARGAHeader;
|
PTARGAHeader = ^TTARGAHeader;
|
||||||
|
|
||||||
@@ -35,29 +34,40 @@ implementation
|
|||||||
Function Parse(buffer : puint8; len : uint32) : PTexture;
|
Function Parse(buffer : puint8; len : uint32) : PTexture;
|
||||||
var
|
var
|
||||||
header : PTARGAHeader;
|
header : PTARGAHeader;
|
||||||
i, j : uint32;
|
src : PTARGAColor;
|
||||||
data : PTARGAColor;
|
|
||||||
tex : PTexture;
|
tex : PTexture;
|
||||||
|
x, y : uint32;
|
||||||
|
dstRow : uint32;
|
||||||
|
topDown: boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (len < sizeof(TTARGAHeader)) then exit;
|
Parse := nil;
|
||||||
|
if len < sizeof(TTARGAHeader) then exit;
|
||||||
|
|
||||||
header := PTARGAHeader(buffer);
|
header := PTARGAHeader(buffer);
|
||||||
if (header^.Magic <> $0) or (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
|
if (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
|
||||||
|
|
||||||
|
{ Pixel data starts after the 18-byte header + any ID field. }
|
||||||
|
src := PTARGAColor(buffer + sizeof(TTARGAHeader) + header^.IDLength);
|
||||||
|
|
||||||
|
{ Bit 5 of ImageDescriptor: 1 = top-to-bottom, 0 = bottom-to-top. }
|
||||||
|
topDown := (header^.ImageDescriptor AND $20) <> 0;
|
||||||
|
|
||||||
//Create a new texture
|
|
||||||
tex := texture.newTexture(header^.Width, header^.Height);
|
tex := texture.newTexture(header^.Width, header^.Height);
|
||||||
tex^.Width:= header^.Width;
|
|
||||||
tex^.Height:= header^.Height;
|
|
||||||
|
|
||||||
//Copy the data
|
for y := 0 to header^.Height - 1 do begin
|
||||||
data := PTARGAColor(header^.Data);
|
{ Flip vertically when origin is bottom-left (the TGA default). }
|
||||||
for i := 0 to header^.Height - 1 do begin
|
if topDown then
|
||||||
for j := 0 to header^.Width - 1 do begin
|
dstRow := y
|
||||||
tex^.Pixels[i * header^.Width + j].r := data^.r;
|
else
|
||||||
tex^.Pixels[i * header^.Width + j].g := data^.g;
|
dstRow := (header^.Height - 1) - y;
|
||||||
tex^.Pixels[i * header^.Width + j].b := data^.b;
|
|
||||||
tex^.Pixels[i * header^.Width + j].a := data^.a;
|
for x := 0 to header^.Width - 1 do begin
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].b := src^.b;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].g := src^.g;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].r := src^.r;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].a := src^.a;
|
||||||
|
Inc(src);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+56
-33
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,19 @@
|
|||||||
|
; Embed the boot splash TGA image into .rodata so it is linked
|
||||||
|
; directly into the kernel binary.
|
||||||
|
;
|
||||||
|
; Exported symbols:
|
||||||
|
; _splash_tga_start – pointer to the first byte of the TGA file
|
||||||
|
; _splash_tga_end – pointer one past the last byte
|
||||||
|
; _splash_tga_size – uint32 containing the file size
|
||||||
|
|
||||||
|
section .rodata
|
||||||
|
|
||||||
|
global _splash_tga_start
|
||||||
|
global _splash_tga_end
|
||||||
|
global _splash_tga_size
|
||||||
|
|
||||||
|
_splash_tga_start:
|
||||||
|
incbin "img/asuro.tga"
|
||||||
|
_splash_tga_end:
|
||||||
|
|
||||||
|
_splash_tga_size: dd (_splash_tga_end - _splash_tga_start)
|
||||||
Reference in new issue
Block a user