From 0da1ff883aae8370aebce6a62e52b355c8cd4e7a Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Sat, 21 Nov 2009 12:34:53 +0100 Subject: hdt: Allow user to override the background image Impact: none This commit allow user using vesa= to override the background image in vesa mode --- com32/hdt/hdt-common.c | 10 ++++++++-- com32/hdt/hdt-common.h | 5 +++-- com32/hdt/hdt.c | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c index 427be1e6..5e0254bd 100644 --- a/com32/hdt/hdt-common.c +++ b/com32/hdt/hdt-common.c @@ -87,6 +87,10 @@ void detect_parameters(const int argc, const char *argv[], } else if (!strncmp(argv[i], "vesa", 4)) { vesamode=true; max_console_lines=24; + /* If the user defines a background image */ + if (!strncmp(argv[i], "vesa=", 5)) { + strncpy(hardware->vesa_background,argv[i]+5,sizeof(hardware->vesa_background)); + } } else if (!strncmp(argv[i], "auto=", 5)) { /* The auto= parameter is separated in several argv[] * as it can contains spaces. @@ -176,11 +180,13 @@ void init_hardware(struct s_hardware *hardware) memset(hardware->memtest_label, 0, sizeof hardware->memtest_label); memset(hardware->reboot_label, 0, sizeof hardware->reboot_label); memset(hardware->auto_label, 0, sizeof hardware->auto_label); + memset(hardware->vesa_background, 0, sizeof hardware->vesa_background); strcat(hardware->pciids_path, "pci.ids"); strcat(hardware->modules_pcimap_path, "modules.pcimap"); strcat(hardware->modules_alias_path, "modules.alias"); strcat(hardware->memtest_label, "memtest"); strcat(hardware->reboot_label, "reboot.c32"); + strncpy(hardware->vesa_background,CLI_DEFAULT_BACKGROUND,sizeof(hardware->vesa_background)); } /* @@ -649,10 +655,10 @@ int draw_background(const char *what) return vesacon_load_background(what); } -void init_console() { +void init_console(struct s_hardware *hardware) { if (vesamode) { openconsole(&dev_rawcon_r, &dev_vesaserial_w); - draw_background(CLI_BACKGROUND); + draw_background(hardware->vesa_background); } else console_ansi_raw(); } diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h index b231ad70..204ba497 100644 --- a/com32/hdt/hdt-common.h +++ b/com32/hdt/hdt-common.h @@ -70,7 +70,7 @@ #define AUTO_DELIMITER "'" /* Graphic to load in background when using the vesa mode */ -#define CLI_BACKGROUND "backgnd.png" +#define CLI_DEFAULT_BACKGROUND "backgnd.png" /* Defines if the cli is quiet*/ bool quiet; @@ -192,6 +192,7 @@ struct s_hardware { char memtest_label[255]; char reboot_label[255]; char auto_label[AUTO_COMMAND_SIZE]; + char vesa_background[255]; }; void reset_more_printf(); @@ -212,5 +213,5 @@ void detect_syslinux(struct s_hardware *hardware); void detect_parameters(const int argc, const char *argv[], struct s_hardware *hardware); int detect_vesa(struct s_hardware *hardware); -void init_console(); +void init_console(struct s_hardware *hardware); #endif diff --git a/com32/hdt/hdt.c b/com32/hdt/hdt.c index 73cd8903..66df130e 100644 --- a/com32/hdt/hdt.c +++ b/com32/hdt/hdt.c @@ -63,7 +63,7 @@ int main(const int argc, const char *argv[]) detect_parameters(argc, argv, &hardware); /* Opening the Syslinux console */ - init_console(); + init_console(&hardware); /* Clear the screen and reset position of the cursor */ clear_screen(); -- cgit v1.2.1