mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
Fix previous fix !
Fix some downcast warnings. Fix menu appearing in text mode.
This commit is contained in:
parent
3b542ca711
commit
fba7032c06
@ -323,6 +323,12 @@
|
||||
9AC7809A24178F02005CDD5C /* menu_items.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC7809924178F02005CDD5C /* menu_items.cpp */; };
|
||||
9AC780B32417EE4B005CDD5C /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780B22417EE4A005CDD5C /* global_test.cpp */; };
|
||||
9AC780B52417EE53005CDD5C /* global_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC780B42417EE53005CDD5C /* global_test.h */; };
|
||||
9ACE2CC0260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9ACE2CBE260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp */; };
|
||||
9ACE2CC1260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9ACE2CBE260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp */; };
|
||||
9ACE2CC2260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9ACE2CBE260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp */; };
|
||||
9ACE2CC3260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */ = {isa = PBXBuildFile; fileRef = 9ACE2CBF260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h */; };
|
||||
9ACE2CC4260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */ = {isa = PBXBuildFile; fileRef = 9ACE2CBF260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h */; };
|
||||
9ACE2CC5260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */ = {isa = PBXBuildFile; fileRef = 9ACE2CBF260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h */; };
|
||||
9AD1F9B425CBBD3D00EC1BB3 /* Volumes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD1F9B225CBBD3C00EC1BB3 /* Volumes.h */; };
|
||||
9AD1F9B525CBBD3D00EC1BB3 /* Volumes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD1F9B225CBBD3C00EC1BB3 /* Volumes.h */; };
|
||||
9AD1F9B625CBBD3D00EC1BB3 /* Volumes.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AD1F9B225CBBD3C00EC1BB3 /* Volumes.h */; };
|
||||
@ -940,6 +946,8 @@
|
||||
9AC7809924178F02005CDD5C /* menu_items.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = menu_items.cpp; sourceTree = "<group>"; };
|
||||
9AC780B22417EE4A005CDD5C /* global_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global_test.cpp; sourceTree = "<group>"; };
|
||||
9AC780B42417EE53005CDD5C /* global_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = global_test.h; sourceTree = "<group>"; };
|
||||
9ACE2CBE260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = REFIT_MAINMENU_SCREEN.cpp; sourceTree = "<group>"; };
|
||||
9ACE2CBF260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = REFIT_MAINMENU_SCREEN.h; sourceTree = "<group>"; };
|
||||
9AD1F9B225CBBD3C00EC1BB3 /* Volumes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Volumes.h; sourceTree = "<group>"; };
|
||||
9AD1F9B325CBBD3C00EC1BB3 /* Volumes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Volumes.cpp; sourceTree = "<group>"; };
|
||||
9AD4694C2452B5A600D6D0DB /* Efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Efi.h; sourceTree = "<group>"; };
|
||||
@ -1351,6 +1359,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AC77F8D24176C04005CDD5C /* menu_items */,
|
||||
9ACE2CBE260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp */,
|
||||
9ACE2CBF260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h */,
|
||||
9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */,
|
||||
9AC77F9024176C04005CDD5C /* REFIT_MENU_SCREEN.h */,
|
||||
9A0986352438A15400826276 /* shared_with_menu.cpp */,
|
||||
@ -1526,6 +1536,7 @@
|
||||
9AC7807F24176C04005CDD5C /* menu.h in Headers */,
|
||||
9AC7806224176C04005CDD5C /* MSUEFICADB.h in Headers */,
|
||||
9AC7800324176C04005CDD5C /* Hibernate.h in Headers */,
|
||||
9ACE2CC3260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */,
|
||||
9A105B2524464A830006DE06 /* VectorGraphics.h in Headers */,
|
||||
9AA3918C25CC72900099DC1F /* KextList.h in Headers */,
|
||||
9A28CD35241BC0DF00F3D247 /* strlen_test.h in Headers */,
|
||||
@ -1593,6 +1604,7 @@
|
||||
9AF41585242CD75C00D2644C /* MSKEK.h in Headers */,
|
||||
9A105B2624464A830006DE06 /* VectorGraphics.h in Headers */,
|
||||
9AF41586242CD75C00D2644C /* menu_items.h in Headers */,
|
||||
9ACE2CC4260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */,
|
||||
9AF41587242CD75C00D2644C /* XTheme.h in Headers */,
|
||||
9AF41589242CD75C00D2644C /* nvidia.h in Headers */,
|
||||
9AF4158A242CD75C00D2644C /* operatorNewDelete.h in Headers */,
|
||||
@ -1684,6 +1696,7 @@
|
||||
9AF41662242CDA5800D2644C /* MSKEK.h in Headers */,
|
||||
9A105B2724464A830006DE06 /* VectorGraphics.h in Headers */,
|
||||
9AF41663242CDA5800D2644C /* menu_items.h in Headers */,
|
||||
9ACE2CC5260DA87B00551963 /* REFIT_MAINMENU_SCREEN.h in Headers */,
|
||||
9AF41664242CDA5800D2644C /* XTheme.h in Headers */,
|
||||
9AF41666242CDA5800D2644C /* nvidia.h in Headers */,
|
||||
9AF41667242CDA5800D2644C /* operatorNewDelete.h in Headers */,
|
||||
@ -1950,6 +1963,7 @@
|
||||
9AC7808424176C04005CDD5C /* globals_dtor.cpp in Sources */,
|
||||
9AC7803024176C04005CDD5C /* DevicePath.cpp in Sources */,
|
||||
9AC77FC324176C04005CDD5C /* XArray_tests.cpp in Sources */,
|
||||
9ACE2CC0260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */,
|
||||
9AC7800A24176C04005CDD5C /* StateGenerator.cpp in Sources */,
|
||||
9AC7805C24176C04005CDD5C /* XImage.cpp in Sources */,
|
||||
9AD1F9B725CBBD3D00EC1BB3 /* Volumes.cpp in Sources */,
|
||||
@ -2059,6 +2073,7 @@
|
||||
9AF415EB242CD75C00D2644C /* Hibernate.cpp in Sources */,
|
||||
9AF415ED242CD75C00D2644C /* DataHubCpu.cpp in Sources */,
|
||||
9AF415EE242CD75C00D2644C /* hda.cpp in Sources */,
|
||||
9ACE2CC1260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */,
|
||||
9AF415EF242CD75C00D2644C /* egemb_icons_dark.cpp in Sources */,
|
||||
9AF415F0242CD75C00D2644C /* scroll_images.cpp in Sources */,
|
||||
9AF415F1242CD75C00D2644C /* XStringArray.cpp in Sources */,
|
||||
@ -2168,6 +2183,7 @@
|
||||
9AF416C8242CDA5800D2644C /* Hibernate.cpp in Sources */,
|
||||
9AF416CA242CDA5800D2644C /* DataHubCpu.cpp in Sources */,
|
||||
9AF416CB242CDA5800D2644C /* hda.cpp in Sources */,
|
||||
9ACE2CC2260DA87B00551963 /* REFIT_MAINMENU_SCREEN.cpp in Sources */,
|
||||
9AF416CC242CDA5800D2644C /* egemb_icons_dark.cpp in Sources */,
|
||||
9AF416CD242CDA5800D2644C /* scroll_images.cpp in Sources */,
|
||||
9AF416CE242CDA5800D2644C /* XStringArray.cpp in Sources */,
|
||||
|
@ -584,7 +584,7 @@ static UINT8
|
||||
*/
|
||||
} else if ( Prop->isString() ) {
|
||||
// assume data in hex encoded string property
|
||||
UINT32 Len = (UINT32)Prop->getString()->stringValue().length() >> 1; // number of hex digits
|
||||
size_t Len = (UINT32)Prop->getString()->stringValue().length() >> 1; // number of hex digits
|
||||
Data = (__typeof__(Data))AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number
|
||||
Len = hex2bin(Prop->getString()->stringValue(), Data, Len);
|
||||
|
||||
@ -4555,6 +4555,10 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
if (Prop->isString()) {
|
||||
|
||||
cDeviceProperties = Prop->getString()->stringValue();
|
||||
if ( cDeviceProperties.sizeInBytesIncludingTerminator() > MAX_UINT32-1 ) {
|
||||
MsgLog("cDeviceProperties is too big");
|
||||
cDeviceProperties.setEmpty();
|
||||
}
|
||||
//-------
|
||||
#ifdef CLOVER_BUILD
|
||||
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
@ -4567,8 +4571,8 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
cProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
cPropSize = (UINT32)(cDeviceProperties.length() >> 1);
|
||||
cPropSize = hex2bin(cDeviceProperties, cProperties, EFI_PAGES_TO_SIZE(EFI_SIZE_TO_PAGES (cDeviceProperties.sizeInBytes()) + 1));
|
||||
//cPropSize = (UINT32)(cDeviceProperties.length() >> 1);
|
||||
cPropSize = (UINT32)hex2bin(cDeviceProperties, cProperties, EFI_PAGES_TO_SIZE(EFI_SIZE_TO_PAGES (cDeviceProperties.sizeInBytesIncludingTerminator()))); // cast should be safe cDeviceProperties.sizeInBytesIncludingTerminator() <= MAX_UINT32-1
|
||||
DBG("Injected EFIString of length %d\n", cPropSize);
|
||||
}
|
||||
//---------
|
||||
@ -7429,75 +7433,79 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
|
||||
if (StringDirty) {
|
||||
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
|
||||
device_inject_stringlength = device_inject_string->length * 2;
|
||||
DBG("stringlength = %d\n", device_inject_stringlength);
|
||||
// gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
|
||||
if ( device_inject_string->length > MAX_UINT32/2-1 ) {
|
||||
MsgLog("device_inject_string is too big\n");
|
||||
}else{
|
||||
device_inject_stringlength = device_inject_string->length * 2;
|
||||
DBG("stringlength = %d\n", device_inject_stringlength);
|
||||
// gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
|
||||
|
||||
UINTN nbPages = EFI_SIZE_TO_PAGES (device_inject_stringlength + 1);
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
nbPages,
|
||||
&BufferPtr
|
||||
);
|
||||
UINTN nbPages = EFI_SIZE_TO_PAGES (device_inject_stringlength + 1);
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiACPIReclaimMemory,
|
||||
nbPages,
|
||||
&BufferPtr
|
||||
);
|
||||
|
||||
if (!EFI_ERROR(Status)) {
|
||||
mProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
gDeviceProperties = devprop_generate_string (device_inject_string);
|
||||
gDeviceProperties[device_inject_stringlength] = 0;
|
||||
// DBG(gDeviceProperties);
|
||||
// DBG("\n");
|
||||
// StringDirty = FALSE;
|
||||
//-------
|
||||
mPropSize = (UINT32)AsciiStrLen(gDeviceProperties) / 2;
|
||||
// DBG("Preliminary size of mProperties=%d\n", mPropSize);
|
||||
mPropSize = hex2bin (gDeviceProperties, AsciiStrLen(gDeviceProperties), mProperties, EFI_PAGES_TO_SIZE(nbPages));
|
||||
// DBG("Final size of mProperties=%d\n", mPropSize);
|
||||
//---------
|
||||
// Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirFullPath().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
|
||||
//and now we can free memory?
|
||||
if (gSettings.AddProperties) {
|
||||
FreePool(gSettings.AddProperties);
|
||||
}
|
||||
if (gSettings.ArbProperties) {
|
||||
DEV_PROPERTY *Props;
|
||||
DEV_PROPERTY *Next;
|
||||
Prop = gSettings.ArbProperties;
|
||||
while (Prop) {
|
||||
Props = Prop->Child;
|
||||
if (Prop->Label) {
|
||||
FreePool(Prop->Label);
|
||||
}
|
||||
if (Prop->Key) {
|
||||
FreePool(Prop->Key);
|
||||
}
|
||||
if (Prop->Value) {
|
||||
FreePool(Prop->Value);
|
||||
}
|
||||
if (Prop->DevicePath) {
|
||||
FreePool(Prop->DevicePath);
|
||||
}
|
||||
while (Props) {
|
||||
if (Props->Label) {
|
||||
FreePool(Props->Label);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
mProperties = (UINT8*)(UINTN)BufferPtr;
|
||||
gDeviceProperties = devprop_generate_string (device_inject_string);
|
||||
gDeviceProperties[device_inject_stringlength] = 0;
|
||||
// DBG(gDeviceProperties);
|
||||
// DBG("\n");
|
||||
// StringDirty = FALSE;
|
||||
//-------
|
||||
//mPropSize = (UINT32)AsciiStrLen(gDeviceProperties) / 2;
|
||||
// DBG("Preliminary size of mProperties=%d\n", mPropSize);
|
||||
mPropSize = (UINT32)hex2bin (gDeviceProperties, AsciiStrLen(gDeviceProperties), mProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe as device_inject_string->length <= MAX_UINT32/2-1
|
||||
// DBG("Final size of mProperties=%d\n", mPropSize);
|
||||
//---------
|
||||
// Status = egSaveFile(&self.getSelfRootDir(), SWPrintf("%ls\\misc\\devprop.bin", self.getCloverDirFullPath().wc_str()).wc_str() , (UINT8*)mProperties, mPropSize);
|
||||
//and now we can free memory?
|
||||
if (gSettings.AddProperties) {
|
||||
FreePool(gSettings.AddProperties);
|
||||
}
|
||||
if (gSettings.ArbProperties) {
|
||||
DEV_PROPERTY *Props;
|
||||
DEV_PROPERTY *Next;
|
||||
Prop = gSettings.ArbProperties;
|
||||
while (Prop) {
|
||||
Props = Prop->Child;
|
||||
if (Prop->Label) {
|
||||
FreePool(Prop->Label);
|
||||
}
|
||||
if (Props->Key) {
|
||||
FreePool(Props->Key);
|
||||
if (Prop->Key) {
|
||||
FreePool(Prop->Key);
|
||||
}
|
||||
if (Props->Value) {
|
||||
FreePool(Props->Value);
|
||||
if (Prop->Value) {
|
||||
FreePool(Prop->Value);
|
||||
}
|
||||
if (Props->DevicePath) {
|
||||
FreePool(Props->DevicePath);
|
||||
if (Prop->DevicePath) {
|
||||
FreePool(Prop->DevicePath);
|
||||
}
|
||||
Next = Props->Next;
|
||||
FreePool(Props);
|
||||
//delete Props;
|
||||
Props = Next;
|
||||
while (Props) {
|
||||
if (Props->Label) {
|
||||
FreePool(Props->Label);
|
||||
}
|
||||
if (Props->Key) {
|
||||
FreePool(Props->Key);
|
||||
}
|
||||
if (Props->Value) {
|
||||
FreePool(Props->Value);
|
||||
}
|
||||
if (Props->DevicePath) {
|
||||
FreePool(Props->DevicePath);
|
||||
}
|
||||
Next = Props->Next;
|
||||
FreePool(Props);
|
||||
//delete Props;
|
||||
Props = Next;
|
||||
}
|
||||
Next = Prop->Next;
|
||||
FreePool(Prop);
|
||||
Prop = Next;
|
||||
}
|
||||
Next = Prop->Next;
|
||||
FreePool(Prop);
|
||||
Prop = Next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -735,16 +735,16 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
|
||||
OldRow = 0;
|
||||
OldTimeoutTextWidth = 0;
|
||||
|
||||
if (AllowGraphicsMode) {
|
||||
// Style = &REFIT_MENU_SCREEN::GraphicsMenuStyle;
|
||||
if (ThemeX.VerticalLayout) {
|
||||
m_MainStyle = &REFIT_MAINMENU_SCREEN::MainMenuVerticalStyle;
|
||||
} else {
|
||||
m_MainStyle = &REFIT_MAINMENU_SCREEN::MainMenuStyle;
|
||||
}
|
||||
}else{
|
||||
m_MainStyle = &REFIT_MAINMENU_SCREEN::TextMenuStyle;
|
||||
}
|
||||
// if (AllowGraphicsMode) {
|
||||
//// Style = &REFIT_MENU_SCREEN::GraphicsMenuStyle;
|
||||
// if (ThemeX.VerticalLayout) {
|
||||
// m_MainStyle = &REFIT_MAINMENU_SCREEN::MainMenuVerticalStyle;
|
||||
// } else {
|
||||
// m_MainStyle = &REFIT_MAINMENU_SCREEN::MainMenuStyle;
|
||||
// }
|
||||
// }else{
|
||||
// m_MainStyle = &REFIT_MAINMENU_SCREEN::TextMenuStyle;
|
||||
// }
|
||||
|
||||
while (!MenuExit) {
|
||||
GetAnime();
|
||||
@ -752,121 +752,129 @@ UINTN REFIT_MAINMENU_SCREEN::RunMainMenu(IN INTN DefaultSelection, OUT REFIT_ABS
|
||||
MenuExit = RunGenericMenu(&DefaultEntryIndex, &MainChosenEntry);
|
||||
TimeoutSeconds = 0;
|
||||
|
||||
if (MenuExit == MENU_EXIT_DETAILS && MainChosenEntry->SubScreen != NULL && MainChosenEntry->SubScreen->Entries.size() > 0) { // if MainChosenEntry->SubScreen->Entries.size() == 0, we got a crash in GraphicsMenuStyle
|
||||
XString8Array TmpArgs;
|
||||
if ( gSettings.Boot.BootArgs.length() > 0) {
|
||||
TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
|
||||
}
|
||||
SubMenuIndex = -1;
|
||||
if (MenuExit == MENU_EXIT_DETAILS && MainChosenEntry->SubScreen != NULL) {
|
||||
if ( MainChosenEntry->SubScreen->Entries.size() > 0 ) { // if MainChosenEntry->SubScreen->Entries.size() == 0, we got a crash in GraphicsMenuStyle
|
||||
XString8Array TmpArgs;
|
||||
if ( gSettings.Boot.BootArgs.length() > 0) {
|
||||
TmpArgs = Split<XString8Array>(gSettings.Boot.BootArgs, " ");
|
||||
}
|
||||
SubMenuIndex = -1;
|
||||
|
||||
gSettings.OptionsBits = EncodeOptions(TmpArgs);
|
||||
// DBG("main OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
gSettings.OptionsBits = EncodeOptions(TmpArgs);
|
||||
// DBG("main OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
|
||||
if (MainChosenEntry->getLOADER_ENTRY()) {
|
||||
gSettings.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
|
||||
// DBG("add OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
}
|
||||
|
||||
if (MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM()) {
|
||||
DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM());
|
||||
}
|
||||
// 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
|
||||
gSettings.FlagsBits = MainChosenEntry->getLOADER_ENTRY()->Flags;
|
||||
}
|
||||
// DBG(" MainChosenEntry with FlagsBits = 0x%X\n", gSettings.FlagsBits);
|
||||
|
||||
SubMenuExit = 0;
|
||||
while (!SubMenuExit) {
|
||||
//
|
||||
//running details menu
|
||||
//
|
||||
SubMenuExit = MainChosenEntry->SubScreen->RunGenericMenu(&SubMenuIndex, &TempChosenEntry);
|
||||
|
||||
if (SubMenuExit == MENU_EXIT_ESCAPE || TempChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
SubMenuExit = MENU_EXIT_ENTER;
|
||||
MenuExit = 0;
|
||||
break;
|
||||
if (MainChosenEntry->getLOADER_ENTRY()) {
|
||||
gSettings.OptionsBits |= EncodeOptions(MainChosenEntry->getLOADER_ENTRY()->LoadOptions);
|
||||
// DBG("add OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
}
|
||||
|
||||
if (MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()) {
|
||||
MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()->LoadOptions = (((REFIT_MENU_ENTRY_CLOVER*)TempChosenEntry)->LoadOptions);
|
||||
if (MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM()) {
|
||||
DecodeOptions(MainChosenEntry->getREFIT_MENU_ITEM_BOOTNUM());
|
||||
}
|
||||
// DBG(" enter menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
|
||||
|
||||
if (SubMenuExit == MENU_EXIT_DETAILS) {
|
||||
SubMenuExit = 0;
|
||||
continue;
|
||||
if (MainChosenEntry->getLOADER_ENTRY()) {
|
||||
// Only for non-legacy entries, as LEGACY_ENTRY doesn't have Flags
|
||||
gSettings.FlagsBits = MainChosenEntry->getLOADER_ENTRY()->Flags;
|
||||
}
|
||||
// DBG(" exit menu with LoadOptions: %ls\n", ((LOADER_ENTRY*)MainChosenEntry)->LoadOptions);
|
||||
// DBG(" MainChosenEntry with FlagsBits = 0x%X\n", gSettings.FlagsBits);
|
||||
|
||||
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);
|
||||
if (OSFLAG_ISUNSET(TempChosenEntry->getLOADER_ENTRY()->Flags, OSFLAG_NODEFAULTARGS)) {
|
||||
DecodeOptions(TempChosenEntry->getLOADER_ENTRY());
|
||||
// DBG("get OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
// DBG(" TempChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)TempChosenEntry)->Flags);
|
||||
SubMenuExit = 0;
|
||||
while (!SubMenuExit) {
|
||||
//
|
||||
//running details menu
|
||||
//
|
||||
SubMenuExit = MainChosenEntry->SubScreen->RunGenericMenu(&SubMenuIndex, &TempChosenEntry);
|
||||
|
||||
if (SubMenuExit == MENU_EXIT_ESCAPE || TempChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
SubMenuExit = MENU_EXIT_ENTER;
|
||||
MenuExit = 0;
|
||||
break;
|
||||
}
|
||||
// copy also loadoptions from subentry to mainentry
|
||||
MainChosenEntry->getLOADER_ENTRY()->LoadOptions = TempChosenEntry->getLOADER_ENTRY()->LoadOptions;
|
||||
}
|
||||
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ TempChosenEntry->getLOADER_ENTRY()) {
|
||||
if (TempChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
|
||||
gSettings.Boot.BootArgs = TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8);
|
||||
} else {
|
||||
gSettings.Boot.BootArgs.setEmpty();
|
||||
if (MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()) {
|
||||
MainChosenEntry->getREFIT_MENU_ENTRY_CLOVER()->LoadOptions = (((REFIT_MENU_ENTRY_CLOVER*)TempChosenEntry)->LoadOptions);
|
||||
}
|
||||
DBG(" boot with args: %s\n", gSettings.Boot.BootArgs.c_str());
|
||||
}
|
||||
|
||||
//---- Details submenu (kexts disabling etc)
|
||||
if (SubMenuExit == MENU_EXIT_ENTER /*|| MenuExit == MENU_EXIT_DETAILS*/) {
|
||||
if (TempChosenEntry->SubScreen != NULL) {
|
||||
UINTN NextMenuExit = 0;
|
||||
INTN NextEntryIndex = -1;
|
||||
while (!NextMenuExit) {
|
||||
//
|
||||
// running submenu
|
||||
//
|
||||
NextMenuExit = TempChosenEntry->SubScreen->RunGenericMenu(&NextEntryIndex, &NextChosenEntry);
|
||||
if (NextMenuExit == MENU_EXIT_ESCAPE || NextChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
SubMenuExit = 0;
|
||||
NextMenuExit = MENU_EXIT_ENTER;
|
||||
break;
|
||||
}
|
||||
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) {
|
||||
UINTN DeepMenuExit = 0;
|
||||
INTN DeepEntryIndex = -1;
|
||||
REFIT_ABSTRACT_MENU_ENTRY *DeepChosenEntry = NULL;
|
||||
while (!DeepMenuExit) {
|
||||
//
|
||||
// run deep submenu
|
||||
//
|
||||
DeepMenuExit = NextChosenEntry->SubScreen->RunGenericMenu(&DeepEntryIndex, &DeepChosenEntry);
|
||||
if (DeepMenuExit == MENU_EXIT_ESCAPE || DeepChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
DeepMenuExit = MENU_EXIT_ENTER;
|
||||
NextMenuExit = 0;
|
||||
break;
|
||||
}
|
||||
DBG(" get DeepChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)DeepChosenEntry)->Flags);
|
||||
} //while(!DeepMenuExit)
|
||||
if (SubMenuExit == MENU_EXIT_DETAILS) {
|
||||
SubMenuExit = 0;
|
||||
continue;
|
||||
}
|
||||
// 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);
|
||||
if (OSFLAG_ISUNSET(TempChosenEntry->getLOADER_ENTRY()->Flags, OSFLAG_NODEFAULTARGS)) {
|
||||
DecodeOptions(TempChosenEntry->getLOADER_ENTRY());
|
||||
// DBG("get OptionsBits = 0x%X\n", gSettings.OptionsBits);
|
||||
// DBG(" TempChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)TempChosenEntry)->Flags);
|
||||
}
|
||||
// copy also loadoptions from subentry to mainentry
|
||||
MainChosenEntry->getLOADER_ENTRY()->LoadOptions = TempChosenEntry->getLOADER_ENTRY()->LoadOptions;
|
||||
}
|
||||
|
||||
if (/*MenuExit == MENU_EXIT_ENTER &&*/ TempChosenEntry->getLOADER_ENTRY()) {
|
||||
if (TempChosenEntry->getLOADER_ENTRY()->LoadOptions.notEmpty()) {
|
||||
gSettings.Boot.BootArgs = TempChosenEntry->getLOADER_ENTRY()->LoadOptions.ConcatAll(" "_XS8);
|
||||
} else {
|
||||
gSettings.Boot.BootArgs.setEmpty();
|
||||
}
|
||||
DBG(" boot with args: %s\n", gSettings.Boot.BootArgs.c_str());
|
||||
}
|
||||
|
||||
//---- Details submenu (kexts disabling etc)
|
||||
if (SubMenuExit == MENU_EXIT_ENTER /*|| MenuExit == MENU_EXIT_DETAILS*/) {
|
||||
if (TempChosenEntry->SubScreen != NULL) {
|
||||
UINTN NextMenuExit = 0;
|
||||
INTN NextEntryIndex = -1;
|
||||
while (!NextMenuExit) {
|
||||
//
|
||||
// running submenu
|
||||
//
|
||||
NextMenuExit = TempChosenEntry->SubScreen->RunGenericMenu(&NextEntryIndex, &NextChosenEntry);
|
||||
if (NextMenuExit == MENU_EXIT_ESCAPE || NextChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
SubMenuExit = 0;
|
||||
NextMenuExit = MENU_EXIT_ENTER;
|
||||
break;
|
||||
}
|
||||
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) {
|
||||
UINTN DeepMenuExit = 0;
|
||||
INTN DeepEntryIndex = -1;
|
||||
REFIT_ABSTRACT_MENU_ENTRY *DeepChosenEntry = NULL;
|
||||
while (!DeepMenuExit) {
|
||||
//
|
||||
// run deep submenu
|
||||
//
|
||||
DeepMenuExit = NextChosenEntry->SubScreen->RunGenericMenu(&DeepEntryIndex, &DeepChosenEntry);
|
||||
if (DeepMenuExit == MENU_EXIT_ESCAPE || DeepChosenEntry->getREFIT_MENU_ITEM_RETURN() ) {
|
||||
DeepMenuExit = MENU_EXIT_ENTER;
|
||||
NextMenuExit = 0;
|
||||
break;
|
||||
}
|
||||
DBG(" get DeepChosenEntry FlagsBits = 0x%X\n", ((LOADER_ENTRY*)DeepChosenEntry)->Flags);
|
||||
} //while(!DeepMenuExit)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //while(!NextMenuExit)
|
||||
} //while(!NextMenuExit)
|
||||
}
|
||||
}
|
||||
//---------
|
||||
}
|
||||
//---------
|
||||
}else{
|
||||
// Here, it means MainChosenEntry->SubScreen != null, but MainChosenEntry->SubScreen->Entries.size() == 0.
|
||||
// This is a technical bug. GraphicsMenuStyle would crash.
|
||||
#ifdef DEBUG
|
||||
panic("A sub menu doesn't have any entries");
|
||||
#else
|
||||
MenuExit = 0; // loop on main menu
|
||||
#endif
|
||||
}
|
||||
}else{
|
||||
MenuExit = 0; // loop on main menu
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#define __REFIT_MAINMENU_SCREEN_H__
|
||||
|
||||
#include "REFIT_MENU_SCREEN.h"
|
||||
|
||||
#include "../libeg/XTheme.h"
|
||||
//#include "../Platform/Settings.h"
|
||||
//#include "../libeg/libegint.h"
|
||||
////#include "../libeg/libeg.h"
|
||||
@ -60,7 +60,7 @@ class REFIT_MAINMENU_SCREEN : public REFIT_MENU_SCREEN
|
||||
{
|
||||
public:
|
||||
typedef void (REFIT_MAINMENU_SCREEN::*MAINMENU_STYLE_FUNC)(IN UINTN Function, IN CONST CHAR16 *ParamText);
|
||||
MAINMENU_STYLE_FUNC m_MainStyle = NULL;
|
||||
// MAINMENU_STYLE_FUNC m_MainStyle = NULL;
|
||||
|
||||
REFIT_MAINMENU_SCREEN(UINTN ID, XStringW TTitle, XStringW TTimeoutText);
|
||||
|
||||
@ -69,15 +69,26 @@ public:
|
||||
virtual void TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) { REFIT_MENU_SCREEN::TextMenuStyle(Function, ParamText); }
|
||||
virtual void MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText); // cannot remove from here because the use of pointer to member function
|
||||
virtual void MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16 *ParamText); // cannot remove from here because the use of pointer to member function
|
||||
virtual void MenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) {
|
||||
if (AllowGraphicsMode) {
|
||||
if (ThemeX.VerticalLayout) {
|
||||
MainMenuVerticalStyle(Function, ParamText);
|
||||
} else {
|
||||
MainMenuStyle(Function, ParamText);
|
||||
}
|
||||
}else {
|
||||
TextMenuStyle(Function, ParamText);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos);
|
||||
void DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos);
|
||||
|
||||
virtual void call_MENU_FUNCTION_INIT(IN CONST CHAR16 *ParamText) { ((*this).*(m_MainStyle))(MENU_FUNCTION_INIT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_ALL(IN CONST CHAR16 *ParamText) { ((*this).*(m_MainStyle))(MENU_FUNCTION_PAINT_ALL, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_SELECTION(IN CONST CHAR16 *ParamText) { ((*this).*(m_MainStyle))(MENU_FUNCTION_PAINT_SELECTION, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_TIMEOUT(IN CONST CHAR16 *ParamText) { ((*this).*(m_MainStyle))(MENU_FUNCTION_PAINT_TIMEOUT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_CLEANUP(IN CONST CHAR16 *ParamText) { ((*this).*(m_MainStyle))(MENU_FUNCTION_CLEANUP, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_INIT(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_INIT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_ALL(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_ALL, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_SELECTION(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_SELECTION, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_TIMEOUT(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_TIMEOUT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_CLEANUP(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_CLEANUP, ParamText); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -360,8 +360,6 @@ public:
|
||||
|
||||
|
||||
void common_init() {
|
||||
if (AllowGraphicsMode) m_StyleFunc = &REFIT_MENU_SCREEN::GraphicsMenuStyle;
|
||||
else m_StyleFunc = &REFIT_MENU_SCREEN::TextMenuStyle;
|
||||
#ifdef CLOVER_BUILD
|
||||
EFI_TIME Now;
|
||||
gRT->GetTime(&Now, NULL);
|
||||
@ -446,14 +444,18 @@ public:
|
||||
|
||||
virtual void GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
|
||||
virtual void TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText);
|
||||
virtual void MenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamText) {
|
||||
if (AllowGraphicsMode) GraphicsMenuStyle(Function, ParamText);
|
||||
else TextMenuStyle(Function, ParamText);
|
||||
}
|
||||
|
||||
MENU_STYLE_FUNC m_StyleFunc = NULL;
|
||||
// MENU_STYLE_FUNC m_StyleFunc = NULL;
|
||||
|
||||
virtual void call_MENU_FUNCTION_INIT(IN CONST CHAR16 *ParamText) { ((*this).*(m_StyleFunc))(MENU_FUNCTION_INIT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_ALL(IN CONST CHAR16 *ParamText) { ((*this).*(m_StyleFunc))(MENU_FUNCTION_PAINT_ALL, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_SELECTION(IN CONST CHAR16 *ParamText) { ((*this).*(m_StyleFunc))(MENU_FUNCTION_PAINT_SELECTION, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_TIMEOUT(IN CONST CHAR16 *ParamText) { ((*this).*(m_StyleFunc))(MENU_FUNCTION_PAINT_TIMEOUT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_CLEANUP(IN CONST CHAR16 *ParamText) { ((*this).*(m_StyleFunc))(MENU_FUNCTION_CLEANUP, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_INIT(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_INIT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_ALL(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_ALL, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_SELECTION(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_SELECTION, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_PAINT_TIMEOUT(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_PAINT_TIMEOUT, ParamText); }
|
||||
virtual void call_MENU_FUNCTION_CLEANUP(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_CLEANUP, ParamText); }
|
||||
|
||||
virtual ~REFIT_MENU_SCREEN() {};
|
||||
};
|
||||
|
@ -1295,7 +1295,7 @@ static unsigned int nsvg__parseColorHex(const char* str)
|
||||
while(str[n] && IsHexDigit(str[n]))
|
||||
n++;
|
||||
if (n == 6) {
|
||||
n = hex2bin((CHAR8*)str, 6, (UINT8*)&c, 3); //big endian
|
||||
hex2bin((CHAR8*)str, 6, (UINT8*)&c, 3); //big endian
|
||||
b = (c >> 16) & 0xff;
|
||||
g = (c >> 8) & 0xff;
|
||||
r = c & 0xff;
|
||||
|
Loading…
Reference in New Issue
Block a user