diff --git a/Changelog.md b/Changelog.md index 59a7176ec4e9202e663030284e010067868a7be5..3f32d1c22d0b7552e45e141e6c19cc91b82bcf5c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ OpenCore Changelog - Added workaround for firmware not specifying DeviceHandle at bootstrap - Added support for R/O page tables in `SetupVirtualMap` quirk - Added OEM preservation for certain Apple SMBIOS tables +- Fixed switching to graphics mode when entering OpenCanopy #### v0.6.6 - Added keyboard and pointer entry scroll support in OpenCanopy diff --git a/Platform/OpenCanopy/OcBootstrap.c b/Platform/OpenCanopy/OcBootstrap.c index bb125a0ce394a384b40c10c6c3289c9edb6ca0cd..d19d2b6735928053ed0fdc9c87cc8d59b8b08b7a 100644 --- a/Platform/OpenCanopy/OcBootstrap.c +++ b/Platform/OpenCanopy/OcBootstrap.c @@ -33,9 +33,48 @@ extern BOOT_PICKER_GUI_CONTEXT mGuiContext; extern CONST GUI_IMAGE mBackgroundImage; +STATIC GUI_DRAWING_CONTEXT mDrawContext; +STATIC EFI_CONSOLE_CONTROL_SCREEN_MODE mPreviousMode; + +STATIC +EFI_STATUS +OcShowMenyByOcEnter ( + IN OC_BOOT_CONTEXT *BootContext + ) +{ + EFI_STATUS Status; + + Status = GuiLibConstruct ( + BootContext->PickerContext, + mGuiContext.CursorDefaultX, + mGuiContext.CursorDefaultY + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Extension for OpenCore builtin renderer to mark that we control text output here. + // + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED); + mPreviousMode = OcConsoleControlSetMode (EfiConsoleControlScreenGraphics); + + return EFI_SUCCESS; +} + STATIC -GUI_DRAWING_CONTEXT -mDrawContext; +VOID +OcShowMenyByOcLeave ( + VOID + ) +{ + GuiLibDestruct (); + // + // Extension for OpenCore builtin renderer to mark that we no longer control text output here. + // + gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED); + OcConsoleControlSetMode (mPreviousMode); +} EFI_STATUS EFIAPI @@ -56,20 +95,11 @@ OcShowMenuByOc ( mGuiContext.PickerContext = BootContext->PickerContext; mGuiContext.AudioPlaybackTimeout = -1; - Status = GuiLibConstruct ( - BootContext->PickerContext, - mGuiContext.CursorDefaultX, - mGuiContext.CursorDefaultY - ); + Status = OcShowMenyByOcEnter (BootContext); if (EFI_ERROR (Status)) { return Status; } - // - // Extension for OpenCore builtin renderer to mark that we control text output here. - // - gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_CONTROLLED); - // // Do not play intro animation for blind. // @@ -83,7 +113,7 @@ OcShowMenuByOc ( InternalGetCursorImage ); if (EFI_ERROR (Status)) { - GuiLibDestruct (); + OcShowMenyByOcLeave (); return Status; } @@ -95,7 +125,7 @@ OcShowMenuByOc ( Index == BootContext->DefaultEntry->EntryIndex - 1 ); if (EFI_ERROR (Status)) { - GuiLibDestruct (); + OcShowMenyByOcLeave (); return Status; } } @@ -138,12 +168,7 @@ OcShowMenuByOc ( // GuiClearScreen (&mDrawContext, mBackgroundImage.Buffer); BootPickerViewDeinitialize (&mDrawContext, &mGuiContext); - GuiLibDestruct (); - - // - // Extension for OpenCore builtin renderer to mark that we no longer control text output here. - // - gST->ConOut->TestString (gST->ConOut, OC_CONSOLE_MARK_UNCONTROLLED); + OcShowMenyByOcLeave (); *ChosenBootEntry = mGuiContext.BootEntry; BootContext->PickerContext->HideAuxiliary = mGuiContext.HideAuxiliary; diff --git a/Platform/OpenCanopy/OpenCanopy.inf b/Platform/OpenCanopy/OpenCanopy.inf index 64d1bc62b9a34fc2bcd790d4f9c803bddfa96f52..4654b7569fbffcf6853b7d624d008174060ed4b9 100644 --- a/Platform/OpenCanopy/OpenCanopy.inf +++ b/Platform/OpenCanopy/OpenCanopy.inf @@ -71,6 +71,7 @@ MtrrLib OcAppleKeyMapLib OcCompressionLib + OcConsoleLib OcGuardLib OcMiscLib OcPngLib