some cleanup

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-05 16:59:17 +03:00
parent 0ca41b23f2
commit b735290ad2
9 changed files with 18 additions and 1951 deletions

View File

@ -657,10 +657,6 @@
DEFINE ANDX86_FLAG = -DANDX86
#!endif
#!ifdef LODEPNG
DEFINE LODEPNG_FLAG = -DLODEPNG
#!endif
!ifdef ENABLE_PS2MOUSE_LEGACYBOOT
DEFINE PS2MOUSE_LEGACYBOOT_FLAG = -DENABLE_PS2MOUSE_LEGACYBOOT
!endif
@ -679,7 +675,7 @@ DEFINE EXIT_USBKB_FLAG = -DEXIT_USBKB
!endif
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(LODEPNG_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
DEFINE BUILD_OPTIONS=-DMDEPKG_NDEBUG -DCLOVER_BUILD $(VBIOS_PATCH_CLOVEREFI_FLAG) $(ONLY_SATA_0_FLAG) $(BLOCKIO_FLAG) $(NOUSB_FLAG) $(NOUDMA_FLAG) $(AMD_FLAG) $(SECURE_BOOT_FLAG) $(ANDX86_FLAG) $(PS2MOUSE_LEGACYBOOT_FLAG) $(DEBUG_ON_SERIAL_PORT_FLAG) $(EXIT_USBKB_FLAG)
#MSFT:*_*_*_CC_FLAGS = /FAcs /FR$(@R).SBR /wd4701 /wd4703 $(BUILD_OPTIONS)
MSFT:*_*_*_CC_FLAGS = /FAcs $(BUILD_OPTIONS) -Dinline=__inline /Zi

View File

@ -1,410 +0,0 @@
////
//// Pointer.c
////
////
//// Created by Slice on 23.09.12.
////
//// Initial idea comes from iBoot project by OS_Ninja and Ujen
//// their sources are under GNU License but I don't know what is the subject for licensing here.
//// my sources are quite different while Mouse/Events interfaces comes from Tiano,
//// for example ConSplitterDxe or BdsDxe/FrontPage
//// anyway thanks for good tutorial how to do and how not to do
////
//// Any usage for SMBIOS here?
///// Built-in Pointing Device (Type 21).
//
////#include "Platform.h"
//#include "libegint.h" //this includes platform.h
//#include "../refit/screen.h"
//
//#ifndef DEBUG_ALL
//#define DEBUG_MOUSE 1
//#else
//#define DEBUG_MOUSE DEBUG_ALL
//#endif
//
//#if DEBUG_MOUSE == 0
//#define DBG(...)
//#else
//#define DBG(...) DebugLog(DEBUG_MOUSE, __VA_ARGS__)
//#endif
//
//extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
//
//// make them theme dependent? No, 32 is good value for all.
//#define POINTER_WIDTH 32
//#define POINTER_HEIGHT 32
////have to be moved to menu class
//ACTION gAction;
//UINTN gItemID;
//
//POINTERS gPointer = {NULL, NULL, NULL, NULL,
// {0, 0, POINTER_WIDTH, POINTER_HEIGHT},
// {0, 0, POINTER_WIDTH, POINTER_HEIGHT}, 0,
// {0, 0, 0, FALSE, FALSE}, NoEvents};
//
//VOID HidePointer()
//{
// if (gPointer.SimplePointerProtocol) {
// egDrawImageArea(gPointer.oldImage, 0, 0, 0, 0, gPointer.oldPlace.XPos, gPointer.oldPlace.YPos);
// }
//}
//
//VOID DrawPointer()
//{
// // thanks lllevelll for the patch, I move it to egTakeImage and egDrawImageArea
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///* UINTN PointerHCrop = POINTER_HEIGHT;
// UINTN PointerWCrop = POINTER_WIDTH;
// UINTN Var = 0;
//
// PointerHCrop = POINTER_HEIGHT;
// PointerWCrop = POINTER_WIDTH;
//
// Var = UGAWidth - gPointer.newPlace.XPos;
//
// If (Var < POINTER_WIDTH) {
// PointerWCrop = Var;
// }
//
// Var = UGAHeight - gPointer.newPlace.YPos;
//
// If Var < (POINTER_HEIGHT) {
// PointerHCrop = Var;
// }
// //////////////////////////////////////////////////////////////////////////////////////////////////////////
//*/
// // take background image
// egTakeImage(gPointer.oldImage, gPointer.newPlace.XPos, gPointer.newPlace.YPos,
// POINTER_WIDTH, POINTER_HEIGHT);
// CopyMem(&gPointer.oldPlace, &gPointer.newPlace, sizeof(EG_RECT));
// CopyMem(gPointer.newImage->PixelData, gPointer.oldImage->PixelData, (UINTN)(POINTER_WIDTH * POINTER_HEIGHT * sizeof(EG_PIXEL))); // Should be faster
// egComposeImage(gPointer.newImage, gPointer.Pointer, 0, 0);
// egDrawImageArea(gPointer.newImage, 0, 0,
// POINTER_WIDTH, POINTER_HEIGHT,
// gPointer.oldPlace.XPos, gPointer.oldPlace.YPos);
//
//}
//
//VOID RedrawPointer()
//{
// //always assumed
// if (!gPointer.SimplePointerProtocol) {
// return;
// }
// HidePointer();
// DrawPointer();
//}
//
//EFI_STATUS MouseBirth()
//{
// EFI_STATUS Status = EFI_UNSUPPORTED;
//
// if (!gSettings.PointerEnabled) {
// return EFI_SUCCESS;
// }
//
// if (gPointer.SimplePointerProtocol) { //do not double
//// DBG("DrawPointer\n");
// DrawPointer();
// return EFI_SUCCESS;
// }
// //Status = gBS->LocateProtocol (&gEfiSimplePointerProtocolGuid, NULL, (VOID**)&gPointer.SimplePointerProtocol);
//
// // Try first to use mouse from System Table
// Status = gBS->HandleProtocol (gST->ConsoleInHandle, &gEfiSimplePointerProtocolGuid, (VOID**)&gPointer.SimplePointerProtocol);
// if (EFI_ERROR (Status)) {
// // not found, so use the first found device
// DBG("MouseBirth: No mouse at ConIn, checking if any other device exists\n");
// Status = gBS->LocateProtocol (&gEfiSimplePointerProtocolGuid, NULL, (VOID**)&gPointer.SimplePointerProtocol);
// }
// /*else {
// DBG("MouseBirth: Mouse located at ConIn\n");
// }*/
//
// if(EFI_ERROR(Status)) {
// gPointer.Pointer = NULL;
// gPointer.MouseEvent = NoEvents;
// gPointer.SimplePointerProtocol = NULL;
// MsgLog("No mouse!\n");
// gSettings.PointerEnabled = FALSE;
// return Status;
// }
//
// //there may be also trackpad protocol but afaik it is not properly work and
// // trackpad is usually controlled by simple mouse driver
//
// gPointer.Pointer = BuiltinIcon(BUILTIN_ICON_POINTER);
// if(!gPointer.Pointer) {
// //this is impossible after BuiltinIcon
// DBG("No pointer image!\n");
// gPointer.SimplePointerProtocol = NULL;
// return EFI_NOT_FOUND;
// }
// gPointer.LastClickTime = 0; //AsmReadTsc();
// gPointer.oldPlace.XPos = (INTN)(UGAWidth >> 2);
// gPointer.oldPlace.YPos = (INTN)(UGAHeight >> 2);
// gPointer.oldPlace.Width = POINTER_WIDTH;
// gPointer.oldPlace.Height = POINTER_HEIGHT;
// CopyMem(&gPointer.newPlace, &gPointer.oldPlace, sizeof(EG_RECT));
//
// gPointer.oldImage = egCreateImage(POINTER_WIDTH, POINTER_HEIGHT, FALSE);
// gPointer.newImage = egCreateFilledImage(POINTER_WIDTH, POINTER_HEIGHT, FALSE, &MenuBackgroundPixel);
//// egTakeImage(gPointer.oldImage, gPointer.oldPlace.XPos, gPointer.oldPlace.YPos,
//// POINTER_WIDTH, POINTER_HEIGHT); // DrawPointer repeats it
// DrawPointer();
// gPointer.MouseEvent = NoEvents;
// return Status;
//}
//
//VOID KillMouse()
//{
//// EG_PIXEL pi;
// if (!gPointer.SimplePointerProtocol) {
// return;
// }
//// pi = gPointer.oldImage->PixelData[0];
//// DBG("Mouse death\n");
//// DBG(" Blue=%x Green=%x Red=%x Alfa=%x\n\n", pi.b, pi.g, pi.r, pi.a);
//
//
// egFreeImage(gPointer.newImage); gPointer.newImage = NULL;
// egFreeImage(gPointer.oldImage); gPointer.oldImage = NULL;
//
// // Free Pointer only if it is not builtin icon
// if (gPointer.Pointer != BuiltinIcon(BUILTIN_ICON_POINTER)) {
// egFreeImage(gPointer.Pointer);
// }
//
// gPointer.Pointer = NULL;
// gPointer.MouseEvent = NoEvents;
// gPointer.SimplePointerProtocol = NULL;
//}
//
//// input - tsc
//// output - milliseconds
//// the caller is responsible for t1 > t0
//UINT64 TimeDiff(UINT64 t0, UINT64 t1)
//{
// return DivU64x64Remainder((t1 - t0), DivU64x32(gCPUStructure.TSCFrequency, 1000), 0);
//}
//
//VOID PrintPointerVars(
// INT32 RelX,
// INT32 RelY,
// INTN ScreenRelX,
// INTN ScreenRelY,
// INTN XPosPrev,
// INTN YPosPrev,
// INTN XPos,
// INTN YPos
// )
//{
// EFI_SIMPLE_POINTER_MODE *CurrentMode;
//// UINT64 Now;
//
// CurrentMode = gPointer.SimplePointerProtocol->Mode;
//// Now = AsmReadTsc();
// gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
//// DBG("%ld \n", Now);
// DBG("Resolution X, Y: %ld, %ld \n", CurrentMode->ResolutionX, CurrentMode->ResolutionY);
// DBG("Relative X, Y: %d, %d (%ld, %ld millimeters) \n",
// RelX, RelY,
// (INTN)RelX / (INTN)CurrentMode->ResolutionX,
// (INTN)RelY / (INTN)CurrentMode->ResolutionY
// );
// DBG("X: %d + %d = %d -> %d \n", XPosPrev, ScreenRelX, (XPosPrev + ScreenRelX), XPos);
// DBG("Y: %d + %d = %d -> %d \n", YPosPrev, ScreenRelY, (YPosPrev + ScreenRelY), YPos);
//}
//
////static INTN PrintCount = 0;
//
//VOID UpdatePointer()
//{
//// EFI_TIME Now;
// UINT64 Now;
// EFI_STATUS Status; // = EFI_SUCCESS;
// EFI_SIMPLE_POINTER_STATE tmpState;
// EFI_SIMPLE_POINTER_MODE *CurrentMode;
//// INTN XPosPrev;
//// INTN YPosPrev;
// INTN ScreenRelX;
// INTN ScreenRelY;
//
//// Now = gRT->GetTime(&Now, NULL);
// Now = AsmReadTsc();
// Status = gPointer.SimplePointerProtocol->GetState(gPointer.SimplePointerProtocol, &tmpState);
// if (!EFI_ERROR(Status)) {
// if (!gPointer.State.LeftButton && tmpState.LeftButton) // press left
// gPointer.MouseEvent = LeftMouseDown;
// else if (!gPointer.State.RightButton && tmpState.RightButton) // press right
// gPointer.MouseEvent = RightMouseDown;
// else if (gPointer.State.LeftButton && !tmpState.LeftButton) { //release left
// // time for double click 500ms into menu
// if (TimeDiff(gPointer.LastClickTime, Now) < gSettings.DoubleClickTime)
// gPointer.MouseEvent = DoubleClick;
// else
// gPointer.MouseEvent = LeftClick;
// // CopyMem(&gPointer.LastClickTime, &Now, sizeof(EFI_TIME));
// gPointer.LastClickTime = Now;
// } else if (gPointer.State.RightButton && !tmpState.RightButton) //release right
// gPointer.MouseEvent = RightClick;
// else if (gPointer.State.RelativeMovementZ > 0)
// gPointer.MouseEvent = ScrollDown;
// else if (gPointer.State.RelativeMovementZ < 0)
// gPointer.MouseEvent = ScrollUp;
// else if (gPointer.State.RelativeMovementX || gPointer.State.RelativeMovementY)
// gPointer.MouseEvent = MouseMove;
// else
// gPointer.MouseEvent = NoEvents;
//
// CopyMem(&gPointer.State, &tmpState, sizeof(EFI_SIMPLE_POINTER_STATE));
// CurrentMode = gPointer.SimplePointerProtocol->Mode;
//
//// XPosPrev = gPointer.newPlace.XPos;
// ScreenRelX = ((UGAWidth * gPointer.State.RelativeMovementX / (INTN)CurrentMode->ResolutionX) * gSettings.PointerSpeed) >> 10;
// if (gSettings.PointerMirror) {
// gPointer.newPlace.XPos -= ScreenRelX;
// } else {
// gPointer.newPlace.XPos += ScreenRelX;
// }
// if (gPointer.newPlace.XPos < 0) gPointer.newPlace.XPos = 0;
// if (gPointer.newPlace.XPos > UGAWidth - 1) gPointer.newPlace.XPos = UGAWidth - 1;
//
//// YPosPrev = gPointer.newPlace.YPos;
// ScreenRelY = ((UGAHeight * gPointer.State.RelativeMovementY / (INTN)CurrentMode->ResolutionY) * gSettings.PointerSpeed) >> 10;
// gPointer.newPlace.YPos += ScreenRelY;
// if (gPointer.newPlace.YPos < 0) gPointer.newPlace.YPos = 0;
// if (gPointer.newPlace.YPos > UGAHeight - 1) gPointer.newPlace.YPos = UGAHeight - 1;
// /*
// if (PrintCount < 1) {
// PrintPointerVars(gPointer.State.RelativeMovementX,
// gPointer.State.RelativeMovementY,
// ScreenRelX,
// ScreenRelY,
// XPosPrev,
// YPosPrev,
// gPointer.newPlace.XPos,
// gPointer.newPlace.YPos
// );
//
// PrintCount++;
// }
// */
// RedrawPointer();
// }
//// return Status;
//}
//
//BOOLEAN MouseInRect(EG_RECT *Place)
//{
// return ((gPointer.newPlace.XPos >= Place->XPos) &&
// (gPointer.newPlace.XPos < (Place->XPos + (INTN)Place->Width)) &&
// (gPointer.newPlace.YPos >= Place->YPos) &&
// (gPointer.newPlace.YPos < (Place->YPos + (INTN)Place->Height)));
//}
//
//EFI_STATUS CheckMouseEvent(REFIT_MENU_SCREEN *Screen)
//{
// EFI_STATUS Status = EFI_TIMEOUT;
//// INTN EntryId;
//
// gAction = ActionNone;
//
// if (!Screen) {
// return EFI_TIMEOUT;
// }
//
// if (!IsDragging && gPointer.MouseEvent == MouseMove)
// gPointer.MouseEvent = NoEvents;
//
//// if (gPointer.MouseEvent != NoEvents){
// if (ScrollEnabled && MouseInRect(&UpButton) && gPointer.MouseEvent == LeftClick)
// gAction = ActionScrollUp;
// else if (ScrollEnabled && MouseInRect(&DownButton) && gPointer.MouseEvent == LeftClick)
// gAction = ActionScrollDown;
// else if (ScrollEnabled && MouseInRect(&Scrollbar) && gPointer.MouseEvent == LeftMouseDown) {
// IsDragging = TRUE;
// ScrollbarYMovement = 0;
// ScrollbarOldPointerPlace.XPos = ScrollbarNewPointerPlace.XPos = gPointer.newPlace.XPos;
// ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = gPointer.newPlace.YPos;
// } else if (ScrollEnabled && IsDragging && gPointer.MouseEvent == LeftClick) {
// IsDragging = FALSE;
// } else if (ScrollEnabled && IsDragging && gPointer.MouseEvent == MouseMove) {
// gAction = ActionMoveScrollbar;
// ScrollbarNewPointerPlace.XPos = gPointer.newPlace.XPos;
// ScrollbarNewPointerPlace.YPos = gPointer.newPlace.YPos;
// } else if (ScrollEnabled && MouseInRect(&ScrollbarBackground) &&
// gPointer.MouseEvent == LeftClick) {
// if (gPointer.newPlace.YPos < Scrollbar.YPos) // up
// gAction = ActionPageUp;
// else // down
// gAction = ActionPageDown;
// // page up/down, like in OS X
// } else if (ScrollEnabled &&
// gPointer.MouseEvent == ScrollDown) {
// gAction = ActionScrollDown;
// } else if (ScrollEnabled &&
// gPointer.MouseEvent == ScrollUp) {
// gAction = ActionScrollUp;
// } else {
// for (UINTN EntryId = 0; EntryId < Screen->Entries.size(); EntryId++) {
// if (MouseInRect(&(Screen->Entries[EntryId].Place))) {
// switch (gPointer.MouseEvent) {
// case LeftClick:
// gAction = Screen->Entries[EntryId].AtClick;
// // DBG("Click\n");
// break;
// case RightClick:
// gAction = Screen->Entries[EntryId].AtRightClick;
// break;
// case DoubleClick:
// gAction = Screen->Entries[EntryId].AtDoubleClick;
// break;
// case ScrollDown:
// gAction = ActionScrollDown;
// break;
// case ScrollUp:
// gAction = ActionScrollUp;
// break;
// case MouseMove:
// gAction = Screen->Entries[EntryId].AtMouseOver;
// //how to do the action once?
// break;
// default:
// gAction = ActionNone;
// break;
// }
// gItemID = EntryId;
// break;
// } else { //click in milk
// switch (gPointer.MouseEvent) {
// case LeftClick:
// gAction = ActionDeselect;
// break;
// case RightClick:
// gAction = ActionFinish;
// break;
// case ScrollDown:
// gAction = ActionScrollDown;
// break;
// case ScrollUp:
// gAction = ActionScrollUp;
// break;
// default:
// gAction = ActionNone;
// break;
// }
// gItemID = 0xFFFF;
// }
// }
// }
//// }
// if (gAction != ActionNone) {
// Status = EFI_SUCCESS;
// gPointer.MouseEvent = NoEvents; //clear event as set action
// }
// return Status;
//}
//
//

View File

@ -1,2 +0,0 @@
//
//VOID KillMouse();

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _PICOPNG_H
#define _PICOPNG_H
#include "Platform.h"
typedef struct {
UINT32 *data;
UINT32 size;
UINT32 allocsize;
} VECTOR_32;
typedef struct {
UINT8 *data;
UINT32 size;
UINT32 allocsize;
} VECTOR_8;
typedef struct {
UINT32 width, height;
UINT32 colorType, bitDepth;
UINT32 compressionMethod, filterMethod, interlaceMethod;
UINT32 key_r, key_g, key_b;
BOOLEAN key_defined;
VECTOR_8 *palette;
VECTOR_8 *image;
} PNG_INFO;
EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha);
#endif

View File

@ -35,10 +35,7 @@
*/
#include "libegint.h"
#if defined(LODEPNG)
#include "lodepng.h"
#endif //LODEPNG
#define MAX_FILE_SIZE (1024*1024*1024)
@ -884,7 +881,7 @@ VOID egCopyPlane(IN UINT8 *SrcPlanePtr, IN UINT8 *DestPlanePtr, IN UINTN PixelCo
}
}
#if defined(LODEPNG)
EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha) {
EG_IMAGE *NewImage = NULL;
UINTN Error, i, ImageSize, Width, Height;
@ -933,6 +930,6 @@ EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN W
lodepng_free(PixelData);
return NewImage;
}
#endif //LODEPNG
/* EOF */

View File

@ -35,10 +35,8 @@
*/
#include "libegint.h"
#if defined(LODEPNG)
#include "lodepng.h"
#endif //LODEPNG
//#include <efiUgaDraw.h>
#include <Protocol/GraphicsOutput.h>
@ -628,8 +626,6 @@ VOID egTakeImage(IN EG_IMAGE *Image, INTN ScreenPosX, INTN ScreenPosY,
// Make a screenshot
//
CONST CHAR8 ScreenShotName[] = "EFI\\CLOVER\\misc\\screenshot";
#define USE_XIMAGE 1
#if USE_XIMAGE
EFI_STATUS egScreenShot(VOID)
{
EFI_STATUS Status = EFI_NOT_READY;
@ -656,122 +652,7 @@ EFI_STATUS egScreenShot(VOID)
FreePool(FileData);
return Status;
}
#else
EFI_STATUS egScreenShot(VOID)
{
EFI_STATUS Status = EFI_NOT_READY;
EG_IMAGE *Image;
UINT8 *FileData = NULL;
UINTN FileDataLength = 0U;
// UINTN Index;
// CHAR16 ScreenshotName[128];
CHAR16 *ScreenshotName;
if (!egHasGraphics)
return EFI_NOT_READY;
MsgLog("Make screenshot W=%d H=%d\n", egScreenWidth, egScreenHeight);
// allocate a buffer for the whole screen
Image = egCreateImage(egScreenWidth, egScreenHeight, FALSE);
if (Image == NULL) {
MsgLog("Error egCreateImage returned NULL\n");
return EFI_NO_MEDIA;
}
MsgLog("take screen\n");
// get full screen image
if (GraphicsOutput != NULL) {
GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Image->PixelData,
EfiBltVideoToBltBuffer,
0, 0, 0, 0, (UINTN)Image->Width, (UINTN)Image->Height, 0);
} else if (UgaDraw != NULL) {
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL *)Image->PixelData, EfiUgaVideoToBltBuffer,
0, 0, 0, 0, (UINTN)Image->Width, (UINTN)Image->Height, 0);
} else {
MsgLog("Error no GOP\n");
return EFI_NOT_READY;
}
// yyyyy
#if defined(LODEPNG)
{
EFI_UGA_PIXEL *ImagePNG = (EFI_UGA_PIXEL *)Image->PixelData;
UINTN ImageSize = Image->Width * Image->Height;
// UINTN i;
unsigned lode_return;
//MsgLog("convert BGR\n");
// Convert BGR to RGBA with Alpha set to 0xFF
for (UINTN i = 0; i < ImageSize; i++) {
UINT8 Temp = ImagePNG[i].Blue;
ImagePNG[i].Blue = ImagePNG[i].Red;
ImagePNG[i].Red = Temp;
ImagePNG[i].Reserved = 0xFF;
}
//MsgLog("eglodepng_encode\n");
// Encode raw RGB image to PNG format
lode_return = eglodepng_encode(&FileData, &FileDataLength, (CONST UINT8*)ImagePNG, (UINTN)Image->Width, (UINTN)Image->Height);
if (lode_return) {
MsgLog("egScreenShot(): eglodepng_encode failed on ImagePNG %p, Width %ld, Height %ld with error %u\n",
ImagePNG, Image->Width, Image->Height, lode_return);
}
}
#else //LODEPNG
// encode as BMP
egEncodeBMP(Image, &FileData, &FileDataLength);
#endif //LODEPNG
//MsgLog("egFreeImage\n");
egFreeImage(Image);
if (FileData == NULL) {
MsgLog("Error egEncode returned NULL\n");
return EFI_NO_MEDIA;
}
for (UINTN Index=0; Index < 60; Index++) {
// MsgLog("create name [%d]\n", Index);
#if defined(LODEPNG)
// UnicodeSPrint(ScreenshotName, 256, L"EFI\\CLOVER\\misc\\screenshot%d.png", Index);
ScreenshotName = PoolPrint(L"%a%d.png", ScreenShotName, Index);
#else //LODEPNG
ScreenshotName = PoolPrint(L"%a%d.bmp", ScreenShotName, Index);
// UnicodeSPrint(ScreenshotName, 256, L"EFI\\CLOVER\\misc\\screenshot%d.bmp", Index);
#endif //LODEPNG
if(!FileExists(SelfRootDir, ScreenshotName)){
Status = egSaveFile(SelfRootDir, ScreenshotName, FileData, FileDataLength);
FreePool(ScreenshotName);
ScreenshotName = NULL;
if (!EFI_ERROR(Status)) {
break;
}
} else {
FreePool(ScreenshotName);
}
}
// else save to file on the ESP
if (EFI_ERROR(Status)) {
for (UINTN Index=0; Index < 60; Index++) {
#if defined(LODEPNG)
// UnicodeSPrint(ScreenshotName, 256, L"EFI\\CLOVER\\misc\\screenshot%d.png", Index);
ScreenshotName = PoolPrint(L"%a%d.png", ScreenShotName, Index);
#else //LODEPNG
ScreenshotName = PoolPrint(L"%a%d.bmp", ScreenShotName, Index);
// UnicodeSPrint(ScreenshotName, 256, L"EFI\\CLOVER\\misc\\screenshot%d.bmp", Index);
#endif //LODEPNG
// if(!FileExists(NULL, ScreenshotName)){
Status = egSaveFile(NULL, ScreenshotName, FileData, FileDataLength);
FreePool(ScreenshotName);
if (!EFI_ERROR(Status)) {
break;
}
// }
}
CheckError(Status, L"Error egSaveFile\n");
}
#if defined(LODEPNG)
lodepng_free(FileData);
#else //LODEPNG
FreePool(FileData);
#endif //LODEPNG
return Status;
}
#endif
//
// Sets mode via GOP protocol, and reconnects simple text out drivers
//

View File

@ -40,7 +40,9 @@
refit/lib.cpp
refit/lib.h
refit/menu.cpp
refit/menu.h
refit/screen.cpp
refit/screen.h
refit/IO.cpp
refit/IO.h
entry_scan/common.cpp
@ -52,6 +54,7 @@
entry_scan/securemenu.cpp
entry_scan/securevars.cpp
entry_scan/bootscreen.cpp
entry_scan/bootscreen.h
entry_scan/lockedgraphics.cpp
entry_scan/CanonicalDB.h
entry_scan/CloverDB.h
@ -61,6 +64,8 @@
entry_scan/MSUEFICADB.h
entry_scan/entry_scan.h
entry_scan/securebootkeys.h
gui/menu_items/menu_items.h
gui/menu_items/menu_globals.h
libeg/egemb_icons.cpp
libeg/egemb_icons_dark.cpp
libeg/egemb_font.cpp
@ -99,6 +104,7 @@
Platform/Console.cpp
Platform/cpu.cpp
Platform/DataHubCpu.cpp
Platform/DataHubCpu.h
# Platform/DataHubRecords.h
Platform/device_inject.cpp
Platform/device_inject.h
@ -106,6 +112,7 @@
# Platform/device_tree.h
Platform/Edid.cpp
Platform/Events.cpp
Platform/Events.h
Platform/hda.cpp
Platform/hda.h
Platform/HdaCodecDump.cpp
@ -120,14 +127,14 @@
Platform/memvendors.h
Platform/nvidia.cpp
Platform/nvidia.h
# Platform/pci.cpp
# Platform/picopng.cpp
# Platform/picopng.h
Platform/Nvram.cpp
Platform/Nvram.h
Platform/Platform.h
Platform/platformdata.cpp
Platform/plist.cpp
# Platform/Pointer.cpp
Platform/Settings.cpp
Platform/Settings.h
Platform/smbios.cpp
# Platform/SmBios.h
Platform/spd.cpp
@ -152,10 +159,10 @@
Platform/kext_patcher.cpp
Platform/kext_inject.cpp
Platform/kext_inject.h
Platform/Nvram.cpp
Platform/card_vlist.cpp
Platform/PlatformDriverOverride.cpp
Platform/Hibernate.cpp
Platform/Hibernate.h
Platform/Net.cpp
Platform/sound.cpp
Platform/StartupSound.cpp

View File

@ -37,22 +37,15 @@
#ifndef __REFITLIB_STANDARD_H__
#define __REFITLIB_STANDARD_H__
// Experimental -->
/*
- FKERNELPATCH: Sat Jul 30 19:13:21 2016
Since we're in bruteforce mode, no need to check the existence of given patterns before patching (except for debugging purposes). Just patch or leave it.
This will skip "SearchAndCount" to boost those operations. We hope this will be safe enough. The "SearchAndReplace" always do a CompareMem before CopyMem.
And dataLen (for search & replace) already sanitised while parsing user config & should be matched.
- ADVLOG: Thu Aug 4 18:14:19 2016
- ADVLOG: Thu Aug 4 18:14:19 2016
Add log routine line separator.
- LODEPNG: Thu Aug 4 18:14:19 2016
Size matter, screenshot as PNG instead of BMP. Inspired by mr. Coderush "CrScreenshotDxe". Maybe useful for other PNG encoding purposes. Activate by "-D LODEPNG".
Size matter, screenshot as PNG instead of BMP.
- ANDX86: Mon Aug 8 04:07:13 2016
@ -62,7 +55,6 @@
https://www.chromium.org/chromium-os
*/
//#define FKERNELPATCH 1
#define ADVLOG 1
// Experimental <--
@ -902,9 +894,7 @@ UINT32 EncodeOptions(CONST CHAR16 *Options);
CHAR8* GetUnicodeChar(CHAR8 *s, CHAR16* UnicodeChar);
#define KERNEL_MAX_SIZE 40000000
#if defined(FKERNELPATCH)
#define FSearchReplace(Source, Search, Replace) SearchAndReplace(Source, KERNEL_MAX_SIZE, Search, sizeof(Search), Replace, 1)
#endif //FKERNELPATCH
VOID DbgHeader(CONST CHAR8 *str);