|
1 | 1 | /* |
2 | 2 | * Copyright 2012 James Bottomley <James.Bottomley@HansenPartnership.com> |
3 | | - * Copyright 2024-2025 Pete Batard <pete@akeo.ie> |
| 3 | + * Copyright 2024-2026 Pete Batard <pete@akeo.ie> |
4 | 4 | * |
5 | 5 | * This program is free software: you can redistribute it and/or modify |
6 | 6 | * it under the terms of the GNU General Public License as published by |
@@ -96,7 +96,7 @@ EFI_STATUS ConsolePrintBoxAt( |
96 | 96 | { |
97 | 97 | INTN i; |
98 | 98 | EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = gST->ConOut; |
99 | | - UINTN Rows, Cols; |
| 99 | + UINTN Cols, Rows; |
100 | 100 | CHAR16 *Line; |
101 | 101 |
|
102 | 102 | if (Lines == 0) |
@@ -371,13 +371,17 @@ VOID ConsoleError( |
371 | 371 | ConsoleAlertBox(ErrArray); |
372 | 372 | } |
373 | 373 |
|
374 | | -VOID ConsoleReset(VOID) |
| 374 | +VOID ConsoleInit(VOID) |
375 | 375 | { |
| 376 | + UINTN Cols, Rows; |
376 | 377 | EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = gST->ConOut; |
377 | 378 |
|
378 | | - Console->Reset(Console, TRUE); |
379 | | - // Set mode 0 - required to be 80x25 |
380 | | - Console->SetMode(Console, 0); |
| 379 | + // Some broken firmware implementations (<cough>HP ProDesk 600 G1<cough>) have a default |
| 380 | + // console where mode 0 overshoots the screen (on a 4k monitor) until SetMode is called. |
| 381 | + // So we call SetMode with the current mode to fix that. Also, you do *NOT* want to call |
| 382 | + // Console->Reset() as it may switch from a default high res mode to low res mode 0... |
| 383 | + Console->QueryMode(Console, Console->Mode->Mode, &Cols, &Rows); |
| 384 | + Console->SetMode(Console, Console->Mode->Mode); |
381 | 385 | Console->ClearScreen(Console); |
382 | 386 | } |
383 | 387 |
|
@@ -515,8 +519,9 @@ UINTN EFIAPI RecallPrint( |
515 | 519 | VOID RecallPrintRestore(VOID) |
516 | 520 | { |
517 | 521 | UINTN i; |
| 522 | + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Console = gST->ConOut; |
518 | 523 |
|
519 | | - ConsoleReset(); |
| 524 | + Console->ClearScreen(Console); |
520 | 525 | for (i = 0; i < CurrentLine; i++) |
521 | 526 | Print(L"%s", PrintLine[i]); |
522 | 527 | } |
|
0 commit comments