From c30d15742c69013ff41a308886512be79f0a0922 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sun, 29 Aug 2021 22:24:37 -0600 Subject: [PATCH] frame buffer init now reads splash screen data from resources --- src/fbinit.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/fbinit.c b/src/fbinit.c index e6b47fb..cf21cbd 100644 --- a/src/fbinit.c +++ b/src/fbinit.c @@ -29,11 +29,7 @@ #include "log.h" #include "fbinit.h" #include "scode.h" - -/* references to splash screen data in splash.o/splash.bin */ -extern uint8_t _binary_splash_bin_start[]; -extern uint8_t _binary_splash_bin_end; -extern uint8_t _binary_splash_bin_size; +#include "resources.h" static int fb_fd = -1; /* framebuffer file descriptor */ @@ -62,6 +58,8 @@ static void do_cleanup(void) HRESULT Fb_setup(void) { HRESULT hr = S_OK; + HRESULT hr2 = S_OK; + HRSRC splash; struct fb_fix_screeninfo fixed; struct fb_var_screeninfo var; @@ -84,7 +82,7 @@ HRESULT Fb_setup(void) local_info.linebytes = fixed.line_length; local_info.screenbytes = fixed.smem_len; - /* variable info is used to get scren geometry and color info */ + /* variable info is used to get screen geometry and color info */ if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &var)) { hr = ERRNO_AS_SCODE; @@ -118,8 +116,16 @@ HRESULT Fb_setup(void) return hr; } - /* display the splash screen */ - memcpy(Fb_Ptr, _binary_splash_bin_start, (size_t)(&_binary_splash_bin_size)); + /* The splash screen is in the system resources. Use the resource API to load it straight to the frame buffer. */ + hr2 = Rsrc_find_resource(NULL, "splash.bin", NULL, &splash); + if (SUCCEEDED(hr2)) + { + ASSERT(Rsrc_sizeof_resource(splash) == fixed.smem_len); + hr2 = Rsrc_read_resource_here(splash, Fb_Ptr, fixed.smem_len, NULL); + Rsrc_free_resource(splash); + } + if (FAILED(hr2)) + Log(LWARN, "splash screen rendering failed (%08X)", hr2); hr = Config_exitfunc(do_cleanup); if (FAILED(hr))