From 57b93550f87c3d96137f9f3d02075b2d23b0a87f Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Mon, 1 Nov 2021 21:26:41 +0300 Subject: [PATCH] a separate folder for OpenRuntime-v12 for possibility to start old Clover with OpenRuntime-v11 Signed-off-by: SergeySlice --- OpenCorePkg | 2 +- rEFIt_UEFI/refit/main.cpp | 33 ++++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/OpenCorePkg b/OpenCorePkg index dc620f7794..f092684086 160000 --- a/OpenCorePkg +++ b/OpenCorePkg @@ -1 +1 @@ -Subproject commit dc620f779455b6b9c68d7014490e3c03ec9be03f +Subproject commit f0926840864a5538782e53eae465c3c409dfbb8e diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 6c0d79eec2..eeb1bef695 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -605,11 +605,12 @@ static XStringW getDriversPath() } else { return L"drivers64"_XSW; //backward compatibility } - } else - if (FileExists(&self.getCloverDir(), L"drivers\\UEFI")) { - return L"drivers\\UEFI"_XSW; + } else if (FileExists(&self.getCloverDir(), L"drivers\\5142")) { + return L"drivers\\5142"_XSW; + } else if (FileExists(&self.getCloverDir(), L"drivers\\UEFI")) { + return L"drivers\\UEFI"_XSW; } else { - return L"drivers64UEFI"_XSW; + return L"drivers64UEFI"_XSW; } #else return L"drivers32"_XSW; @@ -1814,7 +1815,7 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne DriversArrSize = 0; DriversArrNum = 0; DriversArr = NULL; - OpenRuntimeEfiName.setEmpty(); + // OpenRuntimeEfiName.setEmpty(); //only one driver with highest priority will obtain status "Loaded" DirIterOpen(&self.getCloverDir(), Path, &DirIter); @@ -1857,18 +1858,27 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne if ( LStringW(DirEntry->FileName).containsIC("AptioMemoryFix") ) { continue; } + if ( LStringW(DirEntry->FileName).containsIC("OpenRuntime") ) { + if (!OpenRuntimeEfiName.isEmpty()) { + DBG(" - OpenRuntime already detected\n"); + continue; + } if ( LStringW(DirEntry->FileName).isEqualIC("OpenRuntime-v12.efi") && LString8(OPEN_CORE_VERSION).isEqual("0.7.5") ) { OpenRuntimeEfiName.takeValueFrom(DirEntry->FileName); + DBG(" - OpenRuntime-v12 for 075 taken from %ls\n", getDriversPath().wc_str()); }else if ( LStringW(DirEntry->FileName).isEqualIC("OpenRuntime-v12.efi") && LString8(OPEN_CORE_VERSION).isEqual("0.7.3") ) { OpenRuntimeEfiName.takeValueFrom(DirEntry->FileName); + DBG(" - OpenRuntime-v12 for 073 taken from %ls\n", getDriversPath().wc_str()); }else if ( LStringW(DirEntry->FileName).isEqualIC("OpenRuntime-v11.efi") && LString8(OPEN_CORE_VERSION).isEqual("0.6.5") ) { OpenRuntimeEfiName.takeValueFrom(DirEntry->FileName); + DBG(" - OpenRuntime-v11 for 065 taken from %ls\n", getDriversPath().wc_str()); }else if ( LStringW(DirEntry->FileName).isEqualIC("OpenRuntime-v11.efi") && LString8(OPEN_CORE_VERSION).isEqual("0.6.1") ) { OpenRuntimeEfiName.takeValueFrom(DirEntry->FileName); + DBG(" - OpenRuntime-v11 for 061 taken from %ls\n", getDriversPath().wc_str()); }else if ( OpenRuntimeEfiName.isEmpty() ) { OpenRuntimeEfiName.takeValueFrom(DirEntry->FileName); @@ -2231,11 +2241,16 @@ static void LoadDrivers(void) } else { ScanDriverDir(L"drivers64", &DriversToConnect, &DriversToConnectNum); } - } else - if (FileExists(&self.getCloverDir(), L"drivers\\UEFI")) { - ScanDriverDir(L"drivers\\UEFI", &DriversToConnect, &DriversToConnectNum); } else { - ScanDriverDir(L"drivers64UEFI", &DriversToConnect, &DriversToConnectNum); + OpenRuntimeEfiName.setEmpty(); + if (FileExists(&self.getCloverDir(), L"drivers\\5142")) { + ScanDriverDir(L"drivers\\5142", &DriversToConnect, &DriversToConnectNum); + } + if (FileExists(&self.getCloverDir(), L"drivers\\UEFI")) { + ScanDriverDir(L"drivers\\UEFI", &DriversToConnect, &DriversToConnectNum); + } else { + ScanDriverDir(L"drivers64UEFI", &DriversToConnect, &DriversToConnectNum); + } } #else ScanDriverDir(L"drivers32", &DriversToConnect, &DriversToConnectNum);