diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index fd2b2b8a1..e1cd64448 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -319,7 +319,7 @@ public: XIcon Image = XIcon(); XIcon DriveImage = XIcon(); - CUSTOM_LEGACY_ENTRY(const CUSTOM_LEGACY_ENTRY_SETTINGS& _settings, EFI_FILE& ThemeDir) : settings(_settings) + CUSTOM_LEGACY_ENTRY(const CUSTOM_LEGACY_ENTRY_SETTINGS& _settings, const EFI_FILE& ThemeDir) : settings(_settings) { if ( settings.ImagePath.notEmpty() ) { Image.LoadXImage(&ThemeDir, settings.ImagePath); @@ -371,7 +371,7 @@ public: const CUSTOM_TOOL_ENTRY_SETTINGS& settings = CUSTOM_TOOL_ENTRY_SETTINGS(); - CUSTOM_TOOL_ENTRY(const CUSTOM_TOOL_ENTRY_SETTINGS& _settings, EFI_FILE& ThemeDir) : settings(_settings) + CUSTOM_TOOL_ENTRY(const CUSTOM_TOOL_ENTRY_SETTINGS& _settings, const EFI_FILE& ThemeDir) : settings(_settings) { if ( settings.ImagePath.notEmpty() ) { Image.LoadXImage(&ThemeDir, settings.ImagePath); diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 6a6b20558..3c72bc657 100644 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -91,9 +91,6 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full } // Allocate the entry Entry = new REFIT_MENU_ENTRY_LOADER_TOOL(); - if (Entry == NULL) { - return FALSE; - } if (FullTitle) { Entry->Title.takeValueFrom(FullTitle); @@ -249,7 +246,7 @@ void AddCustomTool(void) for (size_t i = 0 ; i < GlobalConfig.CustomToolsEntries.size(); ++i) { CUSTOM_TOOL_ENTRY& Custom = GlobalConfig.CustomToolsEntries[i]; if (OSFLAG_ISSET(Custom.getFlags(), OSFLAG_DISABLED)) { - DBG("Custom tool %llu skipped because it is disabled.\n", i); + DBG("Custom tool %zu skipped because it is disabled.\n", i); continue; } // if (!gSettings.ShowHiddenEntries && OSFLAG_ISSET(Custom.Flags, OSFLAG_HIDDEN)) { @@ -258,12 +255,12 @@ void AddCustomTool(void) // } if (Custom.settings.Volume.notEmpty()) { - DBG("Custom tool %llu matching \"%ls\" ...\n", i, Custom.Volume); + DBG("Custom tool %zu matching \"%ls\" ...\n", i, Custom.settings.Volume.wc_str()); } for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) { Volume = &Volumes[VolumeIndex]; - DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName, Volume->DevicePathString); + DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName.wc_str(), Volume->DevicePathString.wc_str()); // Skip Whole Disc Boot if (Volume->RootDir == NULL) { @@ -300,7 +297,7 @@ void AddCustomTool(void) } // Check the tool exists on the volume if (!FileExists(Volume->RootDir, Custom.settings.Path)) { - DBG("skipped because path '%s' does not exist\n", Custom.Path.wc_str()); + DBG("skipped because path '%ls' does not exist\n", Custom.settings.Path.wc_str()); continue; } // Change to custom image if needed @@ -308,13 +305,13 @@ void AddCustomTool(void) if (Image.isEmpty() && Custom.settings.ImagePath.notEmpty()) { Image.LoadXImage(&ThemeX.getThemeDir(), Custom.settings.ImagePath); } + DBG("match!\n"); if (Image.isEmpty()) { AddToolEntry(Custom.settings.Path, Custom.settings.FullTitle.wc_str(), Custom.settings.Title.wc_str(), Volume, ThemeX.GetIcon(BUILTIN_ICON_TOOL_SHELL), Custom.settings.Hotkey, Custom.getLoadOptions()); } else { // Create a legacy entry for this volume AddToolEntry(Custom.settings.Path, Custom.settings.FullTitle.wc_str(), Custom.settings.Title.wc_str(), Volume, Image, Custom.settings.Hotkey, Custom.getLoadOptions()); } - DBG("match!\n"); // break; // break scan volumes, continue scan entries -- why? } } diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index b1ff7b0b5..2510f668f 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -1677,7 +1677,7 @@ void REFIT_MENU_ENTRY_LOADER_TOOL::StartTool() egClearScreen(&MenuBackgroundPixel); // assumes "Start " as assigned below BeginExternalScreen(OSFLAG_ISSET(Flags, OSFLAG_USEGRAPHICS)/*, &Entry->Title[6]*/); // Shouldn't we check that length of Title is at least 6 ? - StartEFIImage(DevicePath, LoadOptions, LoaderPath.basename(), LoaderPath.basename(), NULL, NULL); + StartEFIImage(DevicePath, LoadOptions, NullXStringW, LoaderPath.basename(), NULL, NULL); FinishExternalScreen(); } @@ -2631,6 +2631,18 @@ void afterGetUserSettings(const SETTINGS_DATA& gSettings) GlobalConfig.CustomEntries.AddReference(entry, true); } + for ( size_t idx = 0 ; idx < gSettings.GUI.CustomLegacySettings.size() ; ++idx ) { + const CUSTOM_LEGACY_ENTRY_SETTINGS& CustomLegacySettings = gSettings.GUI.CustomLegacySettings[idx]; + CUSTOM_LEGACY_ENTRY* entry = new CUSTOM_LEGACY_ENTRY(CustomLegacySettings, ThemeX.getThemeDir()); + GlobalConfig.CustomLegacyEntries.AddReference(entry, true); + } + + for ( size_t idx = 0 ; idx < gSettings.GUI.CustomToolSettings.size() ; ++idx ) { + const CUSTOM_TOOL_ENTRY_SETTINGS& CustomToolSettings = gSettings.GUI.CustomToolSettings[idx]; + CUSTOM_TOOL_ENTRY* entry = new CUSTOM_TOOL_ENTRY(CustomToolSettings, ThemeX.getThemeDir()); + GlobalConfig.CustomToolsEntries.AddReference(entry, true); + } + if ( gSettings.GUI.Theme.notEmpty() ) { ThemeX.Theme.takeValueFrom(gSettings.GUI.Theme);