The branch stable/14 has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cd8ab8cecff5eca1b6aaf671a840ee840c8e73c7

commit cd8ab8cecff5eca1b6aaf671a840ee840c8e73c7
Author:     Kyle Evans <kev...@freebsd.org>
AuthorDate: 2025-06-18 15:12:54 +0000
Commit:     Kyle Evans <kev...@freebsd.org>
CommitDate: 2025-07-21 02:12:27 +0000

    lualoader: adapt builtin brand/logo definitions as well
    
    While these should be moved to the new format, it wasn't my intention
    to force them over immediately.  Downstreams may embed their own brands
    in drawer.lua, and we shouldn't break them for something like this.
    
    Move adapt_fb_shim() up and use it for preloaded definitions to avoid
    forcing the matter for now.  Perhaps in the future we'll start writing
    out warnings for those that do need adapted.
    
    Reported by:    0x1eef on IRC
    
    (cherry picked from commit abdbd85d1b6af892c18eaae0330a146b01ff6712)
---
 stand/lua/drawer.lua | 68 ++++++++++++++++++++++++++++------------------------
 1 file changed, 37 insertions(+), 31 deletions(-)

diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua
index 46390590352e..b8fcb0b35ba5 100644
--- a/stand/lua/drawer.lua
+++ b/stand/lua/drawer.lua
@@ -101,6 +101,39 @@ local function processFile(gfxname)
        return true
 end
 
+-- Backwards compatibility shims for previous FreeBSD versions, please document
+-- new additions
+local function adapt_fb_shim(def)
+       -- In FreeBSD 14.x+, we have improved framebuffer support in the loader
+       -- and some graphics may have images that we can actually draw on the
+       -- screen.  Those graphics may come with shifts that are distinct from
+       -- the ASCII version, so we move both ascii and image versions into
+       -- their own tables.
+       if not def.ascii then
+               def.ascii = {
+                       image = def.graphic,
+                       requires_color = def.requires_color,
+                       shift = def.shift,
+               }
+       end
+       if def.image then
+               assert(not def.fb,
+                   "Unrecognized graphic definition format")
+
+               -- Legacy images may have adapted a shift from the ASCII
+               -- version, or perhaps we just didn't care enough to adjust it.
+               -- Steal the shift.
+               def.fb = {
+                       image = def.image,
+                       width = def.image_rl,
+                       shift = def.shift,
+               }
+       end
+
+       def.adapted = true
+       return def
+end
+
 local function getBranddef(brand)
        if brand == nil then
                return nil
@@ -123,6 +156,8 @@ local function getBranddef(brand)
                end
 
                branddef = branddefs[brand]
+       elseif not branddef.adapted then
+               adapt_fb_shim(branddef)
        end
 
        return branddef
@@ -150,6 +185,8 @@ local function getLogodef(logo)
                end
 
                logodef = logodefs[logo]
+       elseif not logodef.adapted then
+               adapt_fb_shim(logodef)
        end
 
        return logodef
@@ -503,37 +540,6 @@ drawer.default_bw_logodef = 'orbbw'
 -- drawer module in case it's a filesystem issue.
 drawer.default_fallback_logodef = 'none'
 
--- Backwards compatibility shims for previous FreeBSD versions, please document
--- new additions
-local function adapt_fb_shim(def)
-       -- In FreeBSD 14.x+, we have improved framebuffer support in the loader
-       -- and some graphics may have images that we can actually draw on the
-       -- screen.  Those graphics may come with shifts that are distinct from
-       -- the ASCII version, so we move both ascii and image versions into
-       -- their own tables.
-       if not def.ascii then
-               def.ascii = {
-                       image = def.graphic,
-                       requires_color = def.requires_color,
-                       shift = def.shift,
-               }
-       end
-       if def.image then
-               assert(not def.fb,
-                   "Unrecognized graphic definition format")
-
-               -- Legacy images may have adapted a shift from the ASCII
-               -- version, or perhaps we just didn't care enough to adjust it.
-               -- Steal the shift.
-               def.fb = {
-                       image = def.image,
-                       width = def.image_rl,
-                       shift = def.shift,
-               }
-       end
-       return def
-end
-
 function drawer.addBrand(name, def)
        branddefs[name] = adapt_fb_shim(def)
 end

Reply via email to