mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
dynamic daylight, some optimisation
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
6236534ec4
commit
85d3bd1ad9
@ -3985,6 +3985,9 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam, EFI_TIME *Time)
|
||||
UINTN Rnd;
|
||||
EFI_TIME Now;
|
||||
|
||||
DbgHeader("InitXTheme");
|
||||
ThemeX.Init();
|
||||
|
||||
//initialize Daylight when we know timezone
|
||||
if (GlobalConfig.Timezone != 0xFF) { // 0xFF:default=timezone not set
|
||||
gRT->GetTime(&Now, NULL);
|
||||
@ -4001,9 +4004,6 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam, EFI_TIME *Time)
|
||||
DBG("use night theme\n");
|
||||
}
|
||||
|
||||
DbgHeader("InitXTheme");
|
||||
ThemeX.Init();
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
// DBG("validate %d face\n", i);
|
||||
textFace[i].valid = FALSE;
|
||||
|
@ -76,7 +76,7 @@ const XStringArray LINUX_DEFAULT_OPTIONS = Split<XStringArray>("ro add_efi_memma
|
||||
#endif
|
||||
|
||||
|
||||
extern LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry);
|
||||
//extern LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry);
|
||||
|
||||
// Linux loader path data
|
||||
typedef struct LINUX_PATH_DATA
|
||||
@ -778,14 +778,17 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
UINT64 VolumeSize;
|
||||
EFI_GUID *Guid = NULL;
|
||||
BOOLEAN KernelIs64BitOnly;
|
||||
UINT64 os_version = AsciiOSVersionToUint64(Entry->OSVersion);
|
||||
UINT64 os_version = AsciiOSVersionToUint64(OSVersion);
|
||||
|
||||
constexpr LString8 quietLitteral = "quiet";
|
||||
constexpr LString8 splashLitteral = "splash";
|
||||
|
||||
// Only kernels up to 10.7 have 32-bit mode
|
||||
KernelIs64BitOnly = (OSVersion == NULL ||
|
||||
AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.8"));
|
||||
os_version >= AsciiOSVersionToUint64("10.8"));
|
||||
|
||||
const char* macOS = (os_version < AsciiOSVersionToUint64("10.8"))? "Mac OS X" :
|
||||
(os_version < AsciiOSVersionToUint64("10.12"))? "OS X" : "macOS";
|
||||
|
||||
FileName = LoaderPath.basename();
|
||||
|
||||
@ -810,13 +813,7 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
if (LoaderType == OSTYPE_OSX ||
|
||||
LoaderType == OSTYPE_OSX_INSTALLER ||
|
||||
LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubScreen->AddMenuInfoLine_f("Mac OS X: %s", OSVersion);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubScreen->AddMenuInfoLine_f("OS X: %s", OSVersion);
|
||||
} else {
|
||||
SubScreen->AddMenuInfoLine_f("macOS: %s", OSVersion);
|
||||
}
|
||||
SubScreen->AddMenuInfoLine_f("%s: %s", macOS, OSVersion);
|
||||
|
||||
if (OSFLAG_ISSET(Flags, OSFLAG_HIBERNATED)) {
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
@ -829,25 +826,13 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X with selected options");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title.takeValueFrom("Boot OS X with selected options");
|
||||
} else {
|
||||
SubEntry->Title.takeValueFrom("Boot macOS with selected options");
|
||||
}
|
||||
SubEntry->Title.SWPrintf("Boot %s with selected options", macOS);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X with injected kexts");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title.takeValueFrom("Boot OS X with injected kexts");
|
||||
} else {
|
||||
SubEntry->Title.takeValueFrom("Boot macOS with injected kexts");
|
||||
}
|
||||
SubEntry->Title.SWPrintf("Boot %s with injected kexts", macOS);
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
|
||||
SubEntry->Flags = OSFLAG_SET(SubEntry->Flags, OSFLAG_WITHKEXTS);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
@ -855,31 +840,20 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubEntry->Title.takeValueFrom("Boot Mac OS X without injected kexts");
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
SubEntry->Title.takeValueFrom("Boot OS X without injected kexts");
|
||||
} else {
|
||||
SubEntry->Title.takeValueFrom("Boot macOS without injected kexts");
|
||||
}
|
||||
SubEntry->Title.SWPrintf("Boot %s without injected kexts", macOS);
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_CHECKFAKESMC);
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_WITHKEXTS);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(Entry), true);
|
||||
SubScreen->AddMenuEntry(SubMenuKextInjectMgmt(), true);
|
||||
SubScreen->AddMenuInfo_f("=== boot-args ===");
|
||||
if (!KernelIs64BitOnly) {
|
||||
if (os_version < AsciiOSVersionToUint64("10.8")) {
|
||||
SubScreen->AddMenuCheck("Mac OS X 32bit", OPT_I386, 68);
|
||||
SubScreen->AddMenuCheck("Mac OS X 64bit", OPT_X64, 68);
|
||||
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
|
||||
// SubScreen->AddMenuCheck("OS X 32bit", OPT_I386, 68); //it cant be 32 bit
|
||||
SubScreen->AddMenuCheck("OS X 64bit", OPT_X64, 68);
|
||||
} else {
|
||||
// SubScreen->AddMenuCheck("macOS 32bit", OPT_I386, 68);
|
||||
SubScreen->AddMenuCheck("macOS 64bit", OPT_X64, 68);
|
||||
}
|
||||
// SubScreen->AddMenuCheck(XString8().SPrintf("%s 64bit", macOS).c_str(), OPT_X64, 68);
|
||||
SubScreen->AddMenuCheck((macOS + " 64bit"_XS8).c_str(), OPT_X64, 68);
|
||||
}
|
||||
SubScreen->AddMenuCheck("Verbose (-v)", OPT_VERBOSE, 68);
|
||||
// No Caches option works on 10.6 - 10.9
|
||||
@ -966,40 +940,40 @@ void LOADER_ENTRY::AddDefaultMenu()
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
} else if ((Entry->LoaderType == OSTYPE_WIN) || (Entry->LoaderType == OSTYPE_WINEFI)) {
|
||||
} else if ((LoaderType == OSTYPE_WIN) || (LoaderType == OSTYPE_WINEFI)) {
|
||||
// by default, skip the built-in selection and boot from hard disk only
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-s"_XS8);
|
||||
LoadOptions.Add("-h"_XS8);
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-s"_XS8);
|
||||
LoadOptions.Add("-h"_XS8);
|
||||
|
||||
// default entry
|
||||
SubEntry =getPartiallyDuplicatedEntry();
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.SWPrintf("Run %ls", FileName.wc_str());
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry =getPartiallyDuplicatedEntry();
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.takeValueFrom("Boot Windows from Hard Disk");
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry =getPartiallyDuplicatedEntry();
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.takeValueFrom("Boot Windows from CD-ROM");
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-s"_XS8);
|
||||
LoadOptions.Add("-c"_XS8);
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-s"_XS8);
|
||||
LoadOptions.Add("-c"_XS8);
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
||||
SubEntry =getPartiallyDuplicatedEntry();
|
||||
SubEntry = getPartiallyDuplicatedEntry();
|
||||
if (SubEntry) {
|
||||
SubEntry->Title.SWPrintf("Run %ls in text mode", FileName.wc_str());
|
||||
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_USEGRAPHICS);
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-v"_XS8);
|
||||
LoadOptions.setEmpty();
|
||||
LoadOptions.Add("-v"_XS8);
|
||||
SubEntry->LoaderType = OSTYPE_OTHER; // Sothor - Why are we using OSTYPE_OTHER here?
|
||||
SubScreen->AddMenuEntry(SubEntry, true);
|
||||
}
|
||||
|
@ -270,10 +270,6 @@ VOID AddCustomTool(VOID)
|
||||
}
|
||||
|
||||
// skip volume if its kind is configured as disabled
|
||||
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) ||
|
||||
(Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) ||
|
||||
(Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) ||
|
||||
(Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE)))*/
|
||||
if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0)
|
||||
{
|
||||
DBG("skipped because media is disabled\n");
|
||||
@ -281,10 +277,6 @@ VOID AddCustomTool(VOID)
|
||||
}
|
||||
|
||||
if (Custom->VolumeType != 0) {
|
||||
/* if ((Volume->DiskKind == DISK_KIND_OPTICAL && ((Custom->VolumeType & VOLTYPE_OPTICAL) == 0)) ||
|
||||
(Volume->DiskKind == DISK_KIND_EXTERNAL && ((Custom->VolumeType & VOLTYPE_EXTERNAL) == 0)) ||
|
||||
(Volume->DiskKind == DISK_KIND_INTERNAL && ((Custom->VolumeType & VOLTYPE_INTERNAL) == 0)) ||
|
||||
(Volume->DiskKind == DISK_KIND_FIREWIRE && ((Custom->VolumeType & VOLTYPE_FIREWIRE) == 0)))*/
|
||||
if (((1ull<<Volume->DiskKind) & Custom->VolumeType) == 0) {
|
||||
DBG("skipped because media is ignored\n");
|
||||
continue;
|
||||
|
@ -712,11 +712,10 @@ UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc)
|
||||
|
||||
// TimeoutDefault for a wait in seconds
|
||||
// return EFI_TIMEOUT if no inputs
|
||||
//the function must be in menu class
|
||||
//the function must be in menu_screen class
|
||||
//so UpdatePointer(); => mPointer.Update(&gItemID, &Screen->mAction);
|
||||
EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefault)
|
||||
EFI_STATUS REFIT_MENU_SCREEN::WaitForInputEventPoll(UINTN TimeoutDefault)
|
||||
{
|
||||
REFIT_MENU_SCREEN& Screen = *ScreenPtr;
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
UINTN TimeoutRemain = TimeoutDefault * 100;
|
||||
|
||||
@ -725,14 +724,14 @@ EFI_STATUS WaitForInputEventPoll(REFIT_MENU_SCREEN* ScreenPtr, UINTN TimeoutDefa
|
||||
if (Status != EFI_TIMEOUT) {
|
||||
break;
|
||||
}
|
||||
Screen.UpdateFilm();
|
||||
UpdateFilm();
|
||||
if (gSettings.PlayAsync) {
|
||||
CheckSyncSound();
|
||||
}
|
||||
TimeoutRemain--;
|
||||
if (Screen.mPointer.isAlive()) {
|
||||
Screen.mPointer.UpdatePointer();
|
||||
Status = Screen.CheckMouseEvent(); //out: gItemID, gAction
|
||||
if (mPointer.isAlive()) {
|
||||
mPointer.UpdatePointer(!Daylight);
|
||||
Status = CheckMouseEvent(); //out: gItemID, gAction
|
||||
if (Status != EFI_TIMEOUT) { //this check should return timeout if no mouse events occured
|
||||
break;
|
||||
}
|
||||
@ -826,7 +825,19 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN MENU_STYLE_FUNC StyleFunc, IN OUT INT
|
||||
mGuiReady = TRUE;
|
||||
DBG("GUI ready\n");
|
||||
}
|
||||
Status = WaitForInputEventPoll(this, 1); //wait for 1 seconds.
|
||||
|
||||
EFI_TIME Now;
|
||||
gRT->GetTime(&Now, NULL);
|
||||
if (GlobalConfig.Timezone != 0xFF) {
|
||||
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
|
||||
if (NowHour < 0 ) NowHour += 24;
|
||||
if (NowHour >= 24 ) NowHour -= 24;
|
||||
Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member
|
||||
} else {
|
||||
Daylight = true;
|
||||
}
|
||||
|
||||
Status = WaitForInputEventPoll(1); //wait for 1 seconds.
|
||||
if (Status == EFI_TIMEOUT) {
|
||||
if (HaveTimeout) {
|
||||
if (TimeoutCountdown <= 0) {
|
||||
@ -1900,7 +1911,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
|
||||
INTN X = XPos - (TextWidth >> 1) - (BadgeDim + 16);
|
||||
INTN Y = YPos - ((BadgeDim - ThemeX.TextHeight) >> 1);
|
||||
Back.CopyRect(ThemeX.Background, X, Y);
|
||||
Back.Compose(0, 0, Entries[ScrollState.CurrentSelection].Image.GetBest(!ThemeX.Daylight), false, BadgeDim/128.f);
|
||||
Back.Compose(0, 0, Entries[ScrollState.CurrentSelection].Image.GetBest(!Daylight), false, BadgeDim/128.f);
|
||||
Back.DrawOnBack(X, Y, Back);
|
||||
}
|
||||
|
||||
@ -2015,7 +2026,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
|
||||
|
||||
// const XImage& MainImage = (!ThemeX.Daylight && !MainIcon.ImageNight.isEmpty())? MainIcon.ImageNight : MainIcon.Image;
|
||||
|
||||
const XImage& MainImage = MainIcon.GetBest(!ThemeX.Daylight);
|
||||
const XImage& MainImage = MainIcon.GetBest(!Daylight);
|
||||
|
||||
INTN CompWidth = (Entry->Row == 0) ? ThemeX.row0TileSize : ThemeX.row1TileSize;
|
||||
INTN CompHeight = CompWidth;
|
||||
@ -2064,7 +2075,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
|
||||
float fBadgeScale = ThemeX.BadgeScale/16.f;
|
||||
if ((Entry->Row == 0) && BadgeIcon && !BadgeIcon->isEmpty()) {
|
||||
// const XImage& BadgeImage = (!ThemeX.Daylight && !BadgeIcon->ImageNight.isEmpty()) ? &BadgeIcon->ImageNight : BadgeImage = &BadgeIcon->Image;
|
||||
const XImage& BadgeImage = BadgeIcon->GetBest(!ThemeX.Daylight);
|
||||
const XImage& BadgeImage = BadgeIcon->GetBest(!Daylight);
|
||||
INTN BadgeWidth = (INTN)(BadgeImage.GetWidth() * fBadgeScale);
|
||||
INTN BadgeHeight = (INTN)(BadgeImage.GetHeight() * fBadgeScale);
|
||||
|
||||
|
@ -36,9 +36,11 @@
|
||||
#define __REFIT_MENU_SCREEN_H__
|
||||
|
||||
|
||||
#include "../libeg/libeg.h"
|
||||
#include "../libeg/libegint.h"
|
||||
//#include "../libeg/libeg.h"
|
||||
#include "../refit/lib.h"
|
||||
|
||||
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringArray.h"
|
||||
@ -51,7 +53,6 @@
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
|
||||
//some unreal values
|
||||
#define FILM_CENTRE 40000
|
||||
//#define FILM_LEFT 50000
|
||||
@ -80,6 +81,7 @@ public:
|
||||
XObjArray<REFIT_ABSTRACT_MENU_ENTRY> Entries;
|
||||
|
||||
INTN TimeoutSeconds;
|
||||
bool Daylight;
|
||||
XStringW TimeoutText;
|
||||
XStringW ThemeName; //?
|
||||
EG_RECT OldTextBufferRect;
|
||||
@ -111,15 +113,26 @@ public:
|
||||
|
||||
REFIT_MENU_SCREEN()
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
TimeoutSeconds(0), Daylight(false), TimeoutText(), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
{
|
||||
EFI_TIME Now;
|
||||
gRT->GetTime(&Now, NULL);
|
||||
if (GlobalConfig.Timezone != 0xFF) {
|
||||
INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
|
||||
if (NowHour < 0 ) NowHour += 24;
|
||||
if (NowHour >= 24 ) NowHour -= 24;
|
||||
Daylight = (NowHour > 8) && (NowHour < 20); //this is the screen member
|
||||
} else {
|
||||
Daylight = true;
|
||||
}
|
||||
};
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText)
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
TimeoutSeconds(0), Daylight(false), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
@ -128,7 +141,7 @@ public:
|
||||
//TODO exclude CHAR16
|
||||
REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* TitleC, CONST CHAR16* TimeoutTextC)
|
||||
: ID(ID), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
TimeoutSeconds(0), Daylight(false), TimeoutText(), ThemeName(),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
@ -139,7 +152,7 @@ public:
|
||||
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
||||
: ID(ID), Title(TTitle), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TTimeoutText), ThemeName(),
|
||||
TimeoutSeconds(0), Daylight(false), TimeoutText(TTimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
/*AnimeRun(0), LastDraw(0), CurrentFrame(0),*/
|
||||
FilmC(),
|
||||
@ -157,11 +170,12 @@ public:
|
||||
VOID ScrollingBar();
|
||||
VOID SetBar(INTN PosX, INTN UpPosY, INTN DownPosY, IN SCROLL_STATE *State);
|
||||
|
||||
//mouse functions
|
||||
//mouse functions and event
|
||||
VOID HidePointer();
|
||||
EFI_STATUS MouseBirth();
|
||||
VOID KillMouse();
|
||||
EFI_STATUS CheckMouseEvent();
|
||||
EFI_STATUS WaitForInputEventPoll(UINTN TimeoutDefault);
|
||||
|
||||
//menu functions
|
||||
VOID AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor);
|
||||
|
@ -466,6 +466,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
void AddDefaultMenu();
|
||||
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
|
||||
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
|
||||
LOADER_ENTRY* SubMenuKextInjectMgmt();
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
XPointer::XPointer()
|
||||
: SimplePointerProtocol(NULL), PointerImage(NULL),
|
||||
// newImage(POINTER_WIDTH, POINTER_HEIGHT),
|
||||
oldImage(0, 0), Alive(false)
|
||||
oldImage(0, 0), Alive(false), night(false)
|
||||
{
|
||||
|
||||
}
|
||||
@ -88,7 +88,7 @@ EFI_STATUS XPointer::MouseBirth()
|
||||
PointerImage = nullptr;
|
||||
}
|
||||
// Now update image because of other theme has other image
|
||||
PointerImage = new XImage(ThemeX.GetIcon(BUILTIN_ICON_POINTER).GetBest(!ThemeX.Daylight));
|
||||
PointerImage = new XImage(ThemeX.GetIcon(BUILTIN_ICON_POINTER).GetBest(night));
|
||||
|
||||
oldImage.setSizeInPixels(PointerImage->GetWidth(), PointerImage->GetHeight());
|
||||
LastClickTime = 0;
|
||||
@ -135,7 +135,7 @@ VOID XPointer::KillMouse()
|
||||
SimplePointerProtocol = NULL;
|
||||
}
|
||||
|
||||
VOID XPointer::UpdatePointer()
|
||||
VOID XPointer::UpdatePointer(bool daylight)
|
||||
{
|
||||
UINT64 Now;
|
||||
EFI_STATUS Status;
|
||||
@ -143,6 +143,8 @@ VOID XPointer::UpdatePointer()
|
||||
EFI_SIMPLE_POINTER_MODE *CurrentMode;
|
||||
INTN ScreenRelX;
|
||||
INTN ScreenRelY;
|
||||
|
||||
night = !daylight;
|
||||
|
||||
// Now = gRT->GetTime(&Now, NULL);
|
||||
Now = AsmReadTsc();
|
||||
|
@ -26,13 +26,14 @@ protected:
|
||||
EFI_SIMPLE_POINTER_STATE State;
|
||||
MOUSE_EVENT MouseEvent;
|
||||
bool Alive;
|
||||
bool night;
|
||||
|
||||
public:
|
||||
void Hide();
|
||||
bool isAlive();
|
||||
EFI_STATUS MouseBirth();
|
||||
VOID KillMouse();
|
||||
VOID UpdatePointer();
|
||||
VOID UpdatePointer(bool daylight);
|
||||
bool MouseInRect(EG_RECT *Place);
|
||||
|
||||
bool isEmpty() const { return PointerImage->isEmpty(); }
|
||||
|
@ -1949,7 +1949,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuKextBlockInjection(CONST CHAR16* UniSysVer)
|
||||
return Entry;
|
||||
}
|
||||
|
||||
LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt()
|
||||
{
|
||||
LOADER_ENTRY *SubEntry;
|
||||
REFIT_MENU_SCREEN *SubScreen;
|
||||
@ -1957,11 +1957,11 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
// UINTN i;
|
||||
CHAR8 ShortOSVersion[8];
|
||||
// CHAR16 *UniSysVer = NULL;
|
||||
CHAR8 *ChosenOS = Entry->OSVersion;
|
||||
CHAR8 *ChosenOS = OSVersion;
|
||||
|
||||
SubEntry = new LOADER_ENTRY();
|
||||
NewEntry_(SubEntry, &SubScreen, ActionEnter, SCREEN_SYSTEM, "Block injected kexts->");
|
||||
SubEntry->Flags = Entry->Flags;
|
||||
SubEntry->Flags = Flags;
|
||||
if (ChosenOS) {
|
||||
// DBG("chosen os %s\n", ChosenOS);
|
||||
//shorten os version 10.11.6 -> 10.11
|
||||
@ -1976,7 +1976,6 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SubScreen->AddMenuInfoLine_f("Block injected kexts for target version of macOS: %s",
|
||||
ShortOSVersion);
|
||||
|
||||
@ -1985,11 +1984,11 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(L"10"), true);
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "10_install");
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "10_recovery");
|
||||
}
|
||||
else {
|
||||
@ -2005,11 +2004,11 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
snwprintf(DirName, sizeof(DirName), "%s", ShortOSVersion);
|
||||
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "%s_install", ShortOSVersion);
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "%s_recovery", ShortOSVersion);
|
||||
}
|
||||
else {
|
||||
@ -2025,27 +2024,27 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry)
|
||||
{
|
||||
{
|
||||
CHAR16 OSVersionKextsDirName[256];
|
||||
if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) {
|
||||
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s.0", Entry->OSVersion);
|
||||
if ( AsciiStrCmp(ShortOSVersion, OSVersion) == 0 ) {
|
||||
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s.0", OSVersion);
|
||||
}else{
|
||||
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s", Entry->OSVersion);
|
||||
snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s", OSVersion);
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true);
|
||||
}
|
||||
|
||||
CHAR16 DirName[256];
|
||||
if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_INSTALLER(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "%s_install",
|
||||
Entry->OSVersion);
|
||||
OSVersion);
|
||||
}
|
||||
else {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) {
|
||||
if (OSTYPE_IS_OSX_RECOVERY(LoaderType)) {
|
||||
snwprintf(DirName, sizeof(DirName), "%s_recovery",
|
||||
Entry->OSVersion);
|
||||
OSVersion);
|
||||
}
|
||||
else {
|
||||
snwprintf(DirName, sizeof(DirName), "%s_normal",
|
||||
Entry->OSVersion);
|
||||
OSVersion);
|
||||
}
|
||||
}
|
||||
SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true);
|
||||
|
Loading…
Reference in New Issue
Block a user