MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / AddLegacyEntry

Function AddLegacyEntry

rEFIt_UEFI/entry_scan/legacy.cpp:55–189  ·  view source on GitHub ↗

the function is not in the class and deals always with MainMenu I made args as pointers to have an ability to call with NULL

Source from the content-addressed store, hash-verified

53//the function is not in the class and deals always with MainMenu
54//I made args as pointers to have an ability to call with NULL
55BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN CHAR16 Hotkey, IN BOOLEAN CustomEntry)
56{
57 LEGACY_ENTRY *Entry, *SubEntry;
58 REFIT_MENU_SCREEN *SubScreen;
59 XStringW VolDesc;
60 CHAR16 ShortcutLetter = 0;
61// INTN i;
62
63 if (Volume == NULL) {
64 return false;
65 }
66 // Ignore this loader if it's device path is already present in another loader
67 for (UINTN i = 0; i < MainMenu.Entries.size(); ++i) {
68 REFIT_ABSTRACT_MENU_ENTRY& MainEntry = MainMenu.Entries[i];
69// DBG("entry %lld\n", i);
70 // Only want legacy
71 if (MainEntry.getLEGACY_ENTRY()) {
72 if ( MainEntry.getLEGACY_ENTRY()->DevicePathString.equalIC(Volume->DevicePathString) ) {
73 return true;
74 }
75 }
76 }
77 XStringW LTitle;
78 if (LoaderTitle.isEmpty()) {
79 if (Volume->LegacyOS->Name.notEmpty()) {
80 LTitle.takeValueFrom(Volume->LegacyOS->Name);
81 if (Volume->LegacyOS->Name[0] == 'W' || Volume->LegacyOS->Name[0] == 'L')
82 ShortcutLetter = Volume->LegacyOS->Name[0];
83 } else
84 LTitle = L"Legacy OS"_XSW;
85 } else
86 LTitle = LoaderTitle;
87 if (Volume->VolName.notEmpty())
88 VolDesc = Volume->VolName;
89 else
90 VolDesc.takeValueFrom((Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : L"HD");
91//DBG("VolDesc=%ls\n", VolDesc);
92
93 // prepare the menu entry
94 Entry = new LEGACY_ENTRY();
95 if (!FullTitle.isEmpty()) {
96 Entry->Title = FullTitle;
97 } else {
98 if (ThemeX.BootCampStyle) {
99 Entry->Title = LTitle;
100 } else {
101 Entry->Title = L"Boot "_XSW + LoaderTitle + L" from "_XSW + VolDesc;
102// Entry->Title.SWPrintf("Boot %ls from %ls", LoaderTitle->wc_str(), VolDesc);
103 }
104 }
105
106// DBG("Title=%ls\n", Entry->Title);
107 Entry->Row = 0;
108 Entry->ShortcutLetter = (Hotkey == 0) ? ShortcutLetter : Hotkey;
109
110 if (Image) {
111 Entry->Image = *Image;
112 } else {

Callers 2

ScanLegacyFunction · 0.85
AddCustomLegacyFunction · 0.85

Calls 13

equalICMethod · 0.80
SWPrintfMethod · 0.80
GetAnimeMethod · 0.80
AddMenuEntryMethod · 0.80
XImageClass · 0.50
sizeMethod · 0.45
getLEGACY_ENTRYMethod · 0.45
isEmptyMethod · 0.45
notEmptyMethod · 0.45
setEmptyMethod · 0.45
AddMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected