From: srs5694
Originally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index 2a13366..b65c6fa 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -151,7 +151,7 @@ timeout 20Originally written: 4/19/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/features.html b/docs/refind/features.html index e47ae1d..417171c 100644 --- a/docs/refind/features.html +++ b/docs/refind/features.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -129,6 +129,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -97,7 +97,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/installing.html b/docs/refind/installing.html index 7be19bd..288c86c 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/linux.html b/docs/refind/linux.html index e6dbcbf..5d52042 100644 --- a/docs/refind/linux.html +++ b/docs/refind/linux.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/19/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/revisions.html b/docs/refind/revisions.html index 1ea8d93..38a1a91 100644 --- a/docs/refind/revisions.html +++ b/docs/refind/revisions.html @@ -14,7 +14,7 @@by Roderick W. Smith, rodsmith@rodsbooks.com
-Last Web page update: 5/6/2012
+Last Web page update: 5/9/2012
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -93,6 +93,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 4/19/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.4
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -96,7 +96,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -126,10 +126,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com themes for rEFInd, see the Theming rEFInd page.Originally written: 3/14/2012; last Web page update: -5/6/2012, referencing rEFInd 0.3.3
+5/9/2012, referencing rEFInd 0.3.4I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/libeg/image.c b/libeg/image.c index 4dac964..271141f 100644 --- a/libeg/image.c +++ b/libeg/image.c @@ -35,6 +35,8 @@ */ #include "libegint.h" +#include "../refind/global.h" +#include "../refind/lib.h" #include "refit_call_wrapper.h" #define MAX_FILE_SIZE (1024*1024*1024) @@ -46,7 +48,7 @@ EG_IMAGE * egCreateImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha) { EG_IMAGE *NewImage; - + NewImage = (EG_IMAGE *) AllocatePool(sizeof(EG_IMAGE)); if (NewImage == NULL) return NULL; @@ -55,7 +57,7 @@ EG_IMAGE * egCreateImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha) FreePool(NewImage); return NULL; } - + NewImage->Width = Width; NewImage->Height = Height; NewImage->HasAlpha = HasAlpha; @@ -65,11 +67,11 @@ EG_IMAGE * egCreateImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha) EG_IMAGE * egCreateFilledImage(IN UINTN Width, IN UINTN Height, IN BOOLEAN HasAlpha, IN EG_PIXEL *Color) { EG_IMAGE *NewImage; - + NewImage = egCreateImage(Width, Height, HasAlpha); if (NewImage == NULL) return NULL; - + egFillImage(NewImage, Color); return NewImage; } @@ -111,14 +113,12 @@ EFI_STATUS egLoadFile(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, Status = refit_call5_wrapper(BaseDir->Open, BaseDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0); if (EFI_ERROR(Status)) { -// Print(L"Returning %d from egLoadFile() because of an error on open!\n", Status); return Status; } FileInfo = LibFileInfo(FileHandle); if (FileInfo == NULL) { refit_call1_wrapper(FileHandle->Close, FileHandle); -// Print(L"LibFileInfo() returned NULL!\n"); return EFI_NOT_FOUND; } ReadSize = FileInfo->FileSize; @@ -132,7 +132,7 @@ EFI_STATUS egLoadFile(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, refit_call1_wrapper(FileHandle->Close, FileHandle); return EFI_OUT_OF_RESOURCES; } - + Status = refit_call3_wrapper(FileHandle->Read, FileHandle, &BufferSize, Buffer); refit_call1_wrapper(FileHandle->Close, FileHandle); if (EFI_ERROR(Status)) { @@ -142,7 +142,6 @@ EFI_STATUS egLoadFile(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, *FileData = Buffer; *FileDataLength = BufferSize; -// Print(L"In egLoadFile(), Returning EFI_SUCCESS\n"); return EFI_SUCCESS; } @@ -247,32 +246,40 @@ EG_IMAGE * egLoadImage(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, IN BOOLEAN Wan return NewImage; } -EG_IMAGE * egLoadIcon(IN EFI_FILE* BaseDir, IN CHAR16 *FileName, IN UINTN IconSize) +// Load an icon from (BaseDir)/Path, extracting the icon of size IconSize x IconSize. +// If the initial attempt is unsuccessful, try again, replacing the directory +// component of Path with DEFAULT_ICONS_DIR. +// Note: The assumption is that BaseDir points to rEFInd's home directory and Path +// includes one subdirectory level. If this changes in future revisions, it may be +// necessary to alter the code that tries again with DEFAULT_ICONS_DIR. +// Returns a pointer to the image data, or NULL if the icon could not be loaded. +EG_IMAGE * egLoadIcon(IN EFI_FILE* BaseDir, IN CHAR16 *Path, IN UINTN IconSize) { EFI_STATUS Status; UINT8 *FileData; UINTN FileDataLength; + CHAR16 *FileName, FileName2[256]; EG_IMAGE *NewImage; - if (BaseDir == NULL || FileName == NULL) + if (BaseDir == NULL || Path == NULL) return NULL; // load file - Status = egLoadFile(BaseDir, FileName, &FileData, &FileDataLength); + Status = egLoadFile(BaseDir, Path, &FileData, &FileDataLength); if (EFI_ERROR(Status)) { -// Print(L"In egLoadIcon(), Status = %d after egLoadFile(); aborting load!\n", Status); - return NULL; + FileName = Basename(Path); // Note: FileName is a pointer within Path; DON'T FREE IT! + SPrint(FileName2, 255, L"%s\\%s", DEFAULT_ICONS_DIR, FileName); + Status = egLoadFile(BaseDir, FileName2, &FileData, &FileDataLength); + if (EFI_ERROR(Status)) + return NULL; } // decode it - NewImage = egDecodeAny(FileData, FileDataLength, egFindExtension(FileName), IconSize, TRUE); -// Print(L"Done with egDecodeAny(), used extension '%s'\n", egFindExtension(FileName)); -// if (NewImage == NULL) -// Print(L"Returning NULL from egLoadIcon()\n"); + NewImage = egDecodeAny(FileData, FileDataLength, egFindExtension(Path), IconSize, TRUE); FreePool(FileData); return NewImage; -} +} // EG_IMAGE *egLoadIcon() EG_IMAGE * egDecodeImage(IN UINT8 *FileData, IN UINTN FileDataLength, IN CHAR16 *Format, IN BOOLEAN WantAlpha) { @@ -285,26 +292,26 @@ EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEA UINT8 *CompData; UINTN CompLen; UINTN PixelCount; - + // sanity check if (EmbeddedImage->PixelMode > EG_MAX_EIPIXELMODE || (EmbeddedImage->CompressMode != EG_EICOMPMODE_NONE && EmbeddedImage->CompressMode != EG_EICOMPMODE_RLE)) return NULL; - + // allocate image structure and pixel buffer NewImage = egCreateImage(EmbeddedImage->Width, EmbeddedImage->Height, WantAlpha); if (NewImage == NULL) return NULL; - + CompData = (UINT8 *)EmbeddedImage->Data; // drop const CompLen = EmbeddedImage->DataLength; PixelCount = EmbeddedImage->Width * EmbeddedImage->Height; - + // FUTURE: for EG_EICOMPMODE_EFICOMPRESS, decompress whole data block here - + if (EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY || EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY_ALPHA) { - + // copy grayscale plane and expand if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) { egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, r), PixelCount); @@ -314,10 +321,10 @@ EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEA } egCopyPlane(PLPTR(NewImage, r), PLPTR(NewImage, g), PixelCount); egCopyPlane(PLPTR(NewImage, r), PLPTR(NewImage, b), PixelCount); - + } else if (EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR || EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR_ALPHA) { - + // copy color planes if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) { egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, r), PixelCount); @@ -331,20 +338,20 @@ EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEA egInsertPlane(CompData, PLPTR(NewImage, b), PixelCount); CompData += PixelCount; } - + } else { - + // set color planes to black egSetPlane(PLPTR(NewImage, r), 0, PixelCount); egSetPlane(PLPTR(NewImage, g), 0, PixelCount); egSetPlane(PLPTR(NewImage, b), 0, PixelCount); - + } - + if (WantAlpha && (EmbeddedImage->PixelMode == EG_EIPIXELMODE_GRAY_ALPHA || EmbeddedImage->PixelMode == EG_EIPIXELMODE_COLOR_ALPHA || EmbeddedImage->PixelMode == EG_EIPIXELMODE_ALPHA)) { - + // copy alpha plane if (EmbeddedImage->CompressMode == EG_EICOMPMODE_RLE) { egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, a), PixelCount); @@ -352,11 +359,11 @@ EG_IMAGE * egPrepareEmbeddedImage(IN EG_EMBEDDED_IMAGE *EmbeddedImage, IN BOOLEA egInsertPlane(CompData, PLPTR(NewImage, a), PixelCount); CompData += PixelCount; } - + } else { egSetPlane(PLPTR(NewImage, a), WantAlpha ? 255 : 0, PixelCount); } - + return NewImage; } diff --git a/refind.conf-sample b/refind.conf-sample index 1f44731..ec8e696 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -23,7 +23,10 @@ timeout 20 # Set the name of a subdirectory in which icons are stored. Icons must # have the same names they have in the standard directory. The directory -# name is specified relative to the main rEFInd binary's directory. +# name is specified relative to the main rEFInd binary's directory. If +# an icon can't be found in the specified directory, an attempt is made +# to load it from the default directory; thus, you can replace just some +# icons in your own directory and rely on the default for others. # Default is "icons". # #icons_dir myicons diff --git a/refind/icns.c b/refind/icns.c index 1bc3202..e4738e2 100644 --- a/refind/icns.c +++ b/refind/icns.c @@ -160,7 +160,7 @@ EG_IMAGE * DummyImage(IN UINTN PixelSize) } YPtr += LineOffset; } - + return Image; } diff --git a/refind/main.c b/refind/main.c index 55ddf89..6256bbf 100644 --- a/refind/main.c +++ b/refind/main.c @@ -104,7 +104,7 @@ static VOID AboutrEFInd(VOID) { if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.3.2"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.4"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");