MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / LoadTheme

Method LoadTheme

rEFIt_UEFI/Platform/Settings.cpp:3563–3622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3561}
3562
3563TagDict* XTheme::LoadTheme(const XStringW& TestTheme)
3564
3565{
3566 EFI_STATUS Status = EFI_UNSUPPORTED;
3567 TagDict* ThemeDict = NULL;
3568 CHAR8 *ThemePtr = NULL;
3569 UINTN Size = 0;
3570
3571 if (TestTheme.isEmpty()) {
3572 return NULL;
3573 }
3574 if (UGAHeight > HEIGHT_2K) {
3575 ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls@2x", TestTheme.wc_str());
3576 } else {
3577 ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls", TestTheme.wc_str());
3578 }
3579 Status = SelfRootDir->Open(SelfRootDir, &ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
3580 if (EFI_ERROR(Status)) {
3581 if (ThemeDir != NULL) {
3582 ThemeDir->Close (ThemeDir);
3583 ThemeDir = NULL;
3584 }
3585 ThemePath = SWPrintf("EFI\\CLOVER\\themes\\%ls", TestTheme.wc_str());
3586 Status = SelfRootDir->Open(SelfRootDir, &ThemeDir, ThemePath.wc_str(), EFI_FILE_MODE_READ, 0);
3587 }
3588
3589 if (!EFI_ERROR(Status)) {
3590 Status = egLoadFile(ThemeDir, CONFIG_THEME_SVG, (UINT8**)&ThemePtr, &Size);
3591 if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
3592 Status = ParseSVGXTheme(ThemePtr);
3593 if (EFI_ERROR(Status)) {
3594 ThemeDict = NULL;
3595 } else {
3596 ThemeDict = TagDict::getEmptyTag();
3597 }
3598 if (ThemeDict == NULL) {
3599 DBG("svg file %ls not parsed\n", CONFIG_THEME_SVG);
3600 } else {
3601 DBG("Using vector theme '%ls' (%ls)\n", TestTheme.wc_str(), ThemePath.wc_str());
3602 }
3603 } else {
3604 Status = egLoadFile(ThemeDir, CONFIG_THEME_FILENAME, (UINT8**)&ThemePtr, &Size);
3605 if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
3606 Status = ParseXML(ThemePtr, &ThemeDict, 0);
3607 if (EFI_ERROR(Status)) {
3608 ThemeDict = NULL;
3609 }
3610 if (ThemeDict == NULL) {
3611 DBG("xml file %ls not parsed\n", CONFIG_THEME_FILENAME);
3612 } else {
3613 DBG("Using theme '%ls' (%ls)\n", TestTheme.wc_str(), ThemePath.wc_str());
3614 }
3615 }
3616 }
3617 }
3618 if (ThemePtr != NULL) {
3619 FreePool(ThemePtr);
3620 }

Callers 1

InitThemeFunction · 0.80

Calls 8

SWPrintfFunction · 0.85
egLoadFileFunction · 0.85
ParseXMLFunction · 0.85
FreePoolFunction · 0.50
isEmptyMethod · 0.45
wc_strMethod · 0.45
OpenMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected