CloverBootloader/rEFIt_UEFI/refit/menu.cpp

3657 lines
140 KiB
C++
Raw Normal View History

2020-04-04 14:27:02 +02:00
/*
* refit/menu.c
* Menu functions
*
* Copyright (c) 2006 Christoph Pfisterer
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Christoph Pfisterer nor the names of the
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "menu.h"
//#include "Platform.h"
#include "../libeg/libegint.h" //this includes platform.h
//#include "../include/scroll_images.h"
#include "../Platform/Settings.h"
#include "../../Version.h"
//#include "colors.h"
#include "../libeg/nanosvg.h"
#include "../libeg/FloatLib.h"
#include "HdaCodecDump.h"
#include "menu.h"
#include "screen.h"
#include "../cpp_foundation/XString.h"
#include "../libeg/XTheme.h"
#include "../libeg/VectorGraphics.h" // for testSVG
#include "../gui/shared_with_menu.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1
#else
#define DEBUG_MENU DEBUG_ALL
#endif
#if DEBUG_MENU == 0
#define DBG(...)
#else
#define DBG(...) DebugLog(DEBUG_MENU, __VA_ARGS__)
#endif
//#define PREBOOT_LOG L"EFI\\CLOVER\\misc\\preboot.log"
//#define VBIOS_BIN L"EFI\\CLOVER\\misc\\c0000.bin"
//CONST CHAR16 *VBIOS_BIN = L"EFI\\CLOVER\\misc\\c0000.bin"; // tmporarily moved in shared_wint_menu
//#define LSTR(s) L##s
// scrolling definitions
//static INTN MaxItemOnScreen = -1;
//#if USE_XTHEME
//REFIT_MENU_SCREEN OptionMenu(4, L"Options"_XSW, L""_XSW);
//#else
REFIT_MENU_SCREEN OptionMenu(4, L"Options", L""_XSW);
//#endif
//
//extern REFIT_MENU_ITEM_RETURN MenuEntryReturn;
//extern UINTN ThemesNum;
//extern CONST CHAR16 *ThemesList[];
//extern UINTN ConfigsNum;
//extern CHAR16 *ConfigsList[];
//extern UINTN DsdtsNum;
//extern CHAR16 *DsdtsList[];
//extern UINTN AudioNum;
//extern HDA_OUTPUTS AudioList[20];
extern CONST CHAR8 *AudioOutputNames[];
//extern CHAR8 NonDetected[];
#include "../Platform/string.h"
//extern BOOLEAN GetLegacyLanAddress;
//extern UINT8 gLanMac[4][6]; // their MAC addresses
//extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
//
////layout must be in XTheme
//#if !USE_XTHEME
//INTN LayoutBannerOffset = 64;
//INTN LayoutButtonOffset = 0;
//INTN LayoutTextOffset = 0;
INTN LayoutMainMenuHeight = 376;
INTN LayoutAnimMoveForMenuX = 0;
//#endif
//
//BOOLEAN SavePreBootLog = FALSE;
//
//#define SCROLL_LINE_UP (0)
//#define SCROLL_LINE_DOWN (1)
//#define SCROLL_PAGE_UP (2)
//#define SCROLL_PAGE_DOWN (3)
//#define SCROLL_FIRST (4)
//#define SCROLL_LAST (5)
//#define SCROLL_NONE (6)
//#define SCROLL_SCROLL_DOWN (7)
//#define SCROLL_SCROLL_UP (8)
//#define SCROLL_SCROLLBAR_MOVE (9)
//
//
#define TEXT_CORNER_REVISION (1)
#define TEXT_CORNER_HELP (2)
#define TEXT_CORNER_OPTIMUS (3)
//
//#define TITLE_MAX_LEN (SVALUE_MAX_SIZE / sizeof(CHAR16) + 128)
//
//// other menu definitions
//
//#define MENU_FUNCTION_INIT (0)
//#define MENU_FUNCTION_CLEANUP (1)
//#define MENU_FUNCTION_PAINT_ALL (2)
//#define MENU_FUNCTION_PAINT_SELECTION (3)
//#define MENU_FUNCTION_PAINT_TIMEOUT (4)
//
//
//
//static CHAR16 ArrowUp[2] = { ARROW_UP, 0 };
//static CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 };
//
//BOOLEAN MainAnime = FALSE;
//
////TODO Scroll variables must be a part of REFIT_SCREEN
////BOOLEAN ScrollEnabled = FALSE;
//BOOLEAN IsDragging = FALSE;
//#if !USE_XTHEME
INTN ScrollWidth = 16;
//INTN ScrollButtonsHeight = 20;
//INTN ScrollBarDecorationsHeight = 5;
//INTN ScrollScrollDecorationsHeight = 7;
//#endif
//INTN ScrollbarYMovement;
//
//
////#define TextHeight (FONT_CELL_HEIGHT + TEXT_YMARGIN * 2)
//
//// clovy - set row height based on text size
//#define RowHeightFromTextHeight (1.35f)
//
////TODO spacing must be a part of layout in XTheme
//#define TITLEICON_SPACING (16)
////#define ROW0__TILESIZE (144)
////#define ROW1_TILESIZE (64)
//#define TILE1_XSPACING (8)
////#define TILE_YSPACING (24)
//#define ROW0_SCROLLSIZE (100)
//
////EG_IMAGE *SelectionImages[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
////EG_IMAGE *Buttons[4] = {NULL, NULL, NULL, NULL};
2020-04-04 15:50:13 +02:00
#if !USE_XTHEME
2020-04-04 14:27:02 +02:00
static EG_IMAGE *TextBuffer = NULL;
2020-04-04 15:50:13 +02:00
#endif
2020-04-04 14:27:02 +02:00
//
////EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //non-trasparent
//
////INTN row0TileSize = 144;
////INTN row1TileSize = 64;
//
//static INTN row0Count, row0PosX, row0PosXRunning;
//static INTN row1Count, row1PosX, row1PosXRunning;
//static INTN *itemPosX = NULL;
//static INTN *itemPosY = NULL;
2020-04-04 15:50:13 +02:00
#if !USE_XTHEME
2020-04-04 14:27:02 +02:00
static INTN row0PosY /*, row1PosY, textPosY, FunctextPosY*/;
2020-04-04 15:50:13 +02:00
#endif
2020-04-04 14:27:02 +02:00
////static EG_IMAGE* MainImage;
//static INTN OldX = 0, OldY = 0;
//static INTN OldTextWidth = 0;
//static UINTN OldRow = 0;
//static INTN OldTimeoutTextWidth = 0;
//static INTN MenuWidth, TimeoutPosY;
//static INTN EntriesPosX, EntriesPosY;
//static INTN EntriesWidth, EntriesHeight, EntriesGap;
//#if !USE_XTHEME
EG_IMAGE* ScrollbarImage = NULL;
EG_IMAGE* ScrollbarBackgroundImage = NULL;
EG_IMAGE* UpButtonImage = NULL;
EG_IMAGE* DownButtonImage = NULL;
EG_IMAGE* BarStartImage = NULL;
EG_IMAGE* BarEndImage = NULL;
EG_IMAGE* ScrollStartImage = NULL;
EG_IMAGE* ScrollEndImage = NULL;
EG_RECT BarStart;
EG_RECT BarEnd;
EG_RECT ScrollStart;
EG_RECT ScrollEnd;
EG_RECT ScrollTotal;
EG_RECT UpButton;
EG_RECT DownButton;
EG_RECT ScrollbarBackground;
EG_RECT Scrollbar;
EG_RECT ScrollbarOldPointerPlace;
EG_RECT ScrollbarNewPointerPlace;
//#endif
//
//INPUT_ITEM *InputItems = NULL;
//UINTN InputItemsCount = 0;
//
//INTN OldChosenTheme;
//INTN OldChosenConfig;
//INTN OldChosenDsdt;
//UINTN OldChosenAudio;
//UINT8 DefaultAudioVolume = 70;
////INTN NewChosenTheme;
//#if !USE_XTHEME
//INTN TextStyle; //why global? It will be class SCREEN member
//#endif
////BOOLEAN mGuiReady = FALSE;
//
//REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (L"Options"_XSW, 1, 0, 'O', ActionEnter);
REFIT_MENU_ITEM_ABOUT MenuEntryAbout (L"About Clover"_XSW, 1, 0, 'A', ActionEnter);
REFIT_MENU_ITEM_RESET MenuEntryReset (L"Restart Computer"_XSW, 1, 0, 'R', ActionSelect);
REFIT_MENU_ITEM_SHUTDOWN MenuEntryShutdown(L"Exit Clover"_XSW, 1, 0, 'U', ActionSelect);
REFIT_MENU_ITEM_RETURN MenuEntryReturn (L"Return"_XSW, 0, 0, 0, ActionEnter);
#if USE_XTHEME
REFIT_MENU_SCREEN MainMenu(1, L"Main Menu"_XSW, L"Automatic boot"_XSW);
REFIT_MENU_SCREEN AboutMenu(2, L"About"_XSW, L""_XSW);
REFIT_MENU_SCREEN HelpMenu(3, L"Help"_XSW, L""_XSW);
#else
REFIT_MENU_SCREEN MainMenu(1, L"Main Menu", L"Automatic boot");
REFIT_MENU_SCREEN AboutMenu(2, L"About", NULL);
REFIT_MENU_SCREEN HelpMenu(3, L"Help", NULL);
#endif
// input - tsc
// output - milliseconds
// the caller is responsible for t1 > t0
UINT64 TimeDiff(UINT64 t0, UINT64 t1)
{
return DivU64x64Remainder((t1 - t0), DivU64x32(gCPUStructure.TSCFrequency, 1000), 0);
}
VOID FillInputs(BOOLEAN New)
{
UINTN i,j; //for loops
CHAR8 tmp[41];
// BOOLEAN bit;
tmp[40] = 0; //make it null-terminated
UINTN InputItemsCount = 0;
if (New) {
InputItems = (__typeof__(InputItems))AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
}
InputItems[InputItemsCount].ItemType = ASString; //0
//even though Ascii we will keep value as Unicode to convert later
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s ", gSettings.BootArgs);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = UNIString; //1
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(32);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 32, "%ls", gSettings.DsdtName); // 1-> 2
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = UNIString; //2
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(63);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 63, "%ls", gSettings.BlockKexts);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = RadioSwitch; //3 - Themes chooser
InputItems[InputItemsCount++].IValue = 3;
InputItems[InputItemsCount].ItemType = BoolValue; //4
InputItems[InputItemsCount++].BValue = gSettings.DropSSDT;
InputItems[InputItemsCount].ItemType = BoolValue; //5
InputItems[InputItemsCount++].BValue = gSettings.GeneratePStates;
InputItems[InputItemsCount].ItemType = BoolValue; //6
InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable;
InputItems[InputItemsCount].ItemType = Decimal; //7
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.PLimitDict);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //8
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.UnderVoltStep);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //9
InputItems[InputItemsCount++].BValue = gSettings.GenerateCStates;
InputItems[InputItemsCount].ItemType = BoolValue; //10
InputItems[InputItemsCount++].BValue = gSettings.EnableC2;
InputItems[InputItemsCount].ItemType = BoolValue; //11
InputItems[InputItemsCount++].BValue = gSettings.EnableC4;
InputItems[InputItemsCount].ItemType = BoolValue; //12
InputItems[InputItemsCount++].BValue = gSettings.EnableC6;
InputItems[InputItemsCount].ItemType = BoolValue; //13
InputItems[InputItemsCount++].BValue = gSettings.EnableISS;
InputItems[InputItemsCount].ItemType = Decimal; //14
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.QPI);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //15
InputItems[InputItemsCount++].BValue = gSettings.PatchNMI;
InputItems[InputItemsCount].ItemType = BoolValue; //16
InputItems[InputItemsCount++].BValue = gSettings.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%llX", gPlatformFeature);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //18
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(36);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 36, "0x%X", gSettings.BacklightLevel);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //19
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
if (gSettings.BusSpeed > 20000) {
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.BusSpeed);
2020-04-04 14:27:02 +02:00
} else {
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06llu", gCPUStructure.ExternalClock);
2020-04-04 14:27:02 +02:00
}
InputItemsCount = 20;
for (i=0; i<NGFX; i++) {
InputItems[InputItemsCount].ItemType = ASString; //20+i*6
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gGraphics[i].Model);
2020-04-04 14:27:02 +02:00
if (gGraphics[i].Vendor == Ati) {
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
InputItems[InputItemsCount++].BValue = gSettings.InjectATI;
InputItems[InputItemsCount].ItemType = ASString; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
if (StrLen(gSettings.FBName) > 2) { //fool proof: cfg_name is 3 character or more.
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%ls", gSettings.FBName);
2020-04-04 14:27:02 +02:00
} else {
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%s", gGraphics[i].Config);
2020-04-04 14:27:02 +02:00
}
} else if (gGraphics[i].Vendor == Nvidia) {
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
InputItems[InputItemsCount++].BValue = gSettings.InjectNVidia;
InputItems[InputItemsCount].ItemType = ASString; //22+6i
for (j=0; j<8; j++) {
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.Dcfg[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 40, "%s", tmp);
2020-04-04 14:27:02 +02:00
//InputItems[InputItemsCount++].SValue = PoolPrint(L"%08x",*(UINT64*)&gSettings.Dcfg[0]);
} else /*if (gGraphics[i].Vendor == Intel) */ {
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
InputItems[InputItemsCount++].BValue = gSettings.InjectIntel;
InputItems[InputItemsCount].ItemType = Hex; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.IgPlatform);
2020-04-04 14:27:02 +02:00
// InputItemsCount += 3;
// continue;
}
InputItems[InputItemsCount].ItemType = Decimal; //23+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
if (gSettings.VideoPorts > 0) {
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.VideoPorts);
2020-04-04 14:27:02 +02:00
} else {
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gGraphics[i].Ports);
2020-04-04 14:27:02 +02:00
}
if (gGraphics[i].Vendor == Nvidia) {
InputItems[InputItemsCount].ItemType = ASString; //24+6i
for (j=0; j<20; j++) {
snprintf((CHAR8*)&tmp[2*j], 3, "%02X", gSettings.NVCAP[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 84, "%s", tmp);
2020-04-04 14:27:02 +02:00
} else { //ATI and others there will be connectors
InputItems[InputItemsCount].ItemType = Hex; //24+6i
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 20, "%08x", gGraphics[i].Connectors);
2020-04-04 14:27:02 +02:00
}
InputItems[InputItemsCount].ItemType = BoolValue; //25+6i
InputItems[InputItemsCount++].BValue = gGraphics[i].LoadVBios;
}
//and so on
InputItemsCount = 44;
InputItems[InputItemsCount].ItemType = BoolValue; //44
InputItems[InputItemsCount++].BValue = gSettings.KextPatchesAllowed;
InputItems[InputItemsCount].ItemType = BoolValue; //45
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelCpu;
InputItems[InputItemsCount].ItemType = BoolValue; //46
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPAppleIntelCPUPM;
InputItems[InputItemsCount].ItemType = BoolValue; //47
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPAppleRTC;
InputItems[InputItemsCount].ItemType = BoolValue; //48
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelPm;
InputItems[InputItemsCount].ItemType = BoolValue; //49
InputItems[InputItemsCount++].BValue = gSettings.FixMCFG;
InputItems[InputItemsCount].ItemType = Decimal; //50
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.RefCLK);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //51 OS version if non-detected
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s ", NonDetected);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //52
InputItems[InputItemsCount++].BValue = gSettings.InjectEDID;
//VendorEDID & ProductEDID 53, 54
InputItems[InputItemsCount].ItemType = Decimal; //53
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.VendorEDID);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //54
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.ProductEDID);
2020-04-04 14:27:02 +02:00
// ErmaC: NvidiaGeneric menu selector y/n
InputItems[InputItemsCount].ItemType = BoolValue; //55
InputItems[InputItemsCount++].BValue = gSettings.NvidiaGeneric;
InputItems[InputItemsCount].ItemType = BoolValue; //56
InputItems[InputItemsCount++].BValue = gSettings.NvidiaWeb;
InputItems[InputItemsCount].ItemType = BoolValue; //57
InputItems[InputItemsCount++].BValue = gSettings.ResetHDA;
InputItems[InputItemsCount].ItemType = BoolValue; //58
InputItems[InputItemsCount++].BValue = gSettings.AFGLowPowerState;
InputItems[InputItemsCount].ItemType = BoolValue; //59
InputItems[InputItemsCount++].BValue = gSettings.HDAInjection;
InputItems[InputItemsCount].ItemType = Decimal; // 60
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.HDALayoutId);
2020-04-04 14:27:02 +02:00
// syscl change here
InputItems[InputItemsCount].ItemType = BoolValue; //61
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPDELLSMBIOS;
// end of change
InputItems[InputItemsCount].ItemType = Hex; //62
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeatures);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //63
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeaturesMask);
2020-04-04 14:27:02 +02:00
// Debug for KernelAndKextPatches
InputItems[InputItemsCount].ItemType = BoolValue; //64
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPDebug;
// CSR - aka System Integrity Protection configuration
InputItems[InputItemsCount].ItemType = CheckBit; //65
InputItems[InputItemsCount++].IValue = gSettings.BooterConfig;
InputItems[InputItemsCount].ItemType = CheckBit; //66
InputItems[InputItemsCount++].IValue = gSettings.CsrActiveConfig;
InputItems[InputItemsCount].ItemType = CheckBit; //67
InputItems[InputItemsCount++].IValue = gSettings.FixDsdt;
InputItems[InputItemsCount].ItemType = CheckBit; //68
InputItems[InputItemsCount++].IValue = gSettings.OptionsBits;
InputItems[InputItemsCount].ItemType = CheckBit; //69
InputItems[InputItemsCount++].IValue = gSettings.FlagsBits;
InputItems[InputItemsCount].ItemType = Decimal; //70
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02lld", gSettings.PointerSpeed);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //71
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04llu", gSettings.DoubleClickTime);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //72
InputItems[InputItemsCount++].BValue = gSettings.PointerMirror;
//reserve for mouse and continue
InputItemsCount = 74;
InputItems[InputItemsCount].ItemType = BoolValue; //74
InputItems[InputItemsCount++].BValue = gSettings.USBFixOwnership;
InputItems[InputItemsCount].ItemType = Hex; //75
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.C3Latency);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //76
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.EnabledCores);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //77
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.SavingMode);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //78
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ProductName);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //79
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.VersionNr);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //80
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.SerialNr);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //81
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardNumber);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //82
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardSerialNumber);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //83
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.BoardType);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //84
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardVersion);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Decimal; //85
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.ChassisType);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //86
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.RomVersion);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //87
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ReleaseDate);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //88
InputItems[InputItemsCount++].BValue = gSettings.DoubleFirstState;
InputItems[InputItemsCount].ItemType = BoolValue; //89
InputItems[InputItemsCount++].BValue = gSettings.EnableC7;
InputItems[InputItemsCount].ItemType = RadioSwitch; //90
InputItems[InputItemsCount++].IValue = 90;
InputItems[InputItemsCount].ItemType = BoolValue; //91
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelLapic;
InputItems[InputItemsCount].ItemType = BoolValue; //92
InputItems[InputItemsCount++].BValue = gSettings.USBInjection;
InputItems[InputItemsCount].ItemType = BoolValue; //93
InputItems[InputItemsCount++].BValue = gSettings.InjectClockID;
InputItems[InputItemsCount].ItemType = Hex; //94
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeATI);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //95
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeNVidia);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //96
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIntel);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //97
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeLAN);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //98
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeWIFI);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //99
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeSATA);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //100
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = CheckBit; //101
InputItems[InputItemsCount++].IValue = dropDSM;
InputItems[InputItemsCount].ItemType = BoolValue; //102
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT;
InputItems[InputItemsCount].ItemType = Hex; //103
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIMEI);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = Hex; //104
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.KernelAndKextPatches.FakeCPUID);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //105
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPKernelXCPM;
InputItems[InputItemsCount].ItemType = BoolValue; //106
InputItems[InputItemsCount++].BValue = gSettings.StringInjector;
InputItems[InputItemsCount].ItemType = BoolValue; //107
InputItems[InputItemsCount++].BValue = gSettings.NoDefaultProperties;
InputItems[InputItemsCount].ItemType = BoolValue; //108
InputItems[InputItemsCount++].BValue = gSettings.KernelPatchesAllowed;
InputItems[InputItemsCount].ItemType = Hex; //109
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%01X", gSettings.DualLink);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //110
InputItems[InputItemsCount++].BValue = gSettings.NvidiaNoEFI;
InputItems[InputItemsCount].ItemType = BoolValue; //111
InputItems[InputItemsCount++].BValue = gSettings.NvidiaSingle;
InputItems[InputItemsCount].ItemType = Hex; //112
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.IntelMaxValue);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //113
InputItems[InputItemsCount++].BValue = gSettings.AutoMerge;
InputItems[InputItemsCount].ItemType = BoolValue; //114
InputItems[InputItemsCount++].BValue = gSettings.DeInit;
InputItems[InputItemsCount].ItemType = BoolValue; //115
InputItems[InputItemsCount++].BValue = gSettings.NoCaches;
InputItems[InputItemsCount].ItemType = RadioSwitch; //116 - DSDT chooser
InputItems[InputItemsCount++].IValue = 116;
InputItems[InputItemsCount].ItemType = ASString; //117
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.EfiVersion);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = ASString; //118
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BooterCfgStr);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = RadioSwitch; //119 - Audio chooser
InputItems[InputItemsCount++].IValue = 119;
InputItems[InputItemsCount].ItemType = Decimal; //120
if (New) {
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04d", DefaultAudioVolume);
2020-04-04 14:27:02 +02:00
InputItems[InputItemsCount].ItemType = BoolValue; //121
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
//menu for drop table
if (gSettings.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables;
while (DropTable) {
DropTable->MenuItem.ItemType = BoolValue;
DropTable = DropTable->Next;
}
}
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
ACPIPatchedAMLTmp->MenuItem.ItemType = BoolValue;
ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next;
}
}
}
VOID ApplyInputs(VOID)
{
EFI_STATUS Status = EFI_NOT_FOUND;
MACHINE_TYPES Model;
BOOLEAN NeedSave = TRUE;
INTN i = 0;
UINTN j;
// UINT32 k;
CHAR16 *ch;
CHAR8 AString[256];
TagPtr dict;
// DBG("ApplyInputs\n");
if (InputItems[i].Valid) {
ZeroMem(&gSettings.BootArgs, 256);
gBootChanged = TRUE;
ch = InputItems[i].SValue;
do {
if (*ch == L'\\') {
*ch = L'_';
}
} while (*(++ch));
snprintf(gSettings.BootArgs, 255, "%ls ", InputItems[i].SValue);
}
i++; //1
if (InputItems[i].Valid) {
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.DsdtName, sizeof(gSettings.DsdtName), "%ls", InputItems[i].SValue);
2020-04-04 14:27:02 +02:00
}
i++; //2
if (InputItems[i].Valid) {
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.BlockKexts, sizeof(gSettings.BlockKexts), "%ls", InputItems[i].SValue);
2020-04-04 14:27:02 +02:00
}
i++; //3
if (InputItems[i].Valid) {
#if USE_XTHEME
if (OldChosenTheme == 0xFFFF) {
ThemeX.Theme.takeValueFrom("embedded");
} else {
ThemeX.Theme.takeValueFrom(ThemesList[OldChosenTheme]);
ThemeX.DarkEmbedded = FALSE;
ThemeX.Font = FONT_ALFA;
}
#else
if (GlobalConfig.Theme) {
FreePool(GlobalConfig.Theme);
}
if (OldChosenTheme == 0xFFFF) {
GlobalConfig.Theme = PoolPrint(L"embedded");
} else {
GlobalConfig.Theme = PoolPrint(L"%s", ThemesList[OldChosenTheme]);
GlobalConfig.DarkEmbedded = FALSE;
GlobalConfig.Font = FONT_ALFA;
}
#endif
//will change theme after ESC
gThemeChanged = TRUE;
}
i++; //4
if (InputItems[i].Valid) {
gSettings.DropSSDT = InputItems[i].BValue;
}
i++; //5
if (InputItems[i].Valid) {
gSettings.GeneratePStates = InputItems[i].BValue;
}
i++; //6
if (InputItems[i].Valid) {
gSettings.SlpSmiEnable = InputItems[i].BValue;
}
i++; //7
if (InputItems[i].Valid) {
// DBG("InputItems[i]: %ls\n", InputItems[i].SValue);
gSettings.PLimitDict = (UINT8)(StrDecimalToUintn(InputItems[i].SValue) & 0x7F);
// DBG("Item 7=PLimitDict %d\n", gSettings.PLimitDict);
}
i++; //8
if (InputItems[i].Valid) {
gSettings.UnderVoltStep = (UINT8)(StrDecimalToUintn(InputItems[i].SValue) & 0x3F);
// DBG("Item 8=UnderVoltStep %d\n", gSettings.UnderVoltStep);
}
i++; //9
if (InputItems[i].Valid) {
gSettings.GenerateCStates = InputItems[i].BValue;
}
i++; //10
if (InputItems[i].Valid) {
gSettings.EnableC2 = InputItems[i].BValue;
}
i++; //11
if (InputItems[i].Valid) {
gSettings.EnableC4 = InputItems[i].BValue;
}
i++; //12
if (InputItems[i].Valid) {
gSettings.EnableC6 = InputItems[i].BValue;
}
i++; //13
if (InputItems[i].Valid) {
gSettings.EnableISS = InputItems[i].BValue;
}
i++; //14
if (InputItems[i].Valid) {
gSettings.QPI = (UINT16)StrDecimalToUintn(InputItems[i].SValue);
DBG("applied QPI=%d\n", gSettings.QPI);
}
i++; //15
if (InputItems[i].Valid) {
gSettings.PatchNMI = InputItems[i].BValue;
}
i++; //16
if (InputItems[i].Valid) {
gSettings.PatchVBios = InputItems[i].BValue;
}
i++; //17
if (InputItems[i].Valid) {
gPlatformFeature = (UINT64)StrHexToUint64(InputItems[i].SValue);
DBG("applied PlatformFeature=0x%llX\n", gPlatformFeature);
}
i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise
if (InputItems[i].Valid) {
gSettings.BacklightLevel = (UINT16)StrHexToUint64(InputItems[i].SValue);
gSettings.BacklightLevelConfig = TRUE;
}
i++; //19
if (InputItems[i].Valid) {
gSettings.BusSpeed = (UINT32)StrDecimalToUintn(InputItems[i].SValue);
DBG("applied BusSpeed=%d\n", gSettings.BusSpeed);
}
i = 19;
for (j = 0; j < NGFX; j++) {
i++; //20
if (InputItems[i].Valid) {
snprintf(gGraphics[j].Model, 64, "%ls", InputItems[i].SValue);
}
i++; //21
if (InputItems[i].Valid) {
if (gGraphics[j].Vendor == Ati) {
gSettings.InjectATI = InputItems[i].BValue;
} else if (gGraphics[j].Vendor == Nvidia) {
gSettings.InjectNVidia = InputItems[i].BValue;
} else if (gGraphics[j].Vendor == Intel) {
gSettings.InjectIntel = InputItems[i].BValue;
}
}
i++; //22
if (InputItems[i].Valid) {
if (gGraphics[j].Vendor == Ati) {
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.FBName, 32, "%ls", InputItems[i].SValue);
2020-04-04 14:27:02 +02:00
} else if (gGraphics[j].Vendor == Nvidia) {
ZeroMem(AString, 256);
snprintf(AString, 255, "%ls", InputItems[i].SValue);
hex2bin(AString, (UINT8*)&gSettings.Dcfg[0], 8);
} else if (gGraphics[j].Vendor == Intel) {
//ig-platform-id for Ivy+ and snb-platform-id for Sandy
gSettings.IgPlatform = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied *-platform-id=0x%X\n", gSettings.IgPlatform);
}
}
if (gGraphics[i].Vendor == Intel) {
i += 3;
continue;
}
i++; //23
if (InputItems[i].Valid) {
gGraphics[j].Ports = (UINT8)(StrDecimalToUintn(InputItems[i].SValue) & 0x0F);
}
i++; //24
if (InputItems[i].Valid) {
if (gGraphics[j].Vendor == Nvidia) {
ZeroMem(AString, 256);
if (StrLen(InputItems[i].SValue) > 0) {
snprintf(AString, 255, "%ls", InputItems[i].SValue);
hex2bin(AString, (UINT8*)&gSettings.NVCAP[0], 20);
}
} else {
gGraphics[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue);
gGraphics[j].ConnChanged = TRUE;
}
}
i++; //25
if (InputItems[i].Valid) {
gGraphics[j].LoadVBios = InputItems[i].BValue;
}
} //end of Graphics Cards
// next number == 42
i = 44;
if (InputItems[i].Valid) {
gSettings.KextPatchesAllowed = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //45
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPKernelCpu = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //46
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPAppleIntelCPUPM = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //47
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPAppleRTC = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //48
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPKernelPm = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //49
if (InputItems[i].Valid) {
gSettings.FixMCFG = InputItems[i].BValue;
}
i++; //50
if (InputItems[i].Valid) {
gSettings.RefCLK = (UINT32)StrDecimalToUintn(InputItems[i].SValue);
}
i++; //51
if (InputItems[i].Valid) {
snprintf(NonDetected, 64, "%ls", InputItems[i].SValue);
}
i++; //52
if (InputItems[i].Valid) {
gSettings.InjectEDID = InputItems[i].BValue;
}
i++; //53
if (InputItems[i].Valid) {
gSettings.VendorEDID = (UINT16)StrHexToUint64(InputItems[i].SValue);
}
i++; //54
if (InputItems[i].Valid) {
gSettings.ProductEDID = (UINT16)StrHexToUint64(InputItems[i].SValue);
}
i++; //55
// ErmaC: NvidiaGeneric bool(Y/N)
if (InputItems[i].Valid) {
gSettings.NvidiaGeneric = InputItems[i].BValue;
}
i++; //56
if (InputItems[i].Valid) {
gSettings.NvidiaWeb = InputItems[i].BValue;
}
i++; //57
if (InputItems[i].Valid) {
gSettings.ResetHDA = InputItems[i].BValue;
}
i++; //58
if (InputItems[i].Valid) {
gSettings.AFGLowPowerState = InputItems[i].BValue;
}
i++; //59
if (InputItems[i].Valid) {
gSettings.HDAInjection = InputItems[i].BValue;
}
i++; //60
if (InputItems[i].Valid) {
gSettings.HDALayoutId = (UINT32)(StrDecimalToUintn(InputItems[i].SValue));
}
i++; //61
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPDELLSMBIOS = InputItems[i].BValue;
// yes, we do need to change gRemapSmBiosIsRequire here as well
gRemapSmBiosIsRequire = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //62
if (InputItems[i].Valid) {
gFwFeatures = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied FirmwareFeatures=0x%X\n", gFwFeatures);
}
i++; //63
if (InputItems[i].Valid) {
gFwFeaturesMask = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied FirmwareFeaturesMask=0x%X\n", gFwFeaturesMask);
}
i++; //64
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPDebug = InputItems[i].BValue;
// gBootChanged = TRUE;
}
// CSR
i = 65;
if (InputItems[i].Valid) {
gSettings.BooterConfig = InputItems[i].IValue & 0x7F;
}
i++; //66
if (InputItems[i].Valid) {
gSettings.CsrActiveConfig = InputItems[i].IValue;
}
i++; //67
if (InputItems[i].Valid) {
gSettings.FixDsdt = InputItems[i].IValue;
}
i++; //68
if (InputItems[i].Valid) {
gSettings.OptionsBits = InputItems[i].IValue;
}
i++; //69
if (InputItems[i].Valid) {
gSettings.FlagsBits = InputItems[i].IValue;
}
i++; //70
if (InputItems[i].Valid) {
INTN Minus = 0;
if (InputItems[i].SValue[0] == '-') {
Minus = 1;
}
gSettings.PointerSpeed = StrDecimalToUintn(&InputItems[i].SValue[Minus]);
if (Minus) {
gSettings.PointerSpeed = -gSettings.PointerSpeed;
}
// DBG("Pointer Speed=%d\n", gSettings.PointerSpeed);
}
i++; //71
if (InputItems[i].Valid) {
gSettings.DoubleClickTime = StrDecimalToUintn(InputItems[i].SValue);
// DBG("DoubleClickTime=%d ms\n", gSettings.DoubleClickTime);
}
i++; //72
if (InputItems[i].Valid) {
gSettings.PointerMirror = InputItems[i].BValue;
}
i = 74;
if (InputItems[i].Valid) {
gSettings.USBFixOwnership = InputItems[i].BValue;
}
i++; //75
if (InputItems[i].Valid) {
gSettings.C3Latency = (UINT16)StrHexToUint64(InputItems[i].SValue);
}
i++; //76
if (InputItems[i].Valid) {
gSettings.EnabledCores = (UINT8)StrDecimalToUintn(InputItems[i].SValue);
}
i++; //77
if (InputItems[i].Valid) {
gSettings.SavingMode = (UINT8)StrDecimalToUintn(InputItems[i].SValue);
}
i++; //78
if (InputItems[i].Valid) {
snprintf(gSettings.ProductName, 64, "%ls", InputItems[i].SValue);
// let's fill all other fields based on this ProductName
// to serve as default
Model = GetModelFromString(gSettings.ProductName);
if (Model != MaxMachineType) {
SetDMISettingsForModel(Model, FALSE);
}
}
i++; //79
if (InputItems[i].Valid) {
snprintf(gSettings.VersionNr, 64, "%ls", InputItems[i].SValue);
}
i++; //80
if (InputItems[i].Valid) {
snprintf(gSettings.SerialNr, 64, "%ls", InputItems[i].SValue);
}
i++; //81
if (InputItems[i].Valid) {
snprintf(gSettings.BoardNumber, 64, "%ls", InputItems[i].SValue);
}
i++; //82
if (InputItems[i].Valid) {
snprintf(gSettings.BoardSerialNumber, 64, "%ls", InputItems[i].SValue);
}
i++; //83
if (InputItems[i].Valid) {
gSettings.BoardType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue) & 0x0F);
}
i++; //84
if (InputItems[i].Valid) {
snprintf(gSettings.BoardVersion, 64, "%ls", InputItems[i].SValue);
}
i++; //85
if (InputItems[i].Valid) {
gSettings.ChassisType = (UINT8)(StrDecimalToUintn(InputItems[i].SValue) & 0x0F);
}
i++; //86
if (InputItems[i].Valid) {
snprintf(gSettings.RomVersion, 64, "%ls", InputItems[i].SValue);
}
i++; //87
if (InputItems[i].Valid) {
snprintf(gSettings.ReleaseDate, 64, "%ls", InputItems[i].SValue);
}
i++; //88
if (InputItems[i].Valid) {
gSettings.DoubleFirstState = InputItems[i].BValue;
}
i++; //89
if (InputItems[i].Valid) {
gSettings.EnableC7 = InputItems[i].BValue;
}
i++; //90
if (InputItems[i].Valid) {
Status = LoadUserSettings(SelfRootDir, ConfigsList[OldChosenConfig], &dict);
if (!EFI_ERROR(Status)) {
Status = GetUserSettings(SelfRootDir, dict);
if (gConfigDict[2]) FreeTag(gConfigDict[2]);
gConfigDict[2] = dict;
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.ConfigName, 64, "%ls", ConfigsList[OldChosenConfig]);
2020-04-04 14:27:02 +02:00
gBootChanged = TRUE;
gThemeChanged = TRUE;
}
FillInputs(FALSE);
NeedSave = FALSE;
}
i++; //91
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPKernelLapic = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //92
if (InputItems[i].Valid) {
gSettings.USBInjection = InputItems[i].BValue;
}
i++; //93
if (InputItems[i].Valid) {
gSettings.InjectClockID = InputItems[i].BValue;
}
i++; //94
if (InputItems[i].Valid) {
gSettings.FakeATI = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //95
if (InputItems[i].Valid) {
gSettings.FakeNVidia = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //96
if (InputItems[i].Valid) {
gSettings.FakeIntel = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied FakeIntel=0x%X\n", gSettings.FakeIntel);
}
i++; //97
if (InputItems[i].Valid) {
gSettings.FakeLAN = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //98
if (InputItems[i].Valid) {
gSettings.FakeWIFI = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //99
if (InputItems[i].Valid) {
gSettings.FakeSATA = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //100
if (InputItems[i].Valid) {
gSettings.FakeXHCI = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //101
if (InputItems[i].Valid) {
// gSettings.DropOEM_DSM = (UINT16)StrHexToUint64(InputItems[i].SValue);
gSettings.DropOEM_DSM = (UINT16)InputItems[i].IValue;
dropDSM = gSettings.DropOEM_DSM; //?
// defDSM = TRUE;
}
i++; //102
if (InputItems[i].Valid) {
gSettings.DebugDSDT = InputItems[i].BValue;
}
i++; //103
if (InputItems[i].Valid) {
gSettings.FakeIMEI = (UINT32)StrHexToUint64(InputItems[i].SValue);
}
i++; //104
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.FakeCPUID = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied FakeCPUID=%06X\n", gSettings.KernelAndKextPatches.FakeCPUID);
gBootChanged = TRUE;
}
i++; //105
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPKernelXCPM = InputItems[i].BValue;
DBG("applied KernelXCPM\n");
gBootChanged = TRUE;
}
i++; //106
if (InputItems[i].Valid) {
gSettings.StringInjector = InputItems[i].BValue;
}
i++; //107
if (InputItems[i].Valid) {
gSettings.NoDefaultProperties = InputItems[i].BValue;
}
i++; //108
if (InputItems[i].Valid) {
gSettings.KernelPatchesAllowed = InputItems[i].BValue;
gBootChanged = TRUE;
}
i++; //109
if (InputItems[i].Valid) {
gSettings.DualLink = (UINT32)StrHexToUint64(InputItems[i].SValue);
DBG("applied DualLink=%X\n", gSettings.DualLink);
}
i++; //110
if (InputItems[i].Valid) {
gSettings.NvidiaNoEFI = InputItems[i].BValue;
}
i++; //111
if (InputItems[i].Valid) {
gSettings.NvidiaSingle = InputItems[i].BValue;
}
i++; //112
if (InputItems[i].Valid) {
gSettings.IntelMaxValue = (UINT16)StrHexToUint64(InputItems[i].SValue);
}
i++; //113
if (InputItems[i].Valid) {
gSettings.AutoMerge = InputItems[i].BValue;
}
i++; //114
if (InputItems[i].Valid) {
gSettings.DeInit = InputItems[i].BValue;
}
i++; //115
if (InputItems[i].Valid) {
gSettings.NoCaches = InputItems[i].BValue;
}
i++; //116
if (InputItems[i].Valid) {
if (OldChosenDsdt == 0xFFFF) {
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.DsdtName, 64, "BIOS.aml");
2020-04-04 14:27:02 +02:00
} else {
2020-04-04 15:50:13 +02:00
snwprintf(gSettings.DsdtName, 64, "%ls", DsdtsList[OldChosenDsdt]);
2020-04-04 14:27:02 +02:00
}
}
i++; //117
if (InputItems[i].Valid) {
snprintf(gSettings.EfiVersion, 64, "%ls", InputItems[i].SValue);
}
i++; //118
if (InputItems[i].Valid) {
snprintf(gSettings.BooterCfgStr, 64, "%ls", InputItems[i].SValue);
}
i++; //119
if (InputItems[i].Valid) {
EFI_DEVICE_PATH_PROTOCOL* DevicePath = NULL;
UINT8 TmpIndex = OldChosenAudio & 0xFF;
DBG("Chosen output %llu:%ls_%s\n", OldChosenAudio, AudioList[OldChosenAudio].Name, AudioOutputNames[OldChosenAudio]);
DevicePath = DevicePathFromHandle(AudioList[OldChosenAudio].Handle);
if (DevicePath != NULL) {
SetNvramVariable(L"Clover.SoundDevice", &gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
GetDevicePathSize(DevicePath), (UINT8 *)DevicePath);
SetNvramVariable(L"Clover.SoundIndex", &gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
1, (UINT8 *)&TmpIndex);
}
}
i++; //120
if (InputItems[i].Valid) {
DefaultAudioVolume = (UINT8)StrDecimalToUintn(InputItems[i].SValue);
if (DefaultAudioVolume > 100) {
// correct wrong input
DefaultAudioVolume = 90;
2020-04-04 15:50:13 +02:00
snwprintf(InputItems[i].SValue, 16, "%04d", DefaultAudioVolume);
2020-04-04 14:27:02 +02:00
}
SetNvramVariable(L"Clover.SoundVolume", &gEfiAppleBootGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
1, &DefaultAudioVolume);
}
i++; //121
if (InputItems[i].Valid) {
gSettings.KernelAndKextPatches.KPPanicNoKextDump = InputItems[i].BValue;
gBootChanged = TRUE;
}
if (NeedSave) {
SaveSettings();
}
}
VOID AboutRefit(VOID)
{
#if USE_XTHEME
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
AboutMenu.TitleImage = ThemeX.GetIcon((INTN)BUILTIN_ICON_FUNC_ABOUT);
} else {
AboutMenu.TitleImage.setEmpty();
}
#else
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
} else {
AboutMenu.TitleImage = NULL;
}
#endif
if (AboutMenu.Entries.size() == 0) {
// AboutMenu.AddMenuInfo_f(("Clover Version 5.0"));
#ifdef REVISION_STR
AboutMenu.AddMenuInfo_f(" %s ", REVISION_STR);
#else
AboutMenu.AddMenuInfo_f((L"Clover Revision %s", gFirmwareRevision));
#endif
#ifdef FIRMWARE_BUILDDATE
AboutMenu.AddMenuInfo_f(" Build: %s", FIRMWARE_BUILDDATE);
#else
AboutMenu.AddMenuInfo(" Build: unknown");
#endif
AboutMenu.AddMenuInfo("");
AboutMenu.AddMenuInfo("Based on rEFIt (c) 2006-2010 Christoph Pfisterer");
AboutMenu.AddMenuInfo("Portions Copyright (c) Intel Corporation");
AboutMenu.AddMenuInfo("Developers:");
AboutMenu.AddMenuInfo(" Slice, dmazar, apianti, JrCs, pene, usrsse2");
AboutMenu.AddMenuInfo(" Kabyl, pcj, jadran, Blackosx, STLVNUB, ycr.ru");
AboutMenu.AddMenuInfo(" FrodoKenny, skoczi, crazybirdy, Oscar09, xsmile");
AboutMenu.AddMenuInfo(" cparm, rehabman, nms42, Sherlocks, Zenith432");
AboutMenu.AddMenuInfo(" stinga11, TheRacerMaster, solstice, SoThOr, DF");
AboutMenu.AddMenuInfo(" cecekpawon, Micky1979, Needy, joevt, ErmaC, vit9696");
AboutMenu.AddMenuInfo(" ath, savvas, syscl, goodwin_c, clovy, jief_machak");
AboutMenu.AddMenuInfo("Credits also:");
AboutMenu.AddMenuInfo(" projectosx.com, applelife.ru, insanelymac.com");
AboutMenu.AddMenuInfo("");
AboutMenu.AddMenuInfo("Running on:");
AboutMenu.AddMenuInfo_f(" EFI Revision %d.%02d",
gST->Hdr.Revision >> 16, gST->Hdr.Revision & ((1 << 16) - 1));
#if defined(MDE_CPU_IA32)
AboutMenu.AddMenuInfo(" Platform: i386 (32 bit)");
#elif defined(MDE_CPU_X64)
AboutMenu.AddMenuInfo(" Platform: x86_64 (64 bit)");
#elif defined(_MSC_VER)
AboutMenu.AddMenuInfo(" Platform: x86_64 (64 bit) VS");
#else
AboutMenu.AddMenuInfo(" Platform: unknown");
#endif
AboutMenu.AddMenuInfo_f(" Firmware: %ls rev %d.%04d", gST->FirmwareVendor, gST->FirmwareRevision >> 16, gST->FirmwareRevision & ((1 << 16) - 1));
AboutMenu.AddMenuInfo_f(" Screen Output: %ls", egScreenDescription());
AboutMenu.AnimeRun = AboutMenu.GetAnime();
AboutMenu.AddMenuEntry(&MenuEntryReturn, false);
} else if (AboutMenu.Entries.size() >= 2) {
/*
EntryCount instead of InfoLineCount. Lastline == return/back. Is necessary recheck screen res here?
*/
// FreePool(AboutMenu.Entries[AboutMenu.Entries.size()-2].Title); //what is FreePool(XStringW)?
AboutMenu.Entries[AboutMenu.Entries.size()-2].Title.SWPrintf(" Screen Output: %ls", egScreenDescription());
}
AboutMenu.RunMenu(NULL);
}
VOID HelpRefit(VOID)
{
#if USE_XTHEME
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
HelpMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_HELP);
} else {
HelpMenu.TitleImage.setEmpty();
}
#else
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
HelpMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_HELP);
} else {
HelpMenu.TitleImage = NULL;
}
#endif
if (HelpMenu.Entries.size() == 0) {
switch (gLanguage)
{
case russian:
HelpMenu.AddMenuInfo("ESC - Выход из подменю, обновление главного меню");
HelpMenu.AddMenuInfo("F1 - Помощь по горячим клавишам");
HelpMenu.AddMenuInfo("F2 - Сохранить отчет в preboot.log (только если FAT32)");
HelpMenu.AddMenuInfo("F3 - Показать скрытые значки в меню");
HelpMenu.AddMenuInfo("F4 - Родной DSDT сохранить в EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Патченный DSDT сохранить в EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Сохранить ВидеоБиос в EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Проверить звук на выбранном выходе");
HelpMenu.AddMenuInfo("F8 - Сделать дамп звуковых устройств в EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Изменить разрешение экрана на одно из возможных");
HelpMenu.AddMenuInfo("F10 - Снимок экрана в папку EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Извлечь указанный DVD");
HelpMenu.AddMenuInfo("Пробел - Дополнительное меню запуска выбранного тома");
HelpMenu.AddMenuInfo("Цифры 1-9 - Быстрый запуск тома по порядку в меню");
HelpMenu.AddMenuInfo("A (About) - О загрузчике");
HelpMenu.AddMenuInfo("O (Options) - Дополнительные настройки");
HelpMenu.AddMenuInfo("R (Reset) - Теплый перезапуск");
HelpMenu.AddMenuInfo("U (go oUt) - Завершить работу в Кловере");
HelpMenu.AddMenuInfo("S (Shell) - Переход в режим командной строки");
break;
case ukrainian:
HelpMenu.AddMenuInfo("ESC - Вийти з меню, оновити головне меню");
HelpMenu.AddMenuInfo("F1 - Ця довідка");
HelpMenu.AddMenuInfo("F2 - Зберегти preboot.log (тiльки FAT32)");
HelpMenu.AddMenuInfo("F3 - Відображати приховані розділи");
HelpMenu.AddMenuInfo("F4 - Зберегти OEM DSDT в EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Зберегти патчений DSDT в EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F6 - Зберегти VideoBios в EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F10 - Зберегти знімок екрану в EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Відкрити обраний диск (DVD)");
HelpMenu.AddMenuInfo("Пробіл - докладніше про обраний пункт меню");
HelpMenu.AddMenuInfo("Клавіші 1-9 -  клавіші пунктів меню");
HelpMenu.AddMenuInfo("A - Про систему");
HelpMenu.AddMenuInfo("O - Опції меню");
HelpMenu.AddMenuInfo("R - Перезавантаження");
HelpMenu.AddMenuInfo("U - Відключити ПК");
HelpMenu.AddMenuInfo("S - Shell");
break;
case spanish:
HelpMenu.AddMenuInfo("ESC - Salir de submenu o actualizar el menu principal");
HelpMenu.AddMenuInfo("F1 - Esta Ayuda");
HelpMenu.AddMenuInfo("F2 - Guardar preboot.log (Solo FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Guardar DSDT oem en EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Guardar DSDT parcheado en EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Guardar VideoBios en EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Guardar Captura de pantalla en EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Expulsar volumen seleccionado (DVD)");
HelpMenu.AddMenuInfo("Espacio - Detalles acerca selected menu entry");
HelpMenu.AddMenuInfo("Digitos 1-9 - Atajo a la entrada del menu");
HelpMenu.AddMenuInfo("A - Menu Acerca de");
HelpMenu.AddMenuInfo("O - Menu Optiones");
HelpMenu.AddMenuInfo("R - Reiniciar Equipo");
HelpMenu.AddMenuInfo("U - Apagar");
HelpMenu.AddMenuInfo("S - Shell");
break;
case portuguese:
case brasil:
HelpMenu.AddMenuInfo("ESC - Sai do submenu, atualiza o menu principal");
HelpMenu.AddMenuInfo("F1 - Esta ajuda");
HelpMenu.AddMenuInfo("F2 - Salva preboot.log (somente FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Salva oem DSDT em EFI/CLOVER/ACPI/origin/ (somente FAT32)");
HelpMenu.AddMenuInfo("F5 - Salva DSDT corrigido em EFI/CLOVER/ACPI/origin/ (somente FAT32)");
HelpMenu.AddMenuInfo("F6 - Salva VideoBios em EFI/CLOVER/misc/ (somente FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Salva screenshot em EFI/CLOVER/misc/ (somente FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Ejeta o volume selecionado (DVD)");
HelpMenu.AddMenuInfo("Espaco - Detalhes sobre a opcao do menu selecionada");
HelpMenu.AddMenuInfo("Tecle 1-9 - Atalho para as entradas do menu");
HelpMenu.AddMenuInfo("A - Sobre o Menu");
HelpMenu.AddMenuInfo("O - Opcoes do Menu");
HelpMenu.AddMenuInfo("R - Reiniciar");
HelpMenu.AddMenuInfo("U - Desligar");
HelpMenu.AddMenuInfo("S - Shell");
break;
case italian:
HelpMenu.AddMenuInfo("ESC - Esci dal submenu, Aggiorna menu principale");
HelpMenu.AddMenuInfo("F1 - Aiuto");
HelpMenu.AddMenuInfo("F2 - Salva il preboot.log (solo su FAT32)");
HelpMenu.AddMenuInfo("F3 - Mostra volumi nascosti");
HelpMenu.AddMenuInfo("F4 - Salva il DSDT oem in EFI/CLOVER/ACPI/origin/ (solo suFAT32)");
HelpMenu.AddMenuInfo("F5 - Salva il patched DSDT in EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Salva il VideoBios in EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Controlla il suono sull'uscita selezionata");
HelpMenu.AddMenuInfo("F8 - Scarica le uscite audio in EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Cambia la risoluzione dello schermo alla prossima disponibile");
HelpMenu.AddMenuInfo("F10 - Salva screenshot in EFI/CLOVER/misc/ (solo su FAT32)");
HelpMenu.AddMenuInfo("F11 - Resetta NVRAM");
HelpMenu.AddMenuInfo("F12 - Espelli il volume selezionato (DVD)");
HelpMenu.AddMenuInfo("Spazio - Dettagli sul menu selezionato");
HelpMenu.AddMenuInfo("Digita 1-9 - Abbreviazioni per il menu");
HelpMenu.AddMenuInfo("A - Informazioni");
HelpMenu.AddMenuInfo("O - Menu Opzioni");
HelpMenu.AddMenuInfo("R - Riavvio");
HelpMenu.AddMenuInfo("U - Spegnimento");
HelpMenu.AddMenuInfo("S - Shell");
break;
case german:
HelpMenu.AddMenuInfo("ESC - Zurueck aus Untermenue, Hauptmenue erneuern");
HelpMenu.AddMenuInfo("F1 - Diese Hilfe");
HelpMenu.AddMenuInfo("F2 - Sichere preboot.log (nur mit FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Sichere OEM DSDT in EFI/CLOVER/ACPI/origin/ (nur mit FAT32)");
HelpMenu.AddMenuInfo("F5 - Sichere gepatchtes DSDT in EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Sichere VideoBios in EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Sichere Bildschirmfoto in EFI/CLOVER/misc/ (nur mit FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Volume auswerfen (DVD)");
HelpMenu.AddMenuInfo("Leertaste - Details über den gewählten Menue Eintrag");
HelpMenu.AddMenuInfo("Zahlen 1-9 - Kurzwahl zum Menue Eintrag");
HelpMenu.AddMenuInfo("A - Menue Informationen");
HelpMenu.AddMenuInfo("O - Menue Optionen");
HelpMenu.AddMenuInfo("R - Neustart");
HelpMenu.AddMenuInfo("U - Ausschalten");
HelpMenu.AddMenuInfo("S - Shell");
break;
case dutch:
HelpMenu.AddMenuInfo("ESC - Verlaat submenu, Vernieuw hoofdmenu");
HelpMenu.AddMenuInfo("F1 - Onderdeel hulp");
HelpMenu.AddMenuInfo("F2 - preboot.log opslaan (Alleen FAT32)");
HelpMenu.AddMenuInfo("F3 - Verborgen opties weergeven");
HelpMenu.AddMenuInfo("F4 - Opslaan oem DSDT in EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Opslaan gepatchte DSDT in EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Opslaan VideoBios in EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Controleer geluid op geselecteerde uitgang");
HelpMenu.AddMenuInfo("F8 - Opslaan audio uitgangen in EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Wijzig schermresolutie naar eerstvolgende mogelijke modus");
HelpMenu.AddMenuInfo("F10 - Opslaan schermafdruk in EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Uitwerpen geselecteerd volume (DVD)");
HelpMenu.AddMenuInfo("Spatie - Details over geselecteerd menuoptie");
HelpMenu.AddMenuInfo("Cijfers 1-9 - Snelkoppeling naar menuoptie");
HelpMenu.AddMenuInfo("A - Menu Over");
HelpMenu.AddMenuInfo("O - Menu Opties");
HelpMenu.AddMenuInfo("R - Soft Reset");
HelpMenu.AddMenuInfo("U - Verlaten");
HelpMenu.AddMenuInfo("S - Shell");
break;
case french:
HelpMenu.AddMenuInfo("ESC - Quitter sous-menu, Retour menu principal");
HelpMenu.AddMenuInfo("F1 - Aide");
HelpMenu.AddMenuInfo("F2 - Enregistrer preboot.log (FAT32 only)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Enregistrer oem DSDT dans EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Enregistrer DSDT modifié dans EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Enregistrer VideoBios dans EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Enregistrer la capture d'écran dans EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Ejecter le volume (DVD)");
HelpMenu.AddMenuInfo("Space - Détails a propos du menu selectionné");
HelpMenu.AddMenuInfo("Digits 1-9 - Raccourci vers entrée menu");
HelpMenu.AddMenuInfo("A - A propos");
HelpMenu.AddMenuInfo("O - Options Menu");
HelpMenu.AddMenuInfo("R - Redémarrer");
HelpMenu.AddMenuInfo("U - Eteindre");
HelpMenu.AddMenuInfo("S - Shell");
break;
case indonesian:
HelpMenu.AddMenuInfo("ESC - Keluar submenu, Refresh main menu");
HelpMenu.AddMenuInfo("F1 - Help");
HelpMenu.AddMenuInfo("F2 - Simpan preboot.log ke EFI/CLOVER/ACPI/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Simpan oem DSDT ke EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Simpan patched DSDT ke EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Simpan VideoBios ke EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Simpan screenshot ke EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Eject volume (DVD)");
HelpMenu.AddMenuInfo("Spasi - Detail dari menu yang dipilih");
HelpMenu.AddMenuInfo("Tombol 1-9 - Shortcut pilihan menu");
HelpMenu.AddMenuInfo("A - About");
HelpMenu.AddMenuInfo("O - Opsi");
HelpMenu.AddMenuInfo("R - Soft Reset");
HelpMenu.AddMenuInfo("U - Shutdown");
HelpMenu.AddMenuInfo("S - Shell");
break;
case polish:
HelpMenu.AddMenuInfo("ESC - Wyjscie z podmenu, Odswiezenie glownego menu");
HelpMenu.AddMenuInfo("F1 - Pomoc");
HelpMenu.AddMenuInfo("F2 - Zapis preboot.log (tylko FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Zapis DSDT do EFI/CLOVER/ACPI/origin/ (tylko FAT32)");
HelpMenu.AddMenuInfo("F5 - Zapis poprawionego DSDT do EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Zapis BIOSu k. graficznej do EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Zapis zrzutu ekranu do EFI/CLOVER/misc/ (tylko FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Wysuniecie zaznaczonego dysku (tylko dla DVD)");
HelpMenu.AddMenuInfo("Spacja - Informacje nt. dostepnych opcji dla zaznaczonego dysku");
HelpMenu.AddMenuInfo("Znaki 1-9 - Skroty opcji dla wybranego dysku");
HelpMenu.AddMenuInfo("A - Menu Informacyjne");
HelpMenu.AddMenuInfo("O - Menu Opcje");
HelpMenu.AddMenuInfo("R - Restart komputera");
HelpMenu.AddMenuInfo("U - Wylaczenie komputera");
HelpMenu.AddMenuInfo("S - Shell");
break;
case croatian:
HelpMenu.AddMenuInfo("ESC - izlaz iz podizbornika, Osvježi glavni izbornik");
HelpMenu.AddMenuInfo("F1 - Ovaj izbornik");
HelpMenu.AddMenuInfo("F2 - Spremi preboot.log (samo na FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Spremi oem DSDT u EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Spremi patched DSDT into EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Spremi VideoBios into EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Spremi screenshot into EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Izbaci izabrai (DVD)");
HelpMenu.AddMenuInfo("Space - Detalji o odabranom sistemu");
HelpMenu.AddMenuInfo("Brojevi 1 do 9 su prečac do izbora");
HelpMenu.AddMenuInfo("A - Izbornik o meni");
HelpMenu.AddMenuInfo("O - Izbornik opcije");
HelpMenu.AddMenuInfo("R - Restart računala");
HelpMenu.AddMenuInfo("U - Isključivanje računala");
HelpMenu.AddMenuInfo("S - Shell");
break;
case czech:
HelpMenu.AddMenuInfo("ESC - Vrátit se do hlavní nabídky");
HelpMenu.AddMenuInfo("F1 - Tato Nápověda");
HelpMenu.AddMenuInfo("F2 - Uložit preboot.log (FAT32 only)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Uložit oem DSDT do EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Uložit patchnuté DSDT do EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Uložit VideoBios do EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Uložit snímek obrazovky do EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Vysunout vybranou mechaniku (DVD)");
HelpMenu.AddMenuInfo("Mezerník - Podrobnosti o vybraném disku");
HelpMenu.AddMenuInfo("čísla 1-9 - Klávesové zkratky pro disky");
HelpMenu.AddMenuInfo("A - Menu O Programu");
HelpMenu.AddMenuInfo("O - Menu Možnosti");
HelpMenu.AddMenuInfo("R - Částečný restart");
HelpMenu.AddMenuInfo("U - Odejít");
HelpMenu.AddMenuInfo("S - Shell");
break;
case korean:
HelpMenu.AddMenuInfo("ESC - 하위메뉴에서 나감, 메인메뉴 새로 고침");
HelpMenu.AddMenuInfo("F1 - 이 도움말");
HelpMenu.AddMenuInfo("F2 - preboot.log를 저장합니다. (FAT32방식에만 해당됨)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - oem DSDT를 EFI/CLOVER/ACPI/origin/에 저장합니다. (FAT32)");
HelpMenu.AddMenuInfo("F5 - 패치된 DSDT를 EFI/CLOVER/ACPI/origin/에 저장합니다. (FAT32)");
HelpMenu.AddMenuInfo("F6 - VideoBios를 EFI/CLOVER/misc/에 저장합니다. (FAT32)");
HelpMenu.AddMenuInfo("F7 - 선택한 출력에서 사운드 확인");
HelpMenu.AddMenuInfo("F8 - 오디오 코덱덤프를 EFI/CLOVER/misc/에 저장합니다.");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - 스크린샷을 EFI/CLOVER/misc/에 저장합니다. (FAT32)");
HelpMenu.AddMenuInfo("F11 - NVRAM 초기화");
HelpMenu.AddMenuInfo("F12 - 선택한 볼륨을 제거합니다. (DVD)");
HelpMenu.AddMenuInfo("Space - 선택한 메뉴의 상세 설명");
HelpMenu.AddMenuInfo("Digits 1-9 - 메뉴 단축 번호");
HelpMenu.AddMenuInfo("A - 단축키 - 이 부트로더에 관하여");
HelpMenu.AddMenuInfo("O - 단축키 - 부트 옵션");
HelpMenu.AddMenuInfo("R - 단축키 - 리셋");
HelpMenu.AddMenuInfo("U - 단축키 - 시스템 종료");
HelpMenu.AddMenuInfo("S - Shell");
break;
case romanian:
HelpMenu.AddMenuInfo("ESC - Iesire din sub-meniu, Refresh meniul principal");
HelpMenu.AddMenuInfo("F1 - Ajutor");
HelpMenu.AddMenuInfo("F2 - Salvare preboot.log (doar pentru FAT32)");
HelpMenu.AddMenuInfo("F4 - Salvare oem DSDT in EFI/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Salvare DSDT modificat in EFI/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Salvare VideoBios in EFI/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Salvare screenshot in EFI/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Scoatere volum selectat (DVD)");
HelpMenu.AddMenuInfo("Space - Detalii despre item-ul selectat");
HelpMenu.AddMenuInfo("Cifre 1-9 - Scurtaturi pentru itemele meniului");
HelpMenu.AddMenuInfo("A - Despre");
HelpMenu.AddMenuInfo("O - Optiuni");
HelpMenu.AddMenuInfo("R - Soft Reset");
HelpMenu.AddMenuInfo("U - Inchidere");
HelpMenu.AddMenuInfo("S - Shell");
break;
case chinese:
HelpMenu.AddMenuInfo("ESC - 离开子菜单, 刷新主菜单");
HelpMenu.AddMenuInfo("F1 - 帮助");
HelpMenu.AddMenuInfo("F2 - 保存 preboot.log 到 EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F3 - 显示隐藏的启动项");
HelpMenu.AddMenuInfo("F4 - 保存原始的 DSDT 到 EFI/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - 保存修正后的 DSDT 到 EFI/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - 保存 VideoBios 到 EFI/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - 检查选中输出设备的声音");
HelpMenu.AddMenuInfo("F8 - 生成声卡输出转储到 EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - 调整屏幕分辨率为下一个可用的模式");
HelpMenu.AddMenuInfo("F10 - 保存截图到 EFI/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - 重置 NVRAM");
HelpMenu.AddMenuInfo("F12 - 推出选中的卷 (DVD)");
HelpMenu.AddMenuInfo("空格 - 关于选中项的详情");
HelpMenu.AddMenuInfo("数字 1-9 - 菜单快捷键");
HelpMenu.AddMenuInfo("A - 关于");
HelpMenu.AddMenuInfo("O - 选项");
HelpMenu.AddMenuInfo("R - 软复位");
HelpMenu.AddMenuInfo("U - 退出");
HelpMenu.AddMenuInfo("S - Shell");
break;
case english:
default:
HelpMenu.AddMenuInfo("ESC - Escape from submenu, Refresh main menu");
HelpMenu.AddMenuInfo("F1 - This help");
HelpMenu.AddMenuInfo("F2 - Save preboot.log into EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F3 - Show hidden entries");
HelpMenu.AddMenuInfo("F4 - Save oem DSDT into EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F5 - Save patched DSDT into EFI/CLOVER/ACPI/origin/ (FAT32)");
HelpMenu.AddMenuInfo("F6 - Save VideoBios into EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F7 - Check sound on selected output");
HelpMenu.AddMenuInfo("F8 - Make audio outputs dump into EFI/CLOVER/misc/");
HelpMenu.AddMenuInfo("F9 - Switch screen resoluton to next possible mode");
HelpMenu.AddMenuInfo("F10 - Save screenshot into EFI/CLOVER/misc/ (FAT32)");
HelpMenu.AddMenuInfo("F11 - Reset NVRAM");
HelpMenu.AddMenuInfo("F12 - Eject selected volume (DVD)");
HelpMenu.AddMenuInfo("Space - Details about selected menu entry");
HelpMenu.AddMenuInfo("Digits 1-9 - Shortcut to menu entry");
HelpMenu.AddMenuInfo("A - Menu About");
HelpMenu.AddMenuInfo("O - Menu Options");
HelpMenu.AddMenuInfo("R - Soft Reset");
HelpMenu.AddMenuInfo("U - Exit from Clover");
HelpMenu.AddMenuInfo("S - Shell");
break;
}
HelpMenu.AnimeRun = HelpMenu.GetAnime();
HelpMenu.AddMenuEntry(&MenuEntryReturn, false);
}
HelpMenu.RunMenu(NULL);
}
//
// Graphics helper functions
//
/*
SelectionImages:
[0] SelectionBig
[2] SelectionSmall
[4] SelectionIndicator
Buttons:
[0] radio_button
[1] radio_button_selected
[2] checkbox
[3] checkbox_checked
*/
#if !USE_XTHEME
VOID InitSelection(VOID)
{
if (!AllowGraphicsMode)
return;
SelectionBackgroundPixel.r = (GlobalConfig.SelectionColor >> 24) & 0xFF;
SelectionBackgroundPixel.g = (GlobalConfig.SelectionColor >> 16) & 0xFF;
SelectionBackgroundPixel.b = (GlobalConfig.SelectionColor >> 8) & 0xFF;
SelectionBackgroundPixel.a = (GlobalConfig.SelectionColor >> 0) & 0xFF;
if (SelectionImages[0] != NULL) {
return;
}
// load small selection image
if (GlobalConfig.SelectionSmallFileName != NULL){
SelectionImages[2] = egLoadImage(ThemeDir, GlobalConfig.SelectionSmallFileName, FALSE);
}
if (SelectionImages[2] == NULL){
SelectionImages[2] = BuiltinIcon(BUILTIN_SELECTION_SMALL);
SelectionImages[2]->HasAlpha = FALSE; // support transparensy for selection icons
CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EG_PIXEL));
}
SelectionImages[2] = egEnsureImageSize(SelectionImages[2],
row1TileSize, row1TileSize, &MenuBackgroundPixel);
if (SelectionImages[2] == NULL) {
return;
}
// load big selection image
if (!GlobalConfig.TypeSVG && GlobalConfig.SelectionBigFileName != NULL) {
SelectionImages[0] = egLoadImage(ThemeDir, GlobalConfig.SelectionBigFileName, FALSE);
SelectionImages[0] = egEnsureImageSize(SelectionImages[0],
row0TileSize, row0TileSize,
&MenuBackgroundPixel);
}
if (SelectionImages[0] == NULL) {
// calculate big selection image from small one
SelectionImages[0] = BuiltinIcon(BUILTIN_SELECTION_BIG);
SelectionImages[0]->HasAlpha = FALSE; // support transparensy for selection icons
CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EG_PIXEL));
if (SelectionImages[0] == NULL) {
egFreeImage(SelectionImages[2]);
SelectionImages[2] = NULL;
return;
}
if (GlobalConfig.SelectionOnTop) {
SelectionImages[0]->HasAlpha = TRUE;
SelectionImages[2]->HasAlpha = TRUE;
}
}
// BootCampStyle indicator image
if (GlobalConfig.BootCampStyle) {
// load indicator selection image
if (GlobalConfig.SelectionIndicatorName != NULL) {
SelectionImages[4] = egLoadImage(ThemeDir, GlobalConfig.SelectionIndicatorName, TRUE);
}
if (!SelectionImages[4]) {
SelectionImages[4] = egDecodePNG(ACCESS_EMB_DATA(emb_selection_indicator), ACCESS_EMB_SIZE(emb_selection_indicator), TRUE);
}
INTN ScaledIndicatorSize = (INTN)(INDICATOR_SIZE * GlobalConfig.Scale);
SelectionImages[4] = egEnsureImageSize(SelectionImages[4], ScaledIndicatorSize, ScaledIndicatorSize, &MenuBackgroundPixel);
if (!SelectionImages[4]) {
SelectionImages[4] = egCreateFilledImage(ScaledIndicatorSize, ScaledIndicatorSize,
TRUE, &StdBackgroundPixel);
}
SelectionImages[5] = egCreateFilledImage(ScaledIndicatorSize, ScaledIndicatorSize,
TRUE, &MenuBackgroundPixel);
}
/*
Button & radio, or any other next icons with builtin icon as fallback should synced to:
- BUILTIN_ICON_* in lib.h
- BuiltinIconTable in icns.c
- Data in egemb_icons.h / scroll_images.h
*/
// Radio buttons
//it was a nonsense egLoadImage is just inluded into egLoadIcon.
// will be corrected with XTheme support
//the procedure loadIcon should also check embedded icons
Buttons[0] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button", L"png"), TRUE); //memory leak
Buttons[1] = egLoadImage(ThemeDir, GetIconsExt(L"radio_button_selected", L"png"), TRUE);
if (!Buttons[0]) {
Buttons[0] = egLoadIcon(ThemeDir, L"radio_button.png", 48);
}
if (!Buttons[0]) {
Buttons[0] = egDecodePNG(ACCESS_EMB_DATA(emb_radio_button), ACCESS_EMB_SIZE(emb_radio_button), TRUE);
}
if (!Buttons[1]) {
Buttons[1] = egLoadIcon(ThemeDir, L"radio_button_selected.png", 48);
}
if (!Buttons[1]) {
Buttons[1] = egDecodePNG(ACCESS_EMB_DATA(emb_radio_button_selected), ACCESS_EMB_SIZE(emb_radio_button_selected), TRUE);
}
// Checkbox
Buttons[2] = egLoadImage(ThemeDir, GetIconsExt(L"checkbox", L"png"), TRUE);
Buttons[3] = egLoadImage(ThemeDir, GetIconsExt(L"checkbox_checked", L"png"), TRUE);
if (!Buttons[2]) {
// DBG("egLoadIcon checkbox\n");
Buttons[2] = egLoadIcon(ThemeDir, L"checkbox.png", 48);
}
if (!Buttons[3]) {
// DBG("egLoadIcon checkbox_checked\n");
Buttons[3] = egLoadIcon(ThemeDir, L"checkbox_checked.png", 48);
}
if (!Buttons[2]) {
// DBG("embedded checkbox\n");
Buttons[2] = egDecodePNG(ACCESS_EMB_DATA(emb_checkbox), ACCESS_EMB_SIZE(emb_checkbox), TRUE);
}
if (!Buttons[3]) {
// DBG("embedded checkbox_checked\n");
Buttons[3] = egDecodePNG(ACCESS_EMB_DATA(emb_checkbox_checked), ACCESS_EMB_SIZE(emb_checkbox_checked), TRUE);
}
// non-selected background images
//totally wrong
if (GlobalConfig.SelectionBigFileName != NULL) {
SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize,
TRUE, &MenuBackgroundPixel);
SelectionImages[3] = egCreateFilledImage(row1TileSize, row1TileSize,
TRUE, &MenuBackgroundPixel);
} else { // using embedded theme (this is an assumption but a better check is required)
EG_PIXEL BackgroundPixel;
if (GlobalConfig.DarkEmbedded || GlobalConfig.TypeSVG) {
BackgroundPixel = DarkEmbeddedBackgroundPixel;
BackgroundPixel.a = 0x00;
} else {
BackgroundPixel = StdBackgroundPixel;
BackgroundPixel.a = 0xff;
}
if (GlobalConfig.DarkEmbedded) { //nonsense then equal else
SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize,
TRUE, &BackgroundPixel);
SelectionImages[3] = egCreateFilledImage(row1TileSize, row1TileSize,
TRUE, &BackgroundPixel);
} else {
SelectionImages[1] = egCreateFilledImage(row0TileSize, row0TileSize,
TRUE, &BackgroundPixel); //&StdBackgroundPixel);
SelectionImages[3] = egCreateFilledImage(row1TileSize, row1TileSize,
TRUE, &BackgroundPixel);
}
}
// DBG("selections inited\n");
}
#endif
//
// Scrolling functions
//
#define CONSTRAIN_MIN(Variable, MinValue) if (Variable < MinValue) Variable = MinValue
#define CONSTRAIN_MAX(Variable, MaxValue) if (Variable > MaxValue) Variable = MaxValue
#if !USE_XTHEME
INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
{
INTN TextWidth = 0;
INTN XText = 0;
INTN Height;
INTN TextXYStyle = 1;
EG_IMAGE *TextBufferXY = NULL;
if (!Text) {
return 0;
}
if (!textFace[1].valid) {
if (textFace[2].valid) {
TextXYStyle = 2;
} else {
TextXYStyle = 0;
}
}
egMeasureText(Text, &TextWidth, NULL);
if (XAlign == X_IS_LEFT) {
TextWidth = UGAWidth - XPos - 1;
XText = XPos;
}
if (GlobalConfig.TypeSVG) {
TextWidth += TextHeight * 2; //give more place for buffer
if (!textFace[TextXYStyle].valid) {
DBG("no vaid text face for message!\n");
Height = TextHeight;
} else {
Height = (int)(textFace[TextXYStyle].size * RowHeightFromTextHeight * GlobalConfig.Scale);
}
} else {
Height = TextHeight;
}
TextBufferXY = egCreateFilledImage(TextWidth, Height, TRUE, &MenuBackgroundPixel);
// render the text
TextWidth = egRenderText(Text, TextBufferXY, 0, 0, 0xFFFF, TextXYStyle);
if (XAlign != X_IS_LEFT) {
// shift 64 is prohibited
XText = XPos - (TextWidth >> XAlign); //X_IS_CENTER = 1
}
// DBG("draw text %ls\n", Text);
// DBG("pos=%d width=%d xtext=%d Height=%d Y=%d\n", XPos, TextWidth, XText, Height, YPos);
BltImageAlpha(TextBufferXY, XText, YPos, &MenuBackgroundPixel, 16);
egFreeImage(TextBufferXY);
return TextWidth;
}
#endif
/**
* Helper function to draw text for Boot Camp Style.
* @author: Needy
*/
#if USE_XTHEME
#else
VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor)
{
//use Text=null to reinit the buffer
if (!Text) {
if (TextBuffer) {
egFreeImage(TextBuffer);
TextBuffer = NULL;
}
return;
}
if (TextBuffer && (TextBuffer->Height != TextHeight)) {
egFreeImage(TextBuffer);
TextBuffer = NULL;
}
if (TextBuffer == NULL) {
TextBuffer = egCreateImage(UGAWidth-XPos, TextHeight, TRUE);
}
if (Cursor != 0xFFFF) {
egFillImage(TextBuffer, &MenuBackgroundPixel);
} else {
egFillImage(TextBuffer, &InputBackgroundPixel);
}
if (SelectedWidth > 0) {
// draw selection bar background
egFillImageArea(TextBuffer, 0, 0, (INTN)SelectedWidth, TextHeight,
&SelectionBackgroundPixel);
}
// render the text
if (GlobalConfig.TypeSVG) {
//clovy - text veltically centred on Height
egRenderText(Text, TextBuffer, 0,
(INTN)((TextHeight - (textFace[TextStyle].size * GlobalConfig.Scale)) / 2),
Cursor, TextStyle);
} else {
egRenderText(Text, TextBuffer, TEXT_XMARGIN, TEXT_YMARGIN, Cursor, TextStyle);
}
BltImageAlpha(TextBuffer, (INTN)XPos, (INTN)YPos, &MenuBackgroundPixel, 16);
}
#endif
#if !USE_XTHEME
VOID FreeScrollBar(VOID)
{
if (ScrollbarBackgroundImage) {
egFreeImage(ScrollbarBackgroundImage);
ScrollbarBackgroundImage = NULL;
}
if (BarStartImage) {
egFreeImage(BarStartImage);
BarStartImage = NULL;
}
if (BarEndImage) {
egFreeImage(BarEndImage);
BarEndImage = NULL;
}
if (ScrollbarImage) {
egFreeImage(ScrollbarImage);
ScrollbarImage = NULL;
}
if (ScrollStartImage) {
egFreeImage(ScrollStartImage);
ScrollStartImage = NULL;
}
if (ScrollEndImage) {
egFreeImage(ScrollEndImage);
ScrollEndImage = NULL;
}
if (UpButtonImage) {
egFreeImage(UpButtonImage);
UpButtonImage = NULL;
}
if (DownButtonImage) {
egFreeImage(DownButtonImage);
DownButtonImage = NULL;
}
}
VOID InitBar(VOID)
{
if (ThemeDir) {
if (!ScrollbarBackgroundImage) {
ScrollbarBackgroundImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\bar_fill", L"png"), FALSE);
}
if (!BarStartImage) {
BarStartImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\bar_start", L"png"), TRUE);
}
if (!BarEndImage) {
BarEndImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\bar_end", L"png"), TRUE);
}
if (!ScrollbarImage) {
ScrollbarImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\scroll_fill", L"png"), FALSE);
}
if (!ScrollStartImage) {
ScrollStartImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\scroll_start", L"png"), TRUE);
}
if (!ScrollEndImage) {
ScrollEndImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\scroll_end", L"png"), TRUE);
}
if (!UpButtonImage) {
UpButtonImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\up_button", L"png"), TRUE);
}
if (!DownButtonImage) {
DownButtonImage = egLoadImage(ThemeDir, GetIconsExt(L"scrollbar\\down_button", L"png"), TRUE);
}
}
if (!BarStartImage && !GlobalConfig.TypeSVG) {
BarStartImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_bar_start), ACCESS_EMB_SIZE(emb_scroll_bar_start), TRUE);
}
if (!BarEndImage && !GlobalConfig.TypeSVG) {
BarEndImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_bar_end), ACCESS_EMB_SIZE(emb_scroll_bar_end), TRUE);
}
if (!ScrollbarBackgroundImage) {
if (GlobalConfig.TypeSVG) {
ScrollbarBackgroundImage = egLoadIcon(ThemeDir, L"scrollbar-background.png", 48);
}
if (!ScrollbarBackgroundImage) {
ScrollbarBackgroundImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_bar_fill), ACCESS_EMB_SIZE(emb_scroll_bar_fill), TRUE);
}
}
if (!ScrollbarImage) {
if (GlobalConfig.TypeSVG) {
ScrollbarImage = egLoadIcon(ThemeDir, L"scrollbar-holder.png", 48);
}
if (!ScrollbarImage) {
ScrollbarImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_scroll_fill), ACCESS_EMB_SIZE(emb_scroll_scroll_fill), TRUE);
}
}
if (!ScrollStartImage && !GlobalConfig.TypeSVG) {
ScrollStartImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_scroll_start), ACCESS_EMB_SIZE(emb_scroll_scroll_start), TRUE);
}
if (!ScrollEndImage && !GlobalConfig.TypeSVG) {
ScrollEndImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_scroll_end), ACCESS_EMB_SIZE(emb_scroll_scroll_end), TRUE);
}
if (!UpButtonImage && !GlobalConfig.TypeSVG) {
UpButtonImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_up_button), ACCESS_EMB_SIZE(emb_scroll_up_button), TRUE);
}
if (!DownButtonImage && !GlobalConfig.TypeSVG) {
DownButtonImage = egDecodePNG(ACCESS_EMB_DATA(emb_scroll_down_button), ACCESS_EMB_SIZE(emb_scroll_down_button), TRUE);
}
if (!GlobalConfig.TypeSVG) {
UpButton.Width = ScrollWidth; // 16
UpButton.Height = ScrollButtonsHeight; // 20
DownButton.Width = UpButton.Width;
DownButton.Height = ScrollButtonsHeight;
BarStart.Height = ScrollBarDecorationsHeight; // 5
BarEnd.Height = ScrollBarDecorationsHeight;
ScrollStart.Height = ScrollScrollDecorationsHeight; // 7
ScrollEnd.Height = ScrollScrollDecorationsHeight;
} else {
UpButton.Width = ScrollWidth; // 16
UpButton.Height = 0; // 20
DownButton.Width = UpButton.Width;
DownButton.Height = 0;
BarStart.Height = ScrollBarDecorationsHeight; // 5
BarEnd.Height = ScrollBarDecorationsHeight;
ScrollStart.Height = 0; // 7
ScrollEnd.Height = 0;
}
}
#endif
/**
* Draw entries for GUI.
*/
#if USE_XTHEME
#else
VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos)
{
EG_IMAGE* MainImage = NULL;
EG_IMAGE* BadgeImage = NULL;
bool NewImageCreated = false;
INTN Scale = GlobalConfig.MainEntriesSize >> 3; //usually it is 128>>3 == 16. if 256>>3 == 32
if (Entry->Row == 0 && Entry->getDriveImage() && !(GlobalConfig.HideBadges & HDBADGES_SWAP)) {
MainImage = Entry->getDriveImage();
} else {
MainImage = Entry->Image;
}
//this should be inited by the Theme
if (!MainImage) {
if (!IsEmbeddedTheme()) {
MainImage = egLoadIcon(ThemeDir, GetIconsExt(L"icons\\os_mac", L"icns"), Scale << 3);
}
if (!MainImage) {
MainImage = DummyImage(Scale << 3);
}
if (MainImage) {
NewImageCreated = true;
}
}
// DBG("Entry title=%ls; Width=%d\n", Entry->Title, MainImage->Width);
if (GlobalConfig.TypeSVG) {
Scale = 16 * (selected ? 1 : -1);
} else {
Scale = ((Entry->Row == 0) ? (Scale * (selected ? 1 : -1)): 16) ;
}
if (Entry->Row == 0) {
BadgeImage = Entry->getBadgeImage();
} //else null
if (GlobalConfig.SelectionOnTop) {
SelectionImages[0]->HasAlpha = TRUE;
SelectionImages[2]->HasAlpha = TRUE;
//MainImage->HasAlpha = TRUE;
BltImageCompositeBadge(MainImage,
SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)],
BadgeImage,
XPos, YPos, Scale);
} else {
BltImageCompositeBadge(SelectionImages[((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1)],
MainImage,
BadgeImage,
XPos, YPos, Scale);
}
// draw BCS indicator
// Needy: if Labels (Titles) are hidden there is no point to draw the indicator
if (GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
SelectionImages[4]->HasAlpha = TRUE;
// indicator is for row 0, main entries, only
if (Entry->Row == 0) {
BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)],
XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale),
row0PosY + row0TileSize + TextHeight + (INTN)((BCSMargin * 2) * GlobalConfig.Scale),
&MenuBackgroundPixel, Scale);
}
}
Entry->Place.XPos = XPos;
Entry->Place.YPos = YPos;
Entry->Place.Width = MainImage->Width;
Entry->Place.Height = MainImage->Height;
//we can't free MainImage because it may be new image or it may be a link to entry image
// a workaround
if (NewImageCreated) {
egFreeImage(MainImage);
}
}
#endif
//the purpose of the procedure is restore Background in rect
//XAlign is always centre, Color is the Backgrounf fill
#if USE_XTHEME
#else
VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color, IN UINT8 XAlign)
{
EG_IMAGE *TmpBuffer = NULL;
INTN X = XPos - (Width >> XAlign);
if (!Width || !Height) return;
TmpBuffer = egCreateImage(Width, Height, FALSE);
if (!BackgroundImage) {
egFillImage(TmpBuffer, Color);
} else {
egRawCopy(TmpBuffer->PixelData,
BackgroundImage->PixelData + YPos * BackgroundImage->Width + X,
Width, Height,
TmpBuffer->Width,
BackgroundImage->Width);
}
BltImage(TmpBuffer, X, YPos);
egFreeImage(TmpBuffer);
}
#endif
#if USE_XTHEME
#else
VOID DrawTextCorner(UINTN TextC, UINT8 Align)
{
INTN Xpos;
CHAR16 *Text = NULL;
if (
// HIDEUI_ALL - included
((TextC == TEXT_CORNER_REVISION) && ((GlobalConfig.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) ||
((TextC == TEXT_CORNER_HELP) && ((GlobalConfig.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) ||
((TextC == TEXT_CORNER_OPTIMUS) && (GlobalConfig.ShowOptimus == FALSE))
) {
return;
}
switch (TextC) {
case TEXT_CORNER_REVISION:
// Display Clover boot volume
if (SelfVolume->VolLabel && SelfVolume->VolLabel[0] != L'#') {
Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel);
}
if ( !Text ) {
Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName);
}
break;
case TEXT_CORNER_HELP:
Text = PoolPrint(L"F1:Help");
break;
case TEXT_CORNER_OPTIMUS:
if (gGraphics[0].Vendor != Intel) {
Text = PoolPrint(L"Discrete");
} else {
Text = PoolPrint(L"Intel");
}
// Text = (NGFX == 2)?L"Intel":L"Discrete";
break;
default:
return;
}
switch (Align) {
case X_IS_LEFT:
Xpos = (INTN)(TextHeight * 0.75f);
break;
case X_IS_RIGHT:
Xpos = UGAWidth - (INTN)(TextHeight * 0.7f);//2
break;
case X_IS_CENTER:
Xpos = UGAWidth >> 1;
break;
default:
if ( Text ) FreePool(Text);
return;
}
// DBG("draw text %ls at (%d, %d)\n", Text, Xpos, UGAHeight - 5 - TextHeight),
// clovy DrawTextXY(Text, Xpos, UGAHeight - 5 - TextHeight, Align);
DrawTextXY(Text, Xpos, UGAHeight - (INTN)(TextHeight * 1.5f), Align);
if ( Text ) FreePool(Text);
}
#endif
//
// user-callable dispatcher functions
//
REFIT_ABSTRACT_MENU_ENTRY* NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
{
if ( Title ) Entry->Title.takeValueFrom(Title);
else Entry->Title.setEmpty();
// if (Title) {
// } else {
// Entry->Title = (__typeof__(Entry->Title))AllocateZeroPool(128);
// }
Entry->Image = OptionMenu.TitleImage;
Entry->AtClick = AtClick;
// create the submenu
// *SubScreen = (__typeof_am__(*SubScreen))AllocateZeroPool(sizeof(**SubScreen));
*SubScreen = new REFIT_MENU_SCREEN();
// (*SubScreen)->Title = EfiStrDuplicate(Entry->Title);
(*SubScreen)->Title = Entry->Title;
(*SubScreen)->TitleImage = Entry->Image;
(*SubScreen)->ID = ID;
(*SubScreen)->AnimeRun = (*SubScreen)->GetAnime();
Entry->SubScreen = *SubScreen;
return Entry;
}
REFIT_MENU_ITEM_OPTIONS* newREFIT_MENU_ITEM_OPTIONS(REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
{
//create entry
// *Entry = (__typeof_am__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY)); // carefull, **Entry is not a LOADER_ENTRY. Don't use sizeof.
REFIT_MENU_ITEM_OPTIONS* Entry = new REFIT_MENU_ITEM_OPTIONS();
return NewEntry_(Entry, SubScreen, AtClick, ID, Title)->getREFIT_MENU_ITEM_OPTIONS();
// (*Entry)->Tag = TAG_OPTIONS;
}
//
//VOID NewLoaderEntry(LOADER_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
//{
// //create entry
//// *Entry = (__typeof_am__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY)); // carefull, **Entry is not a LOADER_ENTRY. Don't use sizeof.
// *Entry = new LOADER_ENTRY();
// NewEntry_(*Entry, SubScreen, AtClick, ID, Title); // cast ok because super class
//}
VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
{
if (ChosenEntry->SubScreen->ID == SCREEN_DSDT) {
2020-04-04 15:50:13 +02:00
// snwprintf((CHAR16*)ChosenEntry->Title, 128, "DSDT fix mask [0x%08X]->", gSettings.FixDsdt); // TODO jief : cast to fix
2020-04-04 14:27:02 +02:00
ChosenEntry->Title.SWPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix
//MsgLog("@ESC: %ls\n", (*ChosenEntry)->Title);
} else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) {
// CSR
2020-04-04 15:50:13 +02:00
// snwprintf((CHAR16*)ChosenEntry->Title, 128, "System Integrity Protection [0x%04X]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix
2020-04-04 14:27:02 +02:00
ChosenEntry->Title.SWPrintf("System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix
// check for the right booter flag to allow the application
// of the new System Integrity Protection configuration.
if (gSettings.CsrActiveConfig != 0 && gSettings.BooterConfig == 0) {
gSettings.BooterConfig = 0x28;
}
} else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) {
2020-04-04 15:50:13 +02:00
// snwprintf((CHAR16*)ChosenEntry->Title, 128, "boot_args->flags [0x%04X]->", gSettings.BooterConfig); // TODO jief : cast to fix
2020-04-04 14:27:02 +02:00
ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix
} else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) {
2020-04-04 15:50:13 +02:00
// snwprintf((CHAR16*)ChosenEntry->Title, 128, "Drop OEM _DSM [0x%04X]->", dropDSM); // TODO jief : cast to fix
2020-04-04 14:27:02 +02:00
ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix
}
}
REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
{
UINTN i, N, Ven = 97;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_GRAPHICS, "Graphics Injector->");
SubScreen->AddMenuInfoLine(PoolPrint(L"Number of VideoCard%a=%d",((NGFX!=1)?"s":""), NGFX));
SubScreen->AddMenuItemInput(52, "InjectEDID", FALSE);
SubScreen->AddMenuItemInput(53, "Fake Vendor EDID:", TRUE);
SubScreen->AddMenuItemInput(54, "Fake Product EDID:", TRUE);
SubScreen->AddMenuItemInput(18, "Backlight Level:", TRUE);
SubScreen->AddMenuItemInput(112, "Intel Max Backlight:", TRUE); //gSettings.IntelMaxValue
for (i = 0; i < NGFX; i++) {
SubScreen->AddMenuInfo("----------------------");
SubScreen->AddMenuInfo_f("Card DeviceID=%04x", gGraphics[i].DeviceID);
N = 20 + i * 6;
SubScreen->AddMenuItemInput(N, "Model:", TRUE);
if (gGraphics[i].Vendor == Nvidia) {
SubScreen->AddMenuItemInput(N+1, "InjectNVidia", FALSE);
} else if (gGraphics[i].Vendor == Ati) {
SubScreen->AddMenuItemInput(N+1, "InjectATI", FALSE);
} else if (gGraphics[i].Vendor == Intel) {
SubScreen->AddMenuItemInput(N+1, "InjectIntel", FALSE);
} else {
SubScreen->AddMenuItemInput(N+1, "InjectX3", FALSE);
}
if (gGraphics[i].Vendor == Nvidia) {
Ven = 95;
} else if (gGraphics[i].Vendor == Ati) {
Ven = 94;
} else /*if (gGraphics[i].Vendor == Intel)*/ {
Ven = 96;
}
if ((gGraphics[i].Vendor == Ati) || (gGraphics[i].Vendor == Intel)) {
SubScreen->AddMenuItemInput(109, "DualLink:", TRUE);
}
if (gGraphics[i].Vendor == Ati) {
SubScreen->AddMenuItemInput(114, "DeInit:", TRUE);
}
SubScreen->AddMenuItemInput(Ven, "FakeID:", TRUE);
if (gGraphics[i].Vendor == Nvidia) {
SubScreen->AddMenuItemInput(N+2, "DisplayCFG:", TRUE);
} else if (gGraphics[i].Vendor == Ati) {
SubScreen->AddMenuItemInput(N+2, "FBConfig:", TRUE);
} else /*if (gGraphics[i].Vendor == Intel)*/{
SubScreen->AddMenuItemInput(N+2, "*-platform-id:", TRUE);
}
// ErmaC: NvidiaGeneric entry
if (gGraphics[i].Vendor == Nvidia) {
SubScreen->AddMenuItemInput(55, "Generic NVIDIA name", FALSE);
SubScreen->AddMenuItemInput(110, "NVIDIA No EFI", FALSE);
SubScreen->AddMenuItemInput(111, "NVIDIA Single", FALSE);
SubScreen->AddMenuItemInput(56, "Use NVIDIA WEB drivers", FALSE);
}
if (gGraphics[i].Vendor == Intel) {
continue;
}
SubScreen->AddMenuItemInput(N+3, "Ports:", TRUE);
if (gGraphics[i].Vendor == Nvidia) {
SubScreen->AddMenuItemInput(N+4, "NVCAP:", TRUE);
} else {
SubScreen->AddMenuItemInput(N+4, "Connectors:", TRUE);
SubScreen->AddMenuItemInput(50, "RefCLK:", TRUE);
}
SubScreen->AddMenuItemInput(N+5, "Load Video Bios", FALSE);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
// ErmaC: Audio submenu
REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
{
UINTN i;
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_AUDIO, "Audio tuning->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to tune the HDA devices"));
SubScreen->AddMenuInfoLine(PoolPrint(L"Number of Audio Controller%a=%d", ((NHDA!=1)?"s":""), NHDA));
for (i = 0; i < NHDA; i++) {
SubScreen->AddMenuInfoLine(PoolPrint(L"%d) %s [%04x][%04x]",
(i+1),
gAudios[i].controller_name,
gAudios[i].controller_vendor_id,
gAudios[i].controller_device_id)
);
}
//SubScreen->AddMenuItemInput(59, "HDAInjection", FALSE);
if (gSettings.HDAInjection) {
SubScreen->AddMenuItemInput(60, "HDALayoutId:", TRUE);
}
// avaiable configuration
SubScreen->AddMenuItemInput(57, "ResetHDA", FALSE);
SubScreen->AddMenuItemInput(58, "AFGLowPowerState", FALSE);
// return
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
#define nya(x) x/10,x%10
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSpeedStep()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_CPU, "CPU tuning->");
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gCPUStructure.BrandString));
SubScreen->AddMenuInfoLine(PoolPrint(L"Model: %2x/%2x/%2x",
gCPUStructure.Family, gCPUStructure.Model, gCPUStructure.Stepping));
SubScreen->AddMenuInfoLine(PoolPrint(L"Cores: %d Threads: %d",
gCPUStructure.Cores, gCPUStructure.Threads));
SubScreen->AddMenuInfoLine(PoolPrint(L"FSB speed MHz: %d",
DivU64x32(gCPUStructure.FSBFrequency, Mega)));
SubScreen->AddMenuInfoLine(PoolPrint(L"CPU speed MHz: %d",
DivU64x32(gCPUStructure.CPUFrequency, Mega)));
SubScreen->AddMenuInfoLine(PoolPrint(L"Ratio: Min=%d.%d Max=%d.%d Turbo=%d.%d/%d.%d/%d.%d/%d.%d",
nya(gCPUStructure.MinRatio), nya(gCPUStructure.MaxRatio),
nya(gCPUStructure.Turbo4), nya(gCPUStructure.Turbo3), nya(gCPUStructure.Turbo2), nya(gCPUStructure.Turbo1)));
SubScreen->AddMenuItemInput(76, "Cores enabled:", TRUE);
SubScreen->AddMenuItemInput(6, "Halt Enabler", FALSE);
SubScreen->AddMenuItemInput(7, "PLimitDict:", TRUE);
SubScreen->AddMenuItemInput(8, "UnderVoltStep:", TRUE);
SubScreen->AddMenuItemInput(88, "DoubleFirstState", FALSE);
SubScreen->AddMenuItemInput(5, "GeneratePStates", FALSE);
SubScreen->AddMenuItemInput(9, "GenerateCStates", FALSE);
SubScreen->AddMenuItemInput(10, "EnableC2", FALSE);
SubScreen->AddMenuItemInput(11, "EnableC4", FALSE);
SubScreen->AddMenuItemInput(12, "EnableC6", FALSE);
SubScreen->AddMenuItemInput(89, "EnableC7", FALSE);
SubScreen->AddMenuItemInput(13, "Use SystemIO", FALSE);
SubScreen->AddMenuItemInput(75, "C3Latency:", TRUE);
SubScreen->AddMenuItemInput(19, "BusSpeed [kHz]:", TRUE);
SubScreen->AddMenuItemInput(14, "QPI [MHz]:", TRUE);
SubScreen->AddMenuItemInput(77, "Saving Mode:", TRUE);
SubScreen->AddMenuItemInput(15, "PatchAPIC", FALSE); //-> move to ACPI?
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextPatches()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
INTN NrKexts = gSettings.KernelAndKextPatches.NrKexts;
KEXT_PATCH *KextPatchesMenu = gSettings.KernelAndKextPatches.KextPatches; //zzzz
INTN Index;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXTS, "Custom kexts patches->");
for (Index = 0; Index < NrKexts; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%30s", KextPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(KextPatchesMenu[Index].MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
{
REFIT_MENU_ITEM_OPTIONS *Entry = NULL;
REFIT_MENU_SCREEN *SubScreen = NULL;
REFIT_INPUT_DIALOG *InputBootArgs;
UINTN i = 0;
SIDELOAD_KEXT *Kext = NULL;
CHAR8 sysVer[256];
UnicodeStrToAsciiStrS(UniSysVer, sysVer, sizeof(sysVer));
for (i = 0; i < sizeof(sysVer)-2; i++) {
if (sysVer[i] == '\0') {
sysVer[i+0] = '-';
sysVer[i+1] = '>';
sysVer[i+2] = '\0';
break;
}
}
Kext = InjectKextList;
while (Kext) {
if (StrCmp(Kext->KextDirNameUnderOEMPath, UniSysVer) == 0) {
if ( SubScreen == NULL ) {
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose/check kext to disable:"));
}
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%ls, v.%ls", Kext->FileName, Kext->Version);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(Kext->MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
SIDELOAD_KEXT *plugInKext = Kext->PlugInList;
while (plugInKext) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf(" |-- %ls, v.%ls", plugInKext->FileName, plugInKext->Version);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(plugInKext->MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
plugInKext = plugInKext->Next;
}
}
Kext = Kext->Next;
}
if ( SubScreen != NULL ) SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
{
LOADER_ENTRY *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
CHAR16 *kextDir = NULL;
UINTN i;
CHAR8 ShortOSVersion[8];
// CHAR16 *UniSysVer = NULL;
CHAR8 *ChosenOS = Entry->OSVersion;
SubEntry = new LOADER_ENTRY();
NewEntry_(SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
SubEntry->Flags = Entry->Flags;
if (ChosenOS) {
// DBG("chosen os %s\n", ChosenOS);
//shorten os version 10.11.6 -> 10.11
for (i = 0; i < 8; i++) {
ShortOSVersion[i] = ChosenOS[i];
if (ShortOSVersion[i] == '\0') {
break;
}
if (((i > 2) && (ShortOSVersion[i] == '.')) || (i == 5)) {
ShortOSVersion[i] = '\0';
break;
}
}
SubScreen->AddMenuInfoLine(PoolPrint(
L"Block injected kexts for target version of macOS: %a",
ShortOSVersion));
// Add kext from 10
{
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"10"), true);
CHAR16 DirName[256];
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "10_install");
2020-04-04 14:27:02 +02:00
}
else {
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "10_recovery");
2020-04-04 14:27:02 +02:00
}
else {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "10_normal");
2020-04-04 14:27:02 +02:00
}
}
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
}
// Add kext from 10.{version}
{
CHAR16 DirName[256];
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s", ShortOSVersion);
2020-04-04 14:27:02 +02:00
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_install", ShortOSVersion);
2020-04-04 14:27:02 +02:00
}
else {
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_recovery", ShortOSVersion);
2020-04-04 14:27:02 +02:00
}
else {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_normal", ShortOSVersion);
2020-04-04 14:27:02 +02:00
}
}
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
}
// Add kext from :
// 10.{version}.0 if NO minor version
// 10.{version}.{minor version} if minor version is > 0
{
{
CHAR16 OSVersionKextsDirName[256];
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
2020-04-04 15:50:13 +02:00
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s.0", Entry->OSVersion);
2020-04-04 14:27:02 +02:00
}else{
2020-04-04 15:50:13 +02:00
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s", Entry->OSVersion);
2020-04-04 14:27:02 +02:00
}
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
}
CHAR16 DirName[256];
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_install",
2020-04-04 14:27:02 +02:00
Entry->OSVersion);
}
else {
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_recovery",
2020-04-04 14:27:02 +02:00
Entry->OSVersion);
}
else {
2020-04-04 15:50:13 +02:00
snwprintf(DirName, sizeof(DirName), "%s_normal",
2020-04-04 14:27:02 +02:00
Entry->OSVersion);
}
}
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
}
}
else {
SubScreen->AddMenuInfoLine(PoolPrint(
L"Block injected kexts for target version of macOS: %a",
ChosenOS));
}
if ((kextDir = GetOtherKextsDir(TRUE)) != NULL) {
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"Other"), true);
FreePool(kextDir);
}
if ((kextDir = GetOtherKextsDir(FALSE)) != NULL) {
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"Off"), true);
FreePool(kextDir);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return SubEntry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKernelPatches()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
INTN NrKernels = gSettings.KernelAndKextPatches.NrKernels;
KERNEL_PATCH *KernelPatchesMenu = gSettings.KernelAndKextPatches.KernelPatches; //zzzz
INTN Index;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_KERNELS, "Custom kernel patches->");
for (Index = 0; Index < NrKernels; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%30s", KernelPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(KernelPatchesMenu[Index].MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBootPatches()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
INTN NrBoots = gSettings.KernelAndKextPatches.NrBoots;
KERNEL_PATCH *BootPatchesMenu = gSettings.KernelAndKextPatches.BootPatches; //zzzz
INTN Index;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BOOTER, "Custom booter patches->");
for (Index = 0; Index < NrBoots; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("%30s", BootPatchesMenu[Index].Label);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(BootPatchesMenu[Index].MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBinaries()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BINARIES, "Binaries patching->");
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gCPUStructure.BrandString));
SubScreen->AddMenuInfoLine(PoolPrint(L"Real CPUID: 0x%06x", gCPUStructure.Signature));
SubScreen->AddMenuItemInput(64, "Debug", FALSE);
SubScreen->AddMenuInfo("----------------------");
SubScreen->AddMenuItemInput(104, "Fake CPUID:", TRUE);
// SubScreen->AddMenuItemInput(108, "Kernel patching allowed", FALSE);
SubScreen->AddMenuItemInput(45, "Kernel Support CPU", FALSE);
SubScreen->AddMenuItemInput(91, "Kernel Lapic", FALSE);
SubScreen->AddMenuItemInput(105, "Kernel XCPM", FALSE);
SubScreen->AddMenuItemInput(48, "Kernel PM", FALSE);
SubScreen->AddMenuItemInput(121, "Panic No Kext Dump", FALSE);
SubScreen->AddMenuEntry(SubMenuKernelPatches(), true);
SubScreen->AddMenuInfo("----------------------");
SubScreen->AddMenuItemInput(46, "AppleIntelCPUPM Patch", FALSE);
SubScreen->AddMenuItemInput(47, "AppleRTC Patch", FALSE);
SubScreen->AddMenuItemInput(61, "Dell SMBIOS Patch", FALSE);
// SubScreen->AddMenuItemInput(115, "No Caches", FALSE);
// SubScreen->AddMenuItemInput(44, "Kext patching allowed", FALSE);
SubScreen->AddMenuEntry(SubMenuKextPatches(), true);
SubScreen->AddMenuInfo("----------------------");
SubScreen->AddMenuEntry(SubMenuBootPatches(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables()
{
CHAR8 sign[5];
CHAR8 OTID[9];
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
sign[4] = 0;
OTID[8] = 0;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->");
if (gSettings.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables;
while (DropTable) {
CopyMem((CHAR8*)&sign, (CHAR8*)&(DropTable->Signature), 4);
CopyMem((CHAR8*)&OTID, (CHAR8*)&(DropTable->TableId), 8);
//MsgLog("adding to menu %s (%X) %s (%lx) L=%d(0x%X)\n",
// sign, DropTable->Signature,
// OTID, DropTable->TableId,
// DropTable->Length, DropTable->Length);
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("Drop \"%4.4s\" \"%8.8s\" %d", sign, OTID, DropTable->Length);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(DropTable->MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
DropTable = DropTable->Next;
}
}
SubScreen->AddMenuItemInput(4, "Drop all OEM SSDT", FALSE);
SubScreen->AddMenuItemInput(113, "Automatic smart merge", FALSE);
//SubScreen->AddMenuInfoLine(L"PATCHED AML:");
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf("Drop \"%ls\"", ACPIPatchedAMLTmp->FileName);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &(ACPIPatchedAMLTmp->MenuItem);
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
ACPIPatchedAMLTmp = ACPIPatchedAMLTmp->Next;
}
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->");
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gCPUStructure.BrandString));
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gSettings.OEMProduct));
SubScreen->AddMenuInfoLine(PoolPrint(L"with board %a", gSettings.OEMBoard));
SubScreen->AddMenuItemInput(78, "Product Name:", TRUE);
SubScreen->AddMenuItemInput(79, "Product Version:", TRUE);
SubScreen->AddMenuItemInput(80, "Product SN:", TRUE);
SubScreen->AddMenuItemInput(81, "Board ID:", TRUE);
SubScreen->AddMenuItemInput(82, "Board SN:", TRUE);
SubScreen->AddMenuItemInput(83, "Board Type:", TRUE);
SubScreen->AddMenuItemInput(84, "Board Version:", TRUE);
SubScreen->AddMenuItemInput(85, "Chassis Type:", TRUE);
SubScreen->AddMenuItemInput(86, "ROM Version:", TRUE);
SubScreen->AddMenuItemInput(87, "ROM Release Date:", TRUE);
SubScreen->AddMenuItemInput(62, "FirmwareFeatures:", TRUE);
SubScreen->AddMenuItemInput(63, "FirmwareFeaturesMask:", TRUE);
SubScreen->AddMenuItemInput(17, "PlatformFeature:", TRUE);
SubScreen->AddMenuItemInput(117, "EFI Version:", TRUE);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSM, NULL);
// Entry->Title.SPrintf("Drop OEM _DSM [0x%04x]->", gSettings.DropOEM_DSM);
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose devices to drop OEM _DSM methods from DSDT"));
SubScreen->AddMenuCheck("ATI/AMD Graphics", DEV_ATI, 101);
SubScreen->AddMenuCheck("Nvidia Graphics", DEV_NVIDIA, 101);
SubScreen->AddMenuCheck("Intel Graphics", DEV_INTEL, 101);
SubScreen->AddMenuCheck("PCI HDA audio", DEV_HDA, 101);
SubScreen->AddMenuCheck("HDMI audio", DEV_HDMI, 101);
SubScreen->AddMenuCheck("PCI LAN Adapter", DEV_LAN, 101);
SubScreen->AddMenuCheck("PCI WiFi Adapter", DEV_WIFI, 101);
SubScreen->AddMenuCheck("IDE HDD", DEV_IDE, 101);
SubScreen->AddMenuCheck("SATA HDD", DEV_SATA, 101);
SubScreen->AddMenuCheck("USB Controllers", DEV_USB, 101);
SubScreen->AddMenuCheck("LPC Controller", DEV_LPC, 101);
SubScreen->AddMenuCheck("SMBUS Controller", DEV_SMBUS, 101);
SubScreen->AddMenuCheck("IMEI Device", DEV_IMEI, 101);
SubScreen->AddMenuCheck("Firewire", DEV_FIREWIRE, 101);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
{
REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
// REFIT_INPUT_DIALOG *InputBootArgs;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NULL);
// Entry->Title.SPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt);
SubScreen->AddMenuCheck("Add DTGP", FIX_DTGP, 67);
SubScreen->AddMenuCheck("Fix Darwin as WinXP", FIX_WARNING, 67);
SubScreen->AddMenuCheck("Fix Darwin as Win7", FIX_DARWIN, 67);
SubScreen->AddMenuCheck("Fix shutdown", FIX_SHUTDOWN, 67);
SubScreen->AddMenuCheck("Add MCHC", FIX_MCHC, 67);
SubScreen->AddMenuCheck("Fix HPET", FIX_HPET, 67);
SubScreen->AddMenuCheck("Fake LPC", FIX_LPC, 67);
SubScreen->AddMenuCheck("Fix IPIC", FIX_IPIC, 67);
SubScreen->AddMenuCheck("Add SMBUS", FIX_SBUS, 67);
SubScreen->AddMenuCheck("Fix display", FIX_DISPLAY, 67);
SubScreen->AddMenuCheck("Fix IDE", FIX_IDE, 67);
SubScreen->AddMenuCheck("Fix SATA", FIX_SATA, 67);
SubScreen->AddMenuCheck("Fix Firewire", FIX_FIREWIRE, 67);
SubScreen->AddMenuCheck("Fix USB", FIX_USB, 67);
SubScreen->AddMenuCheck("Fix LAN", FIX_LAN, 67);
SubScreen->AddMenuCheck("Fix Airport", FIX_WIFI, 67);
SubScreen->AddMenuCheck("Fix sound", FIX_HDA, 67);
// SubScreen->AddMenuCheck("Fix new way", FIX_NEW_WAY, 67);
SubScreen->AddMenuCheck("Fix RTC", FIX_RTC, 67);
SubScreen->AddMenuCheck("Fix TMR", FIX_TMR, 67);
SubScreen->AddMenuCheck("Add IMEI", FIX_IMEI, 67);
SubScreen->AddMenuCheck("Fix IntelGFX", FIX_INTELGFX, 67);
SubScreen->AddMenuCheck("Fix _WAK", FIX_WAK, 67);
SubScreen->AddMenuCheck("Del unused", FIX_UNUSED, 67);
SubScreen->AddMenuCheck("Fix ADP1", FIX_ADP1, 67);
SubScreen->AddMenuCheck("Add PNLF", FIX_PNLF, 67);
SubScreen->AddMenuCheck("Fix S3D", FIX_S3D, 67);
SubScreen->AddMenuCheck("Rename ACST", FIX_ACST, 67);
SubScreen->AddMenuCheck("Add HDMI", FIX_HDMI, 67);
SubScreen->AddMenuCheck("Fix Regions", FIX_REGIONS, 67);
SubScreen->AddMenuCheck("Fix Headers", FIX_HEADERS, 67);
SubScreen->AddMenuCheck("Fix Mutex", FIX_MUTEX, 67);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() //yyyy
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
INTN PatchDsdtNum = gSettings.PatchDsdtNum;
INPUT_ITEM *DSDTPatchesMenu = gSettings.PatchDsdtMenuItem;
INTN Index;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->");
for (Index = 0; Index < PatchDsdtNum; Index++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.takeValueFrom(gSettings.PatchDsdtLabel[Index]);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
InputBootArgs->Item = &DSDTPatchesMenu[Index];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_ACPI, "Dsdt name->");
SubScreen->AddMenuInfoLine(L"Select a DSDT file:");
SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE);
for (i = 0; i < DsdtsNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(DsdtsList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
InputBootArgs->Row = i + 1;
InputBootArgs->Item = &InputItems[116];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuACPI()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_ACPI, "ACPI patching->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to patch ACPI"));
SubScreen->AddMenuItemInput(102, "Debug DSDT", FALSE);
SubScreen->AddMenuEntry(SubMenuDsdts(), true);
SubScreen->AddMenuEntry(SubMenuDropTables(), true);
SubScreen->AddMenuEntry(SubMenuDropDSM(), true);
SubScreen->AddMenuEntry(SubMenuDsdtFix(), true);
SubScreen->AddMenuEntry(SubMenuDSDTPatches(), true);
SubScreen->AddMenuItemInput(49, "Fix MCFG", FALSE);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_AUDIOPORTS, "Startup sound output->");
SubScreen->AddMenuInfoLine(L"Select an audio output, press F7 to test");
SubScreen->AddMenuItemInput(120, "Volume:", TRUE);
for (i = 0; i < AudioNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.SWPrintf("%ls_%s", AudioList[i].Name, AudioOutputNames[AudioList[i].Device]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
InputBootArgs->Row = i;
InputBootArgs->Item = &InputItems[119];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
{
REFIT_INPUT_DIALOG *InputBootArgs;
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_INPUT_DIALOG;
InputBootArgs->Title.SWPrintf(" key: %s", Prop->Key);
// InputBootArgs->Tag = TAG_INPUT;
InputBootArgs->Row = 0xFFFF; //cursor
// InputBootArgs->Item = ADDRESS_OF(DEV_PROPERTY, Prop, INPUT_ITEM, MenuItem);
InputBootArgs->Item = &Prop->MenuItem;
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
switch (Prop->ValueType) {
case kTagTypeInteger:
SubScreen->AddMenuInfo_f(" value: 0x%08llx", *(UINT64*)Prop->Value);
break;
case kTagTypeString:
SubScreen->AddMenuInfo_f(" value: %30s", Prop->Value);
break;
case kTagTypeFalse:
SubScreen->AddMenuInfo_f((" value: false"));
break;
case kTagTypeTrue:
SubScreen->AddMenuInfo_f((" value: true"));
break;
default: //type data, print first 24 bytes
//CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
SubScreen->AddMenuInfo_f(" value[%llu]: %24s", Prop->ValueLen, Bytes2HexStr((UINT8*)Prop->Value, MIN(24, Prop->ValueLen)));
break;
}
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuCustomDevices()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
UINT32 DevAddr, OldDevAddr = 0;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Custom properties->");
if (gSettings.ArbProperties) {
DEV_PROPERTY *Prop = gSettings.ArbProperties;
if (Prop && (Prop->Device == 0))
{
DEV_PROPERTY *Props = NULL;
while (Prop) {
SubScreen->AddMenuInfo("------------");
SubScreen->AddMenuInfo_f("%s", Prop->Label);
Props = Prop->Child;
while (Props) {
CreateMenuProps(SubScreen, Props);
Props = Props->Next;
}
Prop = Prop->Next;
}
}
while (Prop) {
DevAddr = Prop->Device;
if (DevAddr != 0 && DevAddr != OldDevAddr) {
OldDevAddr = DevAddr;
SubScreen->AddMenuInfo("------------");
SubScreen->AddMenuInfo_f("%s", Prop->Label);
CreateMenuProps(SubScreen, Prop);
}
Prop = Prop->Next;
}
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen;
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_USB, "PCI devices->");
SubScreen->AddMenuItemInput(74, "USB Ownership", FALSE);
SubScreen->AddMenuItemInput(92, "USB Injection", FALSE);
SubScreen->AddMenuItemInput(93, "Inject ClockID", FALSE);
SubScreen->AddMenuItemInput(106, "Inject EFI Strings", FALSE);
SubScreen->AddMenuItemInput(107, "No Default Properties", FALSE);
SubScreen->AddMenuItemInput(97, "FakeID LAN:", TRUE);
SubScreen->AddMenuItemInput(98, "FakeID WIFI:", TRUE);
SubScreen->AddMenuItemInput(99, "FakeID SATA:", TRUE);
SubScreen->AddMenuItemInput(100, "FakeID XHCI:", TRUE);
SubScreen->AddMenuItemInput(103, "FakeID IMEI:", TRUE);
SubScreen->AddMenuEntry(SubMenuCustomDevices(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen;
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_THEME, "Themes->");
SubScreen->AddMenuInfoLine(L"Installed themes:");
//add embedded
SubScreen->AddMenuItemSwitch(3, "embedded", FALSE);
for (i = 0; i < ThemesNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(ThemesList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
InputBootArgs->Row = i + 1;
InputBootArgs->Item = &InputItems[3];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuGUI()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_GUI, "GUI tuning->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to tune the Interface"));
SubScreen->AddMenuItemInput(70, "Pointer Speed:", TRUE);
SubScreen->AddMenuItemInput(72, "Mirror Move", FALSE);
SubScreen->AddMenuEntry(SubMenuThemes(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
/*
* This is a simple and user friendly submenu which makes it possible to modify
* the System Integrity Protection configuration from the Clover's GUI.
* Author: Needy.
* The below function is based on the SubMenuDsdtFix function.
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuCSR()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_CSR, NULL);
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Modify the System Integrity Protection configuration."));
SubScreen->AddMenuInfoLine(PoolPrint(L"All configuration changes apply to the entire machine."));
// available configurations
SubScreen->AddMenuCheck("Allow Untrusted Kexts", CSR_ALLOW_UNTRUSTED_KEXTS, 66);
SubScreen->AddMenuCheck("Allow Unrestricted FS", CSR_ALLOW_UNRESTRICTED_FS, 66);
SubScreen->AddMenuCheck("Allow Task For PID", CSR_ALLOW_TASK_FOR_PID, 66);
SubScreen->AddMenuCheck("Allow Kernel Debuger", CSR_ALLOW_KERNEL_DEBUGGER, 66);
SubScreen->AddMenuCheck("Allow Apple Internal", CSR_ALLOW_APPLE_INTERNAL, 66);
SubScreen->AddMenuCheck("Allow Unrestricted DTrace", CSR_ALLOW_UNRESTRICTED_DTRACE, 66);
SubScreen->AddMenuCheck("Allow Unrestricted NVRAM", CSR_ALLOW_UNRESTRICTED_NVRAM, 66);
SubScreen->AddMenuCheck("Allow Device Configuration", CSR_ALLOW_DEVICE_CONFIGURATION, 66);
SubScreen->AddMenuCheck("Allow Any Recovery OS", CSR_ALLOW_ANY_RECOVERY_OS, 66);
SubScreen->AddMenuCheck("Allow Unapproved Kexts", CSR_ALLOW_UNAPPROVED_KEXTS, 66);
// return
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BLC, NULL);
// Entry->Title.SPrintf("boot_args->flags [0x%02x]->", gSettings.BooterConfig);
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Modify flags for boot.efi"));
SubScreen->AddMenuCheck("Reboot On Panic", kBootArgsFlagRebootOnPanic, 65);
SubScreen->AddMenuCheck("Hi DPI", kBootArgsFlagHiDPI, 65);
SubScreen->AddMenuCheck("Black Screen", kBootArgsFlagBlack, 65);
SubScreen->AddMenuCheck("CSR Active Config", kBootArgsFlagCSRActiveConfig, 65);
SubScreen->AddMenuCheck("CSR Pending Config", kBootArgsFlagCSRPendingConfig, 65);
SubScreen->AddMenuCheck("CSR Boot", kBootArgsFlagCSRBoot, 65);
SubScreen->AddMenuCheck("Black Background", kBootArgsFlagBlackBg, 65);
SubScreen->AddMenuCheck("Login UI", kBootArgsFlagLoginUI, 65);
SubScreen->AddMenuCheck("Install UI", kBootArgsFlagInstallUI, 65);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
ModifyTitles(Entry);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem()
{
// init
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SYSTEM, "System Parameters->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options for booted OS"));
SubScreen->AddMenuItemInput(2, "Block kext:", TRUE);
SubScreen->AddMenuItemInput(51, "Set OS version if not:", TRUE);
SubScreen->AddMenuItemInput(118, "Booter Cfg Command:", TRUE);
SubScreen->AddMenuEntry(SubMenuCSR(), true);
SubScreen->AddMenuEntry(SubMenuBLC(), true);
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs()
{
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_THEME, "Configs->");
SubScreen->AddMenuInfoLine(L"Select a config file:");
for (i = 0; i < ConfigsNum; i++) {
// InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = new REFIT_MENU_SWITCH;
InputBootArgs->Title.takeValueFrom(ConfigsList[i]);
// InputBootArgs->Tag = TAG_SWITCH_OLD;
InputBootArgs->Row = i;
InputBootArgs->Item = &InputItems[90];
InputBootArgs->AtClick = ActionEnter;
InputBootArgs->AtRightClick = ActionDetails;
SubScreen->AddMenuEntry(InputBootArgs, true);
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry;
}
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
{
REFIT_ABSTRACT_MENU_ENTRY *TmpChosenEntry = NULL;
REFIT_ABSTRACT_MENU_ENTRY *NextChosenEntry = NULL;
UINTN MenuExit = 0;
UINTN SubMenuExit;
UINTN NextMenuExit;
//CHAR16* Flags;
MENU_STYLE_FUNC Style = &REFIT_MENU_SCREEN::TextMenuStyle;
INTN EntryIndex = 0;
INTN SubEntryIndex = -1; //value -1 means old position to remember
INTN NextEntryIndex = -1;
// REFIT_INPUT_DIALOG* InputBootArgs;
#if USE_XTHEME
BOOLEAN OldFontStyle = ThemeX.Proportional;
ThemeX.Proportional = FALSE; //temporary disable proportional
#else
BOOLEAN OldFontStyle = GlobalConfig.Proportional;
GlobalConfig.Proportional = FALSE; //temporary disable proportional
#endif
if (AllowGraphicsMode) {
Style = &REFIT_MENU_SCREEN::GraphicsMenuStyle;
}
// remember, if you extended this menu then change procedures
// FillInputs and ApplyInputs
#if USE_XTHEME
if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
OptionMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS);
} else {
OptionMenu.TitleImage.setEmpty();
}
#else
if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) {
OptionMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_OPTIONS);
} else {
OptionMenu.TitleImage = NULL;
}
#endif
gThemeOptionsChanged = FALSE;
if (OptionMenu.Entries.size() == 0) {
gThemeOptionsChanged = TRUE;
OptionMenu.ID = SCREEN_OPTIONS;
OptionMenu.AnimeRun = OptionMenu.GetAnime(); //FALSE;
OptionMenu.AddMenuItemInput(0, "Boot Args:", TRUE);
// AddMenuItemInput(&OptionMenu, 90, "Config:", TRUE);
// InputBootArgs->ShortcutDigit = 0xF1;
OptionMenu.AddMenuEntry( SubMenuConfigs(), true);
if (AllowGraphicsMode) {
OptionMenu.AddMenuEntry( SubMenuGUI(), true);
}
OptionMenu.AddMenuEntry( SubMenuACPI(), true);
OptionMenu.AddMenuEntry( SubMenuSmbios(), true);
OptionMenu.AddMenuEntry( SubMenuPCI(), true);
OptionMenu.AddMenuEntry( SubMenuSpeedStep(), true);
OptionMenu.AddMenuEntry( SubMenuGraphics(), true);
OptionMenu.AddMenuEntry( SubMenuAudio(), true);
OptionMenu.AddMenuEntry( SubMenuAudioPort(), true);
OptionMenu.AddMenuEntry( SubMenuBinaries(), true);
OptionMenu.AddMenuEntry( SubMenuSystem(), true);
OptionMenu.AddMenuEntry( &MenuEntryReturn, false);
//DBG("option menu created entries=%d\n", OptionMenu.Entries.size());
}
while (!MenuExit) {
MenuExit = OptionMenu.RunGenericMenu(Style, &EntryIndex, ChosenEntry);
// MenuExit = RunMenu(&OptionMenu, ChosenEntry);
if ( MenuExit == MENU_EXIT_ESCAPE || (*ChosenEntry)->getREFIT_MENU_ITEM_RETURN() )
break;
if (MenuExit == MENU_EXIT_ENTER || MenuExit == MENU_EXIT_DETAILS) {
//enter input dialog or subscreen
if ((*ChosenEntry)->SubScreen != NULL) {
SubMenuExit = 0;
while (!SubMenuExit) {
SubMenuExit = (*ChosenEntry)->SubScreen->RunGenericMenu(Style, &SubEntryIndex, &TmpChosenEntry);
if (SubMenuExit == MENU_EXIT_ESCAPE || TmpChosenEntry->getREFIT_MENU_ITEM_RETURN() ){
ApplyInputs();
ModifyTitles(*ChosenEntry);
break;
}
if (SubMenuExit == MENU_EXIT_ENTER || MenuExit == MENU_EXIT_DETAILS) {
if (TmpChosenEntry->SubScreen != NULL) {
NextMenuExit = 0;
while (!NextMenuExit) {
NextMenuExit = TmpChosenEntry->SubScreen->RunGenericMenu(Style, &NextEntryIndex, &NextChosenEntry);
if (NextMenuExit == MENU_EXIT_ESCAPE || NextChosenEntry->getREFIT_MENU_ITEM_RETURN() ){
ApplyInputs();
ModifyTitles(TmpChosenEntry);
break;
}
if (NextMenuExit == MENU_EXIT_ENTER || MenuExit == MENU_EXIT_DETAILS) {
// enter input dialog
NextMenuExit = 0;
ApplyInputs();
ModifyTitles(TmpChosenEntry);
}
} //while(!NextMenuExit)
}
// enter input dialog
SubMenuExit = 0;
ApplyInputs();
ModifyTitles(TmpChosenEntry);
}
} //while(!SubMenuExit)
}
MenuExit = 0;
} // if MENU_EXIT_ENTER
}
//exit:
#if USE_XTHEME
ThemeX.Proportional = OldFontStyle;
#else
GlobalConfig.Proportional = OldFontStyle;
#endif
ApplyInputs();
}
//UINT32 EncodeOptions(CONST CHAR16 *Options)
//{
// UINT32 OptionsBits = 0;
// INTN Index;
// if (!Options) {
// return 0;
// }
// for (Index = 0; Index < NUM_OPT; Index++) {
// if (StrStr(Options, ArgOptional[Index])) {
// OptionsBits |= (1 << Index);
// if (Index == 1) {
// OptionsBits &= ~1;
// }
// }
// }
// return OptionsBits;
//}
//
//VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
//{
// //set checked option
// INTN Index;
// if (!Entry) {
// return;
// }
// for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON
// if (gSettings.OptionsBits & (1 << Index)) {
// Entry->LoadOptions = AddLoadOption(Entry->LoadOptions, ArgOptional[Index]);
// }
// }
// //remove unchecked options
// for (Index = 0; Index < INX_NVWEBON; Index++) { //not including INX_NVWEBON
// if ((gSettings.OptionsBits & (1 << Index)) == 0) {
// Entry->LoadOptions = RemoveLoadOption(Entry->LoadOptions, ArgOptional[Index]);
// }
// }
//
// if (Entry->getLOADER_ENTRY()) {
// LOADER_ENTRY* loaderEntry = Entry->getLOADER_ENTRY();
// // Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion
// if (gSettings.OptionsBits & OPT_NVWEBON) {
// if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) {
// gSettings.NvidiaWeb = TRUE;
// } else {
// Entry->LoadOptions = AddLoadOption(loaderEntry->LoadOptions, ArgOptional[INX_NVWEBON]);
// }
// }
// if ((gSettings.OptionsBits & OPT_NVWEBON) == 0) {
// if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) {
// gSettings.NvidiaWeb = FALSE;
// } else {
// Entry->LoadOptions = RemoveLoadOption(loaderEntry->LoadOptions, ArgOptional[INX_NVWEBON]);
// }
// }
// }
//}
//