Start refactoring includes. Make gen-config compile.

This commit is contained in:
jief 2020-02-29 10:30:21 +03:00
parent 45f95118cd
commit dec25e954e
34 changed files with 603 additions and 544 deletions

View File

@ -0,0 +1,4 @@
EFI_STATUS
EFIAPI
SetVariablesForOSX (LOADER_ENTRY *Entry);

View File

@ -0,0 +1,5 @@
EFI_STATUS
EventsInitialize (
IN LOADER_ENTRY *Entry
);

View File

@ -0,0 +1,11 @@
//
// Hibernate.c
//
/** Returns TRUE if given macOS on given volume is hibernated
* (/private/var/vm/sleepimage exists and it's modification time is close to volume modification time).
*/
BOOLEAN
IsOsxHibernated (
IN LOADER_ENTRY *Entry
);

View File

@ -0,0 +1,5 @@
INTN
FindStartupDiskVolume (
REFIT_MENU_SCREEN *MainMenu
);

View File

@ -83,7 +83,7 @@ extern "C" {
#endif
// cpp_fundation objects has to be included before lib.h
// cpp_foundation objects has to be included before lib.h
#ifdef __cplusplus
#include "../cpp_foundation/XStringW.h"
#include "../cpp_foundation/XArray.h"
@ -97,8 +97,11 @@ extern "C" {
//#include "PiBootMode.h"
#include "../refit/IO.h"
#include "device_inject.h"
#ifdef __cplusplus
#include "kext_inject.h"
//#include "entry_scan.h"
#endif
#define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
#define NON_APPLE_SMC_SIGNATURE SIGNATURE_64('S','M','C','H','E','L','P','E')
@ -1778,12 +1781,6 @@ KillMouse (VOID);
VOID
HidePointer (VOID);
EFI_STATUS
WaitForInputEventPoll (
REFIT_MENU_SCREEN *Screen,
UINTN TimeoutDefault
);
VOID
InitBooterLog (VOID);
@ -1847,11 +1844,6 @@ StrToGuidLE (
CHAR16 * GuidBeToStr(EFI_GUID *Guid);
CHAR16 * GuidLEToStr(EFI_GUID *Guid);
EFI_STATUS
InitBootScreen (
IN LOADER_ENTRY *Entry
);
EFI_STATUS
InitializeConsoleSim (VOID);
@ -1886,11 +1878,6 @@ GetDefaultModel (VOID);
UINT16
GetAdvancedCpuType (VOID);
CHAR8
*GetOSVersion (
IN LOADER_ENTRY *Entry
);
CONST CHAR16
*GetOSIconName (
IN CONST CHAR8 *OSVersion
@ -1926,11 +1913,6 @@ VOID GetOutputs();
EFI_STATUS CheckSyncSound();
EFI_STATUS
SetFSInjection (
IN LOADER_ENTRY *Entry
);
CHAR16*
GetOtherKextsDir (BOOLEAN On);
@ -1945,11 +1927,6 @@ InjectKextsFromDir (
CHAR16 *SrcDir
);
EFI_STATUS
LoadKexts (
IN LOADER_ENTRY *Entry
);
VOID
ParseLoadOptions (
OUT CHAR16 **Conf,
@ -2023,11 +2000,6 @@ GetSmcKeys(BOOLEAN WriteToSMC);
VOID
GetMacAddress(VOID);
INTN
FindStartupDiskVolume (
REFIT_MENU_SCREEN *MainMenu
);
EFI_STATUS
SetStartupDiskVolume (
IN REFIT_VOLUME *Volume,
@ -2050,10 +2022,6 @@ LogDataHub (
UINT32 DataSize
);
EFI_STATUS
EFIAPI
SetVariablesForOSX (LOADER_ENTRY *Entry);
VOID
EFIAPI
SetupDataForOSX (BOOLEAN Hibernate);
@ -2061,26 +2029,9 @@ SetupDataForOSX (BOOLEAN Hibernate);
EFI_STATUS
SetPrivateVarProto (VOID);
VOID
SetDevices (
LOADER_ENTRY *Entry
);
VOID
ScanSPD (VOID);
BOOLEAN
setup_ati_devprop (
LOADER_ENTRY *Entry,
pci_dt_t *ati_dev
);
BOOLEAN
setup_gma_devprop (
LOADER_ENTRY *Entry,
pci_dt_t *gma_dev
);
CONST CHAR8
*get_gma_model (
IN UINT16 DeviceID
@ -2190,11 +2141,6 @@ FixAny (
VOID
GetAcpiTablesList (VOID);
EFI_STATUS
EventsInitialize (
IN LOADER_ENTRY *Entry
);
EFI_STATUS
EjectVolume (
IN REFIT_VOLUME *Volume
@ -2471,12 +2417,6 @@ DeleteBootOptionsContainingFile (
//get default boot
VOID GetBootFromOption(VOID);
//
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
SetBootCurrent(REFIT_MENU_ENTRY_LOADER *LoadedEntry);
VOID
InitKextList(VOID);
@ -2515,17 +2455,6 @@ EFI_GUID *APFSPartitionUUIDExtract(
UINTN
NodeParser (UINT8 *DevPath, UINTN PathSize, UINT8 Type);
//
// Hibernate.c
//
/** Returns TRUE if given macOS on given volume is hibernated
* (/private/var/vm/sleepimage exists and it's modification time is close to volume modification time).
*/
BOOLEAN
IsOsxHibernated (
IN LOADER_ENTRY *Entry
);
/** Prepares nvram vars needed for boot.efi to wake from hibernation. */
BOOLEAN
PrepareHibernation (

View File

@ -15,6 +15,7 @@
//#include "Platform.h"
#include "libegint.h" //this includes platform.h
#include "../refit/screen.h"
#ifndef DEBUG_ALL
#define DEBUG_MOUSE 1

View File

@ -0,0 +1,6 @@
EFI_STATUS
WaitForInputEventPoll (
REFIT_MENU_SCREEN *Screen,
UINTN TimeoutDefault
);

View File

@ -7,6 +7,9 @@
#include "ati.h"
#include "nanosvg.h"
#include "nvidia.h"
#include "../refit/screen.h"
#include "../refit/menu.h"
#include "gma.h"
#ifndef DEBUG_ALL
#define DEBUG_SET 1

View File

@ -0,0 +1,21 @@
EFI_STATUS
SetFSInjection (
IN LOADER_ENTRY *Entry
);
VOID
SetDevices (
LOADER_ENTRY *Entry
);
//
// check if this entry corresponds to Boot# variable and then set BootCurrent
//
VOID
SetBootCurrent(REFIT_MENU_ENTRY_LOADER *LoadedEntry);
CHAR8
*GetOSVersion (
IN LOADER_ENTRY *Entry
);

View File

@ -308,3 +308,10 @@ extern radeon_card_info_t radeon_cards[];
extern AtiDevProp ati_devprop_list[];
extern const CHAR8 *chip_family_name[];
BOOLEAN
setup_ati_devprop (
LOADER_ENTRY *Entry,
pci_dt_t *ati_dev
);

View File

@ -110,6 +110,8 @@ VOID Patcher_SSE3_5(VOID* kernelData);
VOID Patcher_SSE3_6(VOID* kernelData);
VOID Patcher_SSE3_7(VOID* kernelData);
#include "../gui/menu_items/menu_items.h" // for LOADER_ENTRY
VOID KernelAndKextsPatcherStart(IN LOADER_ENTRY *Entry);
//VOID register_kernel_symbol(CONST CHAR8* name);

View File

@ -11,13 +11,6 @@
#if !defined(__XARRAY_H__)
#define __XARRAY_H__
//#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile // for DebugLog
//VOID EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...); // To avoid include Platform just for this
//extern "C" {
// #include <Library/MemoryAllocationLib.h>
// #include <Library/BaseMemoryLib.h>
// #include <Library/BaseLib.h> // for CpuDeadLoop();
//}
#include "XToolsCommon.h"

View File

@ -11,13 +11,6 @@
#if !defined(__XOBJARRAY_H__)
#define __XOBJARRAY_H__
//#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile // for DebugLog
//VOID EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...); // To avoid include Platform just for this
//extern "C" {
// #include <Library/MemoryAllocationLib.h>
// #include <Library/BaseMemoryLib.h>
// #include <Library/BaseLib.h> // for CpuDeadLoop();
//}
#include "XToolsCommon.h"

View File

@ -18,7 +18,6 @@
#define DBG(...)
#endif
#include <Platform.h>
#include "XToolsCommon.h"
#include "XStringW.h"

View File

@ -10,7 +10,6 @@
#define __XSTRINGW_H__
#include "XToolsCommon.h"
#include <Platform.h>
#include "utf8Conversion.h"
#define LPATH_SEPARATOR L'\\'

View File

@ -7,7 +7,6 @@
#if !defined(__XSTRINGWS_CPP__)
#define __XSTRINGWS_CPP__
#include <Platform.h>
#include "XToolsCommon.h"
#include "XStringWArray.h"

View File

@ -6,9 +6,6 @@
#include "utf8Conversion.h"
#include <Platform.h>
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif

View File

@ -33,6 +33,7 @@
*/
#include "entry_scan.h"
#include "../refit/screen.h"
#ifndef DEBUG_ALL
#define DEBUG_BOOT_SCREEN 1

View File

@ -0,0 +1,5 @@
EFI_STATUS
InitBootScreen (
IN LOADER_ENTRY *Entry
);

View File

@ -34,6 +34,7 @@
*/
#include "entry_scan.h"
#include "../refit/menu.h"
#ifndef DEBUG_ALL
#define DEBUG_COMMON_MENU 1

View File

@ -34,6 +34,8 @@
*/
#include "entry_scan.h"
#include "../refit/screen.h"
#include "../refit/menu.h"
#ifndef DEBUG_ALL
#define DEBUG_SCAN_LEGACY 1

View File

@ -34,6 +34,10 @@
*/
#include "entry_scan.h"
#include "../Platform/Settings.h"
#include "../Platform/Hibernate.h"
#include "../refit/screen.h"
#include "../refit/menu.h"
#ifndef DEBUG_ALL
#define DEBUG_SCAN_LOADER 1

View File

View File

@ -34,6 +34,8 @@
*/
#include "entry_scan.h"
#include "../refit/menu.h"
#include "../refit/screen.h"
//
// Clover File location to boot from on removable media devices

View File

View File

@ -0,0 +1 @@
extern REFIT_MENU_SCREEN OptionMenu;

View File

@ -0,0 +1,464 @@
/*
*
* 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.
*/
#ifndef __menu_items_H__
#define __menu_items_H__
#include "libeg.h"
#ifdef __cplusplus
#include "../cpp_foundation/XObjArray.h"
#include "../cpp_foundation/XStringWArray.h"
#include "../cpp_foundation/XStringW.h"
#endif
//
//#define REFIT_DEBUG (2)
//#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
////#include "GenericBdsLib.h"
//#define TAG_ABOUT_OLD (1)
//#define TAG_RESET_OLD (2)
//#define TAG_SHUTDOWN_OLD (3)
//#define TAG_TOOL_OLD (4)
////#define TAG_LOADER (5)
////#define TAG_LEGACY (6)
//#define TAG_INFO_OLD (7)
//#define TAG_OPTIONS (8)
//#define TAG_INPUT_OLD (9)
//#define TAG_HELP_OLD (10) // wasn't used ?
//#define TAG_SWITCH_OLD (11)
//#define TAG_CHECKBIT_OLD (12)
//#define TAG_SECURE_BOOT_OLD (13)
//#define TAG_SECURE_BOOT_CONFIG_OLD (14)
//#define TAG_CLOVER_OLD (100)
//#define TAG_EXIT_OLD (101)
//#define TAG_RETURN_OLD ((UINTN)(-1))
//typedef struct _refit_menu_screen REFIT_MENU_SCREEN;
class REFIT_MENU_SCREEN;
class REFIT_MENU_SWITCH;
class REFIT_MENU_CHECKBIT;
class REFIT_MENU_ENTRY_CLOVER;
class REFIT_MENU_ITEM_RETURN;
class REFIT_INPUT_DIALOG;
class REFIT_INFO_DIALOG;
class REFIT_MENU_ENTRY_LOADER_TOOL;
class REFIT_MENU_ITEM_SHUTDOWN;
class REFIT_MENU_ITEM_RESET;
class REFIT_MENU_ITEM_ABOUT;
class REFIT_MENU_ITEM_OPTIONS;
class REFIT_MENU_ENTRY_LOADER;
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_ABSTRACT_MENU_ENTRY
{
public:
CONST CHAR16 *Title;
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;
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return nullptr; };
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return nullptr; };
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return nullptr; };
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return nullptr; };
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return nullptr; };
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return nullptr; };
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return nullptr; };
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return nullptr; };
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return nullptr; };
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return nullptr; };
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return nullptr; };
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return nullptr; };
virtual REFIT_MENU_ENTRY_LOADER* getREFIT_MENU_ENTRY_LOADER() { return nullptr; };
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; };
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), DriveImage(NULL), BadgeImage(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {};
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, 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_)
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_),
Image(Image_), DriveImage(DriveImage_), BadgeImage(BadgeImage_), 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;
ACTION AtClick;
REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_), Tag(Tag_), AtClick(AtClick_)
{};
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return this; };
};
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;
REFIT_MENU_ENTRY() : REFIT_ABSTRACT_MENU_ENTRY(NULL) {};
REFIT_MENU_ENTRY( CONST CHAR16 *Title_, 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_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
};
class REFIT_MENU_ENTRY_OTHER : public REFIT_MENU_ENTRY
{
public:
// UINTN Tag;
REFIT_MENU_ENTRY_OTHER() : REFIT_MENU_ENTRY() {};
REFIT_MENU_ENTRY_OTHER(CONST CHAR16 *Title_, 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_)
: REFIT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
};
class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_MENU_ENTRY_OTHER
{
public:
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, 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_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
};
class REFIT_MENU_ITEM_IEM_ABSTRACT : public REFIT_MENU_ENTRY_OTHER {
public:
INPUT_ITEM *Item;
virtual REFIT_MENU_ITEM_IEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { 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_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_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;
virtual REFIT_MENU_ENTRY_LOADER* getREFIT_MENU_ENTRY_LOADER() { return this; };
};
struct KERNEL_AND_KEXT_PATCHES;
class LOADER_ENTRY : public REFIT_MENU_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;
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
} ;
class REFIT_MENU_ENTRY_LOADER_TOOL : public LOADER_ENTRY
{
public:
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return this; };
};
class LEGACY_ENTRY : public REFIT_MENU_ENTRY_LOADER
{
public:
// REFIT_VOLUME *Volume;
// CONST CHAR16 *DevicePathString;
// CONST CHAR16 *LoadOptions;
// UINTN BootNum;
// CONST CHAR16 *LoaderPath; //will be set to NULL
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
};
class REFIT_MENU_ENTRY_CLOVER : public LOADER_ENTRY
{
public:
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
};
//some unreal values
#define FILM_CENTRE 40000
//#define FILM_LEFT 50000
//#define FILM_TOP 50000
//#define FILM_RIGHT 60000
//#define FILM_BOTTOM 60000
//#define FILM_PERCENT 100000
#define INITVALUE 40000
class REFIT_MENU_SCREEN
{
public:
UINTN ID;
CONST CHAR16 *Title;
EG_IMAGE *TitleImage;
// INTN InfoLineCount;
// CONST CHAR16 **InfoLines;
XStringWArray InfoLines;
// INTN EntryCount;
// REFIT_MENU_ENTRY **Entries;
XObjArray<REFIT_ABSTRACT_MENU_ENTRY> Entries;
INTN TimeoutSeconds;
CONST CHAR16 *TimeoutText;
CONST CHAR16 *Theme;
BOOLEAN AnimeRun;
BOOLEAN Once;
UINT64 LastDraw;
INTN CurrentFrame;
INTN Frames;
UINTN FrameTime; //ms
EG_RECT FilmPlace;
EG_IMAGE **Film;
REFIT_MENU_SCREEN()
: ID(0), Title(0), TitleImage(0),
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
Once(0), LastDraw(0), CurrentFrame(0),
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
Film(0)
{};
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_)
{};
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_)
{
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_)
{
Entries.AddReference(entry1, false);
Entries.AddReference(entry2, false);
};
};
#endif
/*
EOF */

View File

@ -8,8 +8,8 @@
#include "nanosvg.h"
#include "FloatLib.h"
#include "lodepng.h"
#include "../refit/screen.h"
#ifndef DEBUG_ALL
#define DEBUG_VEC 1

View File

@ -378,296 +378,6 @@ extern INTN ScrollbarYMovement;
//#define TAG_ABOUT_OLD (1)
//#define TAG_RESET_OLD (2)
//#define TAG_SHUTDOWN_OLD (3)
//#define TAG_TOOL_OLD (4)
////#define TAG_LOADER (5)
////#define TAG_LEGACY (6)
//#define TAG_INFO_OLD (7)
//#define TAG_OPTIONS (8)
//#define TAG_INPUT_OLD (9)
//#define TAG_HELP_OLD (10) // wasn't used ?
//#define TAG_SWITCH_OLD (11)
//#define TAG_CHECKBIT_OLD (12)
//#define TAG_SECURE_BOOT_OLD (13)
//#define TAG_SECURE_BOOT_CONFIG_OLD (14)
//#define TAG_CLOVER_OLD (100)
//#define TAG_EXIT_OLD (101)
//#define TAG_RETURN_OLD ((UINTN)(-1))
//typedef struct _refit_menu_screen REFIT_MENU_SCREEN;
class REFIT_MENU_SCREEN;
class REFIT_MENU_SWITCH;
class REFIT_MENU_CHECKBIT;
class REFIT_MENU_ENTRY_CLOVER;
class REFIT_MENU_ITEM_RETURN;
class REFIT_INPUT_DIALOG;
class REFIT_INFO_DIALOG;
class REFIT_MENU_ENTRY_LOADER_TOOL;
class REFIT_MENU_ITEM_SHUTDOWN;
class REFIT_MENU_ITEM_RESET;
class REFIT_MENU_ITEM_ABOUT;
class REFIT_MENU_ITEM_OPTIONS;
class REFIT_MENU_ENTRY_LOADER;
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_ABSTRACT_MENU_ENTRY
{
public:
CONST CHAR16 *Title;
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;
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return nullptr; };
virtual REFIT_MENU_SWITCH* getREFIT_MENU_SWITCH() { return nullptr; };
virtual REFIT_MENU_CHECKBIT* getREFIT_MENU_CHECKBIT() { return nullptr; };
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return nullptr; };
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return nullptr; };
virtual REFIT_INPUT_DIALOG* getREFIT_INPUT_DIALOG() { return nullptr; };
virtual REFIT_INFO_DIALOG* getREFIT_INFO_DIALOG() { return nullptr; };
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return nullptr; };
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { return nullptr; };
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { return nullptr; };
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { return nullptr; };
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return nullptr; };
virtual REFIT_MENU_ENTRY_LOADER* getREFIT_MENU_ENTRY_LOADER() { return nullptr; };
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; };
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_) : Title(Title_), Row(0), ShortcutDigit(0), ShortcutLetter(0), Image(NULL), DriveImage(NULL), BadgeImage(NULL), Place({0,0,0,0}), AtClick(ActionNone), AtDoubleClick(ActionNone), AtRightClick(ActionNone), AtMouseOver(ActionNone), SubScreen(NULL) {};
REFIT_ABSTRACT_MENU_ENTRY(CONST CHAR16 *Title_, 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_)
: Title(Title_), Row(Row_), ShortcutDigit(ShortcutDigit_), ShortcutLetter(ShortcutLetter_),
Image(Image_), DriveImage(DriveImage_), BadgeImage(BadgeImage_), 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;
ACTION AtClick;
REFIT_SIMPLE_MENU_ENTRY_TAG(CONST CHAR16 *Title_, UINTN Tag_, ACTION AtClick_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_), Tag(Tag_), AtClick(AtClick_)
{};
virtual REFIT_SIMPLE_MENU_ENTRY_TAG* getREFIT_SIMPLE_MENU_ENTRY_TAG() { return this; };
};
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;
REFIT_MENU_ENTRY() : REFIT_ABSTRACT_MENU_ENTRY(NULL) {};
REFIT_MENU_ENTRY( CONST CHAR16 *Title_, 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_)
: REFIT_ABSTRACT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
};
class REFIT_MENU_ENTRY_OTHER : public REFIT_MENU_ENTRY
{
public:
// UINTN Tag;
REFIT_MENU_ENTRY_OTHER() : REFIT_MENU_ENTRY() {};
REFIT_MENU_ENTRY_OTHER(CONST CHAR16 *Title_, 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_)
: REFIT_MENU_ENTRY(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RETURN* getREFIT_MENU_ITEM_RETURN() { return this; };
};
class REFIT_MENU_ITEM_SHUTDOWN : public REFIT_MENU_ENTRY_OTHER
{
public:
REFIT_MENU_ITEM_SHUTDOWN(CONST CHAR16 *Title_, 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_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_SHUTDOWN* getREFIT_MENU_ITEM_SHUTDOWN() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_RESET* getREFIT_MENU_ITEM_RESET() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_ABOUT* getREFIT_MENU_ITEM_ABOUT() { 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_,
EG_IMAGE *Image_, EG_IMAGE *DriveImage_, EG_IMAGE *BadgeImage_, EG_RECT Place_,
ACTION AtClick_, ACTION AtDoubleClick_, ACTION AtRightClick_, ACTION AtMouseOver_,
REFIT_MENU_SCREEN *SubScreen_)
: REFIT_MENU_ENTRY_OTHER(Title_, Row_, ShortcutDigit_, ShortcutLetter_, Image_, DriveImage_, BadgeImage_, Place_, AtClick_, AtDoubleClick_, AtRightClick_, AtMouseOver_, SubScreen_)
{};
virtual REFIT_MENU_ITEM_OPTIONS* getREFIT_MENU_ITEM_OPTIONS() { return this; };
};
class REFIT_MENU_ITEM_IEM_ABSTRACT : public REFIT_MENU_ENTRY_OTHER {
public:
INPUT_ITEM *Item;
virtual REFIT_MENU_ITEM_IEM_ABSTRACT* getREFIT_MENU_ITEM_IEM_ABSTRACT() { 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_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_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;
virtual REFIT_MENU_ENTRY_LOADER* getREFIT_MENU_ENTRY_LOADER() { return this; };
};
struct KERNEL_AND_KEXT_PATCHES;
class LOADER_ENTRY : public REFIT_MENU_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;
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
} ;
class REFIT_MENU_ENTRY_LOADER_TOOL : public LOADER_ENTRY
{
public:
virtual REFIT_MENU_ENTRY_LOADER_TOOL* getREFIT_MENU_ENTRY_LOADER_TOOL() { return this; };
};
class LEGACY_ENTRY : public REFIT_MENU_ENTRY_LOADER
{
public:
// REFIT_VOLUME *Volume;
// CONST CHAR16 *DevicePathString;
// CONST CHAR16 *LoadOptions;
// UINTN BootNum;
// CONST CHAR16 *LoaderPath; //will be set to NULL
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
};
class REFIT_MENU_ENTRY_CLOVER : public LOADER_ENTRY
{
public:
virtual REFIT_MENU_ENTRY_CLOVER* getREFIT_MENU_ENTRY_CLOVER() { return this; };
};
//some unreal values
#define FILM_CENTRE 40000
//#define FILM_LEFT 50000
@ -677,119 +387,6 @@ public:
//#define FILM_PERCENT 100000
#define INITVALUE 40000
class REFIT_MENU_SCREEN
{
public:
UINTN ID;
CONST CHAR16 *Title;
EG_IMAGE *TitleImage;
// INTN InfoLineCount;
// CONST CHAR16 **InfoLines;
XStringWArray InfoLines;
// INTN EntryCount;
// REFIT_MENU_ENTRY **Entries;
XObjArray<REFIT_ABSTRACT_MENU_ENTRY> Entries;
INTN TimeoutSeconds;
CONST CHAR16 *TimeoutText;
CONST CHAR16 *Theme;
BOOLEAN AnimeRun;
BOOLEAN Once;
UINT64 LastDraw;
INTN CurrentFrame;
INTN Frames;
UINTN FrameTime; //ms
EG_RECT FilmPlace;
EG_IMAGE **Film;
REFIT_MENU_SCREEN()
: ID(0), Title(0), TitleImage(0),
TimeoutSeconds(0), TimeoutText(0), Theme(0), AnimeRun(0),
Once(0), LastDraw(0), CurrentFrame(0),
Frames(0), FrameTime(0), FilmPlace({0,0,0,0}),
Film(0)
{};
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_)
{};
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_)
{
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_)
{
Entries.AddReference(entry1, false);
Entries.AddReference(entry2, false);
};
};
#define VOLTYPE_OPTICAL (0x0001)
#define VOLTYPE_EXTERNAL (0x0002)
#define VOLTYPE_INTERNAL (0x0004)
@ -1026,7 +623,6 @@ extern BOOLEAN gThemeChanged;
extern BOOLEAN gBootChanged;
extern BOOLEAN gThemeOptionsChanged;
//extern POINTERS gPointer;
extern REFIT_MENU_SCREEN OptionMenu;
//extern EFI_GUID gEfiAppleBootGuid;
@ -1135,15 +731,6 @@ extern EG_RECT BannerPlace;
extern EG_IMAGE *BackgroundImage;
VOID InitScreen(IN BOOLEAN SetMaxResolution);
VOID SetupScreen(VOID);
VOID BeginTextScreen(IN CONST CHAR16 *Title);
VOID FinishTextScreen(IN BOOLEAN WaitAlways);
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CONST CHAR16 *Title);
VOID FinishExternalScreen(VOID);
VOID TerminateScreen(VOID);
VOID SetNextScreenMode(INT32);
#if REFIT_DEBUG > 0
VOID DebugPause(VOID);
#else
@ -1154,19 +741,6 @@ VOID EndlessIdleLoop(VOID);
BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where);
VOID SwitchToGraphicsAndClear(VOID);
VOID BltClearScreen(IN BOOLEAN ShowBanner);
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *BackgroundPixel, INTN Scale);
VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos);
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale);
//VOID BltImageCompositeIndicator(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos, INTN Scale);
BOOLEAN GetAnime(REFIT_MENU_SCREEN *Screen);
VOID InitAnime(REFIT_MENU_SCREEN *Screen);
VOID UpdateAnime(REFIT_MENU_SCREEN *Screen, EG_RECT *Place);
VOID FreeAnime(GUI_ANIME *Anime);
//
// icns loader module
//
@ -1231,22 +805,8 @@ EG_IMAGE * GetSmallHover(IN UINTN Id);
#define ICON_FORMAT_ICNS (1)
#define ICON_FORMAT_PNG (2)
#define ICON_FORMAT_BMP (3)
VOID AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CONST CHAR16 *InfoLine);
VOID AddMenuInfo(IN REFIT_MENU_SCREEN *SubScreen, IN CONST CHAR16 *Line);
VOID AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry, bool freeIt);
VOID AddMenuCheck(REFIT_MENU_SCREEN *SubScreen, CONST CHAR8 *Text, UINTN Bit, INTN ItemNum);
VOID FreeMenu(IN REFIT_MENU_SCREEN *Screen);
UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN INTN DefaultSelection, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor);
VOID ReinitVolumes(VOID);
BOOLEAN ReadAllKeyStrokes(VOID);
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry, IN CHAR8 *LastChosenOS);
VOID FreeScrollBar(VOID);
INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
//
// config module
//

View File

@ -37,14 +37,19 @@
#include "../Platform/Platform.h"
#include "../cpp_util/globals_ctor.h"
#include "../cpp_util/globals_dtor.h"
#include "../cpp_foundation/XStringW.h"
#include "../cpp_unit_test/all_tests.h"
#include "Version.h"
#include "entry_scan.h"
#include "nanosvg.h"
#include "Version.h"
#include "../gui/menu_items/menu_globals.h"
#include "menu.h"
#include "../Platform/Settings.h"
#include "../Platform/DataHubCpu.h"
#include "../Platform/Events.h"
#include "screen.h"
#include "../entry_scan/bootscreen.h"
#include "../Platform/Nvram.h"
#ifndef DEBUG_ALL
#define DEBUG_MAIN 1

View File

@ -38,16 +38,15 @@
#include "libegint.h" //this includes platform.h
//#include "../include/scroll_images.h"
//#include "../Platform/Platform.h"
//#include "../cpp_foundation/XStringW.h"
#include "Version.h"
//#include "colors.h"
#include "nanosvg.h"
#include "FloatLib.h"
#include "HdaCodecDump.h"
#include "menu.h"
#include "screen.h"
#include "../Platform/Pointer.h"
#ifndef DEBUG_ALL
#define DEBUG_MENU 1

14
rEFIt_UEFI/refit/menu.h Normal file
View File

@ -0,0 +1,14 @@
VOID AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CONST CHAR16 *InfoLine);
VOID AddMenuInfo(IN REFIT_MENU_SCREEN *SubScreen, IN CONST CHAR16 *Line);
VOID AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry, bool freeIt);
VOID AddMenuCheck(REFIT_MENU_SCREEN *SubScreen, CONST CHAR8 *Text, UINTN Bit, INTN ItemNum);
VOID FreeMenu(IN REFIT_MENU_SCREEN *Screen);
UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN INTN DefaultSelection, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
VOID DrawMenuText(IN CONST CHAR16 *Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor);
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry, IN CHAR8 *LastChosenOS);
VOID FreeScrollBar(VOID);
INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);

View File

@ -34,6 +34,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../Platform/Platform.h"
#include "screen.h"
#include "libegint.h"
#ifndef DEBUG_ALL

25
rEFIt_UEFI/refit/screen.h Normal file
View File

@ -0,0 +1,25 @@
#include "../gui/menu_items/menu_items.h"
VOID InitScreen(IN BOOLEAN SetMaxResolution);
VOID SetupScreen(VOID);
VOID BeginTextScreen(IN CONST CHAR16 *Title);
VOID FinishTextScreen(IN BOOLEAN WaitAlways);
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CONST CHAR16 *Title);
VOID FinishExternalScreen(VOID);
VOID TerminateScreen(VOID);
VOID SetNextScreenMode(INT32);
BOOLEAN GetAnime(REFIT_MENU_SCREEN *Screen);
VOID InitAnime(REFIT_MENU_SCREEN *Screen);
VOID UpdateAnime(REFIT_MENU_SCREEN *Screen, EG_RECT *Place);
VOID FreeAnime(GUI_ANIME *Anime);
VOID SwitchToGraphicsAndClear(VOID);
VOID BltClearScreen(IN BOOLEAN ShowBanner);
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *BackgroundPixel, INTN Scale);
VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos);
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale);
//VOID BltImageCompositeIndicator(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos, INTN Scale);