include AddDefaultMenu to class

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-05-16 23:07:27 +03:00
parent 22f9adcbc9
commit 6236534ec4
3 changed files with 93 additions and 105 deletions

View File

@ -767,14 +767,14 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath,
return Entry;
}
STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
void LOADER_ENTRY::AddDefaultMenu()
{
XStringW FileName;
// CHAR16* TempOptions;
// CHAR16 DiagsFileName[256];
LOADER_ENTRY *SubEntry;
REFIT_MENU_SCREEN *SubScreen;
REFIT_VOLUME *Volume;
// REFIT_MENU_SCREEN *SubScreen;
// REFIT_VOLUME *Volume;
UINT64 VolumeSize;
EFI_GUID *Guid = NULL;
BOOLEAN KernelIs64BitOnly;
@ -783,51 +783,43 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
constexpr LString8 quietLitteral = "quiet";
constexpr LString8 splashLitteral = "splash";
if (Entry == NULL) {
return;
}
Volume = Entry->Volume;
if (Volume == NULL) {
return;
}
// Only kernels up to 10.7 have 32-bit mode
KernelIs64BitOnly = (Entry->OSVersion == NULL ||
AsciiOSVersionToUint64(Entry->OSVersion) >= AsciiOSVersionToUint64("10.8"));
KernelIs64BitOnly = (OSVersion == NULL ||
AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.8"));
FileName = Entry->LoaderPath.basename();
FileName = LoaderPath.basename();
// create the submenu
// SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = new REFIT_MENU_SCREEN;
SubScreen->Title.SWPrintf("Options for %ls on %ls", Entry->Title.wc_str(), Entry->VolName);
SubScreen->Title.SWPrintf("Options for %ls on %ls", Title.wc_str(), VolName);
SubScreen->TitleImage = Entry->Image;
SubScreen->ID = Entry->LoaderType + 20; //wow
SubScreen->TitleImage = Image;
SubScreen->ID = LoaderType + 20; //wow
// DBG("get anime for os=%lld\n", SubScreen->ID);
SubScreen->GetAnime();
VolumeSize = RShiftU64(MultU64x32(Volume->BlockIO->Media->LastBlock, Volume->BlockIO->Media->BlockSize), 20);
SubScreen->AddMenuInfoLine_f("Volume size: %lluMb", VolumeSize);
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(Entry->DevicePath));
SubScreen->AddMenuInfoLine_f("%ls", FileDevicePathToStr(DevicePath));
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (Guid) {
SubScreen->AddMenuInfoLine_f("UUID: %s", strguid(Guid));
}
SubScreen->AddMenuInfoLine_f("Options: %s", Entry->LoadOptions.ConcatAll(" "_XS8).c_str());
SubScreen->AddMenuInfoLine_f("Options: %s", LoadOptions.ConcatAll(" "_XS8).c_str());
// loader-specific submenu entries
if (Entry->LoaderType == OSTYPE_OSX ||
Entry->LoaderType == OSTYPE_OSX_INSTALLER ||
Entry->LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
if (LoaderType == OSTYPE_OSX ||
LoaderType == OSTYPE_OSX_INSTALLER ||
LoaderType == OSTYPE_RECOVERY) { // entries for Mac OS X
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubScreen->AddMenuInfoLine_f("Mac OS X: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("Mac OS X: %s", OSVersion);
} else if (os_version < AsciiOSVersionToUint64("10.12")) {
SubScreen->AddMenuInfoLine_f("OS X: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("OS X: %s", OSVersion);
} else {
SubScreen->AddMenuInfoLine_f("macOS: %s", Entry->OSVersion);
SubScreen->AddMenuInfoLine_f("macOS: %s", OSVersion);
}
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_HIBERNATED)) {
SubEntry = Entry->getPartiallyDuplicatedEntry();
if (OSFLAG_ISSET(Flags, OSFLAG_HIBERNATED)) {
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.takeValueFrom("Cancel hibernate wake");
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_HIBERNATED);
@ -835,7 +827,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title.takeValueFrom("Boot Mac OS X with selected options");
@ -847,7 +839,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title.takeValueFrom("Boot Mac OS X with injected kexts");
@ -861,7 +853,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (os_version < AsciiOSVersionToUint64("10.8")) {
SubEntry->Title.takeValueFrom("Boot Mac OS X without injected kexts");
@ -915,59 +907,59 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
SubScreen->AddMenuCheck("No SIP", OSFLAG_NOSIP, 69);
}
} else if (Entry->LoaderType == OSTYPE_LINEFI) {
BOOLEAN Quiet = Entry->LoadOptions.contains(quietLitteral);
BOOLEAN WithSplash = Entry->LoadOptions.contains(splashLitteral);
} else if (LoaderType == OSTYPE_LINEFI) {
BOOLEAN Quiet = LoadOptions.contains(quietLitteral);
BOOLEAN WithSplash = LoadOptions.contains(splashLitteral);
// default entry
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.SWPrintf("Run %ls", FileName.wc_str());
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (Quiet) {
SubEntry->Title.SWPrintf("%ls verbose", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls verbose", Title.s());
SubEntry->LoadOptions.removeIC(quietLitteral);
} else {
SubEntry->Title.SWPrintf("%ls quiet", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls quiet", Title.s());
SubEntry->LoadOptions.AddID(quietLitteral);
}
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (WithSplash) {
SubEntry->Title.SWPrintf("%ls without splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls without splash", Title.s());
SubEntry->LoadOptions.removeIC(splashLitteral);
} else {
SubEntry->Title.SWPrintf("%ls with splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls with splash", Title.s());
SubEntry->LoadOptions.AddID(splashLitteral);
}
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry = getPartiallyDuplicatedEntry();
if (SubEntry) {
if (WithSplash) {
if (Quiet) {
SubEntry->Title.SWPrintf("%ls verbose without splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls verbose without splash", Title.s());
SubEntry->LoadOptions.removeIC(splashLitteral);
SubEntry->LoadOptions.removeIC(quietLitteral);
} else {
SubEntry->Title.SWPrintf("%ls quiet without splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls quiet without splash",Title.s());
SubEntry->LoadOptions.removeIC(splashLitteral);
SubEntry->LoadOptions.Add(quietLitteral);
}
} else if (Quiet) {
SubEntry->Title.SWPrintf("%ls verbose with splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls verbose with splash",Title.s());
SubEntry->LoadOptions.removeIC(quietLitteral); //
SubEntry->LoadOptions.AddID(splashLitteral);
} else {
SubEntry->Title.SWPrintf("%ls quiet with splash", Entry->Title.s());
SubEntry->Title.SWPrintf("%ls quiet with splash",Title.s());
SubEntry->LoadOptions.AddID(quietLitteral);
SubEntry->LoadOptions.AddID(splashLitteral);
}
@ -976,38 +968,38 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
} else if ((Entry->LoaderType == OSTYPE_WIN) || (Entry->LoaderType == OSTYPE_WINEFI)) {
// by default, skip the built-in selection and boot from hard disk only
Entry->LoadOptions.setEmpty();
Entry->LoadOptions.Add("-s"_XS8);
Entry->LoadOptions.Add("-h"_XS8);
LoadOptions.setEmpty();
LoadOptions.Add("-s"_XS8);
LoadOptions.Add("-h"_XS8);
// default entry
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry =getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.SWPrintf("Run %ls", FileName.wc_str());
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry =getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.takeValueFrom("Boot Windows from Hard Disk");
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry =getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.takeValueFrom("Boot Windows from CD-ROM");
Entry->LoadOptions.setEmpty();
Entry->LoadOptions.Add("-s"_XS8);
Entry->LoadOptions.Add("-c"_XS8);
LoadOptions.setEmpty();
LoadOptions.Add("-s"_XS8);
LoadOptions.Add("-c"_XS8);
SubScreen->AddMenuEntry(SubEntry, true);
}
SubEntry = Entry->getPartiallyDuplicatedEntry();
SubEntry =getPartiallyDuplicatedEntry();
if (SubEntry) {
SubEntry->Title.SWPrintf("Run %ls in text mode", FileName.wc_str());
SubEntry->Flags = OSFLAG_UNSET(SubEntry->Flags, OSFLAG_USEGRAPHICS);
Entry->LoadOptions.setEmpty();
Entry->LoadOptions.Add("-v"_XS8);
LoadOptions.setEmpty();
LoadOptions.Add("-v"_XS8);
SubEntry->LoaderType = OSTYPE_OTHER; // Sothor - Why are we using OSTYPE_OTHER here?
SubScreen->AddMenuEntry(SubEntry, true);
}
@ -1015,8 +1007,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
}
SubScreen->AddMenuEntry(&MenuEntryReturn, false);
Entry->SubScreen = SubScreen;
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n", Entry->Title, Entry->LoaderType, Entry->OSVersion);
// DBG(" Added '%ls': OSType='%d', OSVersion='%s'\n",Title,LoaderType,OSVersion);
}
BOOLEAN AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArray& LoaderOptions,
@ -1067,7 +1058,7 @@ BOOLEAN AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XStringArray& Loa
}
//TODO there is a problem that Entry->Flags is unique while InputItems are global ;(
// InputItems[69].IValue = Entry->Flags;
AddDefaultMenu(Entry);
Entry->AddDefaultMenu();
MainMenu.AddMenuEntry(Entry, true);
return TRUE;
}
@ -1839,7 +1830,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
Entry->Settings = Custom->Settings;
}
if (OSFLAG_ISUNSET(Custom->Flags, OSFLAG_NODEFAULTMENU)) {
AddDefaultMenu(Entry);
Entry->AddDefaultMenu();
} else if (Custom->SubEntries != NULL) {
UINTN CustomSubIndex = 0;
// Add subscreen

View File

@ -288,7 +288,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
UINT16 Flags;
EFI_DEVICE_PATH *DevicePath;
VOID StartTool();
void StartTool();
REFIT_MENU_ENTRY_LOADER_TOOL() : REFIT_MENU_ITEM_ABSTRACT_ENTRY_LOADER(), NoMemset(1), Flags(0), DevicePath(0) {};
@ -333,7 +333,7 @@ class REFIT_ABSTRACT_MENU_ENTRY
public:
LEGACY_ENTRY() : REFIT_MENU_ITEM_BOOTNUM() {};
VOID StartLegacy();
void StartLegacy();
virtual LEGACY_ENTRY* getLEGACY_ENTRY() { return this; };
};
@ -403,31 +403,31 @@ class REFIT_ABSTRACT_MENU_ENTRY
KernelRelocBase(0), bootArgs1(0), bootArgs2(0), dtRoot(0), dtLength(0)
{};
VOID SetKernelRelocBase();
VOID FindBootArgs();
void SetKernelRelocBase();
void FindBootArgs();
EFI_STATUS getVTable();
VOID Get_PreLink();
void Get_PreLink();
UINTN searchProc(const char *procedure);
UINTN searchProcInDriver(UINT8 * driver, UINT32 driverLen, const char *procedure);
VOID KernelAndKextsPatcherStart();
VOID KernelAndKextPatcherInit();
void KernelAndKextsPatcherStart();
void KernelAndKextPatcherInit();
BOOLEAN KernelUserPatch();
BOOLEAN KernelPatchPm();
BOOLEAN KernelLapicPatch_32();
BOOLEAN KernelLapicPatch_64();
BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize);
VOID EFIAPI KernelBooterExtensionsPatch();
void EFIAPI KernelBooterExtensionsPatch();
BOOLEAN KernelPanicNoKextDump();
VOID KernelCPUIDPatch();
void KernelCPUIDPatch();
BOOLEAN PatchCPUID(const UINT8* Location, INT32 LenLoc,
const UINT8* Search4, const UINT8* Search10, const UINT8* ReplaceModel,
const UINT8* ReplaceExt, INT32 Len);
VOID KernelPatcher_32();
// VOID KernelPatcher_64();
VOID FilterKernelPatches();
VOID FilterKextPatches();
VOID FilterBootPatches();
VOID applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *repl, const CHAR8 *comment);
void KernelPatcher_32();
// void KernelPatcher_64();
void FilterKernelPatches();
void FilterKextPatches();
void FilterBootPatches();
void applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *repl, const CHAR8 *comment);
EFI_STATUS SetFSInjection();
EFI_STATUS InjectKexts(IN UINT32 deviceTreeP, IN UINT32 *deviceTreeLength);
@ -435,25 +435,25 @@ class REFIT_ABSTRACT_MENU_ENTRY
int is_mkext_v1(UINT8* drvPtr);
void patch_mkext_v1(UINT8 *drvPtr);
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT VOID *kext);
EFI_STATUS LoadKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType, IN OUT void *kext);
EFI_STATUS AddKext(IN EFI_FILE *RootDir, IN CHAR16 *FileName, IN cpu_type_t archCpuType);
VOID LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
VOID AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType);
VOID KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);
VOID KextPatcherStart();
VOID PatchPrelinkedKexts();
VOID PatchLoadedKexts();
VOID PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N);
VOID ATIConnectorsPatchInit();
VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *ForceLoadKexts_v);
VOID AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID CheckForFakeSMC(CHAR8 *InfoPlist);
VOID DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
VOID BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void LoadPlugInKexts(IN EFI_FILE *RootDir, IN CHAR16 *DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force);
void AddKexts(CONST CHAR16 *SrcDir, CONST CHAR16 *Path, cpu_type_t archCpuType);
void KextPatcherRegisterKexts(void *FSInject, void *ForceLoadKexts);
void KextPatcherStart();
void PatchPrelinkedKexts();
void PatchLoadedKexts();
void PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N);
void ATIConnectorsPatchInit();
void ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void ATIConnectorsPatchRegisterKexts(void *FSInject_v, void *ForceLoadKexts_v);
void AppleIntelCPUPMPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void CheckForFakeSMC(CHAR8 *InfoPlist);
void DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
void BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize);
BOOLEAN SandyBridgeEPM();
BOOLEAN HaswellEXCPM();
BOOLEAN HaswellLowEndXCPM();
@ -461,8 +461,9 @@ class REFIT_ABSTRACT_MENU_ENTRY
BOOLEAN KernelIvyBridgeXCPM();
BOOLEAN KernelIvyE5XCPM();
VOID Stall(int Pause) { if ((KernelAndKextPatches != NULL) && KernelAndKextPatches->KPDebug) { gBS->Stall(Pause); } };
VOID StartLoader();
void Stall(int Pause) { if ((KernelAndKextPatches != NULL) && KernelAndKextPatches->KPDebug) { gBS->Stall(Pause); } };
void StartLoader();
void AddDefaultMenu();
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
} ;

View File

@ -64,7 +64,6 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage*
NSVGgroup *group;
NSVGimage *IconImage;
NSVGshape *shapeNext, *shapesTail = NULL, *shapePrev;
// CONST CHAR8 *IconName = IconNameX.c_str();
NSVGparser* p2 = nsvg__createParser();
IconImage = p2->image;
@ -106,7 +105,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage*
if (IconNameX.contains("selection_big") && (!SelectionOnTop)) {
MainEntriesSize = (int)(IconImage->width * Scale); //xxx
row0TileSize = MainEntriesSize + (int)(16.f * Scale);
DBG("main entry size = %lld\n", MainEntriesSize);
// DBG("main entry size = %lld\n", MainEntriesSize);
}
if (IconNameX.contains("selection_small") && (!SelectionOnTop)) {
row1TileSize = (int)(IconImage->width * Scale);
@ -245,7 +244,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
SVGParser = (void *)mainParser; //store the pointer for future use
NSVGimage *SVGimage = mainParser->image;
if (!SVGimage) {
DBG("Theme not parsed!\n");
// DBG("Theme not parsed!\n");
return EFI_NOT_STARTED;
}
@ -297,7 +296,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
}
XIcon* NewIcon = new XIcon(i, false); //initialize without embedded
Status = ParseSVGXIcon(i, NewIcon->Name, &NewIcon->Image, &NewIcon->ImageSVG);
DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
// DBG("parse %s status %s\n", NewIcon->Name.c_str(), strerror(Status));
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
NewIcon->setFilled();
@ -320,14 +319,13 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
if (AsciiStrLen(IconsNames[i]) == 0) break;
XIcon* NewIcon = new XIcon(i, false); //initialize without embedded
Status = ParseSVGXIcon(i, NewIcon->Name, &NewIcon->Image, &NewIcon->ImageSVG);
DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
// DBG("parse %s i=%lld status %s\n", NewIcon->Name.c_str(), i, strerror(Status));
NewIcon->Native = !EFI_ERROR(Status);
if (!EFI_ERROR(Status)) {
ParseSVGXIcon(i, NewIcon->Name + "_night"_XS8, &NewIcon->ImageNight, &NewIcon->ImageSVGnight);
}
Icons.AddReference(NewIcon, true);
}
DBG("parse icon_selection\n");
//selection for bootcampstyle
XIcon *NewIcon = new XIcon(BUILTIN_ICON_SELECTION);
Status = ParseSVGXIcon(BUILTIN_ICON_SELECTION, "selection_indicator"_XS8, &NewIcon->Image, &NewIcon->ImageSVG);
@ -342,17 +340,14 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
SelectionBackgroundPixel.Blue = (SelectionColor >> 8) & 0xFF;
SelectionBackgroundPixel.Reserved = (SelectionColor >> 0) & 0xFF;
//TODO make SelectionImages to be XIcon
DBG("assign selections\n");
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG).GetBest(!Daylight);
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL).GetBest(!Daylight);
SelectionImages[4] = GetIcon(BUILTIN_ICON_SELECTION).GetBest(!Daylight);
DBG("assign buttons\n");
//buttons
for (INTN i = BUILTIN_RADIO_BUTTON; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
Buttons[i - BUILTIN_RADIO_BUTTON] = GetIcon(i).GetBest(!Daylight);
}
DBG("done!\n");
//for (int i=0 ; i<6 ; i+=2 ) {
//SelectionImages[i].Draw(i*100, 0);
//}
@ -545,6 +540,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
nsvgDelete(p->image);
return (INTN)RealWidth; //x;
}
VOID testSVG()
{
do {