Add custom legacy
| 271 | |
| 272 | // Add custom legacy |
| 273 | VOID AddCustomLegacy(VOID) |
| 274 | { |
| 275 | UINTN VolumeIndex, VolumeIndex2; |
| 276 | BOOLEAN ShowVolume, HideIfOthersFound; |
| 277 | REFIT_VOLUME *Volume; |
| 278 | CUSTOM_LEGACY_ENTRY *Custom; |
| 279 | XIcon MainIcon; |
| 280 | XIcon DriveIcon; |
| 281 | UINTN i = 0; |
| 282 | |
| 283 | // DBG("Custom legacy start\n"); |
| 284 | if (gSettings.CustomLegacy) { |
| 285 | DbgHeader("AddCustomLegacy"); |
| 286 | } |
| 287 | |
| 288 | // Traverse the custom entries |
| 289 | for (Custom = gSettings.CustomLegacy; Custom; ++i, Custom = Custom->Next) { |
| 290 | if (OSFLAG_ISSET(Custom->Flags, OSFLAG_DISABLED)) { |
| 291 | DBG("Custom legacy %llu skipped because it is disabled.\n", i); |
| 292 | continue; |
| 293 | } |
| 294 | // if (!gSettings.ShowHiddenEntries && OSFLAG_ISSET(Custom->Flags, OSFLAG_HIDDEN)) { |
| 295 | // DBG("Custom legacy %llu skipped because it is hidden.\n", i); |
| 296 | // continue; |
| 297 | // } |
| 298 | if (Custom->Volume.notEmpty()) { |
| 299 | DBG("Custom legacy %llu matching \"%ls\" ...\n", i, Custom->Volume.wc_str()); |
| 300 | } |
| 301 | for (VolumeIndex = 0; VolumeIndex < Volumes.size(); ++VolumeIndex) { |
| 302 | Volume = &Volumes[VolumeIndex]; |
| 303 | |
| 304 | DBG(" Checking volume \"%ls\" (%ls) ... ", Volume->VolName.wc_str(), Volume->DevicePathString.wc_str()); |
| 305 | |
| 306 | // skip volume if its kind is configured as disabled |
| 307 | if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) |
| 308 | { |
| 309 | DBG("skipped because media is disabled\n"); |
| 310 | continue; |
| 311 | } |
| 312 | |
| 313 | if (Custom->VolumeType != 0) { |
| 314 | if (((1ull<<Volume->DiskKind) & Custom->VolumeType) == 0) { |
| 315 | DBG("skipped because media is ignored\n"); |
| 316 | continue; |
| 317 | } |
| 318 | } |
| 319 | if (/*(Volume->BootType != BOOTING_BY_PBR) && */ |
| 320 | (Volume->BootType >= BOOTING_BY_MBR) /*&& |
| 321 | (Volume->BootType != BOOTING_BY_CD)*/ ) { |
| 322 | DBG("skipped because volume is not legacy bootable\n"); |
| 323 | continue; |
| 324 | } |
| 325 | |
| 326 | ShowVolume = FALSE; |
| 327 | HideIfOthersFound = FALSE; |
| 328 | if (Volume->IsAppleLegacy) { |
| 329 | ShowVolume = TRUE; |
| 330 | HideIfOthersFound = TRUE; |
no test coverage detected