mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-12 09:54:36 +01:00
Merge branch 'master' of https://github.com/CloverHackyColor/CloverBootloader
This commit is contained in:
commit
8cb786d57e
@ -148,6 +148,7 @@ func getOEMVendorShort() -> String? {
|
||||
case "LENOVO":
|
||||
return "Lenovo"
|
||||
case "Micro-Star International": fallthrough
|
||||
case "Micro-Star International Co., Ltd.": fallthrough
|
||||
case "MICRO-STAR INTERNATIONAL CO., LTD": fallthrough
|
||||
case "MICRO-STAR INTERNATIONAL CO.,LTD": fallthrough
|
||||
case "MSI":
|
||||
|
@ -79,7 +79,8 @@
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
// typedef unsigned short CHAR16;
|
||||
typedef wchar_t CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
|
@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
// Disable warning when last field of data structure is a zero sized array.
|
||||
//
|
||||
#pragma warning ( disable : 4200 )
|
||||
#pragma warning ( disable : 4804 )
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -39,7 +40,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
@param Size The expected size for the TYPE.
|
||||
|
||||
**/
|
||||
#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(sizeof(TYPE) == (Size)) / (sizeof(TYPE) == (Size))]
|
||||
#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(sizeof(TYPE) == (Size))?1:0 / (sizeof(TYPE) == (Size))?1:0]
|
||||
|
||||
//
|
||||
// Verify that ProcessorBind.h produced UEFI Data Types that are compliant with
|
||||
|
@ -153,7 +153,14 @@
|
||||
/// 2-byte Character. Unless otherwise specified all strings are stored in the
|
||||
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
|
||||
///
|
||||
// typedef unsigned short CHAR16;
|
||||
// typedef wchar_t CHAR16;
|
||||
#ifdef __cplusplus
|
||||
#define CHAR16 wchar_t
|
||||
#else
|
||||
typedef unsigned short CHAR16;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// 2-byte signed value
|
||||
///
|
||||
|
@ -78,10 +78,10 @@ MsgLogEntrypoint (
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status; // = EFI_SUCCESS;
|
||||
EFI_BOOT_SERVICES* gBS;
|
||||
// EFI_BOOT_SERVICES* gBS;
|
||||
CHAR8 *tmp;
|
||||
|
||||
gBS = SystemTable->BootServices;
|
||||
// gBS = SystemTable->BootServices;
|
||||
mHandle = NULL;
|
||||
Status = gBS->AllocatePool (
|
||||
EfiBootServicesData,
|
||||
|
10
cbuild.bat
10
cbuild.bat
@ -30,11 +30,11 @@ set DEVSTAGE=
|
||||
set IASL_PREFIX=c:\ASL\
|
||||
|
||||
set DEFAULT_CYGWIN_HOME=c:\cygwin
|
||||
rem set DEFAULT_PYTHONHOME=
|
||||
rem d:\Program File\Python37"
|
||||
rem set DEFAULT_PYTHON_FREEZER_PATH=%PYTHON_HOME%\Scripts
|
||||
set "PYTHONHOME=d:\Program File\Python37"
|
||||
set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts"
|
||||
set DEFAULT_PYTHONHOME=d:\Program File\Python38
|
||||
set DEFAULT_PYTHONPATH=d:\Program File\Python38\Lib
|
||||
set DEFAULT_PYTHON_FREEZER_PATH=%PYTHON_HOME%\Scripts
|
||||
rem set "PYTHONHOME=d:\Program File\Python37"
|
||||
rem set "PYTHON_FREEZER_PATH=%PYTHONHOME%\Scripts"
|
||||
set PYTHON3_ENABLE=TRUE
|
||||
set DEFAULT_NASM_PREFIX=
|
||||
rem C:\Program Files (x86)\NASM"
|
||||
|
@ -1186,7 +1186,7 @@ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* GetFadt()
|
||||
|
||||
// EFI_STATUS Status;
|
||||
|
||||
RsdPtr = (__typeof(RsdPtr))FindAcpiRsdPtr();
|
||||
RsdPtr = (__typeof__(RsdPtr))FindAcpiRsdPtr();
|
||||
if (RsdPtr == NULL) {
|
||||
/*Status = */EfiGetSystemConfigurationTable (&gEfiAcpi20TableGuid, (VOID **)&RsdPtr);
|
||||
if (RsdPtr == NULL) {
|
||||
|
@ -310,8 +310,11 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
|
||||
//
|
||||
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, HandleCount, HandleBuffer);
|
||||
if (EFI_ERROR (Status)) goto Error;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
*HandleType = static_cast<UINT32*>(AllocatePool(*HandleCount * sizeof(UINT32)));
|
||||
#else
|
||||
*HandleType = (__typeof__(*HandleType))AllocatePool (*HandleCount * sizeof (UINT32));
|
||||
#endif
|
||||
if (*HandleType == NULL) goto Error;
|
||||
|
||||
for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {
|
||||
|
@ -371,7 +371,7 @@ GetBootOrder (
|
||||
//
|
||||
// Get gEfiGlobalVariableGuid:BootOrder and it's length
|
||||
//
|
||||
*BootOrder = (__typeof__(*BootOrder))GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
|
||||
*BootOrder = (UINT16*)GetNvramVariable (BOOT_ORDER_VAR, &gEfiGlobalVariableGuid, NULL, &BootOrderSize);
|
||||
if (*BootOrder == NULL) {
|
||||
DBG(" EFI_NOT_FOUND\n");
|
||||
return EFI_NOT_FOUND;
|
||||
|
@ -267,7 +267,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
--VariablePtr;
|
||||
}
|
||||
|
||||
gRT->SetVariable(KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language);
|
||||
gRT->SetVariable((CHAR16*)KbdPrevLang, &gEfiAppleBootGuid, Attributes, LangLen, &gSettings.Language);
|
||||
} else {
|
||||
FreePool(OldData);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ CONST CHAR8 hdcID[4] = HDC_ID;
|
||||
extern UINTN AudioNum;
|
||||
extern HDA_OUTPUTS AudioList[20];
|
||||
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
|
||||
extern CONST CHAR16 *OEMPath;
|
||||
extern CHAR16 *OEMPath;
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
|
@ -97,6 +97,10 @@ extern "C" {
|
||||
#define PCAT_RTC_ADDRESS_REGISTER 0x70
|
||||
#define PCAT_RTC_DATA_REGISTER 0x71
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __typeof__(x) decltype(x)
|
||||
#endif
|
||||
|
||||
|
||||
/* XML Tags */
|
||||
#define kXMLTagPList "plist"
|
||||
@ -1721,13 +1725,14 @@ extern SIDELOAD_KEXT *InjectKextList;
|
||||
|
||||
// Hold theme fixed IconFormat / extension
|
||||
extern CHAR16 *IconFormat;
|
||||
extern CONST CHAR16 *gFirmwareRevision;
|
||||
extern CONST CHAR16 *gFirmwareRevision;
|
||||
|
||||
extern BOOLEAN ResumeFromCoreStorage;
|
||||
extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here
|
||||
|
||||
|
||||
//-----------------------------------
|
||||
void FreePool(const wchar_t * A);
|
||||
|
||||
VOID
|
||||
FixBiosDsdt (
|
||||
|
@ -408,7 +408,7 @@ ParseLoadOptions (
|
||||
AsciiConf = (__typeof__(AsciiConf))AllocateCopyPool (TailSize + 1, Start);
|
||||
if (AsciiConf != NULL) {
|
||||
*(AsciiConf + TailSize) = '\0';
|
||||
*Conf = (__typeof__(*Conf))AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
|
||||
*Conf = (CHAR16*)AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
|
||||
AsciiStrToUnicodeStrS (AsciiConf, *Conf, TailSize);
|
||||
FreePool (AsciiConf);
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
}
|
||||
|
||||
if (AsciiStrSize(Prop2->string) > 1) {
|
||||
Patches->ForceKexts[Patches->NrForceKexts] = (__typeof__(Patches->ForceKexts[Patches->NrForceKexts]))AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
|
||||
Patches->ForceKexts[Patches->NrForceKexts] = (CHAR16*)AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
|
||||
AsciiStrToUnicodeStrS(Prop2->string, Patches->ForceKexts[Patches->NrForceKexts], 255);
|
||||
DBG (" - [%d]: %s\n", Patches->NrForceKexts, Patches->ForceKexts[Patches->NrForceKexts]);
|
||||
++Patches->NrForceKexts;
|
||||
@ -1588,7 +1588,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
|
||||
/* comp = (CHAR8 *) AllocatePool(newLen);
|
||||
AsciiStrnCpy(comp, str + startLocation, newLen);
|
||||
comp[newLen] = '\0'; */
|
||||
mo->array[i] = (__typeof__(mo->array[i]))AllocateCopyPool(newLen, str + startLocation);
|
||||
mo->array[i] = (CHAR8*)AllocateCopyPool(newLen, str + startLocation);
|
||||
mo->array[i][newLen - 1] = '\0';
|
||||
}
|
||||
|
||||
@ -1596,7 +1596,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
|
||||
}
|
||||
else {
|
||||
// DBG("str contains only one component and it is our string %s!\n", str);
|
||||
mo->array[0] = (__typeof__(mo->array[0]))AllocateCopyPool(AsciiStrLen(str)+1, str);
|
||||
mo->array[0] = (CHAR8*)AllocateCopyPool(AsciiStrLen(str)+1, str);
|
||||
}
|
||||
return mo;
|
||||
}
|
||||
@ -5051,7 +5051,7 @@ GetUserSettings(
|
||||
for (j = 0; j < PropCount; j++) {
|
||||
Prop3 = NULL;
|
||||
DevProps = *Child;
|
||||
*Child = (__typeof__(*Child))AllocateZeroPool(sizeof(DEV_PROPERTY));
|
||||
*Child = (DEV_PROPERTY *)AllocateZeroPool(sizeof(DEV_PROPERTY));
|
||||
(*Child)->Next = DevProps;
|
||||
|
||||
if (EFI_ERROR(GetElement(Prop2, j, &Prop3))) { // Prop3 -> <key>
|
||||
@ -5628,7 +5628,7 @@ GetUserSettings(
|
||||
} else {
|
||||
AsciiSPrint(DSDTPatchesLabel, 255, " (NoLabel)");
|
||||
}
|
||||
gSettings.PatchDsdtLabel[i] = (__typeof__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256);
|
||||
gSettings.PatchDsdtLabel[i] = (CHAR8*)AllocateZeroPool(256);
|
||||
AsciiSPrint(gSettings.PatchDsdtLabel[i], 255, "%a", DSDTPatchesLabel);
|
||||
DBG(" (%a)", gSettings.PatchDsdtLabel[i]);
|
||||
|
||||
@ -6008,7 +6008,7 @@ GetUserSettings(
|
||||
// Get memory tables
|
||||
Prop2 = GetProperty (Prop, "Modules");
|
||||
if (Prop2 != NULL) {
|
||||
INTN i, Count = GetTagCount (Prop2);
|
||||
INTN Count = GetTagCount (Prop2);
|
||||
Prop3 = NULL;
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
@ -6094,10 +6094,10 @@ GetUserSettings(
|
||||
Prop = GetProperty (DictPointer, "Slots");
|
||||
if (Prop != NULL) {
|
||||
INTN DeviceN;
|
||||
INTN Index, Count = GetTagCount (Prop);
|
||||
INTN Count = GetTagCount (Prop);
|
||||
Prop3 = NULL;
|
||||
|
||||
for (Index = 0; Index < Count; ++Index) {
|
||||
for (INTN Index = 0; Index < Count; ++Index) {
|
||||
if (EFI_ERROR (GetElement (Prop, Index, &Prop3))) {
|
||||
continue;
|
||||
}
|
||||
@ -6730,8 +6730,8 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
|
||||
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
|
||||
}
|
||||
}
|
||||
FreePool(fileBuffer);
|
||||
FreePool(targetString);
|
||||
FreePool((VOID*)fileBuffer);
|
||||
FreePool((VOID*)targetString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1561,11 +1561,12 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
|
||||
if (devprop_list[i].all_ports) {
|
||||
for (pnum = 1; pnum < card->ports; pnum++) {
|
||||
if (devprop_list[i].get_value(val, pnum, Sier)) {
|
||||
char newname[AsciiStrLen(devprop_list[i].name)+1];
|
||||
char* newname = (char*)AllocatePool(AsciiStrLen(devprop_list[i].name)+1);
|
||||
AsciiStrCpy(newname, devprop_list[i].name);
|
||||
newname[1] = (CHAR8)(0x30 + pnum); // convert to ascii
|
||||
devprop_add_value(card->device, newname, val->data, val->size);
|
||||
free_val(val);
|
||||
FreePool((VOID*)newname);
|
||||
}
|
||||
}
|
||||
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
|
||||
@ -1581,12 +1582,13 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
|
||||
if (devprop_list[i].all_ports) {
|
||||
for (pnum = 1; pnum < card->ports; pnum++) {
|
||||
if (devprop_list[i].default_val.type != kNul) {
|
||||
char newname[AsciiStrLen(devprop_list[i].name)+1];
|
||||
char* newname = (char*)AllocatePool(AsciiStrLen(devprop_list[i].name)+1);
|
||||
newname[1] = (CHAR8)(0x30 + pnum); // convert to ascii
|
||||
devprop_add_value(card->device, newname,
|
||||
devprop_list[i].default_val.type == kCst ?
|
||||
(UINT8 *)&(devprop_list[i].default_val.data) : devprop_list[i].default_val.data,
|
||||
devprop_list[i].default_val.size);
|
||||
FreePool((VOID*)newname);
|
||||
}
|
||||
}
|
||||
// devprop_list[i].name[1] = 0x30; // write back our "@0," for a next possible card
|
||||
|
@ -180,16 +180,16 @@ VOID* GetSmbiosTablesFromHob (VOID)
|
||||
EFI_PHYSICAL_ADDRESS *Table;
|
||||
EFI_PEI_HOB_POINTERS GuidHob;
|
||||
|
||||
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
|
||||
GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbiosTableGuid);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
if (Table != NULL) {
|
||||
return (VOID *)(UINTN)*Table;
|
||||
}
|
||||
}
|
||||
GuidHob.Raw = (__typeof(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
|
||||
GuidHob.Raw = (__typeof__(GuidHob.Raw))GetFirstGuidHob (&gEfiSmbios3TableGuid);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
if (Table != NULL) {
|
||||
return (VOID *)(UINTN)*Table;
|
||||
}
|
||||
@ -2107,14 +2107,14 @@ VOID FinalizeSmbios() //continue
|
||||
BOOLEAN FoundTable3 = FALSE;
|
||||
|
||||
// Get Hob List
|
||||
HobStart.Raw = (__typeof(HobStart.Raw))GetHobList();
|
||||
HobStart.Raw = (__typeof__(HobStart.Raw))GetHobList();
|
||||
|
||||
if (HobStart.Raw != NULL) {
|
||||
// find SMBIOS in hob
|
||||
for (Index = 0; Index < sizeof (gTableGuidArray) / sizeof (*gTableGuidArray); ++Index) {
|
||||
GuidHob.Raw = (__typeof(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
|
||||
GuidHob.Raw = (__typeof__(HobStart.Raw))GetNextGuidHob (gTableGuidArray[Index], HobStart.Raw);
|
||||
if (GuidHob.Raw != NULL) {
|
||||
Table = (__typeof(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
Table = (__typeof__(Table))GET_GUID_HOB_DATA (GuidHob.Guid);
|
||||
//TableLength = GET_GUID_HOB_DATA_SIZE (GuidHob);
|
||||
if (Table != NULL) {
|
||||
if (Index != 0) {
|
||||
|
@ -51,13 +51,13 @@ XStringW::XStringW(const XStringW &aString)
|
||||
{
|
||||
DBG("Constructor(const XStringW &aString) : %s\n", aString.data());
|
||||
Init(aString.length());
|
||||
StrnCpy(aString.data(), aString.length());
|
||||
StrnCpy((const CHAR16*)aString.data(), (const CHAR16*)aString.length());
|
||||
}
|
||||
|
||||
XStringW::XStringW(const wchar_t *S)
|
||||
{
|
||||
DBG("Constructor(const wchar_t *S) : %s, StrLen(S)=%d\n", S, StrLen(S));
|
||||
Init(StrLen(S));
|
||||
Init(StrLen((const CHAR16*)S));
|
||||
if ( S ) StrCpy(S);
|
||||
}
|
||||
|
||||
|
@ -115,11 +115,11 @@ public:
|
||||
void Replace(wchar_t c1, wchar_t c2);
|
||||
XStringW SubStringReplace(wchar_t c1, wchar_t c2);
|
||||
|
||||
INTN Compare(const wchar_t* S) const { return StrCmp(data(), S) ; }
|
||||
INTN Compare(const wchar_t* S) const { return StrCmp((const CHAR16*)data(), (const CHAR16*)S) ; }
|
||||
|
||||
bool Equal(const wchar_t* S) const { return Compare(S) == 0; };
|
||||
bool BeginingEqual(const wchar_t* S) const { return StrnCmp(data(), S, StrLen(S)); }
|
||||
bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp(data(Pos), S); }
|
||||
bool BeginingEqual(const wchar_t* S) const { return StrnCmp((const CHAR16*)data(), (const CHAR16*)S, StrLen((const CHAR16*)S)); }
|
||||
bool SubStringEqual(UINTN Pos, const wchar_t* S) const { return StrCmp((const CHAR16*)data(Pos), (const CHAR16*)S); }
|
||||
|
||||
XStringW basename() const;
|
||||
XStringW dirname() const;
|
||||
|
@ -147,6 +147,7 @@ LOADER_ENTRY * DuplicateLoaderEntry(IN LOADER_ENTRY *Entry)
|
||||
if(Entry == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DuplicateEntry = (__typeof__(DuplicateEntry))AllocateZeroPool(sizeof(LOADER_ENTRY));
|
||||
if (DuplicateEntry) {
|
||||
DuplicateEntry->me.Tag = Entry->me.Tag;
|
||||
|
@ -409,7 +409,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
|
||||
|
||||
nsvgDeleteRasterizer(rast);
|
||||
|
||||
*dict = (__typeof__(*dict))AllocateZeroPool(sizeof(TagStruct));
|
||||
*dict = (TagPtr)AllocateZeroPool(sizeof(TagStruct));
|
||||
(*dict)->type = kTagTypeNone;
|
||||
GlobalConfig.TypeSVG = TRUE;
|
||||
GlobalConfig.ThemeDesignHeight = (int)SVGimage->height;
|
||||
|
@ -436,7 +436,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File
|
||||
// end of folder checking
|
||||
|
||||
// Delete existing file if it exists
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, FileName,
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName,
|
||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
Status = FileHandle->Delete(FileHandle);
|
||||
@ -449,7 +449,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE_HANDLE BaseDir OPTIONAL, IN CONST CHAR16 *File
|
||||
|
||||
if (CreateNew) {
|
||||
// Write new file
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, FileName,
|
||||
Status = BaseDir->Open(BaseDir, &FileHandle, (CHAR16*)FileName,
|
||||
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
|
||||
if (EFI_ERROR(Status)) {
|
||||
// DBG("no write %r\n", Status);
|
||||
|
@ -29,6 +29,10 @@ The manual and changelog are in the header file "lodepng.h"
|
||||
Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for C.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define __typeof__(x) decltype(x)
|
||||
#endif
|
||||
|
||||
#include "lodepng.h"
|
||||
|
||||
//MODSNI v
|
||||
|
@ -66,7 +66,7 @@ BOOLEAN gBootChanged = FALSE;
|
||||
BOOLEAN gThemeOptionsChanged = FALSE;
|
||||
|
||||
EFI_FILE *OEMDir;
|
||||
CONST CHAR16 *OEMPath = L"EFI\\CLOVER";
|
||||
CHAR16 *OEMPath = L"EFI\\CLOVER";
|
||||
EFI_FILE *OemThemeDir = NULL;
|
||||
|
||||
|
||||
@ -342,7 +342,7 @@ VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialEl
|
||||
*ElementCount = InitialElementCount;
|
||||
if (*ElementCount > 0) {
|
||||
AllocateCount = (*ElementCount + 7) & ~7; // next multiple of 8
|
||||
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
} else {
|
||||
*ListPtr = NULL;
|
||||
}
|
||||
@ -355,9 +355,9 @@ VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID
|
||||
if ((*ElementCount & 7) == 0) {
|
||||
AllocateCount = *ElementCount + 8;
|
||||
if (*ElementCount == 0)
|
||||
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
|
||||
else
|
||||
*ListPtr = (__typeof__(*ListPtr))EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
|
||||
**ListPtr = EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
|
||||
}
|
||||
(*ListPtr)[*ElementCount] = NewElement;
|
||||
(*ElementCount)++;
|
||||
@ -964,7 +964,6 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
|
||||
}
|
||||
|
||||
if ( FileExists(Volume->RootDir, L"\\.VolumeLabel.txt") ) {
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE_HANDLE FileHandle;
|
||||
Status = Volume->RootDir->Open(Volume->RootDir, &FileHandle, L"\\.VolumeLabel.txt", EFI_FILE_MODE_READ, 0);
|
||||
if (!EFI_ERROR(Status)) {
|
||||
@ -1370,7 +1369,7 @@ BOOLEAN FileExists(IN CONST EFI_FILE *Root, IN CONST CHAR16 *RelativePath)
|
||||
EFI_STATUS Status;
|
||||
EFI_FILE *TestFile = NULL;
|
||||
|
||||
Status = Root->Open(Root, &TestFile, RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
Status = Root->Open((EFI_FILE_PROTOCOL*)Root, &TestFile, (CHAR16*)RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
if (TestFile && TestFile->Close) {
|
||||
TestFile->Close(TestFile);
|
||||
@ -1388,7 +1387,7 @@ BOOLEAN DeleteFile(IN EFI_FILE *Root, IN CONST CHAR16 *RelativePath)
|
||||
|
||||
//DBG("DeleteFile: %s\n", RelativePath);
|
||||
// open file for read/write to see if it exists, need write for delete
|
||||
Status = Root->Open(Root, &File, RelativePath, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
Status = Root->Open(Root, &File, (CHAR16*)RelativePath, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE, 0);
|
||||
//DBG(" Open: %r\n", Status);
|
||||
if (Status == EFI_SUCCESS) {
|
||||
// exists - check if it is a file
|
||||
@ -1486,7 +1485,7 @@ VOID DirIterOpen(IN EFI_FILE *BaseDir, IN CONST CHAR16 *RelativePath OPTIONAL, O
|
||||
DirIter->DirHandle = BaseDir;
|
||||
DirIter->CloseDirHandle = FALSE;
|
||||
} else {
|
||||
DirIter->LastStatus = BaseDir->Open(BaseDir, &(DirIter->DirHandle), RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
DirIter->LastStatus = BaseDir->Open(BaseDir, &(DirIter->DirHandle), (CHAR16*)RelativePath, EFI_FILE_MODE_READ, 0);
|
||||
DirIter->CloseDirHandle = EFI_ERROR(DirIter->LastStatus) ? FALSE : TRUE;
|
||||
}
|
||||
DirIter->LastFileInfo = NULL;
|
||||
@ -1548,7 +1547,7 @@ MetaiMatch (
|
||||
//return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return mUnicodeCollation->MetaiMatch (mUnicodeCollation, String, Pattern);
|
||||
return mUnicodeCollation->MetaiMatch (mUnicodeCollation, (CHAR16*)String, (CHAR16*)Pattern);
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,7 +686,7 @@ extern EFI_DEVICE_PATH *SelfFullDevicePath;
|
||||
extern EFI_FILE *ThemeDir;
|
||||
extern CHAR16 *ThemePath;
|
||||
extern EFI_FILE *OEMDir;
|
||||
extern CONST CHAR16 *OEMPath;
|
||||
extern CHAR16 *OEMPath;
|
||||
extern EFI_FILE *OemThemeDir;
|
||||
|
||||
extern BOOLEAN MainAnime;
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#include "Version.h"
|
||||
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_MAIN 1
|
||||
#else
|
||||
@ -68,7 +69,8 @@
|
||||
|
||||
// variables
|
||||
#ifdef FIRMWARE_REVISION
|
||||
CONST CHAR16 *gFirmwareRevision = FIRMWARE_REVISION;
|
||||
CONST CHAR16 gFirmwareRevisionM[] = FIRMWARE_REVISION;
|
||||
CONST CHAR16 *gFirmwareRevision = &gFirmwareRevisionM[0];
|
||||
#else
|
||||
CONST CHAR16 *gFirmwareRevision = NULL;
|
||||
#endif
|
||||
@ -116,6 +118,11 @@ extern UINTN AudioNum;
|
||||
extern HDA_OUTPUTS AudioList[20];
|
||||
extern EFI_AUDIO_IO_PROTOCOL *AudioIo;
|
||||
|
||||
void FreePool(const wchar_t * A)
|
||||
{
|
||||
FreePool((VOID*)A);
|
||||
}
|
||||
|
||||
static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
|
||||
IN CONST CHAR16 *ImageTitle,
|
||||
OUT UINTN *ErrorInStep,
|
||||
@ -480,7 +487,11 @@ VOID FilterBootPatches(IN LOADER_ENTRY *Entry)
|
||||
VOID ReadSIPCfg()
|
||||
{
|
||||
UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS;
|
||||
#ifdef _MSC_VER
|
||||
CHAR16 *csrLog = (decltype(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
|
||||
#else
|
||||
CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
|
||||
#endif
|
||||
|
||||
if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS)
|
||||
StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS");
|
||||
@ -515,7 +526,7 @@ VOID ReadSIPCfg()
|
||||
// text output from boot.efi when booting in graphics mode
|
||||
//
|
||||
EFI_STATUS EFIAPI
|
||||
NullConOutOutputString(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CONST CHAR16 *String) {
|
||||
NullConOutOutputString(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CHAR16 *String) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1743,7 +1754,7 @@ BOOLEAN SetOEMPathIfExists(IN EFI_FILE *Root, IN CONST CHAR16 *path, CONST CHAR1
|
||||
UnicodeSPrint(ConfigPath, sizeof(ConfigPath), L"%s\\%s.plist", path, ConfName);
|
||||
BOOLEAN res2 = FileExists(Root, ConfigPath);
|
||||
if ( res2 ) {
|
||||
OEMPath = path;
|
||||
OEMPath = (CHAR16*)path;
|
||||
DBG ("CheckOEMPathExists: set OEMPath: %s\n", OEMPath);
|
||||
return 1;
|
||||
}else{
|
||||
|
@ -2831,7 +2831,7 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
|
||||
|
||||
for (i = 0; i < (INTN)Screen->InfoLineCount; i++) {
|
||||
gST->ConOut->SetCursorPosition (gST->ConOut, 3, 4 + i);
|
||||
gST->ConOut->OutputString (gST->ConOut, Screen->InfoLines[i]);
|
||||
gST->ConOut->OutputString (gST->ConOut, (CHAR16*)Screen->InfoLines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4354,7 +4354,7 @@ UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry)
|
||||
VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
|
||||
{
|
||||
//create entry
|
||||
*Entry = (__typeof__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
|
||||
*Entry = (REFIT_MENU_ENTRY*) AllocateZeroPool(sizeof(LOADER_ENTRY));
|
||||
if (Title) {
|
||||
(*Entry)->Title = PoolPrint(L"%a", Title);
|
||||
} else {
|
||||
@ -4365,7 +4365,7 @@ VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION At
|
||||
(*Entry)->Tag = TAG_OPTIONS;
|
||||
(*Entry)->AtClick = AtClick;
|
||||
// create the submenu
|
||||
*SubScreen = (__typeof__(*SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
|
||||
*SubScreen = (REFIT_MENU_SCREEN*)AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
|
||||
(*SubScreen)->Title = (*Entry)->Title;
|
||||
(*SubScreen)->TitleImage = (*Entry)->Image;
|
||||
(*SubScreen)->ID = ID;
|
||||
|
Loading…
Reference in New Issue
Block a user