mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-24 16:27:42 +01:00
Do not use Print() anymore.
This commit is contained in:
parent
ace46a5646
commit
020fe5a2f0
@ -1797,7 +1797,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
|
|||||||
DBG("RsdPointer Acpi 2.0 installed\n");
|
DBG("RsdPointer Acpi 2.0 installed\n");
|
||||||
}
|
}
|
||||||
Xsdt = (XSDT_TABLE*)(UINTN)BufferPtr;
|
Xsdt = (XSDT_TABLE*)(UINTN)BufferPtr;
|
||||||
// Print(L"XSDT = 0x%x\n\r", Xsdt);
|
// DBG("XSDT = 0x%x\n\r", Xsdt);
|
||||||
Xsdt->Header.Signature = 0x54445358; //EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
|
Xsdt->Header.Signature = 0x54445358; //EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
|
||||||
eCntR = (Rsdt->Header.Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT32);
|
eCntR = (Rsdt->Header.Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT32);
|
||||||
Xsdt->Header.Length = eCntR * sizeof(UINT64) + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
Xsdt->Header.Length = eCntR * sizeof(UINT64) + sizeof (EFI_ACPI_DESCRIPTION_HEADER);
|
||||||
|
@ -36,7 +36,7 @@ WaitForKeyPress(
|
|||||||
UINTN index;
|
UINTN index;
|
||||||
EFI_INPUT_KEY key;
|
EFI_INPUT_KEY key;
|
||||||
|
|
||||||
Print(Message);
|
printf("%ls", Message);
|
||||||
do {
|
do {
|
||||||
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &key);
|
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &key);
|
||||||
} while(Status == EFI_SUCCESS);
|
} while(Status == EFI_SUCCESS);
|
||||||
|
@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PATCH_DEBUG
|
#if PATCH_DEBUG
|
||||||
#define DBG(...) Print(__VA_ARGS__);
|
#define DBG(...) printf(__VA_ARGS__);
|
||||||
#else
|
#else
|
||||||
#define DBG(...)
|
#define DBG(...)
|
||||||
#endif
|
#endif
|
||||||
@ -290,7 +290,7 @@ OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
|
|||||||
ptr+=0x1000;
|
ptr+=0x1000;
|
||||||
if((UINT32)(UINTN)ptr > 0x3000000)
|
if((UINT32)(UINTN)ptr > 0x3000000)
|
||||||
{
|
{
|
||||||
// Print(L"bootArgs not found!\n");
|
// DBG("bootArgs not found!\n");
|
||||||
gST->ConOut->OutputString (gST->ConOut, L"bootArgs not found!");
|
gST->ConOut->OutputString (gST->ConOut, L"bootArgs not found!");
|
||||||
gBS->Stall(5000000);
|
gBS->Stall(5000000);
|
||||||
// return;
|
// return;
|
||||||
|
@ -215,7 +215,7 @@ EFI_STATUS EFIAPI GetScreenInfo(VOID* This, UINT64* baseAddress, UINT64* frameBu
|
|||||||
if(EFI_ERROR(Status))
|
if(EFI_ERROR(Status))
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
//this print never occured so this procedure is redundant
|
//this print never occured so this procedure is redundant
|
||||||
// Print(L"GetScreenInfo called with args: %lx %lx %lx %lx %lx %lx\n",
|
// printf("GetScreenInfo called with args: %lx %lx %lx %lx %lx %lx\n",
|
||||||
// baseAddress, frameBufferSize, bpr, w, h, colorDepth);
|
// baseAddress, frameBufferSize, bpr, w, h, colorDepth);
|
||||||
*frameBufferSize = (UINT64)mGraphicsOutput->Mode->FrameBufferSize;
|
*frameBufferSize = (UINT64)mGraphicsOutput->Mode->FrameBufferSize;
|
||||||
*baseAddress = (UINT64)mGraphicsOutput->Mode->FrameBufferBase;
|
*baseAddress = (UINT64)mGraphicsOutput->Mode->FrameBufferBase;
|
||||||
@ -223,7 +223,7 @@ EFI_STATUS EFIAPI GetScreenInfo(VOID* This, UINT64* baseAddress, UINT64* frameBu
|
|||||||
*h = (UINT32)mGraphicsOutput->Mode->Info->VerticalResolution;
|
*h = (UINT32)mGraphicsOutput->Mode->Info->VerticalResolution;
|
||||||
*colorDepth = 32;
|
*colorDepth = 32;
|
||||||
*bpr = (UINT32)(mGraphicsOutput->Mode->Info->PixelsPerScanLine*32) >> 3;
|
*bpr = (UINT32)(mGraphicsOutput->Mode->Info->PixelsPerScanLine*32) >> 3;
|
||||||
// Print(L" Screen info: FBsize=%lx FBaddr=%lx w=%d h=%d\n",
|
// printf(" Screen info: FBsize=%lx FBaddr=%lx w=%d h=%d\n",
|
||||||
// *frameBufferSize, *baseAddress, *w, *h);
|
// *frameBufferSize, *baseAddress, *w, *h);
|
||||||
// PauseForKey(L"--- press any key ---\n");
|
// PauseForKey(L"--- press any key ---\n");
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -10,23 +10,24 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "../../cpp_foundation/XString.h"
|
#include "../../cpp_foundation/XString.h"
|
||||||
|
#include "../../cpp_foundation/XStringW.h"
|
||||||
|
|
||||||
|
static XString stdio_static_buf;
|
||||||
|
static XStringW stdio_static_wbuf;
|
||||||
|
|
||||||
int printf(const char* format, ...)
|
int printf(const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
char buf[1024]; // that's quick and dirty !!!
|
|
||||||
|
|
||||||
|
// AsciiPrint seems no to work with utf8 chars. We have to use Print instead
|
||||||
va_start (va, format);
|
va_start (va, format);
|
||||||
vsnprintf(buf, sizeof(buf), format, va);
|
stdio_static_wbuf.vSPrintf(format, va);
|
||||||
buf[sizeof(buf)-1] = 0; // just in case
|
int ret = (int)Print(L"%s", stdio_static_wbuf.wc_str());
|
||||||
int ret = (int)AsciiPrint("%a", buf);
|
|
||||||
va_end(va);
|
va_end(va);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static XString stdio_static_buf;
|
|
||||||
|
|
||||||
const char* strerror(EFI_STATUS Status)
|
const char* strerror(EFI_STATUS Status)
|
||||||
{
|
{
|
||||||
UINTN n = 0;
|
UINTN n = 0;
|
||||||
|
@ -809,7 +809,7 @@ EFI_STATUS InjectKexts(/*IN EFI_MEMORY_DESCRIPTOR *Desc*/ IN UINT32 deviceTreeP,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (drvPtr == 0 || infoPtr == 0 || extraPtr == 0 || drvPtr > infoPtr || drvPtr > extraPtr || infoPtr > extraPtr) {
|
if (drvPtr == 0 || infoPtr == 0 || extraPtr == 0 || drvPtr > infoPtr || drvPtr > extraPtr || infoPtr > extraPtr) {
|
||||||
Print(L"\nInvalid device tree for kext injection\n");
|
printf("\nInvalid device tree for kext injection\n");
|
||||||
gBS->Stall(5000000);
|
gBS->Stall(5000000);
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ VOID ATIConnectorsPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT
|
|||||||
Num = SearchAndCount(Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsData, Entry->KernelAndKextPatches->KPATIConnectorsDataLen);
|
Num = SearchAndCount(Driver, DriverSize, Entry->KernelAndKextPatches->KPATIConnectorsData, Entry->KernelAndKextPatches->KPATIConnectorsDataLen);
|
||||||
if (Num > 1) {
|
if (Num > 1) {
|
||||||
// error message - shoud always be printed
|
// error message - shoud always be printed
|
||||||
Print(L"==> KPATIConnectorsData found %d times in %a - skipping patching!\n", Num, gKextBundleIdentifier);
|
printf("==> KPATIConnectorsData found %llu times in %s - skipping patching!\n", Num, gKextBundleIdentifier);
|
||||||
gBS->Stall(5*1000000);
|
gBS->Stall(5*1000000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ VOID AppleRTCPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 In
|
|||||||
if (NumLion_X64 + NumLion_i386 + NumML + NumMavMoj3 + NumMoj4 > 1) {
|
if (NumLion_X64 + NumLion_i386 + NumML + NumMavMoj3 + NumMoj4 > 1) {
|
||||||
// more then one pattern found - we do not know what to do with it
|
// more then one pattern found - we do not know what to do with it
|
||||||
// and we'll skip it
|
// and we'll skip it
|
||||||
Print(L"AppleRTCPatch: ERROR: multiple patterns found (LionX64: %d, Lioni386: %d, ML: %d, MavMoj3: %d, Moj4: %d) - skipping patching!\n",
|
printf("AppleRTCPatch: ERROR: multiple patterns found (LionX64: %llu, Lioni386: %llu, ML: %llu, MavMoj3: %llu, Moj4: %llu) - skipping patching!\n",
|
||||||
NumLion_X64, NumLion_i386, NumML, NumMavMoj3, NumMoj4);
|
NumLion_X64, NumLion_i386, NumML, NumMavMoj3, NumMoj4);
|
||||||
gBS->Stall(5000000);
|
gBS->Stall(5000000);
|
||||||
return;
|
return;
|
||||||
|
@ -201,7 +201,7 @@ VOID ScanTool(VOID)
|
|||||||
if (GlobalConfig.DisableFlags & HIDEUI_FLAG_TOOLS)
|
if (GlobalConfig.DisableFlags & HIDEUI_FLAG_TOOLS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Print(L"Scanning for tools...\n");
|
// DBG("Scanning for tools...\n");
|
||||||
|
|
||||||
// look for the EFI shell
|
// look for the EFI shell
|
||||||
if (!(GlobalConfig.DisableFlags & HIDEUI_FLAG_SHELL)) {
|
if (!(GlobalConfig.DisableFlags & HIDEUI_FLAG_SHELL)) {
|
||||||
|
@ -880,7 +880,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
|||||||
// TODO: also check for Boot Camp GUID
|
// TODO: also check for Boot Camp GUID
|
||||||
//gEfiPartTypeSystemPartGuid
|
//gEfiPartTypeSystemPartGuid
|
||||||
Bootable = FALSE; // this handle's BlockIO is just an alias for the whole device
|
Bootable = FALSE; // this handle's BlockIO is just an alias for the whole device
|
||||||
Print(L"AppleLegacy device\n");
|
DBG("AppleLegacy device\n");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -901,7 +901,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
|||||||
}
|
}
|
||||||
// DBG("DevicePath scanned\n");
|
// DBG("DevicePath scanned\n");
|
||||||
if (HdPath) {
|
if (HdPath) {
|
||||||
// Print(L"Partition found %s\n", DevicePathToStr((EFI_DEVICE_PATH *)HdPath));
|
// printf("Partition found %s\n", DevicePathToStr((EFI_DEVICE_PATH *)HdPath));
|
||||||
|
|
||||||
PartialLength = (UINTN)((UINT8 *)HdPath - (UINT8 *)(RemainingDevicePath));
|
PartialLength = (UINTN)((UINT8 *)HdPath - (UINT8 *)(RemainingDevicePath));
|
||||||
if (PartialLength > 0x1000) {
|
if (PartialLength > 0x1000) {
|
||||||
@ -911,7 +911,6 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
|||||||
DiskDevicePath = (EFI_DEVICE_PATH *)AllocatePool(PartialLength + sizeof(EFI_DEVICE_PATH));
|
DiskDevicePath = (EFI_DEVICE_PATH *)AllocatePool(PartialLength + sizeof(EFI_DEVICE_PATH));
|
||||||
CopyMem(DiskDevicePath, Volume->DevicePath, PartialLength);
|
CopyMem(DiskDevicePath, Volume->DevicePath, PartialLength);
|
||||||
CopyMem((UINT8 *)DiskDevicePath + PartialLength, DevicePath, sizeof(EFI_DEVICE_PATH)); //EndDevicePath
|
CopyMem((UINT8 *)DiskDevicePath + PartialLength, DevicePath, sizeof(EFI_DEVICE_PATH)); //EndDevicePath
|
||||||
// Print(L"WholeDevicePath %s\n", DevicePathToStr(DiskDevicePath));
|
|
||||||
// DBG("WholeDevicePath %ls\n", DevicePathToStr(DiskDevicePath));
|
// DBG("WholeDevicePath %ls\n", DevicePathToStr(DiskDevicePath));
|
||||||
RemainingDevicePath = DiskDevicePath;
|
RemainingDevicePath = DiskDevicePath;
|
||||||
Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &WholeDiskHandle);
|
Status = gBS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &WholeDiskHandle);
|
||||||
|
@ -70,7 +70,6 @@ extern XTheme ThemeX; //global variable defined in lib.cpp
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define REFIT_DEBUG (2)
|
#define REFIT_DEBUG (2)
|
||||||
#define Print if ((!GlobalConfig.Quiet) || (GlobalConfig.TextOnly)) Print
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -249,27 +249,27 @@ static VOID DrawScreenHeader(IN CONST CHAR16 *Title)
|
|||||||
BannerLine[0] = BOXDRAW_DOWN_RIGHT;
|
BannerLine[0] = BOXDRAW_DOWN_RIGHT;
|
||||||
BannerLine[ConWidth-1] = BOXDRAW_DOWN_LEFT;
|
BannerLine[ConWidth-1] = BOXDRAW_DOWN_LEFT;
|
||||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
|
||||||
Print(BannerLine);
|
printf("%ls", BannerLine);
|
||||||
|
|
||||||
for (i = 1; i < ConWidth-1; i++)
|
for (i = 1; i < ConWidth-1; i++)
|
||||||
BannerLine[i] = ' ';
|
BannerLine[i] = ' ';
|
||||||
BannerLine[0] = BOXDRAW_VERTICAL;
|
BannerLine[0] = BOXDRAW_VERTICAL;
|
||||||
BannerLine[ConWidth-1] = BOXDRAW_VERTICAL;
|
BannerLine[ConWidth-1] = BOXDRAW_VERTICAL;
|
||||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 1);
|
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 1);
|
||||||
Print(BannerLine);
|
printf("%ls", BannerLine);
|
||||||
|
|
||||||
for (i = 1; i < ConWidth-1; i++)
|
for (i = 1; i < ConWidth-1; i++)
|
||||||
BannerLine[i] = BOXDRAW_HORIZONTAL;
|
BannerLine[i] = BOXDRAW_HORIZONTAL;
|
||||||
BannerLine[0] = BOXDRAW_UP_RIGHT;
|
BannerLine[0] = BOXDRAW_UP_RIGHT;
|
||||||
BannerLine[ConWidth-1] = BOXDRAW_UP_LEFT;
|
BannerLine[ConWidth-1] = BOXDRAW_UP_LEFT;
|
||||||
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
|
gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
|
||||||
Print(BannerLine);
|
printf("%ls", BannerLine);
|
||||||
|
|
||||||
FreePool(BannerLine);
|
FreePool(BannerLine);
|
||||||
|
|
||||||
// print header text
|
// print header text
|
||||||
gST->ConOut->SetCursorPosition (gST->ConOut, 3, 1);
|
gST->ConOut->SetCursorPosition (gST->ConOut, 3, 1);
|
||||||
Print(L"Clover rev %s - %s", gFirmwareRevision, Title);
|
printf("Clover rev %ls - %ls", gFirmwareRevision, Title);
|
||||||
|
|
||||||
// reposition cursor
|
// reposition cursor
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
||||||
@ -303,9 +303,9 @@ VOID PauseForKey(CONST CHAR16* msg)
|
|||||||
#if REFIT_DEBUG > 0
|
#if REFIT_DEBUG > 0
|
||||||
UINTN index;
|
UINTN index;
|
||||||
if (msg) {
|
if (msg) {
|
||||||
Print(L"\n %s", msg);
|
printf("\n %ls", msg);
|
||||||
}
|
}
|
||||||
Print(L"\n* Hit any key to continue *");
|
printf("\n* Hit any key to continue *");
|
||||||
|
|
||||||
if (ReadAllKeyStrokes()) { // remove buffered key strokes
|
if (ReadAllKeyStrokes()) { // remove buffered key strokes
|
||||||
gBS->Stall(5000000); // 5 seconds delay
|
gBS->Stall(5000000); // 5 seconds delay
|
||||||
@ -315,7 +315,7 @@ VOID PauseForKey(CONST CHAR16* msg)
|
|||||||
gBS->WaitForEvent(1, &gST->ConIn->WaitForKey, &index);
|
gBS->WaitForEvent(1, &gST->ConIn->WaitForKey, &index);
|
||||||
ReadAllKeyStrokes(); // empty the buffer to protect the menu
|
ReadAllKeyStrokes(); // empty the buffer to protect the menu
|
||||||
|
|
||||||
Print(L"\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
|||||||
|
|
||||||
// StatusToString(ErrorName, Status);
|
// StatusToString(ErrorName, Status);
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
||||||
Print(L"Fatal Error: %r %s\n", Status, where);
|
printf("Fatal Error: %s %ls\n", strerror(Status), where);
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
||||||
haveError = TRUE;
|
haveError = TRUE;
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
|||||||
|
|
||||||
// StatusToString(ErrorName, Status);
|
// StatusToString(ErrorName, Status);
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
gST->ConOut->SetAttribute (gST->ConOut, ATTR_ERROR);
|
||||||
Print(L"Error: %r %s\n", Status, where);
|
printf("Error: %s %ls\n", strerror(Status), where);
|
||||||
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
gST->ConOut->SetAttribute (gST->ConOut, ATTR_BASIC);
|
||||||
haveError = TRUE;
|
haveError = TRUE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user