提交 3927ee7f 编写于 作者: M Mike Beaton

OcBootManagementLib: Save and restore text and graphics mode settings round...

OcBootManagementLib: Save and restore text and graphics mode settings round tools and failed entries
上级 0df9d126
......@@ -7,6 +7,7 @@ OpenCore Changelog
- Added Unicode font pages for some accented characters, plus box drawing and block elements, to `Builtin` text renderer
- Improved support for overlong menu entries and very narrow console modes in builtin picker
- Made `Builtin` text renderer ignore UI Scale, when required to ensure that text mode reaches minimum supported size of 80x25
- Added save and restore of text and graphics mode round tools and failed boot entries
#### v0.9.2
- Added `DisableIoMapperMapping` quirk, thx @CaseySJ
......
......@@ -44,6 +44,70 @@
#include <Library/UefiLib.h>
#include <Library/ResetSystemLib.h>
STATIC UINT32 mSavedGopMode;
STATIC EFI_CONSOLE_CONTROL_SCREEN_MODE mSavedConsoleControlMode;
STATIC INT32 mSavedConsoleMode;
STATIC
EFI_STATUS
SaveMode (
VOID
)
{
EFI_STATUS Status;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
mSavedConsoleMode = gST->ConOut->Mode->Mode;
mSavedConsoleControlMode = OcConsoleControlGetMode ();
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID **)&Gop
);
if (EFI_ERROR (Status)) {
mSavedGopMode = MAX_UINT32;
} else {
mSavedGopMode = Gop->Mode->Mode;
}
return Status;
}
STATIC
EFI_STATUS
RestoreMode (
VOID
)
{
EFI_STATUS Status;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
if (mSavedGopMode == MAX_UINT32) {
Status = EFI_SUCCESS;
} else {
Status = gBS->HandleProtocol (
gST->ConsoleOutHandle,
&gEfiGraphicsOutputProtocolGuid,
(VOID **)&Gop
);
if ( !EFI_ERROR (Status)
&& (Gop->Mode->Mode != mSavedGopMode))
{
Status = Gop->SetMode (Gop, mSavedGopMode);
}
}
OcConsoleControlSetMode (mSavedConsoleControlMode);
gST->ConOut->SetMode (gST->ConOut, mSavedConsoleMode);
return Status;
}
STATIC
EFI_STATUS
RunShowMenu (
......@@ -409,6 +473,7 @@ OcRunBootPicker (
}
}
SaveMode ();
FwRuntime = Chosen->FullNvramAccess ? OcDisableNvramProtection () : NULL;
Status = OcLoadBootEntry (
......@@ -418,6 +483,7 @@ OcRunBootPicker (
);
OcRestoreNvramProtection (FwRuntime);
RestoreMode ();
//
// Do not wait on successful return code.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册