mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-29 12:35:53 +01:00
Add "FirstAvailable" option for DefaultVolume.
This commit is contained in:
parent
0cb5da745a
commit
7e105c98da
@ -1 +1 @@
|
|||||||
Subproject commit 0fcc050a44f6fa06788b349e65b4e10fcdabde67
|
Subproject commit b297330007bb21302d9fce22d49786443a5750ee
|
@ -670,6 +670,7 @@ public:
|
|||||||
XBool NeverDoRecovery = false;
|
XBool NeverDoRecovery = false;
|
||||||
XBool LastBootedVolume = false;
|
XBool LastBootedVolume = false;
|
||||||
XStringW DefaultVolume = XStringW();
|
XStringW DefaultVolume = XStringW();
|
||||||
|
bool BootFirstAvailable = false;
|
||||||
XStringW DefaultLoader = XStringW();
|
XStringW DefaultLoader = XStringW();
|
||||||
XBool DebugLog = false;
|
XBool DebugLog = false;
|
||||||
XBool FastBoot = false;
|
XBool FastBoot = false;
|
||||||
@ -736,6 +737,7 @@ public:
|
|||||||
NeverDoRecovery = other.dgetNeverDoRecovery();
|
NeverDoRecovery = other.dgetNeverDoRecovery();
|
||||||
LastBootedVolume = other.dgetLastBootedVolume();
|
LastBootedVolume = other.dgetLastBootedVolume();
|
||||||
DefaultVolume = other.dgetDefaultVolume();
|
DefaultVolume = other.dgetDefaultVolume();
|
||||||
|
BootFirstAvailable = other.dgetBootFirstAvailable();
|
||||||
DefaultLoader = other.dgetDefaultLoader();
|
DefaultLoader = other.dgetDefaultLoader();
|
||||||
DebugLog = other.dgetDebugLog();
|
DebugLog = other.dgetDebugLog();
|
||||||
FastBoot = other.dgetFastBoot();
|
FastBoot = other.dgetFastBoot();
|
||||||
|
@ -141,7 +141,12 @@ public:
|
|||||||
const decltype(DefaultVolume)::ValueType& dgetDefaultVolume() const {
|
const decltype(DefaultVolume)::ValueType& dgetDefaultVolume() const {
|
||||||
if ( !DefaultVolume.isDefined() ) return DefaultVolume.nullValue;
|
if ( !DefaultVolume.isDefined() ) return DefaultVolume.nullValue;
|
||||||
if ( DefaultVolume.value().isEqualIC("LastBootedVolume") ) return DefaultVolume.nullValue;
|
if ( DefaultVolume.value().isEqualIC("LastBootedVolume") ) return DefaultVolume.nullValue;
|
||||||
return DefaultVolume.isDefined() ? DefaultVolume.value() : DefaultVolume.nullValue;
|
if ( DefaultVolume.value().isEqualIC("FirstAvailable") ) return DefaultVolume.nullValue;
|
||||||
|
return DefaultVolume.value();
|
||||||
|
};
|
||||||
|
bool dgetBootFirstAvailable() const {
|
||||||
|
if ( !DefaultVolume.isDefined() ) return false;
|
||||||
|
return DefaultVolume.value().isEqualIC("FirstAvailable");
|
||||||
};
|
};
|
||||||
const XString8& dgetDefaultLoader() const { return DefaultLoader.isDefined() ? DefaultLoader.value() : NullXString8; };
|
const XString8& dgetDefaultLoader() const { return DefaultLoader.isDefined() ? DefaultLoader.value() : NullXString8; };
|
||||||
XBool dgetDebugLog() const { return Debug.isDefined() ? Debug.value() : XBool(false); };
|
XBool dgetDebugLog() const { return Debug.isDefined() ? Debug.value() : XBool(false); };
|
||||||
|
@ -110,6 +110,14 @@ class XObjArrayNC
|
|||||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||||
TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); }
|
TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); }
|
||||||
|
|
||||||
|
size_t indexOf(TYPE& e) const {
|
||||||
|
size_t i;
|
||||||
|
for ( i=0 ; i<size() ; i+=1 ) {
|
||||||
|
if ( &ElementAt(i) == &e ) return i;
|
||||||
|
}
|
||||||
|
return MAX_XSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const XObjArrayNC<TYPE>& other) const
|
bool operator==(const XObjArrayNC<TYPE>& other) const
|
||||||
{
|
{
|
||||||
if ( size() != other.size() ) return false;
|
if ( size() != other.size() ) return false;
|
||||||
|
@ -310,7 +310,7 @@ void AddCustomLegacy(void)
|
|||||||
|
|
||||||
if (Custom.settings.VolumeType != 0) {
|
if (Custom.settings.VolumeType != 0) {
|
||||||
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
||||||
DBG("skipped because media is ignored\n");
|
DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2406,7 +2406,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Custom.settings.VolumeType != 0 && ((1<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
if (Custom.settings.VolumeType != 0 && ((1<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
||||||
DBG("skipped because media is ignored\n");
|
DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void AddCustomTool(void)
|
|||||||
|
|
||||||
if (Custom.settings.VolumeType != 0) {
|
if (Custom.settings.VolumeType != 0) {
|
||||||
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
if (((1ull<<Volume->DiskKind) & Custom.settings.VolumeType) == 0) {
|
||||||
DBG("skipped because media is ignored\n");
|
DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,6 +169,10 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
|
|||||||
// Display Clover boot volume
|
// Display Clover boot volume
|
||||||
if (SelfVolume->VolLabel.notEmpty() && SelfVolume->VolLabel[0] != L'#') {
|
if (SelfVolume->VolLabel.notEmpty() && SelfVolume->VolLabel[0] != L'#') {
|
||||||
Text = SWPrintf("%ls, booted from %ls %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str(), self.getCloverDirFullPath().wc_str());
|
Text = SWPrintf("%ls, booted from %ls %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str(), self.getCloverDirFullPath().wc_str());
|
||||||
|
}else{
|
||||||
|
if ( SelfVolume->VolName.notEmpty() ) {
|
||||||
|
Text = SWPrintf("%ls %ls%ls", gFirmwareRevision, SelfVolume->VolName.wc_str(), self.getCloverDirFullPath().wc_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Text.isEmpty()) {
|
if (Text.isEmpty()) {
|
||||||
Text = SWPrintf("%ls %ls", gFirmwareRevision, /*SelfVolume->VolName.wc_str(),*/ self.getCloverDirFullPath().wc_str());
|
Text = SWPrintf("%ls %ls", gFirmwareRevision, /*SelfVolume->VolName.wc_str(),*/ self.getCloverDirFullPath().wc_str());
|
||||||
|
@ -584,16 +584,9 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
|||||||
Volume->DevicePathString = FileDevicePathToXStringW(Volume->DevicePath);
|
Volume->DevicePathString = FileDevicePathToXStringW(Volume->DevicePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if REFIT_DEBUG > 0
|
|
||||||
if (Volume->DevicePath != NULL) {
|
if (Volume->DevicePath != NULL) {
|
||||||
DBG(" %ls\n", FileDevicePathToXStringW(Volume->DevicePath).wc_str());
|
DBG(" %ls\n", FileDevicePathToXStringW(Volume->DevicePath).wc_str());
|
||||||
//#if REFIT_DEBUG >= 2
|
|
||||||
// DumpHex(1, 0, GetDevicePathSize(Volume->DevicePath), Volume->DevicePath);
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
DBG("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Volume->ApfsFileSystemUUID = APFSPartitionUUIDExtract(Volume->DevicePath); // NullXString8 if it's not an APFS volume
|
Volume->ApfsFileSystemUUID = APFSPartitionUUIDExtract(Volume->DevicePath); // NullXString8 if it's not an APFS volume
|
||||||
Volume->DiskKind = DISK_KIND_INTERNAL; // default
|
Volume->DiskKind = DISK_KIND_INTERNAL; // default
|
||||||
@ -996,6 +989,10 @@ void ScanVolumes(void)
|
|||||||
Volume->Hidden = false; // default to not hidden
|
Volume->Hidden = false; // default to not hidden
|
||||||
|
|
||||||
Status = ScanVolume(Volume);
|
Status = ScanVolume(Volume);
|
||||||
|
#ifdef JIEF_DEBUG
|
||||||
|
DBG(" kind=%d\n", Volume->DiskKind);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
Volume->Index = HandleIndex;
|
Volume->Index = HandleIndex;
|
||||||
Volumes.AddReference(Volume, true);
|
Volumes.AddReference(Volume, true);
|
||||||
|
@ -2519,6 +2519,8 @@ INTN FindDefaultEntry(void)
|
|||||||
// DBG("FindDefaultEntry ...\n");
|
// DBG("FindDefaultEntry ...\n");
|
||||||
//DbgHeader("FindDefaultEntry");
|
//DbgHeader("FindDefaultEntry");
|
||||||
|
|
||||||
|
if ( gSettings.Boot.BootFirstAvailable ) return 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// try to detect volume set by Startup Disk or previous Clover selection
|
// try to detect volume set by Startup Disk or previous Clover selection
|
||||||
// with broken nvram this requires emulation to be installed.
|
// with broken nvram this requires emulation to be installed.
|
||||||
@ -3379,7 +3381,7 @@ displayFreeMemory("Before RunMainMenu"_XS8);
|
|||||||
#endif
|
#endif
|
||||||
MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry);
|
MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry);
|
||||||
}
|
}
|
||||||
// DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
// DBG("exit from MainMenu %llu ChosenEntry=%zu\n", MenuExit, MainMenu.Entries.indexOf(*ChosenEntry)); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
||||||
// disable default boot - have sense only in the first run
|
// disable default boot - have sense only in the first run
|
||||||
gSettings.Boot.Timeout = -1;
|
gSettings.Boot.Timeout = -1;
|
||||||
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
|
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user