mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-23 17:09:40 +03:00
Made the margin configurable.
This commit is contained in:
parent
d6f162972c
commit
4f6b1d20c2
@ -22,7 +22,8 @@ Some *local assignments* are shared between entries using any *protocol*, while
|
||||
*Globally assignable* keys are:
|
||||
* `TIMEOUT` - Specifies the timeout in seconds before the first *entry* is automatically booted.
|
||||
* `TEXTMODE` - If set to `on`, do not use graphical VESA framebuffer for the boot menu.
|
||||
* `COLORSCHEME_BLACK`, `COLORSCHEME_RED`, `COLORSCHEME_GREEN`, `COLORSCHEME_BROWN`, `COLORSCHEME_BLUE`, `COLORSCHEME_MAGENTA`, `COLORSCHEME_CYAN`, `COLORSCHEME_GREY`, `COLORSCHEME_WHITE` - Specifies the colors used by the terminal (RRGGBB).
|
||||
* `THEME_BLACK`, `THEME_RED`, `THEME_GREEN`, `THEME_BROWN`, `THEME_BLUE`, `THEME_MAGENTA`, `THEME_CYAN`, `THEME_GREY`, `THEME_WHITE` - Specifies the colors used by the terminal (RRGGBB).
|
||||
* `THEME_MARGIN` - Set the amount of margin around the terminal.
|
||||
|
||||
*Locally assignable (non protocol specific)* keys are:
|
||||
* `PROTOCOL` - The boot protocol that will be used to boot the kernel. Valid protocols are: `linux`, `stivale`, `chainload`.
|
||||
|
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
@ -48,6 +48,7 @@ static uint16_t vbe_bpp = 0;
|
||||
|
||||
static int frame_height;
|
||||
static int frame_width;
|
||||
static int frame_margin = 64;
|
||||
|
||||
static struct image *background;
|
||||
|
||||
@ -257,8 +258,6 @@ void vbe_get_cursor_pos(int *x, int *y) {
|
||||
*y = cursor_y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void vbe_set_text_fg(int fg) {
|
||||
text_fg = ansi_colours[fg];
|
||||
}
|
||||
@ -267,12 +266,16 @@ void vbe_set_text_bg(int bg) {
|
||||
text_bg = ansi_colours[bg];
|
||||
}
|
||||
|
||||
void vge_set_colors(uint32_t *colors){
|
||||
void vbe_set_colors(uint32_t *colors){
|
||||
memcpy(ansi_colours, colors, sizeof(ansi_colours));
|
||||
text_bg = colors[0];
|
||||
text_fg = colors[7];
|
||||
}
|
||||
|
||||
void vbe_set_margin(int margin){
|
||||
frame_margin = margin;
|
||||
}
|
||||
|
||||
void vbe_putchar(char c) {
|
||||
switch (c) {
|
||||
case '\b':
|
||||
@ -322,8 +325,8 @@ void vbe_putchar(char c) {
|
||||
void vbe_tty_init(int *_rows, int *_cols, struct image *_background) {
|
||||
init_vbe(&vbe_framebuffer, &vbe_pitch, &vbe_width, &vbe_height, &vbe_bpp);
|
||||
vga_font_retrieve();
|
||||
*_cols = cols = (vbe_width - 128) / VGA_FONT_WIDTH;
|
||||
*_rows = rows = (vbe_height - 128) / VGA_FONT_HEIGHT;
|
||||
*_cols = cols = (vbe_width - frame_margin * 2) / VGA_FONT_WIDTH;
|
||||
*_rows = rows = (vbe_height - frame_margin * 2) / VGA_FONT_HEIGHT;
|
||||
grid = ext_mem_alloc(rows * cols * sizeof(struct vbe_char));
|
||||
background = _background;
|
||||
|
||||
|
@ -17,6 +17,7 @@ void vbe_set_cursor_pos(int x, int y);
|
||||
void vbe_get_cursor_pos(int *x, int *y);
|
||||
void vbe_set_text_fg(int fg);
|
||||
void vbe_set_text_bg(int bg);
|
||||
void vge_set_colors(uint32_t *colors);
|
||||
void vbe_set_colors(uint32_t *colors);
|
||||
void vbe_set_margin(int margin);
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,7 @@ static char *cmdline;
|
||||
|
||||
static char config_entry_name[1024];
|
||||
|
||||
void load_color_from_config(void) {
|
||||
void load_theme_from_config(void) {
|
||||
char buf[16];
|
||||
|
||||
uint32_t colorsheme[9] = {
|
||||
@ -31,43 +31,48 @@ void load_color_from_config(void) {
|
||||
0x00ffffff, // white
|
||||
};
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_BLACK")) {
|
||||
|
||||
if (config_get_value(buf, 0, 16, "THEME_BLACK")) {
|
||||
colorsheme[0] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_RED")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_RED")) {
|
||||
colorsheme[1] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_GREEN")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_GREEN")) {
|
||||
colorsheme[2] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_BROWN")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_BROWN")) {
|
||||
colorsheme[3] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_BLUE")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_BLUE")) {
|
||||
colorsheme[4] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_MAGENTA")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_MAGENTA")) {
|
||||
colorsheme[5] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_CYAN")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_CYAN")) {
|
||||
colorsheme[6] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_GREY")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_GREY")) {
|
||||
colorsheme[7] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
if (config_get_value(buf, 0, 16, "COLORSCHEME_WHITE")) {
|
||||
if (config_get_value(buf, 0, 16, "THEME_WHITE")) {
|
||||
colorsheme[8] = (int)strtoui16(buf);
|
||||
}
|
||||
|
||||
vge_set_colors(colorsheme);
|
||||
if (config_get_value(buf, 0, 16, "THEME_MARGIN")) {
|
||||
vbe_set_margin((int)strtoui(buf));
|
||||
}
|
||||
|
||||
vbe_set_colors(colorsheme);
|
||||
}
|
||||
|
||||
char *menu(int boot_drive) {
|
||||
@ -77,7 +82,7 @@ char *menu(int boot_drive) {
|
||||
|
||||
// If there is no TEXTMODE config key or the value is not "on", enable graphics
|
||||
if (config_get_value(buf, 0, 16, "TEXTMODE") == NULL || strcmp(buf, "on")) {
|
||||
load_color_from_config();
|
||||
load_theme_from_config();
|
||||
|
||||
int bg_drive;
|
||||
if (!config_get_value(buf, 0, 16, "BACKGROUND_DRIVE")) {
|
||||
|
@ -1,5 +1,18 @@
|
||||
TIMEOUT=3
|
||||
|
||||
THEME_BLACK=33000000
|
||||
THEME_RED=aa0000
|
||||
THEME_GREEN=00aaff
|
||||
THEME_BROWN=aa5500
|
||||
THEME_BLUE=0000aa
|
||||
THEME_MAGENTA=aa00aa
|
||||
THEME_CYAN=9076DE
|
||||
THEME_GREY=aaaaaa
|
||||
THEME_WHITE=ffffff
|
||||
THEME_MARGIN=16
|
||||
|
||||
BACKGROUND_PARTITION=0
|
||||
BACKGROUND_PATH=bg.bmp
|
||||
|
||||
:MyOS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user