mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
correct add legacy entry
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
f61d46411b
commit
f638ad999a
@ -52,7 +52,7 @@
|
||||
//the function is not in the class and deals always with MainMenu
|
||||
#if USE_XTHEME
|
||||
//I made args as pointers to have an ability to call with NULL
|
||||
BOOLEAN AddLegacyEntry(IN const XStringW* FullTitle, IN const XStringW* LoaderTitle, IN REFIT_VOLUME *Volume, IN const XImage* Image, IN const XImage* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
|
||||
BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTitle, IN REFIT_VOLUME *Volume, IN const XImage* Image, IN const XImage* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
|
||||
|
||||
#else
|
||||
BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume, IN EG_IMAGE *Image, IN EG_IMAGE *DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
|
||||
@ -112,7 +112,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
}
|
||||
#if USE_XTHEME
|
||||
XStringW LTitle;
|
||||
if (!LoaderTitle) {
|
||||
if (LoaderTitle.isEmpty()) {
|
||||
if (Volume->LegacyOS->Name != NULL) {
|
||||
LTitle.takeValueFrom(Volume->LegacyOS->Name);
|
||||
if (Volume->LegacyOS->Name[0] == 'W' || Volume->LegacyOS->Name[0] == 'L')
|
||||
@ -120,7 +120,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
} else
|
||||
LTitle = L"Legacy OS"_XSW;
|
||||
} else
|
||||
LTitle = *LoaderTitle;
|
||||
LTitle = LoaderTitle;
|
||||
#else
|
||||
|
||||
if (LoaderTitle == NULL) {
|
||||
@ -142,13 +142,13 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
// prepare the menu entry
|
||||
Entry = new LEGACY_ENTRY();
|
||||
#if USE_XTHEME
|
||||
if (FullTitle) {
|
||||
Entry->Title = *FullTitle;
|
||||
if (!FullTitle.isEmpty()) {
|
||||
Entry->Title = FullTitle;
|
||||
} else {
|
||||
if (ThemeX.BootCampStyle) {
|
||||
Entry->Title = LTitle;
|
||||
} else {
|
||||
Entry->Title = L"Boot "_XSW + *LoaderTitle + L" from "_XSW + VolDesc;
|
||||
Entry->Title = L"Boot "_XSW + LoaderTitle + L" from "_XSW + VolDesc;
|
||||
// Entry->Title.SWPrintf("Boot %ls from %ls", LoaderTitle->wc_str(), VolDesc);
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
#if USE_XTHEME
|
||||
if (ThemeX.HideBadges & HDBADGES_SHOW) {
|
||||
if (ThemeX.HideBadges & HDBADGES_SWAP) {
|
||||
Entry->BadgeImage = XImage(Entry->DriveImage, ThemeX.BadgeScale/16.f);
|
||||
Entry->BadgeImage = XImage(Entry->DriveImage, ThemeX.BadgeScale/16.f); //0 accepted
|
||||
} else {
|
||||
Entry->BadgeImage = XImage(Entry->Image, ThemeX.BadgeScale/16.f);
|
||||
}
|
||||
@ -223,7 +223,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
// SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
|
||||
SubScreen = new REFIT_MENU_SCREEN();
|
||||
#if USE_XTHEME
|
||||
SubScreen->Title = L"Boot Options for "_XSW + *LoaderTitle + L" on "_XSW + VolDesc;
|
||||
SubScreen->Title = L"Boot Options for "_XSW + LoaderTitle + L" on "_XSW + VolDesc;
|
||||
// SubScreen->Title.SWPrintf("Boot Options for %ls on %ls", LoaderTitle, VolDesc);
|
||||
#else
|
||||
SubScreen->Title = PoolPrint(L"Boot Options for %s on %s", LoaderTitle, VolDesc);
|
||||
@ -234,7 +234,7 @@ BOOLEAN AddLegacyEntry(IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle,
|
||||
// SubEntry = (__typeof__(SubEntry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
|
||||
SubEntry = new LEGACY_ENTRY();
|
||||
#if USE_XTHEME
|
||||
SubEntry->Title = L"Boot "_XSW + *LoaderTitle;
|
||||
SubEntry->Title = L"Boot "_XSW + LoaderTitle;
|
||||
#else
|
||||
SubEntry->Title.SWPrintf("Boot %ls", LoaderTitle);
|
||||
#endif
|
||||
@ -322,7 +322,7 @@ VOID ScanLegacy(VOID)
|
||||
|
||||
if (ShowVolume && (!Volume->Hidden)){
|
||||
// DBG(" add legacy\n");
|
||||
if (!AddLegacyEntry(NULL, NULL, Volume, NULL, NULL, 0, FALSE)) {
|
||||
if (!AddLegacyEntry(L""_XSW, L""_XSW, Volume, NULL, NULL, 0, FALSE)) {
|
||||
DBG("...entry not added\n");
|
||||
};
|
||||
} else {
|
||||
@ -473,7 +473,7 @@ VOID AddCustomLegacy(VOID)
|
||||
DriveImage.LoadXImage(ThemeX.ThemeDir, Custom->DriveImagePath);
|
||||
}
|
||||
// Create a legacy entry for this volume
|
||||
if (AddLegacyEntry(&Custom->FullTitle, &Custom->Title, Volume, &Image, &DriveImage, Custom->Hotkey, TRUE))
|
||||
if (AddLegacyEntry(Custom->FullTitle, Custom->Title, Volume, &Image, &DriveImage, Custom->Hotkey, TRUE))
|
||||
{
|
||||
DBG("match!\n");
|
||||
}
|
||||
|
@ -469,12 +469,12 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
}
|
||||
DBG("Banner parsed\n");
|
||||
BanHeight = (int)(Banner.GetHeight() * Scale + 1.f);
|
||||
DBG(" parsed banner->width=%lld\n", Banner.GetWidth());
|
||||
DBG(" parsed banner->width=%lld height=%lld\n", Banner.GetWidth(), BanHeight);
|
||||
|
||||
// --- Make other icons
|
||||
|
||||
for (INTN i = BUILTIN_ICON_FUNC_ABOUT; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
|
||||
if (i == BUILTIN_ICON_BANNER) {
|
||||
if (i == BUILTIN_ICON_BANNER) { //exclude "logo" as it done other way
|
||||
continue;
|
||||
}
|
||||
Icon* NewIcon = new Icon(i); //initialize with embedded but further replace by loaded
|
||||
@ -495,6 +495,11 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = ParseSVGXIcon(mainParser, BUILTIN_ICON_SELECTION, "selection_indicator"_XS, Scale, &SelectionImages[4]);
|
||||
}
|
||||
|
||||
//buttons
|
||||
for (INTN i = BUILTIN_RADIO_BUTTON; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
|
||||
Buttons[i - BUILTIN_RADIO_BUTTON] = GetIcon(i);
|
||||
}
|
||||
//for (int i=0 ; i<6 ; i+=2 ) {
|
||||
//SelectionImages[i].Draw(i*100, 0);
|
||||
//}
|
||||
|
@ -385,7 +385,7 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
}
|
||||
|
||||
//Then prepare Background from BigBack
|
||||
if (!Background.isEmpty() && (Background.GetWidth() != (UINTN)UGAWidth || Background.GetHeight() != (UINTN)UGAHeight)) { // should we type UGAWidth and UGAHeight as UINTN to avoid cast ?
|
||||
if (!Background.isEmpty() && (Background.GetWidth() != UGAWidth || Background.GetHeight() != UGAHeight)) { // should we type UGAWidth and UGAHeight as UINTN to avoid cast ?
|
||||
// Resolution changed
|
||||
Background.setEmpty();
|
||||
}
|
||||
@ -604,10 +604,10 @@ void XTheme::InitSelection() //for PNG theme
|
||||
// non-selected background images
|
||||
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff };
|
||||
if (!TypeSVG && !SelectionBigFileName.isEmpty()) {
|
||||
if (TypeSVG || !SelectionBigFileName.isEmpty()) {
|
||||
BackgroundPixel = { 0x00, 0x00, 0x00, 0x00 };
|
||||
} else if (DarkEmbedded || TypeSVG) {
|
||||
BackgroundPixel = { 0x33, 0x33, 0x33, 0x00 }; //nonsense
|
||||
} else if (DarkEmbedded) {
|
||||
BackgroundPixel = { 0x33, 0x33, 0x33, 0x00 }; //nonsense. Will be a sense if semi-transparent
|
||||
} else { //for example embedded daylight
|
||||
BackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff };
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
float CentreShift;
|
||||
INTN row0TileSize;
|
||||
INTN row1TileSize;
|
||||
UINTN BanHeight;
|
||||
INTN BanHeight;
|
||||
INTN LayoutHeight; //it was 376 before
|
||||
INTN LayoutBannerOffset;
|
||||
INTN LayoutButtonOffset;
|
||||
@ -110,7 +110,7 @@ public:
|
||||
XImage UpButtonImage;
|
||||
XImage DownButtonImage;
|
||||
|
||||
EG_RECT BannerPlace; //TODO exclude BanHeight = BannerPlace.Height
|
||||
EG_RECT BannerPlace;
|
||||
|
||||
//fill the theme
|
||||
const XImage& GetIcon(const XString& Name); //get by name
|
||||
|
Loading…
Reference in New Issue
Block a user