From dec25e954e43f8d51d558f325bb3ad3da0b6e616 Mon Sep 17 00:00:00 2001 From: jief Date: Sat, 29 Feb 2020 10:30:21 +0300 Subject: [PATCH] Start refactoring includes. Make gen-config compile. --- rEFIt_UEFI/Platform/DataHubCpu.h | 4 + rEFIt_UEFI/Platform/Events.h | 5 + rEFIt_UEFI/Platform/Hibernate.h | 11 + rEFIt_UEFI/Platform/Nvram.h | 5 + rEFIt_UEFI/Platform/Platform.h | 79 +--- rEFIt_UEFI/Platform/Pointer.cpp | 1 + rEFIt_UEFI/Platform/Pointer.h | 6 + rEFIt_UEFI/Platform/Settings.cpp | 3 + rEFIt_UEFI/Platform/Settings.h | 21 + rEFIt_UEFI/Platform/ati.h | 7 + rEFIt_UEFI/Platform/kernel_patcher.h | 2 + rEFIt_UEFI/cpp_foundation/XArray.h | 7 - rEFIt_UEFI/cpp_foundation/XObjArray.h | 7 - rEFIt_UEFI/cpp_foundation/XStringW.cpp | 1 - rEFIt_UEFI/cpp_foundation/XStringW.h | 1 - rEFIt_UEFI/cpp_foundation/XStringWArray.cpp | 1 - rEFIt_UEFI/cpp_foundation/utf8Conversion.cpp | 3 - rEFIt_UEFI/entry_scan/bootscreen.cpp | 1 + rEFIt_UEFI/entry_scan/bootscreen.h | 5 + rEFIt_UEFI/entry_scan/common.cpp | 1 + rEFIt_UEFI/entry_scan/legacy.cpp | 2 + rEFIt_UEFI/entry_scan/loader.cpp | 4 + rEFIt_UEFI/entry_scan/loader.h | 0 rEFIt_UEFI/entry_scan/tool.cpp | 2 + rEFIt_UEFI/entry_scan/tool.h | 0 rEFIt_UEFI/gui/menu_items/menu_globals.h | 1 + rEFIt_UEFI/gui/menu_items/menu_items.h | 464 +++++++++++++++++++ rEFIt_UEFI/libeg/VectorGraphics.cpp | 2 +- rEFIt_UEFI/refit/lib.h | 440 ------------------ rEFIt_UEFI/refit/main.cpp | 13 +- rEFIt_UEFI/refit/menu.cpp | 7 +- rEFIt_UEFI/refit/menu.h | 14 + rEFIt_UEFI/refit/screen.cpp | 2 + rEFIt_UEFI/refit/screen.h | 25 + 34 files changed, 603 insertions(+), 544 deletions(-) create mode 100644 rEFIt_UEFI/Platform/DataHubCpu.h create mode 100644 rEFIt_UEFI/Platform/Events.h create mode 100644 rEFIt_UEFI/Platform/Hibernate.h create mode 100644 rEFIt_UEFI/Platform/Nvram.h create mode 100644 rEFIt_UEFI/Platform/Pointer.h create mode 100644 rEFIt_UEFI/Platform/Settings.h create mode 100644 rEFIt_UEFI/entry_scan/bootscreen.h create mode 100644 rEFIt_UEFI/entry_scan/loader.h create mode 100644 rEFIt_UEFI/entry_scan/tool.h create mode 100644 rEFIt_UEFI/gui/menu_items/menu_globals.h create mode 100644 rEFIt_UEFI/gui/menu_items/menu_items.h create mode 100644 rEFIt_UEFI/refit/menu.h create mode 100644 rEFIt_UEFI/refit/screen.h diff --git a/rEFIt_UEFI/Platform/DataHubCpu.h b/rEFIt_UEFI/Platform/DataHubCpu.h new file mode 100644 index 000000000..453c25c35 --- /dev/null +++ b/rEFIt_UEFI/Platform/DataHubCpu.h @@ -0,0 +1,4 @@ + +EFI_STATUS +EFIAPI +SetVariablesForOSX (LOADER_ENTRY *Entry); diff --git a/rEFIt_UEFI/Platform/Events.h b/rEFIt_UEFI/Platform/Events.h new file mode 100644 index 000000000..3f4968930 --- /dev/null +++ b/rEFIt_UEFI/Platform/Events.h @@ -0,0 +1,5 @@ + +EFI_STATUS +EventsInitialize ( + IN LOADER_ENTRY *Entry + ); diff --git a/rEFIt_UEFI/Platform/Hibernate.h b/rEFIt_UEFI/Platform/Hibernate.h new file mode 100644 index 000000000..c0856f648 --- /dev/null +++ b/rEFIt_UEFI/Platform/Hibernate.h @@ -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 + ); diff --git a/rEFIt_UEFI/Platform/Nvram.h b/rEFIt_UEFI/Platform/Nvram.h new file mode 100644 index 000000000..5766c9345 --- /dev/null +++ b/rEFIt_UEFI/Platform/Nvram.h @@ -0,0 +1,5 @@ + +INTN +FindStartupDiskVolume ( + REFIT_MENU_SCREEN *MainMenu + ); diff --git a/rEFIt_UEFI/Platform/Platform.h b/rEFIt_UEFI/Platform/Platform.h index ca182ca4e..5a4a606a4 100755 --- a/rEFIt_UEFI/Platform/Platform.h +++ b/rEFIt_UEFI/Platform/Platform.h @@ -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 ( diff --git a/rEFIt_UEFI/Platform/Pointer.cpp b/rEFIt_UEFI/Platform/Pointer.cpp index 1d5b96868..3059d6ad7 100644 --- a/rEFIt_UEFI/Platform/Pointer.cpp +++ b/rEFIt_UEFI/Platform/Pointer.cpp @@ -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 diff --git a/rEFIt_UEFI/Platform/Pointer.h b/rEFIt_UEFI/Platform/Pointer.h new file mode 100644 index 000000000..857686a0f --- /dev/null +++ b/rEFIt_UEFI/Platform/Pointer.h @@ -0,0 +1,6 @@ + +EFI_STATUS +WaitForInputEventPoll ( + REFIT_MENU_SCREEN *Screen, + UINTN TimeoutDefault + ); diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index e2f1f01d3..120f325a6 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -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 diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h new file mode 100644 index 000000000..c22924306 --- /dev/null +++ b/rEFIt_UEFI/Platform/Settings.h @@ -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 + ); diff --git a/rEFIt_UEFI/Platform/ati.h b/rEFIt_UEFI/Platform/ati.h index 233a99c7d..0387fcd98 100644 --- a/rEFIt_UEFI/Platform/ati.h +++ b/rEFIt_UEFI/Platform/ati.h @@ -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 + ); + diff --git a/rEFIt_UEFI/Platform/kernel_patcher.h b/rEFIt_UEFI/Platform/kernel_patcher.h index 03f6f41a7..db04c5495 100644 --- a/rEFIt_UEFI/Platform/kernel_patcher.h +++ b/rEFIt_UEFI/Platform/kernel_patcher.h @@ -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); diff --git a/rEFIt_UEFI/cpp_foundation/XArray.h b/rEFIt_UEFI/cpp_foundation/XArray.h index 12d4eb551..20f8d6835 100755 --- a/rEFIt_UEFI/cpp_foundation/XArray.h +++ b/rEFIt_UEFI/cpp_foundation/XArray.h @@ -11,13 +11,6 @@ #if !defined(__XARRAY_H__) #define __XARRAY_H__ -//#include // 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 -// #include -// #include // for CpuDeadLoop(); -//} #include "XToolsCommon.h" diff --git a/rEFIt_UEFI/cpp_foundation/XObjArray.h b/rEFIt_UEFI/cpp_foundation/XObjArray.h index d9b9ec86c..89b2dcbc5 100755 --- a/rEFIt_UEFI/cpp_foundation/XObjArray.h +++ b/rEFIt_UEFI/cpp_foundation/XObjArray.h @@ -11,13 +11,6 @@ #if !defined(__XOBJARRAY_H__) #define __XOBJARRAY_H__ -//#include // 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 -// #include -// #include // for CpuDeadLoop(); -//} #include "XToolsCommon.h" diff --git a/rEFIt_UEFI/cpp_foundation/XStringW.cpp b/rEFIt_UEFI/cpp_foundation/XStringW.cpp index 74a5b8664..019465c63 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringW.cpp +++ b/rEFIt_UEFI/cpp_foundation/XStringW.cpp @@ -18,7 +18,6 @@ #define DBG(...) #endif -#include #include "XToolsCommon.h" #include "XStringW.h" diff --git a/rEFIt_UEFI/cpp_foundation/XStringW.h b/rEFIt_UEFI/cpp_foundation/XStringW.h index 11c5e4c32..ef37d3ff2 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringW.h +++ b/rEFIt_UEFI/cpp_foundation/XStringW.h @@ -10,7 +10,6 @@ #define __XSTRINGW_H__ #include "XToolsCommon.h" -#include #include "utf8Conversion.h" #define LPATH_SEPARATOR L'\\' diff --git a/rEFIt_UEFI/cpp_foundation/XStringWArray.cpp b/rEFIt_UEFI/cpp_foundation/XStringWArray.cpp index 12e450a13..7c15ea709 100755 --- a/rEFIt_UEFI/cpp_foundation/XStringWArray.cpp +++ b/rEFIt_UEFI/cpp_foundation/XStringWArray.cpp @@ -7,7 +7,6 @@ #if !defined(__XSTRINGWS_CPP__) #define __XSTRINGWS_CPP__ -#include #include "XToolsCommon.h" #include "XStringWArray.h" diff --git a/rEFIt_UEFI/cpp_foundation/utf8Conversion.cpp b/rEFIt_UEFI/cpp_foundation/utf8Conversion.cpp index ea8904cbf..969640555 100755 --- a/rEFIt_UEFI/cpp_foundation/utf8Conversion.cpp +++ b/rEFIt_UEFI/cpp_foundation/utf8Conversion.cpp @@ -6,9 +6,6 @@ #include "utf8Conversion.h" -#include - - #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/rEFIt_UEFI/entry_scan/bootscreen.cpp b/rEFIt_UEFI/entry_scan/bootscreen.cpp index 477b085a3..c36d2912a 100644 --- a/rEFIt_UEFI/entry_scan/bootscreen.cpp +++ b/rEFIt_UEFI/entry_scan/bootscreen.cpp @@ -33,6 +33,7 @@ */ #include "entry_scan.h" +#include "../refit/screen.h" #ifndef DEBUG_ALL #define DEBUG_BOOT_SCREEN 1 diff --git a/rEFIt_UEFI/entry_scan/bootscreen.h b/rEFIt_UEFI/entry_scan/bootscreen.h new file mode 100644 index 000000000..6ba622035 --- /dev/null +++ b/rEFIt_UEFI/entry_scan/bootscreen.h @@ -0,0 +1,5 @@ + +EFI_STATUS +InitBootScreen ( + IN LOADER_ENTRY *Entry + ); diff --git a/rEFIt_UEFI/entry_scan/common.cpp b/rEFIt_UEFI/entry_scan/common.cpp index 53eb5f611..752f937f7 100644 --- a/rEFIt_UEFI/entry_scan/common.cpp +++ b/rEFIt_UEFI/entry_scan/common.cpp @@ -34,6 +34,7 @@ */ #include "entry_scan.h" +#include "../refit/menu.h" #ifndef DEBUG_ALL #define DEBUG_COMMON_MENU 1 diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index b99aded46..8190f52ea 100644 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -34,6 +34,8 @@ */ #include "entry_scan.h" +#include "../refit/screen.h" +#include "../refit/menu.h" #ifndef DEBUG_ALL #define DEBUG_SCAN_LEGACY 1 diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index b973148a3..d124aa388 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -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 diff --git a/rEFIt_UEFI/entry_scan/loader.h b/rEFIt_UEFI/entry_scan/loader.h new file mode 100644 index 000000000..e69de29bb diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 0e8bd7450..95877482d 100644 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -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 diff --git a/rEFIt_UEFI/entry_scan/tool.h b/rEFIt_UEFI/entry_scan/tool.h new file mode 100644 index 000000000..e69de29bb diff --git a/rEFIt_UEFI/gui/menu_items/menu_globals.h b/rEFIt_UEFI/gui/menu_items/menu_globals.h new file mode 100644 index 000000000..c9f1ca1b6 --- /dev/null +++ b/rEFIt_UEFI/gui/menu_items/menu_globals.h @@ -0,0 +1 @@ +extern REFIT_MENU_SCREEN OptionMenu; diff --git a/rEFIt_UEFI/gui/menu_items/menu_items.h b/rEFIt_UEFI/gui/menu_items/menu_items.h new file mode 100644 index 000000000..7fa5f28a8 --- /dev/null +++ b/rEFIt_UEFI/gui/menu_items/menu_items.h @@ -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 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 */ diff --git a/rEFIt_UEFI/libeg/VectorGraphics.cpp b/rEFIt_UEFI/libeg/VectorGraphics.cpp index 0f8454815..49f6aa512 100644 --- a/rEFIt_UEFI/libeg/VectorGraphics.cpp +++ b/rEFIt_UEFI/libeg/VectorGraphics.cpp @@ -8,8 +8,8 @@ #include "nanosvg.h" #include "FloatLib.h" - #include "lodepng.h" +#include "../refit/screen.h" #ifndef DEBUG_ALL #define DEBUG_VEC 1 diff --git a/rEFIt_UEFI/refit/lib.h b/rEFIt_UEFI/refit/lib.h index a21d72e41..c1229a884 100644 --- a/rEFIt_UEFI/refit/lib.h +++ b/rEFIt_UEFI/refit/lib.h @@ -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 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 // diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 16db0d5f1..b83a6d8e9 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -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 diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 1d1109cb1..da6a4deb4 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -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 diff --git a/rEFIt_UEFI/refit/menu.h b/rEFIt_UEFI/refit/menu.h new file mode 100644 index 000000000..566103ebb --- /dev/null +++ b/rEFIt_UEFI/refit/menu.h @@ -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); + diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index 169f9d744..f5f9e1aad 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -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 diff --git a/rEFIt_UEFI/refit/screen.h b/rEFIt_UEFI/refit/screen.h new file mode 100644 index 000000000..ffc8c712c --- /dev/null +++ b/rEFIt_UEFI/refit/screen.h @@ -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);