Clean the menu item hierarchy.

This commit is contained in:
jief 2020-03-10 12:45:17 +03:00
parent a3dc82d30b
commit 41c49267a5
13 changed files with 430 additions and 471 deletions

View File

@ -10,7 +10,7 @@
//
// Base UEFI types
//
#include <Include/Base.h>
#include <Base.h>
//
// From xnu/EXTERNAL_HEADERS/stdint.h:

View File

@ -473,7 +473,7 @@ GetBootFromOption(VOID)
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
SetBootCurrent(REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER *Entry)
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
{
EFI_STATUS Status;
BO_BOOT_OPTION BootOption;

View File

@ -12,7 +12,7 @@ SetDevices (
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
SetBootCurrent(REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER *LoadedEntry);
SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *LoadedEntry);
CHAR8

View File

@ -140,34 +140,6 @@ EG_IMAGE* ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DE
return NULL;
}
extern BOOLEAN CopyKernelAndKextPatches(IN OUT KERNEL_AND_KEXT_PATCHES *Dst, IN KERNEL_AND_KEXT_PATCHES *Src);
LOADER_ENTRY * DuplicateLoaderEntry(IN LOADER_ENTRY *Entry)
{
LOADER_ENTRY *DuplicateEntry;
if(Entry == NULL) {
return NULL;
}
// DuplicateEntry = (__typeof__(DuplicateEntry))AllocateZeroPool(sizeof(LOADER_ENTRY));
DuplicateEntry = new LOADER_ENTRY();
if (DuplicateEntry) {
// DuplicateEntry->Tag = Entry->Tag;
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Entry->Volume;
DuplicateEntry->DevicePathString = EfiStrDuplicate(Entry->DevicePathString);
DuplicateEntry->LoadOptions = EfiStrDuplicate(Entry->LoadOptions);
DuplicateEntry->LoaderPath = EfiStrDuplicate(Entry->LoaderPath);
DuplicateEntry->VolName = EfiStrDuplicate(Entry->VolName);
DuplicateEntry->DevicePath = Entry->DevicePath;
DuplicateEntry->Flags = Entry->Flags;
DuplicateEntry->LoaderType = Entry->LoaderType;
DuplicateEntry->OSVersion = Entry->OSVersion;
DuplicateEntry->BuildVersion = Entry->BuildVersion;
DuplicateEntry->KernelAndKextPatches = Entry->KernelAndKextPatches;
}
return DuplicateEntry;
}
CHAR16 *AddLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *LoadOption)
{
@ -381,11 +353,11 @@ VOID AlertMessage(IN CONST CHAR16 *Title, IN CONST CHAR16 *Message)
#define TAG_YES 1
#define TAG_NO 2
//STATIC REFIT_MENU_ENTRY_OTHER YesMessageEntry = { L"Yes", TAG_YES, 0, 0, 0, NULL, NULL, NULL,
// { 0, 0, 0, 0 }, ActionEnter, ActionNone, ActionNone, ActionNone, NULL };
//REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG YesMessageEntry = { L"Yes", TAG_YES, ActionEnter };
STATIC REFIT_SIMPLE_MENU_ENTRY_TAG NoMessageEntry = { L"No", TAG_NO, ActionEnter };
//STATIC REFIT_MENU_ENTRY *YesNoMessageEntries[] = { &YesMessageEntry, &NoMessageEntry };
//REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
STATIC REFIT_MENU_SCREEN YesNoMessageMenu(0, NULL, NULL, &YesMessageEntry, &NoMessageEntry);
// Display a yes/no prompt

View File

@ -47,9 +47,6 @@ extern REFIT_MENU_SCREEN MainMenu;
extern XObjArray<REFIT_VOLUME> Volumes;
// common
EG_IMAGE *LoadBuiltinIcon(IN CONST CHAR16 *IconName);
LOADER_ENTRY * DuplicateLoaderEntry(IN LOADER_ENTRY *Entry);
//CHAR16 *AddLoadOption(IN CHAR16 *LoadOptions, IN CHAR16 *LoadOption);
//CHAR16 *RemoveLoadOption(IN CHAR16 *LoadOptions, IN CHAR16 *LoadOption);
EG_IMAGE * ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath);
/*
INTN StrniCmp(IN CHAR16 *Str1,

View File

@ -404,8 +404,6 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
return Status;
}
extern BOOLEAN CopyKernelAndKextPatches(IN OUT KERNEL_AND_KEXT_PATCHES *Dst, IN KERNEL_AND_KEXT_PATCHES *Src);
STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
IN CONST CHAR16 *LoaderOptions,
IN CONST CHAR16 *FullTitle,
@ -785,7 +783,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) {
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = L"Cancel hibernate wake";
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_HIBERNATED);
@ -793,7 +791,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title = L"Boot Mac OS X with selected options";
@ -805,7 +803,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title = L"Boot Mac OS X with injected kexts";
@ -818,7 +816,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubEntry->Flags = OSFLAG_SET(SubEntry->Flags, OSFLAG_WITHKEXTS);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title = L"Boot Mac OS X without injected kexts";
@ -829,7 +827,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_WITHKEXTS);
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(Entry), true);
@ -877,13 +875,13 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
BOOLEAN WithSplash = (StrStr(Entry->LoadOptions, L"splash") != NULL);
// default entry
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = PoolPrint(L"Run %s", FileName);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
FreePool(SubEntry->LoadOptions);
if (Quiet) {
@ -895,7 +893,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
}
SubScreen->AddMenuEntry(SubEntry, true);
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
FreePool(SubEntry->LoadOptions);
if (WithSplash) {
@ -907,7 +905,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
}
SubScreen->AddMenuEntry(SubEntry, true);
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
FreePool(SubEntry->LoadOptions);
if (WithSplash) {
@ -932,38 +930,38 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubEntry->LoadOptions = AddLoadOption(Entry->LoadOptions, L"quiet splash");
}
}
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
} else if ((Entry->LoaderType == OSTYPE_WIN) || (Entry->LoaderType == OSTYPE_WINEFI)) {
// by default, skip the built-in selection and boot from hard disk only
Entry->LoadOptions = PoolPrint(L"-s -h");
// default entry
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = PoolPrint(L"Run %s", FileName);
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = PoolPrint(L"Boot Windows from Hard Disk");
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = PoolPrint(L"Boot Windows from CD-ROM");
SubEntry->LoadOptions = PoolPrint(L"-s -c");
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = PoolPrint(L"Run %s in text mode", FileName);
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_USEGRAPHICS);
SubEntry->LoadOptions = PoolPrint(L"-v");
SubEntry->LoaderType = OSTYPE_OTHER; // Sothor - Why are we using OSTYPE_OTHER here?
SubScreen->AddMenuEntry((REFIT_MENU_ENTRY *)SubEntry, true);
SubScreen->AddMenuEntry(SubEntry, true);
}
}

View File

@ -116,7 +116,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *FullTi
STATIC VOID AddCloverEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume)
{
REFIT_MENU_ENTRY_CLOVER *Entry;
LOADER_ENTRY *SubEntry;
REFIT_MENU_ENTRY_CLOVER *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
// EFI_STATUS Status;
@ -135,7 +135,7 @@ STATIC VOID AddCloverEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderT
Entry->DevicePathString = FileDevicePathToStr(Entry->DevicePath);
Entry->Flags = 0;
Entry->LoadOptions = NULL;
Entry->LoaderType = OSTYPE_OTHER;
// Entry->LoaderType = OSTYPE_OTHER;
//actions
Entry->AtClick = ActionEnter;
@ -156,21 +156,21 @@ STATIC VOID AddCloverEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *LoaderT
}
//always add and always remove menu entries
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = EfiStrDuplicate(L"Add Clover boot options for all entries");
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-ADD");
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = EfiStrDuplicate(L"Remove all Clover boot options");
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-REMOVE");
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = DuplicateLoaderEntry(Entry);
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title = EfiStrDuplicate(L"Print all UEFI boot options to log");
SubEntry->LoadOptions = EfiStrDuplicate(L"BO-PRINT");

View File

@ -1,4 +1,4 @@
#include "menu_items/menu_items.h"
#include "REFIT_MENU_SCREEN.h"
//XPointer REFIT_MENU_SCREEN::mPointer;
XPointer REFIT_MENU_SCREEN::mPointer;

View File

@ -55,7 +55,7 @@
//#define FILM_PERCENT 100000
#define INITVALUE 40000
class REFIT_MENU_ITEM_IEM_ABSTRACT;
class REFIT_MENU_ENTRY_ITEM_ABSTRACT;
class REFIT_MENU_ENTRY;
typedef VOID (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST CHAR16 *ParamText);
@ -63,8 +63,8 @@ typedef VOID (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST C
class REFIT_MENU_SCREEN
{
public:
// static XPointer mPointer;
XPointer mPointer;
static XPointer mPointer;
// XPointer mPointer;
UINTN ID;
CONST CHAR16 *Title; //Title is not const, but *Title is. It will be better to make it XStringW
EG_IMAGE *TitleImage;
@ -113,85 +113,6 @@ public:
Entries.AddReference(entry2, false);
};
// REFIT_MENU_SCREEN( UINTN ID_,
// CONST CHAR16 *Title_,
// EG_IMAGE *TitleImage_,
//// INTN InfoLineCount_,
//// CONST CHAR16 **InfoLines_,
// INTN TimeoutSeconds_,
// CONST CHAR16 *TimeoutText_,
// CONST CHAR16 *Theme_,
// BOOLEAN AnimeRun_,
// BOOLEAN Once_,
// UINT64 LastDraw_,
// INTN CurrentFrame_,
// INTN Frames_,
// UINTN FrameTime_,
// EG_RECT FilmPlace_,
// EG_IMAGE **Film_)
// : ID(ID_), Title(Title_), TitleImage(TitleImage_),
// /*InfoLineCount(InfoLineCount_), InfoLines(InfoLines_),*/ TimeoutSeconds(TimeoutSeconds_),
// TimeoutText(TimeoutText_), Theme(Theme_), AnimeRun(AnimeRun_),
// Once(Once_), LastDraw(LastDraw_), CurrentFrame(CurrentFrame_),
// Frames(Frames_), FrameTime(FrameTime_), FilmPlace(FilmPlace_),
// Film(Film_), mAction(ActionNone), mItemID(0), mPointer(NULL)
// {};
//
// REFIT_MENU_SCREEN( UINTN ID_,
// CONST CHAR16 *Title_,
// EG_IMAGE *TitleImage_,
//// INTN InfoLineCount_,
//// CONST CHAR16 **InfoLines_,
// REFIT_ABSTRACT_MENU_ENTRY* entry,
// INTN TimeoutSeconds_,
// CONST CHAR16 *TimeoutText_,
// CONST CHAR16 *Theme_,
// BOOLEAN AnimeRun_,
// BOOLEAN Once_,
// UINT64 LastDraw_,
// INTN CurrentFrame_,
// INTN Frames_,
// UINTN FrameTime_,
// EG_RECT FilmPlace_,
// EG_IMAGE **Film_)
// : ID(ID_), Title(Title_), TitleImage(TitleImage_),
// /*InfoLineCount(InfoLineCount_), InfoLines(InfoLines_),*/ TimeoutSeconds(TimeoutSeconds_),
// TimeoutText(TimeoutText_), Theme(Theme_), AnimeRun(AnimeRun_),
// Once(Once_), LastDraw(LastDraw_), CurrentFrame(CurrentFrame_),
// Frames(Frames_), FrameTime(FrameTime_), FilmPlace(FilmPlace_),
// Film(Film_), mAction(ActionNone), mItemID(0), mPointer(NULL)
// {
// Entries.AddReference(entry, false);
// };
// REFIT_MENU_SCREEN( UINTN ID_,
// CONST CHAR16 *Title_,
// EG_IMAGE *TitleImage_,
//// INTN InfoLineCount_,
//// CONST CHAR16 **InfoLines_,
// REFIT_ABSTRACT_MENU_ENTRY* entry1,
// REFIT_ABSTRACT_MENU_ENTRY* entry2,
// INTN TimeoutSeconds_,
// CONST CHAR16 *TimeoutText_,
// CONST CHAR16 *Theme_,
// BOOLEAN AnimeRun_,
// BOOLEAN Once_,
// UINT64 LastDraw_,
// INTN CurrentFrame_,
// INTN Frames_,
// UINTN FrameTime_,
// EG_RECT FilmPlace_,
// EG_IMAGE **Film_)
// : ID(ID_), Title(Title_), TitleImage(TitleImage_),
// /*InfoLineCount(InfoLineCount_), InfoLines(InfoLines_),*/ TimeoutSeconds(TimeoutSeconds_),
// TimeoutText(TimeoutText_), Theme(Theme_), AnimeRun(AnimeRun_),
// Once(Once_), LastDraw(LastDraw_), CurrentFrame(CurrentFrame_),
// Frames(Frames_), FrameTime(FrameTime_), FilmPlace(FilmPlace_),
// Film(Film_), mAction(ActionNone), mItemID(0), mPointer(NULL)
// {
// Entries.AddReference(entry1, false);
// Entries.AddReference(entry2, false);
// };
//Scroll functions
VOID InitScroll(IN INTN ItemCount, IN UINTN MaxCount,
IN UINTN VisibleSpace, IN INTN Selected);
@ -199,10 +120,10 @@ public:
VOID HidePointer();
EFI_STATUS MouseBirth();
VOID KillMouse();
VOID AddMenuItem_(REFIT_MENU_ITEM_IEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID AddMenuInfo(CONST CHAR16 *Line);
VOID AddMenuInfoLine(IN CONST CHAR16 *InfoLine);
VOID AddMenuEntry(IN REFIT_MENU_ENTRY *Entry, bool freeIt);
VOID AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt);
VOID AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
VOID AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum);
VOID AddMenuItemInput(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);

View File

@ -0,0 +1,80 @@
/*
*
* Copyright (c) 2020 Jief
* 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_items.h"
#include "libeg.h"
#include "../../refit/lib.h"
#ifdef __cplusplus
#include "../../cpp_foundation/XObjArray.h"
#include "../../cpp_foundation/XStringWArray.h"
#include "../../cpp_foundation/XStringW.h"
#include "../../libeg/XPointer.h"
#endif
REFIT_MENU_ENTRY_CLOVER* REFIT_MENU_ENTRY_CLOVER::getPartiallyDuplicatedEntry() const
{
REFIT_MENU_ENTRY_CLOVER* DuplicateEntry = new REFIT_MENU_ENTRY_CLOVER();
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= EfiStrDuplicate(DevicePathString);
DuplicateEntry->LoadOptions = EfiStrDuplicate(LoadOptions);
DuplicateEntry->LoaderPath = EfiStrDuplicate(LoaderPath);
DuplicateEntry->VolName = EfiStrDuplicate(VolName);
DuplicateEntry->DevicePath = DevicePath;
DuplicateEntry->Flags = Flags;
return DuplicateEntry;
}
LOADER_ENTRY* LOADER_ENTRY::getPartiallyDuplicatedEntry() const
{
LOADER_ENTRY* DuplicateEntry = new LOADER_ENTRY();
DuplicateEntry->AtClick = ActionEnter;
DuplicateEntry->Volume = Volume;
DuplicateEntry->DevicePathString= EfiStrDuplicate(DevicePathString);
DuplicateEntry->LoadOptions = EfiStrDuplicate(LoadOptions);
DuplicateEntry->LoaderPath = EfiStrDuplicate(LoaderPath);
DuplicateEntry->VolName = EfiStrDuplicate(VolName);
DuplicateEntry->DevicePath = DevicePath;
DuplicateEntry->Flags = Flags;
DuplicateEntry->LoaderType = LoaderType;
DuplicateEntry->OSVersion = OSVersion;
DuplicateEntry->BuildVersion = BuildVersion;
DuplicateEntry->KernelAndKextPatches = KernelAndKextPatches;
return DuplicateEntry;
}

View File

@ -39,9 +39,9 @@
#include "libeg.h"
#include "../../refit/lib.h"
#ifdef __cplusplus
#include "../cpp_foundation/XObjArray.h"
#include "../cpp_foundation/XStringWArray.h"
#include "../cpp_foundation/XStringW.h"
#include "../../cpp_foundation/XObjArray.h"
#include "../../cpp_foundation/XStringWArray.h"
#include "../../cpp_foundation/XStringW.h"
#include "../../libeg/XPointer.h"
#endif
@ -87,9 +87,12 @@ class LOADER_ENTRY;
class LEGACY_ENTRY;
class REFIT_MENU_ENTRY_OTHER;
class REFIT_SIMPLE_MENU_ENTRY_TAG;
class REFIT_MENU_ITEM_IEM_ABSTRACT;
class REFIT_MENU_ENTRY_ITEM_ABSTRACT;
class REFIT_MENU_ITEM_BOOTNUM;
class XPointer;
/********************************************************** REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
class REFIT_ABSTRACT_MENU_ENTRY
{
public:
@ -125,8 +128,10 @@ class REFIT_ABSTRACT_MENU_ENTRY
virtual LOADER_ENTRY* getLOADER_ENTRY() { return nullptr; };
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return nullptr; };
virtual REFIT_MENU_ENTRY_OTHER* getREFIT_MENU_ENTRY_OTHER() { return nullptr; };
virtual REFIT_MENU_ITEM_IEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return nullptr; };
virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return nullptr; };
virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return nullptr; };
REFIT_ABSTRACT_MENU_ENTRY() : Title(NULL), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {};
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {};
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, ACTION AtClick_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), Place({0,0,0,0}), AtClick(AtClick_), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {};
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, UINTN Row_,
@ -137,244 +142,241 @@ class REFIT_ABSTRACT_MENU_ENTRY
Image(Image_), Place(Place_),
AtClick(AtClick_), AtDoubleClick(AtDoubleClick_), AtRightClick(AtRightClick_), AtMouseOver(AtMouseOver_),
SubScreen(SubScreen_) {};
virtual ~REFIT_ABSTRACT_MENU_ENTRY() {}; // virtual destructor : this is vital
};
class REFIT_SIMPLE_MENU_ENTRY_TAG : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
UINTN Tag;
REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, AtClick_), Tag(Tag_)
{};
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return this; };
};
/********************************************************** REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
class REFIT_MENU_ENTRY : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
// CONST CHAR16 *Title;
// UINTN Tag;
// UINTN Row;
// CHAR16 ShortcutDigit;
// CHAR16 ShortcutLetter;
// EG_IMAGE *Image;
// EG_IMAGE *DriveImage;
// EG_IMAGE *BadgeImage;
// EG_RECT Place;
// ACTION AtClick;
// ACTION AtDoubleClick;
// ACTION AtRightClick;
// ACTION AtMouseOver;
// REFIT_MENU_SCREEN *SubScreen;
class REFIT_SIMPLE_MENU_ENTRY_TAG : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
UINTN Tag;
REFIT_MENU_ENTRY() : REFIT_ABSTRACT_MENU_ENTRY(NULL) {};
REFIT_MENU_ENTRY( CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE *Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
};
REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, AtClick_), Tag(Tag_)
{};
class REFIT_MENU_ENTRY_OTHER : public REFIT_MENU_ENTRY
{
public:
// UINTN Tag;
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return this; };
};
REFIT_MENU_ENTRY_OTHER() : REFIT_MENU_ENTRY() {};
REFIT_MENU_ENTRY_OTHER(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ENTRY_OTHER* getREFIT_MENU_ENTRY_OTHER() { return this; };
};
class REFIT_MENU_ITEM_RETURN : public REFIT_MENU_ENTRY_OTHER
{
public:
REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
};
/********************************************************** Simple entries. Inherit from REFIT_ABSTRACT_MENU_ENTRY *************************************************************/
class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_MENU_ENTRY_OTHER
{
public:
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return this; };
};
class REFIT_MENU_ITEM_RETURN : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
// REFIT_MENU_ITEM_RETURN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
// EG_IMAGE* Image_, EG_RECT Place_,
// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
// REFIT_MENU_SCREEN *SubScreen_)
// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
// {};
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
};
class REFIT_MENU_ITEM_RESET : public REFIT_MENU_ENTRY_OTHER {
public:
REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return this; };
};
class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
// REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
// EG_IMAGE* Image_, EG_RECT Place_,
// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
// REFIT_MENU_SCREEN *SubScreen_)
// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
// {};
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return this; };
};
class REFIT_MENU_ITEM_ABOUT : public REFIT_MENU_ENTRY_OTHER
{
public:
REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return this; };
};
class REFIT_MENU_ITEM_RESET : public REFIT_ABSTRACT_MENU_ENTRY {
public:
REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
// REFIT_MENU_ITEM_RESET(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
// EG_IMAGE* Image_, EG_RECT Place_,
// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
// REFIT_MENU_SCREEN *SubScreen_)
// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
// {};
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return this; };
};
class REFIT_MENU_ITEM_OPTIONS : public REFIT_MENU_ENTRY_OTHER {
public:
REFIT_MENU_ITEM_OPTIONS() : REFIT_MENU_ENTRY_OTHER() {};
REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
EG_IMAGE* Image_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
};
class REFIT_MENU_ITEM_ABOUT : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
// REFIT_MENU_ITEM_ABOUT(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
// EG_IMAGE* Image_, EG_RECT Place_,
// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
// REFIT_MENU_SCREEN *SubScreen_)
// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
// {};
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return this; };
};
class REFIT_MENU_ITEM_IEM_ABSTRACT : public REFIT_MENU_ENTRY_OTHER {
public:
INPUT_ITEM *Item;
REFIT_MENU_ITEM_IEM_ABSTRACT() : Item(0) {}
virtual REFIT_MENU_ITEM_IEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return this; };
};
class REFIT_MENU_ITEM_OPTIONS : public REFIT_ABSTRACT_MENU_ENTRY {
public:
REFIT_MENU_ITEM_OPTIONS() : REFIT_ABSTRACT_MENU_ENTRY() {};
REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, NULL, {0, 0, 0, 0}, AtClick_, ActionEnter, ActionNone, ActionNone, NULL)
{};
// REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_,
// EG_IMAGE* Image_, EG_RECT Place_,
// ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
// REFIT_MENU_SCREEN *SubScreen_)
// : REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
// {};
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
};
class REFIT_INPUT_DIALOG : public REFIT_MENU_ITEM_IEM_ABSTRACT {
public:
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return this; };
};
class REFIT_INFO_DIALOG : public REFIT_MENU_ENTRY_OTHER {
public:
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return this; };
};
class REFIT_INFO_DIALOG : public REFIT_ABSTRACT_MENU_ENTRY {
public:
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return this; };
};
class REFIT_MENU_SWITCH : public REFIT_MENU_ITEM_IEM_ABSTRACT {
public:
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return this; };
};
class REFIT_MENU_CHECKBIT : public REFIT_MENU_ITEM_IEM_ABSTRACT {
public:
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return this; };
};
/*
* SUper class of LOADER_ENTRY & LEGACY_ENTRY
*/
class REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER : public REFIT_MENU_ENTRY
{
public:
REFIT_VOLUME *Volume;
CONST CHAR16 *DevicePathString;
CONST CHAR16 *LoadOptions; //moved here for compatibility with legacy
UINTN BootNum;
CONST CHAR16 *LoaderPath;
/********************************************************** *************************************************************/
EG_IMAGE *DriveImage;
EG_IMAGE *BadgeImage;
class REFIT_MENU_ENTRY_ITEM_ABSTRACT : public REFIT_ABSTRACT_MENU_ENTRY {
public:
INPUT_ITEM *Item;
REFIT_MENU_ENTRY_ITEM_ABSTRACT() : Item(0) {}
virtual REFIT_MENU_ENTRY_ITEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { return this; };
};
REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()
: Volume(0), DevicePathString(0), LoadOptions(0), BootNum(0), LoaderPath(0), DriveImage(0), BadgeImage(0)
{}
virtual EG_IMAGE* getDriveImage() const { return DriveImage; };
virtual EG_IMAGE* getBadgeImage() const { return BadgeImage; };
/* Classes that needs a Item member */
class REFIT_INPUT_DIALOG : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
public:
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return this; };
};
virtual REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER* getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() { return this; };
};
class REFIT_MENU_SWITCH : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
public:
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return this; };
};
struct KERNEL_AND_KEXT_PATCHES;
class REFIT_MENU_CHECKBIT : public REFIT_MENU_ENTRY_ITEM_ABSTRACT {
public:
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return this; };
};
class LOADER_ENTRY : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
CONST CHAR16 *VolName;
EFI_DEVICE_PATH *DevicePath;
UINT16 Flags;
UINT8 LoaderType;
CHAR8 *OSVersion;
CHAR8 *BuildVersion;
EG_PIXEL *BootBgColor;
UINT8 CustomBoot;
EG_IMAGE *CustomLogo;
KERNEL_AND_KEXT_PATCHES *KernelAndKextPatches;
CONST CHAR16 *Settings;
/********************************************************** Loader entries *************************************************************/
/*
* Super class of LOADER_ENTRY & LEGACY_ENTRY
*/
class REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER : public REFIT_ABSTRACT_MENU_ENTRY
{
public:
CONST CHAR16 *DevicePathString;
CONST CHAR16 *LoadOptions; //moved here for compatibility with legacy
CONST CHAR16 *LoaderPath;
LOADER_ENTRY()
: REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), VolName(0), DevicePath(0), Flags(0), LoaderType(0), OSVersion(0), BuildVersion(0), BootBgColor(0), CustomBoot(0), CustomLogo(0), KernelAndKextPatches(0), Settings(0)
{};
EG_IMAGE *DriveImage;
EG_IMAGE *BadgeImage;
//
// REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()
// : REFIT_ABSTRACT_MENU_ENTRY(), Volume(0), DevicePathString(0), LoadOptions(0), LoaderPath(0), BootNum(0), DriveImage(0), BadgeImage(0)
// {}
virtual EG_IMAGE* getDriveImage() const { return DriveImage; };
virtual EG_IMAGE* getBadgeImage() const { return BadgeImage; };
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
} ;
virtual REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER* getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() { return this; };
};
class REFIT_MENU_ENTRY_LOADER_TOOL : public LOADER_ENTRY
{
public:
UINT8 NoMemset;
REFIT_MENU_ENTRY_LOADER_TOOL()
: LOADER_ENTRY(), NoMemset(1)
{};
//--------------------------------------- REFIT_MENU_ENTRY_LOADER_TOOL ---------------------------------------//
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return this; };
};
class REFIT_MENU_ENTRY_LOADER_TOOL : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
UINT8 NoMemset;
UINT16 Flags;
EFI_DEVICE_PATH *DevicePath;
class LEGACY_ENTRY : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
// REFIT_VOLUME *Volume;
// CONST CHAR16 *DevicePathString;
// CONST CHAR16 *LoadOptions;
// UINTN BootNum;
// CONST CHAR16 *LoaderPath; //will be set to NULL
LEGACY_ENTRY()
: REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()
{};
REFIT_MENU_ENTRY_LOADER_TOOL() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), NoMemset(1) {};
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
};
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return this; };
};
class REFIT_MENU_ENTRY_CLOVER : public LOADER_ENTRY
{
public:
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
};
//--------------------------------------- REFIT_MENU_ENTRY_CLOVER ---------------------------------------//
class REFIT_MENU_ENTRY_CLOVER : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
REFIT_VOLUME *Volume;
CONST CHAR16 *VolName;
EFI_DEVICE_PATH *DevicePath;
UINT16 Flags;
// UINT8 LoaderType;
REFIT_MENU_ENTRY_CLOVER() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() {};
REFIT_MENU_ENTRY_CLOVER* getPartiallyDuplicatedEntry() const;
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
};
//--------------------------------------- REFIT_MENU_ITEM_BOOTNUM ---------------------------------------//
class REFIT_MENU_ITEM_BOOTNUM : public REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER
{
public:
REFIT_VOLUME *Volume;
UINTN BootNum;
virtual REFIT_MENU_ITEM_BOOTNUM* getREFIT_MENU_ITEM_BOOTNUM() { return this; };
} ;
//--------------------------------------- LEGACY_ENTRY ---------------------------------------//
class LEGACY_ENTRY : public REFIT_MENU_ITEM_BOOTNUM
{
public:
LEGACY_ENTRY() : REFIT_MENU_ITEM_BOOTNUM() {};
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
};
//--------------------------------------- LOADER_ENTRY ---------------------------------------//
struct KERNEL_AND_KEXT_PATCHES;
class LOADER_ENTRY : public REFIT_MENU_ITEM_BOOTNUM
{
public:
CONST CHAR16 *VolName;
EFI_DEVICE_PATH *DevicePath;
UINT16 Flags;
UINT8 LoaderType;
CHAR8 *OSVersion;
CHAR8 *BuildVersion;
EG_PIXEL *BootBgColor;
UINT8 CustomBoot;
EG_IMAGE *CustomLogo;
KERNEL_AND_KEXT_PATCHES *KernelAndKextPatches;
CONST CHAR16 *Settings;
// LOADER_ENTRY()
// : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), VolName(0), DevicePath(0), Flags(0), LoaderType(0), OSVersion(0), BuildVersion(0), BootBgColor(0), CustomBoot(0), CustomLogo(0), KernelAndKextPatches(0), Settings(0)
// {};
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
} ;
#endif

View File

@ -1066,7 +1066,7 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry)
// pre-boot tool functions
//
static VOID StartTool(IN LOADER_ENTRY *Entry)
static VOID StartTool(IN REFIT_MENU_ENTRY_LOADER_TOOL *Entry)
{
DBG("Start Tool: %s\n", Entry->LoaderPath);
egClearScreen(&DarkBackgroundPixel);

View File

@ -205,29 +205,16 @@ INTN TextStyle;
BOOLEAN mGuiReady = FALSE;
//REFIT_MENU_ENTRY_OTHER MenuEntryOptions = { L"Options", TAG_OPTIONS, 1, '\0', 'O', NULL, NULL, NULL,
// {0, 0, 0, 0}, ActionEnter, ActionEnter, ActionNone, ActionNone, NULL };
//REFIT_MENU_ENTRY_OTHER MenuEntryAbout = { L"About Clover", TAG_ABOUT_OLD, 1, 0, 'A', NULL, NULL, NULL,
// {0, 0, 0, 0}, ActionEnter, ActionEnter, ActionNone, ActionNone, NULL };
//REFIT_MENU_ENTRY_OTHER MenuEntryReset = { L"Restart Computer", TAG_RESET_OLD, 1, 0, 'R', NULL, NULL, NULL,
// {0, 0, 0, 0}, ActionSelect, ActionEnter, ActionNone, ActionNone, NULL };
//REFIT_MENU_ENTRY_OTHER MenuEntryShutdown = { L"Exit Clover", TAG_SHUTDOWN_OLD, 1, 0, 'U', NULL, NULL, NULL,
// {0, 0, 0, 0}, ActionSelect, ActionEnter, ActionNone, ActionNone, NULL };
//REFIT_MENU_ENTRY_OTHER MenuEntryReturn = { L"Return", TAG_RETURN_OLD, 0, 0, 0, NULL, NULL, NULL,
// {0, 0, 0, 0}, ActionEnter, ActionEnter, ActionNone, ActionNone, NULL };
REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (L"Options", 1, '\0', 'O', ActionEnter);
REFIT_MENU_ITEM_ABOUT MenuEntryAbout (L"About Clover", 1, 0, 'A', ActionEnter);
//REFIT_MENU_ITEM_OPTIONS(CONST CHAR16 *Title_, UINTN Row_, CHAR16 ShortcutDigit_, CHAR16 ShortcutLetter_, ACTION AtClick_)
REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (L"Options", 1, 0, 'O', ActionEnter);
REFIT_MENU_ITEM_ABOUT MenuEntryAbout (L"About Clover", 1, 0, 'A', ActionEnter);
REFIT_MENU_ITEM_RESET MenuEntryReset (L"Restart Computer", 1, 0, 'R', ActionSelect);
REFIT_MENU_ITEM_SHUTDOWN MenuEntryShutdown(L"Exit Clover", 1, 0, 'U', ActionSelect);
REFIT_MENU_ITEM_RETURN MenuEntryReturn (L"Return", 0, 0, 0, ActionEnter);
REFIT_MENU_ITEM_SHUTDOWN MenuEntryShutdown(L"Exit Clover", 1, 0, 'U', ActionSelect);
REFIT_MENU_ITEM_RETURN MenuEntryReturn (L"Return", 0, 0, 0, ActionEnter);
//REFIT_MENU_SCREEN MainMenu = {1, L"Main Menu", NULL, 0, NULL, 0, L"Automatic boot", NULL, FALSE, FALSE, 0, 0, 0, 0, {0, 0, 0, 0}, NULL};
//REFIT_MENU_SCREEN AboutMenu = {2, L"About", NULL, 0, NULL, 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, {0, 0, 0, 0}, NULL};
//REFIT_MENU_SCREEN HelpMenu = {3, L"Help", NULL, 0, NULL, 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, {0, 0, 0, 0}, NULL};
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);
@ -2192,7 +2179,7 @@ VOID REFIT_MENU_SCREEN::AddMenuInfoLine(IN CONST CHAR16 *InfoLine)
// AddListElement((VOID ***) &(Screen->InfoLines), (UINTN*)&(Screen->InfoLines.size()), (CHAR16*)InfoLine); // TODO jief : cast to fix
}
VOID REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_MENU_ENTRY *Entry, bool freeIt)
VOID REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt)
{
if ( !Entry ) return;
Entries.AddReference(Entry, freeIt);
@ -2265,7 +2252,7 @@ INTN REFIT_MENU_SCREEN::FindMenuShortcutEntry(IN CHAR16 Shortcut)
UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc)
{
if ( !Entries[ScrollState.CurrentSelection].getREFIT_MENU_ITEM_IEM_ABSTRACT() ) {
DebugLog(2, "BUG : InputDialog called with !Entries[ScrollState.CurrentSelection].REFIT_MENU_ITEM_IEM_ABSTRACT()\n");
DebugLog(2, "BUG : InputDialog called with !Entries[ScrollState.CurrentSelection].REFIT_MENU_ENTRY_ITEM_ABSTRACT()\n");
return 0; // is it the best thing to do ? CpuDeadLog ?
}
@ -2276,7 +2263,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc)
UINTN MenuExit = 0;
//UINTN LogSize;
UINTN Pos = (Entries[ScrollState.CurrentSelection]).Row;
REFIT_MENU_ITEM_IEM_ABSTRACT& selectedEntry = *Entries[ScrollState.CurrentSelection].getREFIT_MENU_ITEM_IEM_ABSTRACT();
REFIT_MENU_ENTRY_ITEM_ABSTRACT& selectedEntry = *Entries[ScrollState.CurrentSelection].getREFIT_MENU_ITEM_IEM_ABSTRACT();
INPUT_ITEM *Item = selectedEntry.Item;
CHAR16 *Backup = EfiStrDuplicate(Item->SValue);
UINTN BackupPos, BackupShift;
@ -4364,7 +4351,7 @@ UINTN REFIT_MENU_SCREEN::RunMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry)
return RunGenericMenu(&REFIT_MENU_SCREEN::TextMenuStyle, &Index, ChosenEntry);
}
VOID NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
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 = PoolPrint(L"%a", Title);
@ -4382,24 +4369,25 @@ VOID NewEntry_(REFIT_ABSTRACT_MENU_ENTRY *Entry, REFIT_MENU_SCREEN **SubScreen,
(*SubScreen)->ID = ID;
(*SubScreen)->AnimeRun = (*SubScreen)->GetAnime();
Entry->SubScreen = *SubScreen;
return Entry;
}
VOID NewEntry(REFIT_MENU_ENTRY_OTHER **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
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.
*Entry = new REFIT_MENU_ITEM_OPTIONS();
NewEntry_(*Entry, SubScreen, AtClick, ID, Title); // cast ok because super class
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 NewEntry(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 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 REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum)
{
@ -4437,7 +4425,7 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
}
}
VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ITEM_IEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor)
{
InputBootArgs->Title = PoolPrint(L"%a", Line);
if (Inx == 3 || Inx == 116) {
@ -4445,7 +4433,7 @@ VOID REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ITEM_IEM_ABSTRACT* InputBootArgs
} else {
InputBootArgs->Row = Cursor?StrLen(InputItems[Inx].SValue):0xFFFF;
}
InputBootArgs->Item = &InputItems[Inx];
InputBootArgs->Item = &InputItems[Inx];
InputBootArgs->AtClick = Cursor?ActionSelect:ActionEnter;
InputBootArgs->AtRightClick = Cursor?ActionNone:ActionDetails;
InputBootArgs->AtDoubleClick = Cursor?ActionEnter:ActionNone;
@ -4473,13 +4461,13 @@ VOID REFIT_MENU_SCREEN::AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Line, BOOLEAN C
AddMenuItem_(InputBootArgs, Inx, Line, Cursor);
}
REFIT_MENU_ENTRY *SubMenuGraphics()
REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
{
UINTN i, N, Ven = 97;
REFIT_MENU_ENTRY_OTHER *Entry; //, *SubEntry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_GRAPHICS, "Graphics Injector->");
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);
@ -4557,17 +4545,17 @@ REFIT_MENU_ENTRY *SubMenuGraphics()
}
// ErmaC: Audio submenu
REFIT_MENU_ENTRY *SubMenuAudio()
REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
{
UINTN i;
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_AUDIO, "Audio tuning->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_AUDIO, "Audio tuning->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to tune the HDA devices"));
@ -4597,12 +4585,12 @@ REFIT_MENU_ENTRY *SubMenuAudio()
#define nya(x) x/10,x%10
REFIT_MENU_ENTRY *SubMenuSpeedStep()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSpeedStep()
{
REFIT_MENU_ENTRY_OTHER *Entry; //, *SubEntry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_CPU, "CPU tuning->");
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));
@ -4639,16 +4627,16 @@ REFIT_MENU_ENTRY *SubMenuSpeedStep()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuKextPatches()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextPatches()
{
REFIT_MENU_ENTRY_OTHER *Entry;
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;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXTS, "Custom kexts patches->");
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));
@ -4666,9 +4654,9 @@ REFIT_MENU_ENTRY *SubMenuKextPatches()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
{
REFIT_MENU_ENTRY_OTHER *Entry = NULL;
REFIT_MENU_ITEM_OPTIONS *Entry = NULL;
REFIT_MENU_SCREEN *SubScreen = NULL;
REFIT_INPUT_DIALOG *InputBootArgs;
UINTN i = 0;
@ -4689,7 +4677,7 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
while (Kext) {
if (StrCmp(Kext->KextDirNameUnderOEMPath, UniSysVer) == 0) {
if ( SubScreen == NULL ) {
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
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));
@ -4733,7 +4721,8 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
// CHAR16 *UniSysVer = NULL;
CHAR8 *ChosenOS = Entry->OSVersion;
NewEntry(&SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
SubEntry = new LOADER_ENTRY();
NewEntry_(SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
SubEntry->Flags = Entry->Flags;
if (ChosenOS) {
// DBG("chosen os %a\n", ChosenOS);
@ -4845,16 +4834,16 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
REFIT_MENU_ENTRY *SubMenuKernelPatches()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuKernelPatches()
{
REFIT_MENU_ENTRY_OTHER *Entry;
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;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KERNELS, "Custom kernel patches->");
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));
@ -4872,16 +4861,16 @@ REFIT_MENU_ENTRY *SubMenuKernelPatches()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuBootPatches()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBootPatches()
{
REFIT_MENU_ENTRY_OTHER *Entry;
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;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_BOOTER, "Custom booter patches->");
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));
@ -4899,12 +4888,12 @@ REFIT_MENU_ENTRY *SubMenuBootPatches()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuBinaries()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBinaries()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_BINARIES, "Binaries patching->");
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));
@ -4935,18 +4924,18 @@ REFIT_MENU_ENTRY *SubMenuBinaries()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuDropTables()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables()
{
CHAR8 sign[5];
CHAR8 OTID[9];
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
sign[4] = 0;
OTID[8] = 0;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_TABLES, "Tables dropping->");
if (gSettings.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable = gSettings.ACPIDropTables;
@ -4995,12 +4984,12 @@ REFIT_MENU_ENTRY *SubMenuDropTables()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuSmbios()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->");
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gCPUStructure.BrandString));
SubScreen->AddMenuInfoLine(PoolPrint(L"%a", gSettings.OEMProduct));
@ -5025,14 +5014,14 @@ REFIT_MENU_ENTRY *SubMenuSmbios()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuDropDSM()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DSM, NULL);
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSM, NULL);
// Entry->Title = PoolPrint(L"Drop OEM _DSM [0x%04x]->", gSettings.DropOEM_DSM);
// submenu description
@ -5059,13 +5048,13 @@ REFIT_MENU_ENTRY *SubMenuDropDSM()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuDsdtFix()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
{
REFIT_MENU_ENTRY_OTHER *Entry; //, *SubEntry;
REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
// REFIT_INPUT_DIALOG *InputBootArgs;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DSDT, NULL);
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DSDT, NULL);
// Entry->Title = PoolPrint(L"DSDT fix mask [0x%08x]->", gSettings.FixDsdt);
SubScreen->AddMenuCheck("Add DTGP", FIX_DTGP, 67);
@ -5107,9 +5096,9 @@ REFIT_MENU_ENTRY *SubMenuDsdtFix()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuDSDTPatches() //yyyy
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDSDTPatches() //yyyy
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_INPUT_DIALOG *InputBootArgs;
@ -5117,7 +5106,7 @@ REFIT_MENU_ENTRY *SubMenuDSDTPatches() //yyyy
INPUT_ITEM *DSDTPatchesMenu = gSettings.PatchDsdtMenuItem;
INTN Index;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->");
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));
@ -5135,14 +5124,14 @@ REFIT_MENU_ENTRY *SubMenuDSDTPatches() //yyyy
return Entry;
}
REFIT_MENU_ENTRY *SubMenuDsdts()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_ACPI, "Dsdt name->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_ACPI, "Dsdt name->");
SubScreen->AddMenuInfoLine(L"Select a DSDT file:");
SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE);
@ -5163,14 +5152,14 @@ REFIT_MENU_ENTRY *SubMenuDsdts()
}
REFIT_MENU_ENTRY *SubMenuACPI()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuACPI()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_ACPI, "ACPI patching->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_ACPI, "ACPI patching->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to patch ACPI"));
@ -5188,14 +5177,14 @@ REFIT_MENU_ENTRY *SubMenuACPI()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuAudioPort()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_AUDIOPORTS, "Startup sound output->");
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);
@ -5252,14 +5241,14 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
}
REFIT_MENU_ENTRY *SubMenuCustomDevices()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuCustomDevices()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
UINT32 DevAddr, OldDevAddr = 0;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DEVICES, "Custom properties->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_DEVICES, "Custom properties->");
if (gSettings.ArbProperties) {
DEV_PROPERTY *Prop = gSettings.ArbProperties;
@ -5294,12 +5283,12 @@ REFIT_MENU_ENTRY *SubMenuCustomDevices()
}
REFIT_MENU_ENTRY *SubMenuPCI()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_USB, "PCI devices->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_USB, "PCI devices->");
SubScreen->AddMenuItemInput(74, "USB Ownership", FALSE);
SubScreen->AddMenuItemInput(92, "USB Injection", FALSE);
@ -5319,14 +5308,14 @@ REFIT_MENU_ENTRY *SubMenuPCI()
}
REFIT_MENU_ENTRY *SubMenuThemes()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_THEME, "Themes->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_THEME, "Themes->");
SubScreen->AddMenuInfoLine(L"Installed themes:");
//add embedded
@ -5347,14 +5336,14 @@ REFIT_MENU_ENTRY *SubMenuThemes()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuGUI()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuGUI()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_GUI, "GUI tuning->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_GUI, "GUI tuning->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options to tune the Interface"));
@ -5375,14 +5364,14 @@ REFIT_MENU_ENTRY *SubMenuGUI()
* Author: Needy.
* The below function is based on the SubMenuDsdtFix function.
*/
REFIT_MENU_ENTRY *SubMenuCSR()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuCSR()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_CSR, NULL);
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_CSR, NULL);
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Modify the System Integrity Protection configuration."));
@ -5406,14 +5395,14 @@ REFIT_MENU_ENTRY *SubMenuCSR()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuBLC()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuBLC()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the main menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_BLC, NULL);
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BLC, NULL);
// Entry->Title = PoolPrint(L"boot_args->flags [0x%02x]->", gSettings.BooterConfig);
// submenu description
@ -5434,14 +5423,14 @@ REFIT_MENU_ENTRY *SubMenuBLC()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuSystem()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem()
{
// init
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
// create the entry in the options menu
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "System Parameters->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SYSTEM, "System Parameters->");
// submenu description
SubScreen->AddMenuInfoLine(PoolPrint(L"Choose options for booted OS"));
@ -5457,14 +5446,14 @@ REFIT_MENU_ENTRY *SubMenuSystem()
return Entry;
}
REFIT_MENU_ENTRY *SubMenuConfigs()
REFIT_ABSTRACT_MENU_ENTRY* SubMenuConfigs()
{
REFIT_MENU_ENTRY_OTHER *Entry;
REFIT_MENU_ITEM_OPTIONS *Entry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_MENU_SWITCH *InputBootArgs;
UINTN i;
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_THEME, "Configs->");
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_THEME, "Configs->");
SubScreen->AddMenuInfoLine(L"Select a config file:");
@ -5614,7 +5603,7 @@ UINT32 EncodeOptions(CONST CHAR16 *Options)
return OptionsBits;
}
VOID DecodeOptions(REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER *Entry)
VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
{
//set checked option
INTN Index;
@ -5690,9 +5679,9 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
gSettings.OptionsBits = EncodeOptions(TmpArgs);
// DBG("main OptionsBits = 0x%x\n", gSettings.OptionsBits);
if ( MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() ) gSettings.OptionsBits |= EncodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER()->LoadOptions);
if ( MainChosenEntry->getLOADER_ENTRY() ) gSettings.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
// DBG("add OptionsBits = 0x%x\n", gSettings.OptionsBits);
if ( MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() ) DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER());
if ( MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM() ) DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM());
// DBG(" enter menu with LoadOptions: %s\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
if (MainChosenEntry->getLOADER_ENTRY()) {
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags
@ -5708,7 +5697,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
while (!SubMenuExit) {
//running details menu
SubMenuExit = MainChosenEntry->SubScreen->RunGenericMenu(Style, &SubMenuIndex, &TempChosenEntry);
if ( MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER() ) DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER());
if ( MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM() ) DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM());
// DBG("get OptionsBits = 0x%x\n", gSettings.OptionsBits);
// DBG(" TempChosenEntry FlagsBits = 0x%x\n", ((LOADER_ENTRY*)TempChosenEntry)->Flags);
if (SubMenuExit == MENU_EXIT_ESCAPE || TempChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
@ -5727,7 +5716,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
}
if (/*MenuExit == MENU_EXIT_ENTER &&*/ MainChosenEntry->getLOADER_ENTRY()) {
if (MainChosenEntry->getLOADER_ENTRY()->LoadOptions) {
AsciiSPrint(gSettings.BootArgs, 255, "%s", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions); // cast ok
AsciiSPrint(gSettings.BootArgs, 255, "%s", MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
} else {
ZeroMem(&gSettings.BootArgs, 255);
}