Correct Linux Kernel scanning; Some more gui tweaks

This commit is contained in:
asava 2020-05-10 02:40:55 +03:00
parent 8a9bfcb011
commit 296db9ebc5
3 changed files with 31 additions and 33 deletions

View File

@ -1158,7 +1158,9 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
}
}
} else if (Type != OSTYPE_LIN) { //OSTYPE_LINEFI or unspecified
}
if (Type != OSTYPE_LIN) { //OSTYPE_LINEFI or unspecified
// check for linux kernels
PartGUID = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if ((PartGUID != NULL) && (Volume->RootDir != NULL)) {
@ -1311,7 +1313,7 @@ STATIC VOID LinuxScan(REFIT_VOLUME *Volume, UINT8 KernelScan, UINT8 Type, XStrin
if (FileInfo->FileSize > 0) {
// get the kernel file path
Path.SWPrintf("%ls\\%ls", LINUX_BOOT_PATH, FileInfo->FileName);
XStringArray Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXStringArray);
XStringArray Options = LinuxKernelOptions(Iter.DirHandle, Basename(Path.wc_str()) + LINUX_LOADER_PATH.length(), PartUUID, NullXStringArray);
// Add the entry
AddLoaderEntry(Path, (Options.isEmpty()) ? LINUX_DEFAULT_OPTIONS : Options, L""_XSW, Volume, NULL, OSTYPE_LINEFI, OSFLAG_NODEFAULTARGS);
Path.setEmpty();

View File

@ -152,7 +152,7 @@ static INTN *itemPosY = NULL;
static INTN row0PosY, row1PosY, textPosY, FunctextPosY;
static INTN OldX = 0, OldY = 0;
static INTN OldTextWidth = 0;
static INTN OldTextWidth = 0, OldTextHeight = 0;
static UINTN OldRow = 0;
static INTN OldTimeoutTextWidth = 0;
static INTN MenuWidth , TimeoutPosY;
@ -1370,6 +1370,7 @@ INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INT
} else {
Height = ThemeX.TextHeight;
}
OldTextHeight = Height;
// TextBufferXY = egCreateFilledImage(TextWidth, Height, TRUE, &MenuBackgroundPixel);
TextBufferXY.setSizeInPixels(TextWidth, Height);
@ -1437,17 +1438,11 @@ VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN
DrawTextXY(BCSTextX, XPos, YPos, XAlign);
}
VOID REFIT_MENU_SCREEN::DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor)
VOID REFIT_MENU_SCREEN::DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth)
{
INTN MaxWidth;
if (MenuWidth + XPos <= UGAWidth) {
MaxWidth = MenuWidth;
} else {
MaxWidth = UGAWidth - XPos;
}
XImage TextBufferX(MaxWidth, ThemeX.TextHeight);
XImage SelectionBar(MaxWidth, ThemeX.TextHeight);
INTN Width = (MaxWidth > 0 && (XPos + MaxWidth <= UGAWidth)) ? MaxWidth : UGAWidth - XPos;
XImage TextBufferX(Width, ThemeX.TextHeight);
XImage SelectionBar(Width, ThemeX.TextHeight);
/*
if (Cursor == 0xFFFF) { //InfoLine = 0xFFFF
@ -1649,10 +1644,10 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
if (InfoLines.size() > 0) {
// DrawMenuText(NULL, 0, 0, 0, 0);
// DrawMenuText(NULL, 0, 0, 0, 0, 0);
//EraseTextXY(); //but we should make it complementare to DrawMenuText
for (UINTN i = 0; i < InfoLines.size(); i++) {
DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF);
DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF, 0);
EntriesPosY += ThemeX.TextHeight;
}
EntriesPosY += ThemeX.TextHeight; // also add a blank line
@ -1705,7 +1700,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if (inputDialogEntry->Item && inputDialogEntry->Item->ItemType == BoolValue) {
//possible artefacts
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
ctrlTextX, Entry->Place.YPos, 0xFFFF);
ctrlTextX, Entry->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.FillRectAreaOfScreen((ctrlTextX + ctrlX) >> 1, Entry->Place.YPos, ctrlTextX - ctrlX, ThemeX.TextHeight); //clean head
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background);
} else {
@ -1717,12 +1712,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
// Slice - suppose to use Row as Cursor in text
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0,
EntriesPosX, Entry->Place.YPos, TitleLen + Entry->Row);
EntriesPosX, Entry->Place.YPos, TitleLen + Entry->Row, MenuWidth);
ThemeX.FillRectAreaOfScreen(MenuWidth + ((ctrlTextX + EntriesPosX) >> 1), Entry->Place.YPos, ctrlTextX - EntriesPosX, ThemeX.TextHeight); //clean tail
}
} else if (Entry->getREFIT_MENU_CHECKBIT()) {
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
ctrlTextX, Entry->Place.YPos, 0xFFFF);
ctrlTextX, Entry->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.FillRectAreaOfScreen((ctrlTextX + ctrlX) >> 1, Entry->Place.YPos, ctrlTextX - ctrlX, ThemeX.TextHeight); //clean head
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].DrawOnBack(ctrlX, ctrlY, ThemeX.Background);
} else if (Entry->getREFIT_MENU_SWITCH()) {
@ -1738,13 +1733,13 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0,
// clovy EntriesPosX + (TextHeight + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale)),
ctrlTextX, Entry->Place.YPos, 0xFFFF);
ctrlTextX, Entry->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.FillRectAreaOfScreen((ctrlTextX + ctrlX) >> 1, Entry->Place.YPos, ctrlTextX - ctrlX, ThemeX.TextHeight); //clean head
ThemeX.Buttons[(Entry->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, ctrlY, ThemeX.Background);
} else {
//DBG("paint entry %d title=%ls\n", i, Entries[i]->Title);
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0,
EntriesPosX, Entry->Place.YPos, 0xFFFF);
EntriesPosX, Entry->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.FillRectAreaOfScreen(MenuWidth + ((ctrlTextX + EntriesPosX) >> 1), Entry->Place.YPos, ctrlTextX - EntriesPosX, ThemeX.TextHeight); //clean tail
}
}
@ -1782,12 +1777,12 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
if (inputDialogEntry->Item->ItemType == BoolValue) { //this is checkbox
//clovy
DrawMenuText(ResultString, 0,
ctrlTextX, EntryL->Place.YPos, 0xFFFF);
ctrlTextX, EntryL->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background);
} else {
ResultString += (inputDialogEntry->Item->SValue + inputDialogEntry->Item->LineShift) + L" "_XSW;
DrawMenuText(ResultString, 0,
EntriesPosX, EntryL->Place.YPos, TitleLen + EntryL->Row);
EntriesPosX, EntryL->Place.YPos, TitleLen + EntryL->Row, MenuWidth);
ThemeX.FillRectAreaOfScreen(MenuWidth + ((ctrlTextX + EntriesPosX) >> 1), EntryL->Place.YPos, ctrlTextX - EntriesPosX, ThemeX.TextHeight); //clean tail
}
} else if (EntryL->getREFIT_MENU_SWITCH()) { //radio buttons 0,1
@ -1802,16 +1797,16 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
}
// clovy
DrawMenuText(ResultString, 0,
ctrlTextX, EntryL->Place.YPos, 0xFFFF);
ctrlTextX, EntryL->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(EntryL->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre1, ThemeX.Background);
} else if (EntryL->getREFIT_MENU_CHECKBIT()) {
// clovy
DrawMenuText(ResultString, 0,
ctrlTextX, EntryL->Place.YPos, 0xFFFF);
ctrlTextX, EntryL->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(EntryL->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryL->Row) ?3:2].DrawOnBack(ctrlX, EntryL->Place.YPos + PlaceCentre, ThemeX.Background);
} else {
DrawMenuText(ResultString, 0,
EntriesPosX, EntryL->Place.YPos, 0xFFFF);
EntriesPosX, EntryL->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.FillRectAreaOfScreen(MenuWidth + ((ctrlTextX + EntriesPosX) >> 1), EntryL->Place.YPos, ctrlTextX - EntriesPosX, ThemeX.TextHeight); //clean tail
}
@ -1837,24 +1832,24 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
REFIT_INPUT_DIALOG* inputDialogEntry = (REFIT_INPUT_DIALOG*)EntryC;
if (inputDialogEntry->Item->ItemType == BoolValue) { //checkbox
DrawMenuText(ResultString, MenuWidth,
ctrlTextX, EntryC->Place.YPos, 0xFFFF);
ctrlTextX, EntryC->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre, ThemeX.Background);
} else {
ResultString += (inputDialogEntry->Item->SValue + inputDialogEntry->Item->LineShift) + L" "_XSW;
DrawMenuText(ResultString, MenuWidth,
EntriesPosX, EntryC->Place.YPos, TitleLen + EntryC->Row);
EntriesPosX, EntryC->Place.YPos, TitleLen + EntryC->Row, MenuWidth);
}
} else if (EntryC->getREFIT_MENU_SWITCH()) { //radio
DrawMenuText(ResultString, MenuWidth,
ctrlTextX, EntryC->Place.YPos, 0xFFFF);
ctrlTextX, EntryC->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(EntryC->Row == OldChosenItem)?1:0].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre1, ThemeX.Background);
} else if (EntryC->getREFIT_MENU_CHECKBIT()) {
DrawMenuText(ResultString, MenuWidth,
ctrlTextX, EntryC->Place.YPos, 0xFFFF);
ctrlTextX, EntryC->Place.YPos, 0xFFFF, MenuWidth);
ThemeX.Buttons[(EntryC->getREFIT_MENU_CHECKBIT()->Item->IValue & EntryC->Row)?3:2].DrawOnBack(ctrlX, EntryC->Place.YPos + PlaceCentre, ThemeX.Background);
} else {
DrawMenuText(ResultString, MenuWidth,
EntriesPosX, EntryC->Place.YPos, 0xFFFF);
EntriesPosX, EntryC->Place.YPos, 0xFFFF, MenuWidth);
}
ScrollStart.YPos = ScrollbarBackground.YPos + ScrollbarBackground.Height * ScrollState.FirstVisible / (ScrollState.MaxIndex + 1);
@ -1868,7 +1863,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
case MENU_FUNCTION_PAINT_TIMEOUT: //ParamText should be XStringW
ResultString.takeValueFrom(ParamText);
INTN X = (UGAWidth - StrLen(ParamText) * ScaledWidth) >> 1;
DrawMenuText(ResultString, 0, X, TimeoutPosY, 0xFFFF);
DrawMenuText(ResultString, 0, X, TimeoutPosY, 0xFFFF, 0);
break;
}
@ -1888,7 +1883,7 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
//Clear old text
// if (OldTextWidth > TextWidth) {
ThemeX.FillRectAreaOfScreen(OldX, OldY, OldTextWidth, ThemeX.TextHeight);
ThemeX.FillRectAreaOfScreen(OldX, OldY, OldTextWidth, OldTextHeight);
// }
if (!(ThemeX.BootCampStyle)
@ -2584,6 +2579,7 @@ UINTN REFIT_MENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABSTRAC
OldX = 0;
OldY = 0;
OldTextWidth = 0;
OldTextHeight = 0;
OldRow = 0;
OldTimeoutTextWidth = 0;

View File

@ -194,7 +194,7 @@ public:
INTN DrawTextXY(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
void EraseTextXY();
VOID DrawTextCorner(UINTN TextC, UINT8 Align);
VOID DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor);
VOID DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN UINTN Cursor, IN INTN MaxWidth);
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
VOID CountItems();
VOID InitAnime();