repair clover entry

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2022-08-02 22:12:31 +03:00
parent 4d3d93231b
commit 12aa924078
2 changed files with 25 additions and 23 deletions

View File

@ -749,7 +749,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
while (!MenuExit) {
GetAnime();
DBG("AnimeRun=%d\n", (FilmC && FilmC->AnimeRun)?1:0);
// DBG("AnimeRun=%d\n", (FilmC && FilmC->AnimeRun)?1:0);
MenuExit = RunGenericMenu(&DefaultEntryIndex, &MainChosenEntry);
TimeoutSeconds = 0;
@ -762,23 +762,23 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
SubMenuIndex = -1;
GlobalConfig.OptionsBits = EncodeOptions(TmpArgs);
// DBG("main OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
// DBG("main OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
if (MainChosenEntry->getLOADER_ENTRY()) {
GlobalConfig.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
// DBG("add OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
// DBG("add OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
}
if (MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM()) {
DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM());
}
// DBG(" enter menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
// DBG(" enter menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
if (MainChosenEntry->getLOADER_ENTRY()) {
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags
GlobalConfig.FlagsBits = MainChosenEntry->getLOADER_ENTRY()->Flags;
}
// DBG(" MainChosenEntry with FlagsBits = 0x%X\n", GlobalConfig.FlagsBits);
// DBG(" MainChosenEntry with FlagsBits = 0x%X\n", GlobalConfig.FlagsBits);
SubMenuExit = 0;
while (!SubMenuExit) {
@ -794,19 +794,21 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
}
if (MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()) {
DBG("menu entry Clover\n");
MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()->LoadOptions = (((REFIT_MENU_ENTRY_CLOVER*)TempChosenEntry)->LoadOptions);
break;
}
if (SubMenuExit == MENU_EXIT_DETAILS) {
SubMenuExit = 0;
continue;
}
// DBG(" exit menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
// DBG(" exit menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
if (SubMenuExit == MENU_EXIT_ENTER && MainChosenEntry->getLOADER_ENTRY() && TempChosenEntry->getLOADER_ENTRY()) {
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags/Options
MainChosenEntry->getLOADER_ENTRY()->Flags = TempChosenEntry->getLOADER_ENTRY()->Flags;
DBG(" get MainChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)MainChosenEntry)->Flags);
// DBG(" get MainChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)MainChosenEntry)->Flags);
if (OSFLAG_ISUNSET(TempChosenEntry->getLOADER_ENTRY()->Flags, OSFLAG_NODEFAULTARGS)) {
DecodeOptions(TempChosenEntry->getLOADER_ENTRY());
// DBG("get OptionsBits = 0x%X\n", GlobalConfig.OptionsBits);
@ -822,7 +824,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
} else {
gSettings.Boot.BootArgs.setEmpty();
}
DBG(" boot with args: %s\n", gSettings.Boot.BootArgs.c_str());
// DBG(" boot with args: %s\n", gSettings.Boot.BootArgs.c_str());
}
//---- Details submenu (kexts disabling etc)
@ -840,7 +842,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
NextMenuExit = MENU_EXIT_ENTER;
break;
}
DBG(" get NextChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)NextChosenEntry)->Flags);
// DBG(" get NextChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)NextChosenEntry)->Flags);
//---- Details submenu (kexts disabling etc) second level
if (NextMenuExit == MENU_EXIT_ENTER /*|| MenuExit == MENU_EXIT_DETAILS*/) {
if (NextChosenEntry->SubScreen != NULL) {
@ -857,7 +859,7 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
NextMenuExit = 0;
break;
}
DBG(" get DeepChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)DeepChosenEntry)->Flags);
// DBG(" get DeepChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)DeepChosenEntry)->Flags);
} //while(!DeepMenuExit)
}
}

View File

@ -3317,7 +3317,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
}
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\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
// disable default boot - have sense only in the first run
gSettings.Boot.Timeout = -1;
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
@ -3426,8 +3426,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
HelpRefit();
break;
*/
DBG("1\n");
if ( ChosenEntry->getLOADER_ENTRY() ) { // Boot OS via .EFI loader
if ( ChosenEntry->getLOADER_ENTRY() ) { // Boot OS via .EFI loader
SetBootCurrent(ChosenEntry->getLOADER_ENTRY());
ChosenEntry->StartLoader();
//if boot.efi failed we should somehow exit from the loop
@ -3436,7 +3435,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
ReinitDesktop = false;
AfterTool = true;
}
DBG("2\n");
if ( ChosenEntry->getLEGACY_ENTRY() ) { // Boot legacy OS
if (StrCmp(gST->FirmwareVendor, L"Phoenix Technologies Ltd.") == 0 &&
gST->Hdr.Revision >> 16 == 2 && (gST->Hdr.Revision & ((1 << 16) - 1)) == 0){
@ -3452,7 +3450,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
ChosenEntry->StartLegacy();
}
}
DBG("3\n");
if ( ChosenEntry->getREFIT_MENU_ENTRY_LOADER_TOOL() ) { // Start a EFI tool
ChosenEntry->StartTool();
TerminateScreen(); //does not happen
@ -3462,7 +3459,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
MainLoopRunning = false;
AfterTool = true;
}
DBG("4\n");
#ifdef ENABLE_SECURE_BOOT
log_technical_bug("not done yet");
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
@ -3476,11 +3472,13 @@ log_technical_bug("not done yet");
// AfterTool = true;
// }
#endif // ENABLE_SECURE_BOOT
DBG("come to Clover entry\n");
if ( ChosenEntry->getREFIT_MENU_ENTRY_CLOVER() ) { // Clover options
DBG("enter Clover entry\n");
REFIT_MENU_ENTRY_CLOVER* LoaderEntry = ChosenEntry->getREFIT_MENU_ENTRY_CLOVER();
// DBG("come to Clover entry with letter %c\n", ChosenEntry->ShortcutLetter);
REFIT_MENU_ENTRY_CLOVER* LoaderEntry = ChosenEntry->getREFIT_MENU_ENTRY_CLOVER();
if ((ChosenEntry->ShortcutLetter == 'C') || LoaderEntry != NULL ) { // Clover options
// DBG("enter Clover entry\n");
if (LoaderEntry->LoadOptions.notEmpty()) {
// we are uninstalling in case user selected Clover Options and EmuVar is installed
// because adding bios boot option requires access to real nvram
//Slice: sure?
@ -3488,9 +3486,9 @@ log_technical_bug("not done yet");
gEmuVariableControl->UninstallEmulation(gEmuVariableControl);
}
*/
DBG(" Clover entry not empty\n");
// DBG(" Clover entry not empty\n");
if ( LoaderEntry->LoadOptions.contains(L"BO-ADD") ) {
DBG(" BO-ADD");
// DBG(" BO-ADD");
XStringW Description;
CONST CHAR16 *LoaderName;
INTN EntryIndex, NameSize, Name2Size;
@ -3498,6 +3496,7 @@ log_technical_bug("not done yet");
UINT8 *OptionalData;
UINTN OptionalDataSize;
UINTN BootNum;
// EFI_HANDLE UsedHandle = 0;
PrintBootOptions(false);
@ -3538,7 +3537,7 @@ log_technical_bug("not done yet");
if (Name2Size != 0) {
CopyMem(OptionalData + 6 + NameSize, LoaderName, Name2Size);
}
// UsedHandle = LoaderEntry->Volume->DeviceHandle;
Status = AddBootOptionForFile (
LoaderEntry->Volume->DeviceHandle,
LoaderEntry->LoaderPath,
@ -3554,6 +3553,7 @@ log_technical_bug("not done yet");
Entry->BootNum = BootNum;
}
FreePool(OptionalData);
break;
} //for (EntryIndex