term: Misc fixes and improvements
This commit is contained in:
parent
d3c8a66918
commit
48a7c12e5b
@ -11,6 +11,23 @@
|
||||
#include <lib/term.h>
|
||||
#include <mm/pmm.h>
|
||||
|
||||
struct textmode_context {
|
||||
struct term_context term;
|
||||
|
||||
volatile uint8_t *video_mem;
|
||||
|
||||
uint8_t *back_buffer;
|
||||
uint8_t *front_buffer;
|
||||
|
||||
size_t cursor_offset;
|
||||
size_t old_cursor_offset;
|
||||
bool cursor_status;
|
||||
uint8_t text_palette;
|
||||
|
||||
uint8_t saved_state_text_palette;
|
||||
size_t saved_state_cursor_offset;
|
||||
};
|
||||
|
||||
#define VIDEO_BOTTOM ((VD_ROWS * VD_COLS) - 1)
|
||||
#define VD_COLS (80 * 2)
|
||||
#define VD_ROWS 25
|
||||
@ -350,10 +367,12 @@ void vga_textmode_init(bool managed) {
|
||||
term->full_refresh = text_full_refresh;
|
||||
term->deinit = text_deinit;
|
||||
|
||||
term_backend = TEXTMODE;
|
||||
term_context_reinit(term);
|
||||
|
||||
term->in_bootloader = true;
|
||||
|
||||
term_context_reinit(term);
|
||||
term->full_refresh(term);
|
||||
|
||||
term_backend = TEXTMODE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,28 +1,12 @@
|
||||
#ifndef __DRIVERS__VGA_TEXTMODE_H__
|
||||
#define __DRIVERS__VGA_TEXTMODE_H__
|
||||
|
||||
#if defined (BIOS)
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <term/term.h>
|
||||
|
||||
struct textmode_context {
|
||||
struct term_context term;
|
||||
|
||||
volatile uint8_t *video_mem;
|
||||
|
||||
uint8_t *back_buffer;
|
||||
uint8_t *front_buffer;
|
||||
|
||||
size_t cursor_offset;
|
||||
size_t old_cursor_offset;
|
||||
bool cursor_status;
|
||||
uint8_t text_palette;
|
||||
|
||||
uint8_t saved_state_text_palette;
|
||||
size_t saved_state_cursor_offset;
|
||||
};
|
||||
|
||||
void vga_textmode_init(bool managed);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -771,6 +771,10 @@ no_load_font:;
|
||||
font_scale_x, font_scale_y,
|
||||
margin);
|
||||
|
||||
if (term == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pmm_free(font, FONT_MAX);
|
||||
if (bg_canvas != NULL) {
|
||||
pmm_free(bg_canvas, bg_canvas_size);
|
||||
@ -784,7 +788,6 @@ no_load_font:;
|
||||
term->in_bootloader = true;
|
||||
|
||||
term_context_reinit(term);
|
||||
|
||||
term->full_refresh(term);
|
||||
|
||||
term_backend = GTERM;
|
||||
|
@ -564,7 +564,7 @@ static void menu_init_term(void) {
|
||||
if (menu_resolution != NULL)
|
||||
parse_resolution(&req_width, &req_height, &req_bpp, menu_resolution);
|
||||
|
||||
if (!gterm_init(NULL, req_width, req_height)) {
|
||||
if (!quiet && !gterm_init(NULL, req_width, req_height)) {
|
||||
#if defined (BIOS)
|
||||
vga_textmode_init(true);
|
||||
#elif defined (UEFI)
|
||||
@ -851,17 +851,18 @@ timeout_aborted:
|
||||
selected_menu_entry->expanded = !selected_menu_entry->expanded;
|
||||
goto refresh;
|
||||
}
|
||||
if (term_backend == FALLBACK) {
|
||||
gterm_init(NULL, 0, 0);
|
||||
if (term == NULL) {
|
||||
if (!quiet) {
|
||||
if (term_backend == FALLBACK) {
|
||||
if (!gterm_init(NULL, 0, 0)) {
|
||||
#if defined (BIOS)
|
||||
vga_textmode_init(true);
|
||||
vga_textmode_init(true);
|
||||
#elif defined (UEFI)
|
||||
panic(true, "menu: Failed to initialise terminal");
|
||||
panic(true, "menu: Failed to initialise terminal");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
reset_term();
|
||||
}
|
||||
} else {
|
||||
reset_term();
|
||||
}
|
||||
boot(selected_menu_entry->body);
|
||||
case 'e':
|
||||
|
Loading…
Reference in New Issue
Block a user