term: Change default settings to prefer video to text mode

This commit is contained in:
mintsuki 2022-03-07 21:11:17 +01:00
parent 220ebb3830
commit b96046f8b9
8 changed files with 31 additions and 26 deletions

View File

@ -61,7 +61,7 @@ Some keys take *URIs* as values; these are described in the next section.
* `QUIET` - If set to `yes`, enable quiet mode, where all screen output except panics and important warnings is suppressed. If `TIMEOUT` is not 0, the `TIMEOUT` still occurs, and pressing any key during the timeout will reveal the menu and disable quiet mode.
* `SERIAL` - If set to `yes`, enable serial I/O for the bootloader.
* `DEFAULT_ENTRY` - 1-based entry index of the entry which will be automatically selected at startup. If unspecified, it is `1`.
* `GRAPHICS` - If set to `yes`, use a graphical framebuffer for the boot menu, else use text mode. Ignored with Limine UEFI, forced to `yes`.
* `GRAPHICS` - If set to `no`, force CGA text mode for the boot menu, else use a video mode. Ignored with Limine UEFI.
* `MENU_RESOLUTION` - Specify screen resolution to be used by the Limine menu in the form `<width>x<height>`. This will *only* affect the menu, not any booted OS. If not specified, Limine will pick a resolution automatically. If the resolution is not available, Limine will pick another one automatically. Ignored if `GRAPHICS` is not `yes`.
* `MENU_BRANDING` - A string that will be displayed on top of the Limine menu.
* `MENU_BRANDING_COLOUR` - A value between 0 and 7 specifying the colour of the branding string. Default is cyan (6).

View File

@ -104,7 +104,7 @@ static bool try_mode(struct fb_info *ret, size_t mode, int width, int height, in
status = gop->SetMode(gop, mode);
if (status) {
current_video_mode = -2;
current_video_mode = -1;
printv("gop: Failed to set video mode %x, moving on...\n", mode);
return false;
}

View File

@ -189,7 +189,7 @@ retry:
if (vid_modes[i] == current_video_mode) {
printv("vbe: Mode was already set, perfect!\n");
} else if (set_vbe_mode(vid_modes[i]) == 0x01) {
current_video_mode = -2;
current_video_mode = -1;
printv("vbe: Failed to set video mode %x, moving on...\n", vid_modes[i]);
continue;
}

View File

@ -162,12 +162,12 @@ void text_full_refresh(void) {
}
void init_vga_textmode(size_t *_rows, size_t *_cols, bool managed) {
if (current_video_mode != -1) {
if (current_video_mode != 0x3) {
struct rm_regs r = {0};
r.eax = 0x0003;
rm_int(0x10, &r, &r);
current_video_mode = -1;
current_video_mode = 0x3;
}
if (back_buffer == NULL) {

View File

@ -80,13 +80,6 @@ noreturn void entry(uint8_t boot_drive, int boot_from) {
if (!a20_enable())
panic(false, "Could not enable A20 line");
struct rm_regs r = {0};
r.eax = 0x0003;
rm_int(0x10, &r, &r);
outb(0x3d4, 0x0a);
outb(0x3d5, 0x20);
init_e820();
init_memmap();

View File

@ -601,6 +601,9 @@ static bool last_serial = false;
bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
if (current_video_mode >= 0
#if bios == 1
&& current_video_mode != 0x03
#endif
&& fbinfo.default_res == true
&& width == 0
&& height == 0
@ -614,6 +617,9 @@ bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
}
if (current_video_mode >= 0
#if bios == 1
&& current_video_mode != 0x03
#endif
&& fbinfo.framebuffer_width == width
&& fbinfo.framebuffer_height == height
&& fbinfo.framebuffer_bpp == 32
@ -716,6 +722,21 @@ bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
text_fg = default_fg;
text_bg = 0xffffffff;
background = NULL;
char *background_path = config_get_value(NULL, 0, "BACKGROUND_PATH");
if (background_path != NULL) {
struct file_handle *bg_file;
if ((bg_file = uri_open(background_path)) != NULL) {
background = image_open(bg_file);
fclose(bg_file);
}
}
if (background == NULL) {
margin = 0;
margin_gradient = 0;
}
char *theme_margin = config_get_value(NULL, 0, "THEME_MARGIN");
if (theme_margin != NULL) {
margin = strtoui(theme_margin, NULL, 10);
@ -726,15 +747,6 @@ bool gterm_init(size_t *_rows, size_t *_cols, size_t width, size_t height) {
margin_gradient = strtoui(theme_margin_gradient, NULL, 10);
}
char *background_path = config_get_value(NULL, 0, "BACKGROUND_PATH");
if (background_path != NULL) {
struct file_handle *bg_file;
if ((bg_file = uri_open(background_path)) != NULL) {
background = image_open(bg_file);
fclose(bg_file);
}
}
if (background != NULL) {
char *background_layout = config_get_value(NULL, 0, "BACKGROUND_STYLE");
if (background_layout != NULL && strcmp(background_layout, "centered") == 0) {

View File

@ -725,7 +725,7 @@ static noreturn void _menu(bool timeout_enabled) {
#endif
reterm:
if (graphics != NULL && !strcmp(graphics, "yes")) {
if (graphics == NULL || strcmp(graphics, "no") == 1) {
size_t req_width = 0, req_height = 0, req_bpp = 0;
char *menu_resolution = config_get_value(NULL, 0, "MENU_RESOLUTION");
@ -887,10 +887,11 @@ timeout_aborted:
goto refresh;
}
if (term_backend == NOT_READY) {
#if bios == 1
term_textmode();
#elif uefi == 1
term_vbe(0, 0);
#if bios == 1
if (term_backend == NOT_READY) {
term_textmode();
}
#endif
} else {
reset_term();

View File

@ -3,7 +3,6 @@ ${BACKGROUND_PATH}=boot:///boot/bg.bmp
DEFAULT_ENTRY=1
TIMEOUT=3
GRAPHICS=yes
VERBOSE=yes
THEME_BACKGROUND=50000000