dloader: First step in improving looks of boot menu master
authorJohn Marino <draco@marino.st>
Fri, 28 Nov 2014 22:07:46 +0000 (23:07 +0100)
committerJohn Marino <draco@marino.st>
Sat, 29 Nov 2014 00:02:32 +0000 (01:02 +0100)
The boot menu essentially hasn't changed since it was converted to C
a few years ago.  The line between Fred and menu always bugged me, but I
suppose some people like it.  I added a new loader option called
"fred_separated" that is off by default, but if set on in loader.conf,
it will bring back the line.  When the line isn't present, Fred shifts
over by two characters which makes him centered.

While here, improve the colorization of Fred.  Colorization is not turned
on by default.  Before that can happen, adequate detection for a serial
console must be added to avoid using ansi color codes on it.

Since Fred has always been depicted as a red DragonFly with red wings, he
has been given bright red wings against a darker red body, and eyes have
changed from green yellow.  His shape has been tweaked as well.  His
scorpion stinger was sanded down to a small point and his mosquito beak
was made shorter so his head looks more like a DragonFly.  His thorax was
improved with curly brackets.

The original look can be restored by putting this in /boot/loader.conf:
  fred_separated="YES"

Approved by: Positive feedback on IRC channel

sys/boot/dloader/cmds.c
sys/boot/dloader/loader.conf

index 8f8ea5a..995ecb7 100644 (file)
@@ -456,31 +456,31 @@ command_menu(int ac, char **av)
 static char *logo_blank_line = "                                 ";
 
 static char *logo_color[LOGO_LINES] = {
-       "\e[37m ,--,           \e[31m|           \e[37m,--, \e[0m",
-       "\e[37m |   `-,       \e[31m,^,       \e[37m,-'   | \e[0m",
-       "\e[37m  `,    `-,   \e[32m(\e[31m/ \\\e[32m)   \e[37m,-'    ,'  \e[0m",
-       "\e[37m    `-,    `-,\e[31m/   \\\e[37m,-'    ,-'    \e[0m",
-       "\e[37m       `------\e[31m(   )\e[37m------'       \e[0m",
-       "\e[37m   ,----------\e[31m(   )\e[37m----------,   \e[0m",
-       "\e[37m  |        _,-\e[31m(   )\e[37m-,_        |  \e[0m",
-       "\e[37m   `-,__,-'   \e[31m\\   /   \e[37m`-,__,-'   \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m| |               \e[0m",
-       "\e[37m               \e[31m`|'               \e[0m",
+       "\e[31;1m ,--,                       ,--, \e[0m",
+       "\e[31;1m |   `-,       \e[33;1m_\e[31m:\e[33;1m_\e[31;1m       ,-'   | \e[0m",
+       "\e[31;1m  `,    `-,   \e[33;1m(\e[31m/ \\\e[33;1m)\e[31;1m   ,-'    ,'  \e[0m",
+       "\e[31;1m    `-,    `-,\e[31m/   \\\e[31;1m,-'    ,-'    \e[0m",
+       "\e[31;1m       `------\e[31m{   }\e[31;1m------'       \e[0m",
+       "\e[31;1m   ,----------\e[31m{   }\e[31;1m----------,   \e[0m",
+       "\e[31;1m  |        _,-\e[31m{   }\e[31;1m-,_        |  \e[0m",
+       "\e[31;1m   `-,__,-'   \e[31m\\   /\e[31;1m   `-,__,-'   \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               | |               \e[0m",
+       "\e[31m               `,'               \e[0m",
        "                                 " };
 
 static char *logo_mono[LOGO_LINES] =  {
-       " ,--,           |           ,--, ",
-       " |   `-,       ,^,       ,-'   | ",
+       " ,--,                       ,--, ",
+       " |   `-,       _:_       ,-'   | ",
        "  `,    `-,   (/ \\)   ,-'    ,'  ",
        "    `-,    `-,/   \\,-'    ,-'    ",
-       "       `------(   )------'       ",
-       "   ,----------(   )----------,   ",
-       "  |        _,-(   )-,_        |  ",
+       "       `------{   }------'       ",
+       "   ,----------{   }----------,   ",
+       "  |        _,-{   }-,_        |  ",
        "   `-,__,-'   \\   /   `-,__,-'   ",
        "               | |               ",
        "               | |               ",
@@ -488,18 +488,18 @@ static char *logo_mono[LOGO_LINES] =  {
        "               | |               ",
        "               | |               ",
        "               | |               ",
-       "               `|'               ",
+       "               `,'               ",
        "                                 " };
 
 static void
-logo_display(char **logo, int line, int orientation)
+logo_display(char **logo, int line, int orientation, int barrier)
 {
        const char *fmt;
 
        if (orientation == FRED_LEFT)
-               fmt = "%s  | ";
+               fmt = barrier ? "%s  | " : "  %s  ";
        else
-               fmt = " |  %s";
+               fmt = barrier ? " |  %s" : "  %s  ";
 
        if (logo != NULL) {
                if (line < LOGO_LINES)
@@ -515,6 +515,7 @@ menu_display(void)
        dvar_t dvar;
        int i;
        int logo_left = 0;              /* default to fred on right */
+       int separated = 0;              /* default no line b/w fred & menu */
        char **logo = logo_mono;
 
        if (dvar_istrue(dvar_get("loader_color")))
@@ -526,16 +527,24 @@ menu_display(void)
        if (dvar_istrue(dvar_get("fred_on_left")))
                logo_left = 1;
 
+       if (dvar_istrue(dvar_get("fred_separated")))
+               separated = 1;
+
        dvar = dvar_first();
        i = 0;
 
-       if (logo != NULL)
-               printf(logo_left ? "%35s|%43s\n" : "%43s|%35s\n", " ", " ");
-
+       if (logo != NULL) {
+               if (logo_left)
+                       printf(separated ? "%35s|%43s\n" : "%35s %43s\n",
+                               " ", " ");
+               else
+                       printf(separated ? "%43s|%35s\n" : "%43s %35s\n",
+                               " ", " ");
+       }
 
        while (dvar || i < LOGO_LINES) {
                if (logo_left)
-                       logo_display(logo, i, FRED_LEFT);
+                       logo_display(logo, i, FRED_LEFT, separated);
 
                while (dvar) {
                        if (strncmp(dvar->name, "menu_", 5) == 0) {
@@ -548,13 +557,13 @@ menu_display(void)
                }
                /*
                 * Pad when the number of menu entries is less than
-                 * LOGO_LINES.
+                * LOGO_LINES.
                 */
                if (dvar == NULL)
                        printf("    %38.38s", " ");
 
                if (!logo_left)
-                       logo_display(logo, i, FRED_RIGHT);
+                       logo_display(logo, i, FRED_RIGHT, separated);
                printf("\n");
                i++;
        }
index b363260..95fc18f 100644 (file)
@@ -41,6 +41,7 @@ bitmap_type="splash_image_data" # and place it on the module_path
 
 #autoboot_delay="10"           # Delay in seconds before autobooting
 #fred_disable="NO"             # Turn Fred's boot menu on and off
+#fred_separated="NO"           # Place line between Fred and menu
 #fred_on_left="NO"             # Show Fred on left side of menu
 #loader_color="NO"             # Set to YES for a color version of Fred
 #console="vidconsole"          # Set the current console