From 13588fb67c4cef36bfa51f1a0068a23dfc0506a4 Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Thu, 9 Apr 2020 06:32:57 +0300 Subject: [PATCH] allow triple os name like chrome,grub,linux Signed-off-by: Sergey Isakov --- rEFIt_UEFI/entry_scan/loader.cpp | 2 +- rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h | 1 + rEFIt_UEFI/libeg/XTheme.cpp | 15 ++++++++++++++- rEFIt_UEFI/refit/screen.cpp | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index c2ea1514b..c598c5294 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -2138,7 +2138,7 @@ if ((Image == NULL) && Custom->ImagePath) { if (Guid) { SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid)); } - SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.c_str()); + SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.c_str()); DBG("Create sub entries\n"); for (CustomSubEntry = Custom->SubEntries; CustomSubEntry; CustomSubEntry = CustomSubEntry->Next) { if (!CustomSubEntry->Settings) { diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h index f0c810b91..44d4b70eb 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h @@ -100,6 +100,7 @@ public: UINTN FrameTime; //ms EG_RECT FilmPlace; EG_IMAGE **Film; + ACTION mAction; UINTN mItemID; SCROLL_STATE ScrollState; diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index bcbc31f56..e044727a7 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -368,6 +368,7 @@ const XImage& XTheme::LoadOSIcon(const XString& Full) // input value can be L"win", L"ubuntu,linux", L"moja,mac" set by GetOSIconName (OSVersion) XString First; XString Second; + XString Third; const XImage *ReturnImage; UINTN Comma = Full.IdxOf(','); UINTN Size = Full.size(); @@ -379,7 +380,19 @@ const XImage& XTheme::LoadOSIcon(const XString& Full) if (!ReturnImage->isEmpty()) return *ReturnImage; //else search second name Second = "os_"_XS + Full.SubString(Comma+1, Size - Comma - 1); - ReturnImage = &GetIcon(Second); + //moreover names can be triple L"chrome,grub,linux" + UINTN SecondComma = Second.IdxOf(','); + if (Comma == MAX_XSIZE) { + ReturnImage = &GetIcon(Second); + if (!ReturnImage->isEmpty()) return *ReturnImage; + } else { + First = Second.SubString(0, SecondComma); + ReturnImage = &GetIcon(First); + if (!ReturnImage->isEmpty()) return *ReturnImage; + Third = "os_"_XS + Second.SubString(SecondComma + 1, Size - SecondComma - 1); + ReturnImage = &GetIcon(Third); + if (!ReturnImage->isEmpty()) return *ReturnImage; + } // DBG(" Second=%s\n", Second.c_str()); if (!ReturnImage->isEmpty()) return *ReturnImage; } else { diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index d5a4e063c..c0d8b34b4 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -1041,7 +1041,7 @@ VOID REFIT_MENU_SCREEN::InitAnime() p = LoadSvgFrame(i); // DBG("frame %d loaded\n", i); } else { - snwprintf(FileName, 512, "%ls\\%ls_%03llu.png", Path, Path, i); + snwprintf(FileName, 512, "%ls\\%ls_%03llu.png", Path, Path, i); p = egLoadImage(ThemeX.ThemeDir, FileName, TRUE); } if (!p) {