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

Function FindDefaultEntry

rEFIt_UEFI/refit/main.cpp:1551–1628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1549
1550
1551INTN FindDefaultEntry(VOID)
1552{
1553 INTN Index = -1;
1554 REFIT_VOLUME *Volume;
1555 BOOLEAN SearchForLoader;
1556
1557// DBG("FindDefaultEntry ...\n");
1558 //DbgHeader("FindDefaultEntry");
1559
1560 //
1561 // try to detect volume set by Startup Disk or previous Clover selection
1562 // with broken nvram this requires emulation to be installed.
1563 // enable emulation to determin efi-boot-device-data
1564 if (gEmuVariableControl != NULL) {
1565 gEmuVariableControl->InstallEmulation(gEmuVariableControl);
1566 }
1567
1568 Index = FindStartupDiskVolume(&MainMenu);
1569
1570 if (Index >= 0) {
1571 DBG("Boot redirected to Entry %lld. '%ls'\n", Index, MainMenu.Entries[Index].Title.s());
1572 // we got boot-device-data, no need to keep emulating anymore
1573 if (gEmuVariableControl != NULL) {
1574 gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
1575 }
1576 return Index;
1577 }
1578
1579 //
1580 // if not found, then try DefaultVolume from config.plist
1581 // if not null or empty, search volume that matches gSettings.DefaultVolume
1582 //
1583 if (gSettings.DefaultVolume.notEmpty()) {
1584
1585 // if not null or empty, also search for loader that matches gSettings.DefaultLoader
1586 SearchForLoader = gSettings.DefaultLoader.notEmpty();
1587/*
1588 if (SearchForLoader) {
1589 DBG("Searching for DefaultVolume '%ls', DefaultLoader '%ls' ...\n", gSettings.DefaultVolume, gSettings.DefaultLoader);
1590 } else {
1591 DBG("Searching for DefaultVolume '%ls' ...\n", gSettings.DefaultVolume);
1592 }
1593*/
1594 for (Index = 0; Index < (INTN)MainMenu.Entries.size() && MainMenu.Entries[Index].getLOADER_ENTRY() && MainMenu.Entries[Index].getLOADER_ENTRY()->Row == 0 ; Index++) {
1595
1596 LOADER_ENTRY& Entry = *MainMenu.Entries[Index].getLOADER_ENTRY();
1597 if (!Entry.Volume) {
1598 continue;
1599 }
1600
1601 Volume = Entry.Volume;
1602 if ( (Volume->VolName.isEmpty() || Volume->VolName != gSettings.DefaultVolume) &&
1603 !Volume->DevicePathString.contains(gSettings.DefaultVolume) ) {
1604 continue;
1605 }
1606
1607 // we alreday know that Entry.isLoader
1608 if (SearchForLoader && (/*Entry.Tag != TAG_LOADER ||*/ !Entry.LoaderPath.containsIC(gSettings.DefaultLoader))) {

Callers 1

RefitMainFunction · 0.85

Calls 9

FindStartupDiskVolumeFunction · 0.85
sMethod · 0.80
notEmptyMethod · 0.45
sizeMethod · 0.45
getLOADER_ENTRYMethod · 0.45
isEmptyMethod · 0.45
containsMethod · 0.45
containsICMethod · 0.45
wc_strMethod · 0.45

Tested by

no test coverage detected