mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OcConsoleLib: Use UIScale variable for HiDPI mode
This commit is contained in:
parent
2b44eb6832
commit
debd83adc8
@ -482,7 +482,6 @@ OC_DECLARE (OC_UEFI_INPUT)
|
||||
_(OC_STRING , ConsoleMode , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
|
||||
_(OC_STRING , Resolution , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
|
||||
_(OC_STRING , TextRenderer , , OC_STRING_CONSTR ("", _, __), OC_DESTR (OC_STRING)) \
|
||||
_(UINT32 , Scale , , 100 , ()) \
|
||||
_(BOOLEAN , IgnoreTextInGraphics , , FALSE , ()) \
|
||||
_(BOOLEAN , ClearScreenOnModeSwitch , , FALSE , ()) \
|
||||
_(BOOLEAN , ProvideConsoleGop , , FALSE , ()) \
|
||||
|
||||
@ -31,7 +31,6 @@ typedef enum {
|
||||
Configure console control protocol with given options.
|
||||
|
||||
@param[in] Renderer Renderer to use.
|
||||
@param[in] Resolution Renderer resolution in percents.
|
||||
@param[in] IgnoreTextOutput Skip console output in text mode.
|
||||
@param[in] SanitiseClearScreen Workaround ClearScreen breaking resolution.
|
||||
@param[in] ClearScreenOnModeSwitch Clear graphic screen when switching to text mode.
|
||||
@ -40,7 +39,6 @@ typedef enum {
|
||||
VOID
|
||||
OcSetupConsole (
|
||||
IN OC_CONSOLE_RENDERER Renderer,
|
||||
IN UINT32 Resolution,
|
||||
IN BOOLEAN IgnoreTextOutput,
|
||||
IN BOOLEAN SanitiseClearScreen,
|
||||
IN BOOLEAN ClearScreenOnModeSwitch,
|
||||
|
||||
@ -13,13 +13,15 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#include <Guid/AppleVariable.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/OcMiscLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/OcAppleUserInterfaceThemeLib.h>
|
||||
#include <Protocol/UserInterfaceTheme.h>
|
||||
|
||||
STATIC UINT32 mCurrentColor = 0;
|
||||
STATIC UINT32 mCurrentColor;
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
@ -41,24 +43,16 @@ STATIC EFI_USER_INTERFACE_THEME_PROTOCOL mAppleUserInterfaceThemeProtocol = {
|
||||
UserInterfaceThemeGetColor
|
||||
};
|
||||
|
||||
/**
|
||||
Install and initialise the Apple Image Conversion protocol.
|
||||
|
||||
@param[in] Reinstall Replace any installed protocol.
|
||||
|
||||
@returns Installed or located protocol.
|
||||
@retval NULL There was an error locating or installing the protocol.
|
||||
**/
|
||||
EFI_USER_INTERFACE_THEME_PROTOCOL *
|
||||
OcAppleUserInterfaceThemeInstallProtocol (
|
||||
IN BOOLEAN Reinstall
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 Color = 0;
|
||||
UINTN DataSize = 0;
|
||||
EFI_USER_INTERFACE_THEME_PROTOCOL *EfiUiInterface = NULL;
|
||||
EFI_HANDLE NewHandle = NULL;
|
||||
UINT32 Color;
|
||||
UINTN DataSize;
|
||||
EFI_USER_INTERFACE_THEME_PROTOCOL *EfiUiInterface;
|
||||
EFI_HANDLE NewHandle;
|
||||
|
||||
if (Reinstall) {
|
||||
Status = UninstallAllProtocolInstances (&gEfiUserInterfaceThemeProtocolGuid);
|
||||
@ -68,10 +62,10 @@ OcAppleUserInterfaceThemeInstallProtocol (
|
||||
}
|
||||
} else {
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiUserInterfaceThemeProtocolGuid,
|
||||
NULL,
|
||||
(VOID **)&EfiUiInterface
|
||||
);
|
||||
&gEfiUserInterfaceThemeProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &EfiUiInterface
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return EfiUiInterface;
|
||||
}
|
||||
@ -80,26 +74,27 @@ OcAppleUserInterfaceThemeInstallProtocol (
|
||||
//
|
||||
// Default color is black
|
||||
//
|
||||
mCurrentColor = 0x000000;
|
||||
mCurrentColor = APPLE_COLOR_SYRAH_BLACK;
|
||||
|
||||
DataSize = sizeof (Color);
|
||||
Status = gRT->GetVariable (
|
||||
L"DefaultBackgroundColor",
|
||||
&gAppleVendorVariableGuid,
|
||||
0,
|
||||
&DataSize,
|
||||
&Color
|
||||
);
|
||||
APPLE_DEFAULT_BACKGROUND_COLOR_VARIABLE_NAME,
|
||||
&gAppleVendorVariableGuid,
|
||||
0,
|
||||
&DataSize,
|
||||
&Color
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
mCurrentColor = Color;
|
||||
}
|
||||
|
||||
NewHandle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&NewHandle,
|
||||
&gEfiUserInterfaceThemeProtocolGuid,
|
||||
&mAppleUserInterfaceThemeProtocol,
|
||||
NULL
|
||||
);
|
||||
&NewHandle,
|
||||
&gEfiUserInterfaceThemeProtocolGuid,
|
||||
&mAppleUserInterfaceThemeProtocol,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -568,7 +568,6 @@ mUefiOutputSchema[] = {
|
||||
OC_SCHEMA_BOOLEAN_IN ("ReplaceTabWithSpace", OC_GLOBAL_CONFIG, Uefi.Output.ReplaceTabWithSpace),
|
||||
OC_SCHEMA_STRING_IN ("Resolution", OC_GLOBAL_CONFIG, Uefi.Output.Resolution),
|
||||
OC_SCHEMA_BOOLEAN_IN ("SanitiseClearScreen", OC_GLOBAL_CONFIG, Uefi.Output.SanitiseClearScreen),
|
||||
OC_SCHEMA_INTEGER_IN ("Scale", OC_GLOBAL_CONFIG, Uefi.Output.Scale),
|
||||
OC_SCHEMA_STRING_IN ("TextRenderer", OC_GLOBAL_CONFIG, Uefi.Output.TextRenderer),
|
||||
};
|
||||
|
||||
|
||||
@ -339,7 +339,6 @@ OcSetConsoleMode (
|
||||
VOID
|
||||
OcSetupConsole (
|
||||
IN OC_CONSOLE_RENDERER Renderer,
|
||||
IN UINT32 Resolution,
|
||||
IN BOOLEAN IgnoreTextOutput,
|
||||
IN BOOLEAN SanitiseClearScreen,
|
||||
IN BOOLEAN ClearScreenOnModeSwitch,
|
||||
@ -347,7 +346,7 @@ OcSetupConsole (
|
||||
)
|
||||
{
|
||||
if (Renderer == OcConsoleRendererBuiltinGraphics) {
|
||||
OcUseBuiltinTextOutput (Resolution);
|
||||
OcUseBuiltinTextOutput ();
|
||||
} else {
|
||||
OcUseSystemTextOutput (
|
||||
Renderer,
|
||||
|
||||
@ -50,7 +50,7 @@ OcConsoleControlInstallProtocol (
|
||||
|
||||
VOID
|
||||
OcUseBuiltinTextOutput (
|
||||
IN UINT32 Resolution
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
|
||||
@ -902,17 +902,23 @@ ConsoleControlInstall (
|
||||
|
||||
VOID
|
||||
OcUseBuiltinTextOutput (
|
||||
IN UINT32 Resolution
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN UiScaleSize;
|
||||
|
||||
//
|
||||
// TODO: Support more scales.
|
||||
//
|
||||
if (Resolution == 200) {
|
||||
mFontScale = 2;
|
||||
} else {
|
||||
UiScaleSize = sizeof (mFontScale);
|
||||
|
||||
Status = gRT->GetVariable (
|
||||
APPLE_UI_SCALE_VARIABLE_NAME,
|
||||
&gAppleVendorVariableGuid,
|
||||
NULL,
|
||||
&UiScaleSize,
|
||||
(VOID *) &mFontScale
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status) || mFontScale != 2) {
|
||||
mFontScale = 1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user