diff options
Diffstat (limited to 'lib/console.c')
-rw-r--r-- | lib/console.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/lib/console.c b/lib/console.c index 7be5d543..6bbb8a7c 100644 --- a/lib/console.c +++ b/lib/console.c @@ -122,6 +122,30 @@ console_print_at(UINTN col, UINTN row, const CHAR16 *fmt, ...) return ret; } +static struct { + CHAR16 up_left; + CHAR16 up_right; + CHAR16 down_left; + CHAR16 down_right; + CHAR16 horizontal; + CHAR16 vertical; +} boxdraw[2] = { + { + BOXDRAW_UP_LEFT, + BOXDRAW_UP_RIGHT, + BOXDRAW_DOWN_LEFT, + BOXDRAW_DOWN_RIGHT, + BOXDRAW_HORIZONTAL, + BOXDRAW_VERTICAL + }, { + '+', + '+', + '+', + '+', + '-', + '|' + } +}; void console_print_box_at(CHAR16 *str_arr[], int highlight, @@ -133,6 +157,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut; UINTN rows, cols; CHAR16 *Line; + bool char_set; if (lines == 0) return; @@ -181,10 +206,16 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, return; } - SetMem16 (Line, size_cols * 2, BOXDRAW_HORIZONTAL); + /* test if boxdraw characters work */ + co->SetCursorPosition(co, start_col, start_row); + Line[0] = boxdraw[0].up_left; + Line[1] = L'\0'; + char_set = co->OutputString(co, Line) == 0 ? 0 : 1; + + SetMem16 (Line, size_cols * 2, boxdraw[char_set].horizontal); - Line[0] = BOXDRAW_DOWN_RIGHT; - Line[size_cols - 1] = BOXDRAW_DOWN_LEFT; + Line[0] = boxdraw[char_set].down_right; + Line[size_cols - 1] = boxdraw[char_set].down_left; Line[size_cols] = L'\0'; co->SetCursorPosition(co, start_col, start_row); co->OutputString(co, Line); @@ -204,8 +235,8 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, int line = i - start; SetMem16 (Line, size_cols*2, L' '); - Line[0] = BOXDRAW_VERTICAL; - Line[size_cols - 1] = BOXDRAW_VERTICAL; + Line[0] = boxdraw[char_set].vertical; + Line[size_cols - 1] = boxdraw[char_set].vertical; Line[size_cols] = L'\0'; if (line >= 0 && line < lines) { CHAR16 *s = str_arr[line]; @@ -227,9 +258,9 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, EFI_BACKGROUND_BLUE); } - SetMem16 (Line, size_cols * 2, BOXDRAW_HORIZONTAL); - Line[0] = BOXDRAW_UP_RIGHT; - Line[size_cols - 1] = BOXDRAW_UP_LEFT; + SetMem16 (Line, size_cols * 2, boxdraw[char_set].horizontal); + Line[0] = boxdraw[char_set].up_right; + Line[size_cols - 1] = boxdraw[char_set].up_left; Line[size_cols] = L'\0'; co->SetCursorPosition(co, start_col, i); co->OutputString(co, Line); @@ -522,7 +553,6 @@ console_mode_handle(VOID) efi_status = BS->LocateProtocol(&gop_guid, NULL, (void **)&gop); if (EFI_ERROR(efi_status)) { - console_error(L"Locate graphic output protocol fail", efi_status); return; } @@ -702,7 +732,7 @@ setup_verbosity(VOID) UINTN verbose_check_size; verbose_check_size = sizeof(verbose); - efi_status = get_variable(L"SHIM_VERBOSE", &verbose_check_ptr, + efi_status = get_variable(VERBOSE_VAR_NAME, &verbose_check_ptr, &verbose_check_size, SHIM_LOCK_GUID); if (!EFI_ERROR(efi_status)) { verbose = *(__typeof__(verbose) *)verbose_check_ptr; |