Correct LoadOptions lost after pressing SpaceBar, and arch= (older systems) not being used

This commit is contained in:
asava 2020-05-02 22:57:41 +03:00
parent 5ed90999d2
commit 06f1f9301a
2 changed files with 11 additions and 7 deletions

View File

@ -352,7 +352,7 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
EFI_FILE_INFO *PlugInFile; EFI_FILE_INFO *PlugInFile;
CHAR16 *FileName; CHAR16 *FileName;
CHAR16 *PlugIns; CHAR16 *PlugIns;
CONST CHAR16 *Arch = NULL; // CONST CHAR16 *Arch = NULL;
// CONST CHAR16 *Ptr = NULL; // CONST CHAR16 *Ptr = NULL;
#if defined(MDE_CPU_X64) #if defined(MDE_CPU_X64)
cpu_type_t archCpuType=CPU_TYPE_X86_64; cpu_type_t archCpuType=CPU_TYPE_X86_64;
@ -369,13 +369,15 @@ EFI_STATUS LOADER_ENTRY::LoadKexts()
SIDELOAD_KEXT *Next = NULL; SIDELOAD_KEXT *Next = NULL;
// Make Arch point to the last appearance of "arch=" in LoadOptions (which is what boot.efi will use). // Make Arch point to the last appearance of "arch=" in LoadOptions (which is what boot.efi will use).
if (LoadOptions.notEmpty()) { // if (LoadOptions.notEmpty()) {
// for (Ptr = StrStr(LoadOptions, L"arch="); Ptr != NULL; Arch = Ptr + StrLen(L"arch="), Ptr = StrStr(Arch, L"arch=")); // for (Ptr = StrStr(LoadOptions, L"arch="); Ptr != NULL; Arch = Ptr + StrLen(L"arch="), Ptr = StrStr(Arch, L"arch="));
} // }
if (Arch != NULL && StrnCmp(Arch,L"x86_64",StrLen(L"x86_64")) == 0) { // if (Arch != NULL && StrnCmp(Arch,L"x86_64",StrLen(L"x86_64")) == 0) {
if (LoadOptions.contains("arch=x86_64")) {
archCpuType = CPU_TYPE_X86_64; archCpuType = CPU_TYPE_X86_64;
} else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) { // } else if (Arch != NULL && StrnCmp(Arch,L"i386",StrLen(L"i386")) == 0) {
} else if (LoadOptions.contains("arch=i386")) {
archCpuType = CPU_TYPE_I386; archCpuType = CPU_TYPE_I386;
} else if (OSVersion != NULL) { } else if (OSVersion != NULL) {
UINT64 os_version = AsciiOSVersionToUint64(OSVersion); UINT64 os_version = AsciiOSVersionToUint64(OSVersion);

View File

@ -115,7 +115,8 @@ VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) { if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) {
gSettings.NvidiaWeb = TRUE; gSettings.NvidiaWeb = TRUE;
} else { } else {
Entry->LoadOptions = loaderEntry->LoadOptions; //Entry->LoadOptions = loaderEntry->LoadOptions;
Entry->LoadOptions = Split<XStringArray>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
Entry->LoadOptions.AddID(ArgOptional[INX_NVWEBON]); Entry->LoadOptions.AddID(ArgOptional[INX_NVWEBON]);
} }
} }
@ -123,7 +124,8 @@ VOID DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry)
if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) { if (AsciiOSVersionToUint64(loaderEntry->OSVersion) >= AsciiOSVersionToUint64("10.12")) {
gSettings.NvidiaWeb = FALSE; gSettings.NvidiaWeb = FALSE;
} else { } else {
Entry->LoadOptions = loaderEntry->LoadOptions; //Entry->LoadOptions = loaderEntry->LoadOptions;
Entry->LoadOptions = Split<XStringArray>(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " ");
Entry->LoadOptions.removeIC(ArgOptional[INX_NVWEBON]); Entry->LoadOptions.removeIC(ArgOptional[INX_NVWEBON]);
} }
} }