2020-09-02 10:55:56 +03:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <lib/term.h>
|
2020-09-22 01:18:13 +03:00
|
|
|
#include <lib/image.h>
|
2021-02-25 13:28:14 +03:00
|
|
|
#include <lib/blib.h>
|
2021-03-02 08:05:14 +03:00
|
|
|
#include <lib/gterm.h>
|
2020-09-02 10:55:56 +03:00
|
|
|
|
2021-04-11 03:30:48 +03:00
|
|
|
bool early_term = false;
|
|
|
|
|
2021-10-21 03:37:05 +03:00
|
|
|
void term_deinit(void) {
|
|
|
|
switch (term_backend) {
|
|
|
|
case VBE:
|
|
|
|
gterm_deinit();
|
|
|
|
}
|
|
|
|
|
2021-11-20 23:47:51 +03:00
|
|
|
term_notready();
|
2021-10-21 03:37:05 +03:00
|
|
|
}
|
|
|
|
|
2021-08-16 19:02:28 +03:00
|
|
|
void term_vbe(size_t width, size_t height) {
|
2021-11-20 23:47:51 +03:00
|
|
|
term_notready();
|
|
|
|
|
|
|
|
if (quiet) {
|
|
|
|
return;
|
|
|
|
}
|
2021-04-04 19:05:18 +03:00
|
|
|
|
2021-04-11 03:30:48 +03:00
|
|
|
if (!gterm_init(&term_rows, &term_cols, width, height)) {
|
2021-07-15 11:03:47 +03:00
|
|
|
#if bios == 1
|
2020-11-09 13:15:54 +03:00
|
|
|
// Failed to set VBE properly, default to text mode
|
|
|
|
term_textmode();
|
2021-03-02 12:23:43 +03:00
|
|
|
#endif
|
2020-11-09 13:15:54 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-09-02 10:55:56 +03:00
|
|
|
|
2021-08-16 19:02:28 +03:00
|
|
|
term_reinit();
|
|
|
|
|
2021-03-02 08:05:14 +03:00
|
|
|
raw_putchar = gterm_putchar;
|
|
|
|
clear = gterm_clear;
|
|
|
|
enable_cursor = gterm_enable_cursor;
|
|
|
|
disable_cursor = gterm_disable_cursor;
|
|
|
|
set_cursor_pos = gterm_set_cursor_pos;
|
|
|
|
get_cursor_pos = gterm_get_cursor_pos;
|
|
|
|
set_text_fg = gterm_set_text_fg;
|
|
|
|
set_text_bg = gterm_set_text_bg;
|
2021-08-01 00:51:48 +03:00
|
|
|
set_text_fg_bright = gterm_set_text_fg_bright;
|
|
|
|
set_text_bg_bright = gterm_set_text_bg_bright;
|
|
|
|
set_text_fg_default = gterm_set_text_fg_default;
|
|
|
|
set_text_bg_default = gterm_set_text_bg_default;
|
2021-07-08 17:33:24 +03:00
|
|
|
scroll_disable = gterm_scroll_disable;
|
|
|
|
scroll_enable = gterm_scroll_enable;
|
2021-07-31 21:52:46 +03:00
|
|
|
term_move_character = gterm_move_character;
|
2021-08-16 19:02:28 +03:00
|
|
|
term_scroll = gterm_scroll;
|
|
|
|
term_swap_palette = gterm_swap_palette;
|
2020-09-02 10:55:56 +03:00
|
|
|
|
2021-03-02 08:05:14 +03:00
|
|
|
term_double_buffer_flush = gterm_double_buffer_flush;
|
2020-11-20 21:55:18 +03:00
|
|
|
|
2021-08-16 21:00:37 +03:00
|
|
|
term_context_size = gterm_context_size;
|
|
|
|
term_context_save = gterm_context_save;
|
|
|
|
term_context_restore = gterm_context_restore;
|
2021-08-16 21:56:39 +03:00
|
|
|
term_full_refresh = gterm_full_refresh;
|
2021-08-16 21:00:37 +03:00
|
|
|
|
2020-09-02 10:55:56 +03:00
|
|
|
term_backend = VBE;
|
|
|
|
}
|