| 994 | } |
| 995 | |
| 996 | LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Array& LoaderOptions, |
| 997 | IN CONST XStringW& FullTitle, IN CONST XStringW& LoaderTitle, |
| 998 | IN REFIT_VOLUME *Volume, IN const XStringW& APFSTargetUUID, IN XIcon *Image, |
| 999 | IN UINT8 OSType, IN UINT8 Flags) |
| 1000 | { |
| 1001 | LOADER_ENTRY *Entry; |
| 1002 | |
| 1003 | if ((LoaderPath.isEmpty()) || (Volume == NULL) || (Volume->RootDir == NULL) || !FileExists(Volume->RootDir, LoaderPath)) { |
| 1004 | return NULL; |
| 1005 | } |
| 1006 | |
| 1007 | DBG(" AddLoaderEntry for Volume Name=%ls\n", Volume->VolName.wc_str()); |
| 1008 | if (OSFLAG_ISSET(Flags, OSFLAG_DISABLED)) { |
| 1009 | DBG(" skipped because entry is disabled\n"); |
| 1010 | return NULL; |
| 1011 | } |
| 1012 | // if (!gSettings.ShowHiddenEntries && OSFLAG_ISSET(Flags, OSFLAG_HIDDEN)) { |
| 1013 | // DBG(" skipped because entry is hidden\n"); |
| 1014 | // return NULL; |
| 1015 | // } |
| 1016 | //don't add hided entries |
| 1017 | // if (!gSettings.ShowHiddenEntries) { |
| 1018 | // for (HVi = 0; HVi < gSettings.HVCount; HVi++) { |
| 1019 | // if ( LoaderPath.containsIC(gSettings.HVHideStrings[HVi]) ) { |
| 1020 | // DBG(" hiding entry: %ls\n", LoaderPath.s()); |
| 1021 | // return NULL; |
| 1022 | // } |
| 1023 | // } |
| 1024 | // } |
| 1025 | Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, APFSTargetUUID, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE); |
| 1026 | if (Entry != NULL) { |
| 1027 | if ((Entry->LoaderType == OSTYPE_OSX) || |
| 1028 | (Entry->LoaderType == OSTYPE_OSX_INSTALLER ) || |
| 1029 | (Entry->LoaderType == OSTYPE_RECOVERY)) { |
| 1030 | if (gSettings.WithKexts) { |
| 1031 | Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); |
| 1032 | } |
| 1033 | if (gSettings.WithKextsIfNoFakeSMC) { |
| 1034 | Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_CHECKFAKESMC); |
| 1035 | Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS); |
| 1036 | } |
| 1037 | if (gSettings.NoCaches) { |
| 1038 | Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES); |
| 1039 | } |
| 1040 | } |
| 1041 | if ( Volume->Hidden ) { |
| 1042 | Entry->Hidden = true; |
| 1043 | }else{ |
| 1044 | for (size_t HVi = 0; HVi < gSettings.HVHideStrings.size(); HVi++) { |
| 1045 | if ( LoaderPath.containsIC(gSettings.HVHideStrings[HVi]) ) { |
| 1046 | DBG(" hiding entry: %ls\n", LoaderPath.s()); |
| 1047 | Entry->Hidden = true; |
| 1048 | } |
| 1049 | } |
| 1050 | } |
| 1051 | //TODO there is a problem that Entry->Flags is unique while InputItems are global ;( |
| 1052 | // InputItems[69].IValue = Entry->Flags; |
| 1053 | Entry->AddDefaultMenu(); |
no test coverage detected