diff --git a/Include/Library/MemLogLib.h b/Include/Library/MemLogLib.h index 32288b1e6..852da0b45 100644 --- a/Include/Library/MemLogLib.h +++ b/Include/Library/MemLogLib.h @@ -18,6 +18,13 @@ typedef VOID (EFIAPI *MEM_LOG_CALLBACK) (IN INTN DebugMode, IN CHAR8 *LastMessage); +EFI_STATUS +EFIAPI +MemLogInit ( + VOID + ); + + /** Prints a log message to memory buffer. diff --git a/Library/MemLogLibDefault/MemLogLib.c b/Library/MemLogLibDefault/MemLogLib.c index eef1f2d4f..b47068d2a 100644 --- a/Library/MemLogLibDefault/MemLogLib.c +++ b/Library/MemLogLibDefault/MemLogLib.c @@ -427,14 +427,7 @@ UINT64 EFIAPI GetMemLogTscTicksPerSecond (VOID) { - EFI_STATUS Status; - - if (mMemLog == NULL) { - Status = MemLogInit (); - if (EFI_ERROR(Status)) { - return 0; - } - } + if (mMemLog == NULL) return 0; return mMemLog->TscFreqSec; } diff --git a/OpenCorePkg b/OpenCorePkg index 93feac4ed..01a8830e3 160000 --- a/OpenCorePkg +++ b/OpenCorePkg @@ -1 +1 @@ -Subproject commit 93feac4ed96bad9bb54a817e24426241e1df1d5f +Subproject commit 01a8830e3d36eeec4a10a67d5d9f199111bec93f diff --git a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj index aaf087171..472d85cb5 100644 --- a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj @@ -1058,6 +1058,7 @@ 9AF4D970263014C600487D15 /* Volume.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4D96C263014C600487D15 /* Volume.cpp */; }; 9AF4D971263014C600487D15 /* Volume.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4D96C263014C600487D15 /* Volume.cpp */; }; 9AF4D972263014C600487D15 /* Volume.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4D96C263014C600487D15 /* Volume.cpp */; }; + 9AF5454E2702627F00CEC8FD /* XBool.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF5454C2702627F00CEC8FD /* XBool.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -1421,6 +1422,7 @@ 9AF4D936263004E200487D15 /* XmlLiteCompositeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlLiteCompositeTypes.h; sourceTree = ""; }; 9AF4D96B263014C500487D15 /* Volume.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Volume.h; sourceTree = ""; }; 9AF4D96C263014C600487D15 /* Volume.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Volume.cpp; sourceTree = ""; }; + 9AF5454C2702627F00CEC8FD /* XBool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XBool.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1943,6 +1945,7 @@ 9A8788CD26186897000B9362 /* XStringArray.cpp */, 9A8788CF26186897000B9362 /* XStringArray.h */, 9A8788D026186897000B9362 /* XToolsCommon.h */, + 9AF5454C2702627F00CEC8FD /* XBool.h */, ); path = cpp_foundation; sourceTree = ""; @@ -2060,6 +2063,7 @@ 9A87892D26186897000B9362 /* operatorNewDelete.h in Headers */, 9A878C3626186898000B9362 /* bootscreen.h in Headers */, 9A878AF826186897000B9362 /* HdaCodecDump.h in Headers */, + 9AF5454E2702627F00CEC8FD /* XBool.h in Headers */, 9A87890926186897000B9362 /* stdarg.h in Headers */, 9A8789C626186897000B9362 /* rename_helper.h in Headers */, 9A878B4F26186897000B9362 /* DataHub.h in Headers */, @@ -3262,6 +3266,7 @@ DISABLE_SECURE_BOOT, ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_SHADOW = YES; @@ -3315,6 +3320,11 @@ "-Weffc++", "-Wunused-local-typedefs", ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-include", + $PROJECT_DIR/../../rEFIt_UEFI/cpp_foundation/XBool.h, + ); SUPPORTED_PLATFORMS = macosx; USE_HEADERMAP = NO; VALID_ARCHS = x86_64; @@ -3323,6 +3333,8 @@ "-Wno-gnu-zero-variadic-macro-arguments", "-Wignored-qualifiers", "-Wreorder", + "-Wmissing-braces", + "-Wnon-pod-varargs", ); }; name = Debug; @@ -3355,6 +3367,7 @@ GCC_ENABLE_CPP_RTTI = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_SHADOW = YES; @@ -3408,6 +3421,11 @@ "-Weffc++", "-Wunused-local-typedefs", ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-include", + $PROJECT_DIR/../../rEFIt_UEFI/cpp_foundation/XBool.h, + ); SUPPORTED_PLATFORMS = macosx; USE_HEADERMAP = NO; VALID_ARCHS = x86_64; @@ -3416,6 +3434,8 @@ "-Wno-gnu-zero-variadic-macro-arguments", "-Wignored-qualifiers", "-Wreorder", + "-Wmissing-braces", + "-Wnon-pod-varargs", ); }; name = Release; diff --git a/Xcode/cpp_tests/cpp_tests.xcodeproj/project.pbxproj b/Xcode/cpp_tests/cpp_tests.xcodeproj/project.pbxproj index b1a8437eb..6cfaa9ba4 100644 --- a/Xcode/cpp_tests/cpp_tests.xcodeproj/project.pbxproj +++ b/Xcode/cpp_tests/cpp_tests.xcodeproj/project.pbxproj @@ -3462,7 +3462,7 @@ 9A82F7F326184670006F973B /* update_generated.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = update_generated.py; sourceTree = ""; }; 9A82F7F426184670006F973B /* update_products.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = update_products.py; sourceTree = ""; }; 9A82F7F526184670006F973B /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 9A82F7F626184670006F973B /* Products.zjson */ = {isa = PBXFileReference; lastKnownFileType = file; path = Products.zjson; sourceTree = ""; }; + 9A82F7F626184670006F973B /* Products.zjson */ = {isa = PBXFileReference; lastKnownFileType = text; path = Products.zjson; sourceTree = ""; }; 9A82F7F726184670006F973B /* DataBase.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = DataBase.md; sourceTree = ""; }; 9A82F7F926184670006F973B /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 9A82F7FB26184670006F973B /* hfs_format.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hfs_format.h; sourceTree = ""; }; @@ -13786,6 +13786,7 @@ "___NOT___ENABLE_SECURE_BOOT", "sprintf=__sprintf_is_disabled__", "wcscmp=__wcsncmp_is_disabled__", + OC_TARGET_DEBUG, ); GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; @@ -13837,6 +13838,11 @@ "-include", Platform.h, ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-include", + $PROJECT_DIR/../../rEFIt_UEFI/cpp_foundation/XBool.h, + ); SDKROOT = macosx; USE_HEADERMAP = NO; WARNING_CFLAGS = ( @@ -13907,6 +13913,7 @@ "___NOT___ENABLE_SECURE_BOOT", "sprintf=__sprintf_is_disabled__", "wcscmp=__wcsncmp_is_disabled__", + OC_TARGET_DEBUG, ); GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; @@ -13957,6 +13964,11 @@ "-include", Platform.h, ); + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-include", + $PROJECT_DIR/../../rEFIt_UEFI/cpp_foundation/XBool.h, + ); SDKROOT = macosx; USE_HEADERMAP = NO; WARNING_CFLAGS = ( diff --git a/Xcode/cpp_tests/src/main.cpp b/Xcode/cpp_tests/src/main.cpp index 7b41be38a..09f44dce3 100755 --- a/Xcode/cpp_tests/src/main.cpp +++ b/Xcode/cpp_tests/src/main.cpp @@ -13,6 +13,25 @@ #include "../../../rEFIt_UEFI/cpp_unit_test/all_tests.h" +//class Boolean +//{ +// bool flag; +//public: +// explicit Boolean() : flag(false) {} +// explicit Boolean(const bool other) { flag = other; } +// explicit Boolean(const Boolean& other) { flag = other.flag; } +//// template +//// Boolean(T other) = delete;// { return *this; } +// +// Boolean& operator= (const Boolean& other) { return *this; } +// Boolean& operator= (const bool other) { return *this; } +// template +// Boolean& operator= (const T other) = delete;// { return *this; } +// +// bool getValue() const {return flag;} +// void setValue(bool a) {flag = a;} +//}; + extern "C" int main(int argc, const char * argv[]) { @@ -21,9 +40,15 @@ extern "C" int main(int argc, const char * argv[]) setlocale(LC_ALL, "en_US"); // to allow printf unicode char // xcode_utf_fixed_tests(); - int i = 2; - bool b; - b = i; + const int i = 2; + (void)i; + XBool b; + b = true; + b = false; +// b = XBool(i); +// b = (char*)NULL; +// b = (float)1.0; +// b = i; return all_tests() ? 0 : -1 ; } diff --git a/rEFIt_UEFI/Platform/AcpiPatcher.cpp b/rEFIt_UEFI/Platform/AcpiPatcher.cpp index 28724ad68..7752bb67d 100644 --- a/rEFIt_UEFI/Platform/AcpiPatcher.cpp +++ b/rEFIt_UEFI/Platform/AcpiPatcher.cpp @@ -164,10 +164,10 @@ void SaveMergedXsdtEntrySize(UINT32 Index, UINTN Size) } } -BOOLEAN IsXsdtEntryMerged(UINT32 Index) +XBool IsXsdtEntryMerged(UINT32 Index) { if (!XsdtReplaceSizes) { - return FALSE; + return false; } return 0 != XsdtReplaceSizes[Index]; } @@ -249,7 +249,7 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index) DropTable->Signature = Table->Signature; DropTable->TableId = Table->OemTableId; DropTable->Length = Table->Length; - DropTable->MenuItem.BValue = FALSE; + DropTable->MenuItem.BValue = false; DropTable->Next = GlobalConfig.ACPIDropTables; GlobalConfig.ACPIDropTables = DropTable; } @@ -378,29 +378,29 @@ void DropTableFromXSDT(UINT32 Signature, UINT64 TableId, UINT32 Length) // by cecekpawon, edited by Slice, further edits by RehabMan -BOOLEAN FixAsciiTableHeader(UINT8 *Str, UINTN Len) +XBool FixAsciiTableHeader(UINT8 *Str, UINTN Len) { - BOOLEAN NonAscii = FALSE; + XBool NonAscii = false; UINT8* StrEnd = Str + Len; for (; Str < StrEnd; Str++) { if (!*Str) continue; // NUL is allowed if (*Str < ' ') { *Str = ' '; - NonAscii = TRUE; + NonAscii = true; } else if (*Str > 0x7e) { *Str = '_'; - NonAscii = TRUE; + NonAscii = true; } } return NonAscii; } -BOOLEAN PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header) +XBool PatchTableHeader(EFI_ACPI_DESCRIPTION_HEADER *Header) { - BOOLEAN Ret1, Ret2, Ret3; + XBool Ret1, Ret2, Ret3; if ( !gSettings.ACPI.FixHeaders ) { - return FALSE; + return false; } Ret1 = FixAsciiTableHeader((UINT8*)&Header->CreatorId, 4); Ret2 = FixAsciiTableHeader((UINT8*)&Header->OemTableId, 8); @@ -414,7 +414,7 @@ void PatchAllTables() UINT64* Ptr = XsdtEntryPtrFromIndex(0); UINT64* EndPtr = XsdtEntryPtrFromIndex(Count); for (; Ptr < EndPtr; Ptr++) { - BOOLEAN Patched = FALSE; + XBool Patched = false; EFI_ACPI_DESCRIPTION_HEADER* Table = (EFI_ACPI_DESCRIPTION_HEADER*)(UINTN)ReadUnaligned64(Ptr); if (!Table) { // skip NULL entry @@ -478,12 +478,12 @@ void PatchAllTables() NewTable->Length = Len; RenameDevices((UINT8*)NewTable); GetBiosRegions((UINT8*)NewTable); //take Regions from SSDT even if they will be dropped - Patched = TRUE; + Patched = true; } if (NewTable->Signature == MCFG_SIGN && gSettings.ACPI.FixMCFG) { INTN Len1 = ((Len + 4 - 1) / 16 + 1) * 16 - 4; CopyMem(NewTable, Table, Len1); //Len increased but less than EFI_PAGE - NewTable->Length = (UINT32)(UINTN)Len1; Patched = TRUE; + NewTable->Length = (UINT32)(UINTN)Len1; Patched = true; } if (Patched) { WriteUnaligned64(Ptr, BufferPtr); @@ -776,19 +776,19 @@ void **mSavedTables = NULL; UINTN mSavedTablesEntries = 0; UINTN mSavedTablesNum = 0; -/** Returns TRUE is TableEntry is already saved. */ -BOOLEAN IsTableSaved(void *TableEntry) +/** Returns true is TableEntry is already saved. */ +XBool IsTableSaved(void *TableEntry) { UINTN Index; if (mSavedTables != NULL) { for (Index = 0; Index < mSavedTablesNum; Index++) { if (mSavedTables[Index] == TableEntry) { - return TRUE; + return true; } } } - return FALSE; + return false; } /** Adds TableEntry to mSavedTables if not already there. */ @@ -1451,7 +1451,7 @@ void SaveOemTables() // EFI_STATUS Status; void *RsdPtr; XStringW AcpiOriginPath = L"ACPI\\origin"_XSW; - BOOLEAN Saved = FALSE; + XBool Saved = false; CHAR8 *MemLogStart; UINTN MemLogStartLen; @@ -1469,7 +1469,7 @@ void SaveOemTables() if (gFirmwareClover) { // Save it DumpTables(RsdPtr, AcpiOriginPath.wc_str()); - Saved = TRUE; + Saved = true; } else { // just print to log DumpTables(RsdPtr, NULL); @@ -1484,7 +1484,7 @@ void SaveOemTables() DBG("Found UEFI Acpi 2.0 RSDP at %llx\n", (UINTN)RsdPtr); // if tables already saved, then just print to log DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str()); - Saved = TRUE; + Saved = true; } // // Then search Acpi 1.0 UEFI Sys.Tables @@ -1495,13 +1495,13 @@ void SaveOemTables() DBG("Found UEFI Acpi 1.0 RSDP at %llx\n", (UINTN)RsdPtr); // if tables already saved, then just print to log DumpTables(RsdPtr, Saved ? NULL : AcpiOriginPath.wc_str()); - // Saved = TRUE; + // Saved = true; } SaveBufferToDisk(MemLogStart, GetMemLogLen() - MemLogStartLen, AcpiOriginPath.wc_str(), L"DumpLog.txt"); FreePool(mSavedTables); } -void SaveOemDsdt(BOOLEAN FullPatch) +void SaveOemDsdt(XBool FullPatch) { EFI_STATUS Status = EFI_NOT_FOUND; EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer = NULL; @@ -1580,7 +1580,7 @@ void SaveOemDsdt(BOOLEAN FullPatch) } } -BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST CHAR16* PartName, UINTN Pass) +XBool LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST CHAR16* PartName, UINTN Pass) { // pass1 prefilter based on file names (optimization that avoids loading same files twice) UINTN Index = IGNORE_INDEX; @@ -1592,7 +1592,7 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C // special case for SSDT.aml: no attempt to merge if (0 == StriCmp(PartName, L"SSDT.aml") || (8 != StrLen(PartName) && IGNORE_INDEX == Index)) { DBG("ignore on pass 1\n"); - return FALSE; + return false; } } UINT8 *buffer = NULL; @@ -1603,7 +1603,7 @@ BOOLEAN LoadPatchedAML(const EFI_FILE& dir, const XStringW& acpiOemPath, CONST C EFI_ACPI_DESCRIPTION_HEADER* TableHeader = (EFI_ACPI_DESCRIPTION_HEADER*)buffer; if (TableHeader->Length > 500 * Kilo) { DBG("wrong table\n"); - return FALSE; + return false; } } DBG("size=%lld ", (UINT64)bufferLen); @@ -1716,8 +1716,8 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) // UINTN ApicLen; UINTN ApicCPUNum; UINT8 *SubTable; - BOOLEAN DsdtLoaded = FALSE; - BOOLEAN NeedUpdate = FALSE; + XBool DsdtLoaded = false; + XBool NeedUpdate = false; OPER_REGION *tmpRegion; // XStringW AcpiOemPath = SWPrintf("%ls\\ACPI\\patched", OEMPath.wc_str()); @@ -1787,7 +1787,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) NewRsdPointer->Revision = 2; NewRsdPointer->Length = sizeof(EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER); RsdPointer = NewRsdPointer; - NeedUpdate = TRUE; + NeedUpdate = true; // gBS->InstallConfigurationTable(&gEfiAcpiTableGuid, RsdPointer); // DBG("first install success\n"); // gBS->InstallConfigurationTable(&gEfiAcpi10TableGuid, RsdPointer); @@ -1868,7 +1868,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) //should correct headers if needed and if asked PatchTableHeader((EFI_ACPI_DESCRIPTION_HEADER*)newFadt); - if (gSettings.ACPI.smartUPS==TRUE) { + if (gSettings.ACPI.smartUPS==true) { newFadt->PreferredPmProfile = 3; } else { newFadt->PreferredPmProfile = gMobile?2:1; //as calculated before @@ -2002,7 +2002,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) //apply DSDT loaded from a file into buffer //else FADT will contain old BIOS DSDT // - DsdtLoaded = FALSE; + DsdtLoaded = false; if (!EFI_ERROR(Status)) { // if we will apply fixes, allocate additional space bufferLen = bufferLen + bufferLen / 8; @@ -2022,7 +2022,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion) FadtPointer->Dsdt = (UINT32)dsdt; FadtPointer->XDsdt = dsdt; FixChecksum(&FadtPointer->Header); - DsdtLoaded = TRUE; + DsdtLoaded = true; } } if(buffer) FreePool(buffer); //the buffer is allocated if egLoadFile() is success. Else the pointer must be nullptr @@ -2420,7 +2420,7 @@ EFI_STATUS LoadAndInjectAcpiTable(CONST CHAR16 *PathPatched, /** * Patches UEFI ACPI tables with tables found in OsSubdir. */ -EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT) +EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, XBool DropSSDT) { EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *RsdPointer; EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtPointer; diff --git a/rEFIt_UEFI/Platform/AcpiPatcher.h b/rEFIt_UEFI/Platform/AcpiPatcher.h index 57b7214b0..db9b7779a 100644 --- a/rEFIt_UEFI/Platform/AcpiPatcher.h +++ b/rEFIt_UEFI/Platform/AcpiPatcher.h @@ -48,7 +48,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, const MacOsVersion& OSVersion); EFI_STATUS -PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT); +PatchACPI_OtherOS(CONST CHAR16* OsSubdir, XBool DropSSDT); UINT8 Checksum8 ( @@ -61,7 +61,7 @@ void FixChecksum(EFI_ACPI_DESCRIPTION_HEADER* Table); void SaveOemDsdt ( - BOOLEAN FullPatch + XBool FullPatch ); void diff --git a/rEFIt_UEFI/Platform/AmlGenerator.cpp b/rEFIt_UEFI/Platform/AmlGenerator.cpp index ae5423f8c..a1af64c13 100644 --- a/rEFIt_UEFI/Platform/AmlGenerator.cpp +++ b/rEFIt_UEFI/Platform/AmlGenerator.cpp @@ -8,10 +8,10 @@ * additions and corrections by Slice and pcj, 2012. */ -#include "AmlGenerator.h" #include // Only use angled for Platform, else, xcode project won't compile +#include "AmlGenerator.h" -BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node) +XBool aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node) { if (parent && node) { @@ -24,12 +24,12 @@ BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node) case AML_CHUNK_QWORD: case AML_CHUNK_ALIAS: MsgLog("aml_add_to_parent: node doesn't support child nodes!\n"); - return FALSE; + return false; case AML_CHUNK_NAME: if (parent->First) { MsgLog("aml_add_to_parent: name node supports only one child node!\n"); - return FALSE; + return false; } break; @@ -45,10 +45,10 @@ BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node) parent->Last = node; - return TRUE; + return true; } - return FALSE; + return false; } AML_CHUNK* aml_create_node(AML_CHUNK* parent) diff --git a/rEFIt_UEFI/Platform/AmlGenerator.h b/rEFIt_UEFI/Platform/AmlGenerator.h index 18994bad2..63a4202ab 100644 --- a/rEFIt_UEFI/Platform/AmlGenerator.h +++ b/rEFIt_UEFI/Platform/AmlGenerator.h @@ -12,7 +12,7 @@ /* -static inline BOOLEAN aml_isvalidchar(char c) +static inline XBool aml_isvalidchar(char c) { return IS_UPPER(c) || IS_DIGIT(c) || c == '_'; }; @@ -70,7 +70,7 @@ typedef struct aml_chunk AML_CHUNK; #define AML_CHUNK_ARG3 0x6B -BOOLEAN aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node); +XBool aml_add_to_parent(AML_CHUNK* parent, AML_CHUNK* node); AML_CHUNK* aml_create_node(AML_CHUNK* parent); void aml_destroy_node(AML_CHUNK* node); AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, CONST UINT8* buffer, UINT32 size); diff --git a/rEFIt_UEFI/Platform/BasicIO.h b/rEFIt_UEFI/Platform/BasicIO.h index 51bcf7cc6..8cf0c831d 100644 --- a/rEFIt_UEFI/Platform/BasicIO.h +++ b/rEFIt_UEFI/Platform/BasicIO.h @@ -9,15 +9,15 @@ #define PLATFORM_BASICIO_H_ -BOOLEAN ReadAllKeyStrokes(void); +XBool ReadAllKeyStrokes(void); void PauseForKey(const XString8& msg); //void DebugPause(void); void EndlessIdleLoop(void); -BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where); -BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where); +XBool CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where); +XBool CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where); #endif /* PLATFORM_BASICIO_H_ */ diff --git a/rEFIt_UEFI/Platform/BdsConnect.cpp b/rEFIt_UEFI/Platform/BdsConnect.cpp index 0b6f0ed37..7df9adbc1 100644 --- a/rEFIt_UEFI/Platform/BdsConnect.cpp +++ b/rEFIt_UEFI/Platform/BdsConnect.cpp @@ -161,7 +161,7 @@ BdsLibConnectDevicePath ( PreviousHandle = Handle; // // Connect all drivers that apply to Handle and RemainingDevicePath, - // the Recursive flag is FALSE so only one level will be expanded. + // the Recursive flag is false so only one level will be expanded. // // Do not check the connect status here, if the connect controller fail, // then still give the chance to do dispatch, because partial @@ -174,7 +174,7 @@ BdsLibConnectDevicePath ( // change, then avoid the dispatch, we have chance to continue the // next connection // - gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); + gBS->ConnectController (Handle, NULL, RemainingDevicePath, false); } } // @@ -229,7 +229,7 @@ BdsLibConnectAllEfi ( for (Index = 0; Index < HandleCount; Index++) { //Status = - gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); + gBS->ConnectController (HandleBuffer[Index], NULL, NULL, true); } if (HandleBuffer != NULL) { @@ -432,8 +432,8 @@ EFI_STATUS BdsLibConnectMostlyAllEfi() EFI_HANDLE *HandleBuffer = NULL; UINT32 *HandleType = NULL; UINTN HandleIndex; - BOOLEAN Parent; - BOOLEAN Device; + XBool Parent; + XBool Device; EFI_PCI_IO_PROTOCOL* PciIo = NULL; PCI_TYPE00 Pci; @@ -447,18 +447,18 @@ EFI_STATUS BdsLibConnectMostlyAllEfi() if (EFI_ERROR(Status)) goto Done; - Device = TRUE; + Device = true; if (HandleType[Index] & EFI_HANDLE_TYPE_DRIVER_BINDING_HANDLE) - Device = FALSE; + Device = false; if (HandleType[Index] & EFI_HANDLE_TYPE_IMAGE_HANDLE) - Device = FALSE; + Device = false; if (Device) { - Parent = FALSE; + Parent = false; for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { if (HandleType[HandleIndex] & EFI_HANDLE_TYPE_PARENT_HANDLE) - Parent = TRUE; + Parent = true; } if (!Parent) { @@ -467,12 +467,12 @@ EFI_STATUS BdsLibConnectMostlyAllEfi() if (!EFI_ERROR(Status)) { Status = PciIo->Pci.Read (PciIo,EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci); if (!EFI_ERROR(Status)) { - if(IS_PCI_VGA(&Pci)==TRUE) { + if(IS_PCI_VGA(&Pci)==true) { gBS->DisconnectController(AllHandleBuffer[Index], NULL, NULL); } } } - Status = gBS->ConnectController(AllHandleBuffer[Index], NULL, NULL, TRUE); + Status = gBS->ConnectController(AllHandleBuffer[Index], NULL, NULL, true); } } } @@ -552,7 +552,7 @@ BdsLibConnectUsbDevByShortFormDP( UINTN Index; EFI_PCI_IO_PROTOCOL *PciIo; UINT8 Class[3]; - BOOLEAN AtLeastOneConnected; + XBool AtLeastOneConnected; // // Check the passed in parameters @@ -579,7 +579,7 @@ BdsLibConnectUsbDevByShortFormDP( // // Find the usb host controller firstly, then connect with the remaining device path // - AtLeastOneConnected = FALSE; + AtLeastOneConnected = false; Status = gBS->LocateHandleBuffer ( ByProtocol, &gEfiPciIoProtocolGuid, @@ -607,10 +607,10 @@ BdsLibConnectUsbDevByShortFormDP( HandleArray[Index], NULL, RemainingDevicePath, - FALSE + false ); if (!EFI_ERROR(Status)) { - AtLeastOneConnected = TRUE; + AtLeastOneConnected = true; } } } diff --git a/rEFIt_UEFI/Platform/BootLog.h b/rEFIt_UEFI/Platform/BootLog.h index 303966b7a..8d2164d5d 100755 --- a/rEFIt_UEFI/Platform/BootLog.h +++ b/rEFIt_UEFI/Platform/BootLog.h @@ -5,6 +5,11 @@ Headers collection for procedures #ifndef __BOOTLOG__H__ #define __BOOTLOG__H__ + +#ifdef __cplusplus +#include "../cpp_foundation/XBool.h" +#endif + #ifdef __cplusplus extern "C" { #endif @@ -36,10 +41,12 @@ InitBooterLog (void); void closeDebugLog(void); +#ifdef __cplusplus EFI_STATUS SetupBooterLog ( - BOOLEAN AllowGrownSize + XBool AllowGrownSize ); +#endif EFI_STATUS SaveBooterLog ( diff --git a/rEFIt_UEFI/Platform/BootOptions.cpp b/rEFIt_UEFI/Platform/BootOptions.cpp index b469b72d5..9e8e392e8 100644 --- a/rEFIt_UEFI/Platform/BootOptions.cpp +++ b/rEFIt_UEFI/Platform/BootOptions.cpp @@ -158,7 +158,7 @@ Clover_FindDevicePathNodeWithType ( /** Creates device path for boot option: device path for file system volume + file name. - * If UseShortForm == TRUE, then only the hard drive media dev path will be used instead + * If UseShortForm == true, then only the hard drive media dev path will be used instead * of full device path. * Long (full) form: * PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0x1,0x0)/HD(1,GPT,96004846-a018-49ad-bc9f-4e5a340adc4b,0x800,0x64000)/\EFI\BOOT\File.efi @@ -168,9 +168,9 @@ Clover_FindDevicePathNodeWithType ( */ EFI_STATUS CreateBootOptionDevicePath ( - IN EFI_HANDLE FileDeviceHandle, + IN EFI_HANDLE FileDeviceHandle, IN CONST XStringW& FileName, - IN BOOLEAN UseShortForm, + IN XBool UseShortForm, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath ) { @@ -219,14 +219,14 @@ CreateBootOptionDevicePath ( } -/** Returns TRUE if dev paths are equal. Has special ascii case insensitive compare for file dev paths. */ -BOOLEAN +/** Returns true if dev paths are equal. Has special ascii case insensitive compare for file dev paths. */ +XBool DevicePathEqual ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 ) { - BOOLEAN Equal; + XBool Equal; UINT8 Type1; UINT8 SubType1; UINTN Len1; @@ -234,9 +234,9 @@ DevicePathEqual ( CHAR16 *FPath2; - Equal = FALSE; + Equal = false; - while (TRUE) { + while (true) { Type1 = DevicePathType (DevicePath1); SubType1 = DevicePathSubType (DevicePath1); Len1 = DevicePathNodeLength (DevicePath1); @@ -265,7 +265,7 @@ DevicePathEqual ( if (IsDevicePathEnd (DevicePath1)) { // END node - they are the same - Equal = TRUE; + Equal = true; break; } @@ -769,14 +769,14 @@ FindBootOptionForFile ( // // Create FileDeviceHandle/FileName device paths (long and short form) - we will search boot options for that. // - Status = CreateBootOptionDevicePath (FileDeviceHandle, FileName, FALSE, &SearchedDevicePath[0]); + Status = CreateBootOptionDevicePath (FileDeviceHandle, FileName, false, &SearchedDevicePath[0]); if (EFI_ERROR(Status)) { return EFI_OUT_OF_RESOURCES; } SearchedDevicePathSize[0] = GetDevicePathSize (SearchedDevicePath[0]); DBG(" Searching for: %ls (Len: %llu)\n", FileDevicePathToXStringW(SearchedDevicePath[0]).wc_str(), SearchedDevicePathSize[0]); - Status = CreateBootOptionDevicePath (FileDeviceHandle, FileName, TRUE, &SearchedDevicePath[1]); + Status = CreateBootOptionDevicePath (FileDeviceHandle, FileName, true, &SearchedDevicePath[1]); if (EFI_ERROR(Status)) { return EFI_OUT_OF_RESOURCES; } @@ -828,10 +828,10 @@ FindBootOptionForFile ( return EFI_NOT_FOUND; } -/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == TRUE. */ +/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == true. */ void PrintBootOptions ( - IN BOOLEAN AllBootOptions + IN XBool AllBootOptions ) { EFI_STATUS Status; @@ -840,7 +840,7 @@ PrintBootOptions ( UINTN Index; UINTN BootNum; BO_BOOT_OPTION BootOption; - BOOLEAN FoundOthers; + XBool FoundOthers; DBG("\nBoot options:\n-------------\n"); @@ -873,7 +873,7 @@ PrintBootOptions ( if (AllBootOptions) { DBG("\nBoot options not in BootOrder list:\n"); - FoundOthers = FALSE; + FoundOthers = false; // // Additionally print BootXXXX vars which are not in BootOrder // @@ -902,7 +902,7 @@ PrintBootOptions ( PrintBootOption (&BootOption, 0); FreePool(BootOption.Variable); - FoundOthers = TRUE; + FoundOthers = true; } if (!FoundOthers) { DBG(" not found\n"); @@ -988,7 +988,7 @@ AddBootOption ( /** Adds new boot option for given file system device handle FileDeviceHandle, file path FileName * and Description, to be BootIndex in the list of options (0 based). - * If UseShortForm == TRUE, then only the hard drive media dev path will be used instead + * If UseShortForm == true, then only the hard drive media dev path will be used instead * of full device path. * Long (full) form: * PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0x1,0x0)/HD(1,GPT,96004846-a018-49ad-bc9f-4e5a340adc4b,0x800,0x64000)/\EFI\BOOT\File.efi @@ -997,13 +997,13 @@ AddBootOption ( */ EFI_STATUS AddBootOptionForFile ( - IN EFI_HANDLE FileDeviceHandle, + IN EFI_HANDLE FileDeviceHandle, IN CONST XStringW& FileName, - IN BOOLEAN UseShortForm, - IN CONST CHAR16 *Description, + IN XBool UseShortForm, + IN CONST CHAR16 *Description, IN UINT8 *OptionalData, - IN UINTN OptionalDataSize, - IN UINTN BootIndex, + IN UINTN OptionalDataSize, + IN UINTN BootIndex, OUT UINT16 *BootNum ) { diff --git a/rEFIt_UEFI/Platform/BootOptions.h b/rEFIt_UEFI/Platform/BootOptions.h index c69862f31..35084b81f 100644 --- a/rEFIt_UEFI/Platform/BootOptions.h +++ b/rEFIt_UEFI/Platform/BootOptions.h @@ -68,10 +68,10 @@ Clover_FindDevicePathNodeWithType ( EFI_STATUS ParseBootOption (OUT BO_BOOT_OPTION *BootOption); -/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == TRUE. */ +/** Prints BootXXXX vars found listed in BootOrder, plus print others if AllBootOptions == true. */ void PrintBootOptions ( - IN BOOLEAN AllBootOptions + IN XBool AllBootOptions ); /** Prints BootOrder with DBG. */ @@ -113,7 +113,7 @@ FindBootOptionForFile ( /** Adds new boot option for given file system device handle FileDeviceHandle, file path FileName * and Description, to be BootIndex in the list of options (0 based). - * If UseShortForm == TRUE, then only the hard drive media dev path will be used instead + * If UseShortForm == true, then only the hard drive media dev path will be used instead * of full device path. * Long (full) form: * PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0x1,0x0)/HD(1,GPT,96004846-a018-49ad-bc9f-4e5a340adc4b,0x800,0x64000)/\EFI\BOOT\File.efi @@ -122,14 +122,14 @@ FindBootOptionForFile ( */ EFI_STATUS AddBootOptionForFile ( - IN EFI_HANDLE FileDeviceHandle, + IN EFI_HANDLE FileDeviceHandle, IN CONST XStringW &FileName, - IN BOOLEAN UseShortForm, - IN CONST CHAR16 *Description, - IN UINT8 *OptionalData, - IN UINTN OptionalDataSize, - IN UINTN BootIndex, - OUT UINT16 *BootNum + IN XBool UseShortForm, + IN CONST CHAR16 *Description, + IN UINT8 *OptionalData, + IN UINTN OptionalDataSize, + IN UINTN BootIndex, + OUT UINT16 *BootNum ); /** Deletes boot option specified with BootNum (XXXX in BootXXXX var name). */ diff --git a/rEFIt_UEFI/Platform/Console.cpp b/rEFIt_UEFI/Platform/Console.cpp index a1d0fd466..f565ae807 100644 --- a/rEFIt_UEFI/Platform/Console.cpp +++ b/rEFIt_UEFI/Platform/Console.cpp @@ -36,11 +36,11 @@ GetModeImpl ( *Mode = CurrentMode; if (GopUgaExists) { - *GopUgaExists = TRUE; + *GopUgaExists = true; } if (StdInLocked) { - *StdInLocked = FALSE; + *StdInLocked = false; } return EFI_SUCCESS; diff --git a/rEFIt_UEFI/Platform/DataHub.cpp b/rEFIt_UEFI/Platform/DataHub.cpp index 9faaf3a42..74b801fce 100755 --- a/rEFIt_UEFI/Platform/DataHub.cpp +++ b/rEFIt_UEFI/Platform/DataHub.cpp @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ +#include // Only use angled for Platform, else, xcode project won't compile #include "DataHub.h" // @@ -172,14 +173,14 @@ GetNextDataRecord ( { EFI_DATA_ENTRY *LogEntry; LIST_ENTRY *Link; - BOOLEAN ReturnFirstEntry; + XBool ReturnFirstEntry; EFI_DATA_RECORD_HEADER *Record; EFI_DATA_ENTRY *NextLogEntry; // // If MonotonicCount == 0 just return the first one // - ReturnFirstEntry = (BOOLEAN) (*PtrCurrentMTC == 0); + ReturnFirstEntry = *PtrCurrentMTC == 0; Record = NULL; for (Link = GetFirstNode(Head); Link != Head; Link = GetNextNode(Head, Link)) { diff --git a/rEFIt_UEFI/Platform/DataHubCpu.cpp b/rEFIt_UEFI/Platform/DataHubCpu.cpp index 8c90c24ba..105666015 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.cpp +++ b/rEFIt_UEFI/Platform/DataHubCpu.cpp @@ -456,7 +456,7 @@ AddSMCkey(SMC_KEY Key, SMC_DATA_SIZE Size, SMC_KEY_TYPE Type, SMC_DATA *Data) // SetupDataForOSX /// Sets the DataHub data used by OS X void EFIAPI -SetupDataForOSX(BOOLEAN Hibernate) +SetupDataForOSX(XBool Hibernate) { EFI_STATUS Status; @@ -467,7 +467,7 @@ SetupDataForOSX(BOOLEAN Hibernate) UINT64 ARTFrequency; UINTN Revision; UINT16 Zero = 0; - BOOLEAN isRevLess = (ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[0] == 0 && + XBool isRevLess = (ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[0] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[1] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[2] == 0 && ApplePlatformData[GlobalConfig.CurrentModel].smcRevision[3] == 0 && diff --git a/rEFIt_UEFI/Platform/DataHubCpu.h b/rEFIt_UEFI/Platform/DataHubCpu.h index f8104e71a..6c5ad592d 100644 --- a/rEFIt_UEFI/Platform/DataHubCpu.h +++ b/rEFIt_UEFI/Platform/DataHubCpu.h @@ -27,7 +27,7 @@ LogDataHub ( void EFIAPI -SetupDataForOSX (BOOLEAN Hibernate); +SetupDataForOSX (XBool Hibernate); #endif /* PLATFORM_DATAHUBCPU_H_ */ diff --git a/rEFIt_UEFI/Platform/Events.cpp b/rEFIt_UEFI/Platform/Events.cpp index a10272bb1..52080aceb 100644 --- a/rEFIt_UEFI/Platform/Events.cpp +++ b/rEFIt_UEFI/Platform/Events.cpp @@ -69,7 +69,7 @@ void WaitForCR() EFI_INPUT_KEY key; UINTN ind; - while (TRUE) { + while (true) { Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &key); if (Status == EFI_NOT_READY) { gBS->WaitForEvent(1, &gST->ConIn->WaitForKey, &ind); @@ -278,7 +278,7 @@ OnExitBootServices(IN EFI_EVENT Event, IN void *Context) UINTN archMode = sizeof(UINTN) * 8; UINTN Version = 0; - while(TRUE) + while(true) { bootArgs2v = (BootArgs2*)ptr; bootArgs1v = (BootArgs1*)ptr; diff --git a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp index 2c8e7c815..dfb989562 100755 --- a/rEFIt_UEFI/Platform/FixBiosDsdt.cpp +++ b/rEFIt_UEFI/Platform/FixBiosDsdt.cpp @@ -44,25 +44,25 @@ OPER_REGION *gRegions = NULL; CHAR8* device_name[12]; // 0=>Display 1=>network 2=>firewire 3=>LPCB 4=>HDAAudio 5=>RTC 6=>TMR 7=>SBUS 8=>PIC 9=>Airport 10=>XHCI 11=>HDMI CHAR8* UsbName[10]; -BOOLEAN HDAFIX = TRUE; -BOOLEAN GFXHDAFIX = TRUE; -BOOLEAN DisplayName1; -BOOLEAN DisplayName2; -BOOLEAN NetworkName; -BOOLEAN ArptName; -BOOLEAN XhciName; -BOOLEAN ArptBCM; -BOOLEAN ArptAtheros; -BOOLEAN LPCBFIX; -BOOLEAN IDEFIX; -BOOLEAN SATAFIX; -BOOLEAN ASUSFIX; -BOOLEAN USBIntel; -BOOLEAN USBNForce; -BOOLEAN USBIDFIX = TRUE; -//BOOLEAN Display1PCIE; -//BOOLEAN Display2PCIE; -BOOLEAN FirewireName; +XBool HDAFIX = true; +XBool GFXHDAFIX = true; +XBool DisplayName1; +XBool DisplayName2; +XBool NetworkName; +XBool ArptName; +XBool XhciName; +XBool ArptBCM; +XBool ArptAtheros; +XBool LPCBFIX; +XBool IDEFIX; +XBool SATAFIX; +XBool ASUSFIX; +XBool USBIntel; +XBool USBNForce; +XBool USBIDFIX = true; +//XBool Display1PCIE; +//XBool Display2PCIE; +XBool FirewireName; // for read computer data UINT32 DisplayADR1[4]; @@ -494,7 +494,7 @@ UINT8 darwin[] = //it is not const }; -BOOLEAN CmpNum(UINT8 *dsdt, INT32 i, BOOLEAN Sure) +XBool CmpNum(UINT8 *dsdt, INT32 i, XBool Sure) { return ((Sure && ((dsdt[i-1] == 0x0A) || (dsdt[i-2] == 0x0B) || @@ -507,37 +507,37 @@ BOOLEAN CmpNum(UINT8 *dsdt, INT32 i, BOOLEAN Sure) // for HDA from device_inject.c and mark device_inject function //extern UINT32 HDA_IC_sendVerb(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 codecAdr, UINT32 nodeId, UINT32 verb); -BOOLEAN get_lpc_model(UINT32 id) { +XBool get_lpc_model(UINT32 id) { UINTN i; for (i=1; i< (sizeof(lpc_chipset) / sizeof(lpc_chipset[0])); i++) { if (lpc_chipset[i].id == id) { - return FALSE; + return false; } } - return TRUE; + return true; } -BOOLEAN get_ide_model(UINT32 id) { +XBool get_ide_model(UINT32 id) { UINTN i; for (i=1; i< (sizeof(ide_chipset) / sizeof(ide_chipset[0])); i++) { if (ide_chipset[i].id == id) { - return FALSE; + return false; } } - return TRUE; + return true; } /* -BOOLEAN get_ahci_model(UINT32 id) { +XBool get_ahci_model(UINT32 id) { UINTN i; for (i=1; i< (sizeof(ahci_chipset) / sizeof(ahci_chipset[0])); i++) { if (ahci_chipset[i].id == id) { - return FALSE; + return false; } } - return TRUE; + return true; } */ CONST CHAR8* get_net_model(UINT32 id) { @@ -595,7 +595,7 @@ void GetPciADR(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT UINT32 *Addr1, OUT U /* Discussion Native USB mean for those chipsets IOUSBFamily set some "errata" for example native 0x1cXX has no such errata */ -BOOLEAN NativeUSB(UINT16 DID) +XBool NativeUSB(UINT16 DID) { UINT16 d = DID & 0xFF00; return ((d == 0x2600) || (d == 0x2700) || (d == 0x2800) || (d == 0x3a00) || (d == /*NFORCE_USB->*/0x0a00)); @@ -686,8 +686,8 @@ void CheckHardware() Displaydevice[display].revision = Pci.Hdr.RevisionID; Displaydevice[display].subclass = Pci.Hdr.ClassCode[0]; Displaydevice[display].class_id = *((UINT16*)(Pci.Hdr.ClassCode+1)); - Displaydevice[display].subsys_id.subsys.vendor_id = Pci.Device.SubsystemVendorID; - Displaydevice[display].subsys_id.subsys.device_id = Pci.Device.SubsystemID; + Displaydevice[display].subsys_id_union.subsys.vendor_id = Pci.Device.SubsystemVendorID; + Displaydevice[display].subsys_id_union.subsys.device_id = Pci.Device.SubsystemID; // // Detect if PCI Express Device // @@ -697,9 +697,9 @@ void CheckHardware() /* PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (PciIo); if (PciIoDevice->IsPciExp) { if (display==0) - Display1PCIE = TRUE; + Display1PCIE = true; else - Display2PCIE = TRUE; + Display2PCIE = true; } DBG("Display %d is %sPCIE\n", display, (PciIoDevice->IsPciExp) ? "" :" not"); */ display++; @@ -800,12 +800,12 @@ void CheckHardware() DBG("Audio HDA (addr:0x%X) setting specified layout-id=%d (0x%X)\n", HDAADR1, layoutId, layoutId); } - HDAFIX = TRUE; + HDAFIX = true; HDAcodecId = codecId; HDAlayoutId = layoutId; } else { //HDMI GetPciADR(DevicePath, &HDMIADR1, &HDMIADR2, NULL); - GFXHDAFIX = TRUE; + GFXHDAFIX = true; } } @@ -899,7 +899,7 @@ void findCPU(UINT8* dsdt, UINT32 length) { UINT32 i, k, size; UINT32 SBSIZE = 0, SBADR = 0; - BOOLEAN SBFound = FALSE; + XBool SBFound = false; UINT32 off2, j1; if (acpi_cpu_score) { @@ -949,7 +949,7 @@ void findCPU(UINT8* dsdt, UINT32 length) if (dsdt[i] == 0x5B && dsdt[i + 1] == 0x83) { // ProcessorOP UINT32 j; UINT32 offset = i + 3 + (dsdt[i + 2] >> 6); // name - BOOLEAN add_name = TRUE; + XBool add_name = true; if (acpi_cpu_count == 0) { //only first time in the cycle CHAR8 c1 = dsdt[offset + 1]; // I want to determine a scope of PR @@ -976,7 +976,7 @@ void findCPU(UINT8* dsdt, UINT32 length) //check device k = j + 2; if ((dsdt[j] == 0x5B) && (dsdt[j + 1] == 0x82) && - !CmpNum(dsdt, j, TRUE)) { //device candidate + !CmpNum(dsdt, j, true)) { //device candidate // DBG("device candidate at %X\n", j); size = get_size(dsdt, k); if (size) { @@ -1006,7 +1006,7 @@ void findCPU(UINT8* dsdt, UINT32 length) if (dsdt[j - j1] != 0x10) { continue; } - if (!CmpNum(dsdt, j - j1, TRUE)) { + if (!CmpNum(dsdt, j - j1, true)) { SBADR = j - j1 + 1; SBSIZE = get_size(dsdt, SBADR); // DBG("found Scope(\\_SB) address = 0x%08X size = 0x%08X\n", SBADR, SBSIZE); @@ -1014,7 +1014,7 @@ void findCPU(UINT8* dsdt, UINT32 length) //if found k = SBADR - 6; if ((SBADR + SBSIZE) > i + 4) { //Yes - it is outer - SBFound = TRUE; + SBFound = true; break; //SB found } //else not an outer scope } @@ -1048,7 +1048,7 @@ void findCPU(UINT8* dsdt, UINT32 length) } if (!(IS_UPPER(c) || IS_DIGIT(c) || c == '_')) { - add_name = FALSE; + add_name = false; DBG("Invalid character found in ProcessorOP 0x%hhX!\n", c); break; } @@ -1206,18 +1206,18 @@ INT32 FindName(UINT8 *dsdt, INT32 len, CONST CHAR8* name) return 0; } -BOOLEAN GetName(UINT8 *dsdt, INT32 adr, OUT CHAR8* name, OUT INTN *shift) +XBool GetName(UINT8 *dsdt, INT32 adr, OUT CHAR8* name, OUT INTN *shift) { INT32 i; INT32 j = (dsdt[adr] == 0x5C)?1:0; //now we accept \NAME if (!name) { - return FALSE; + return false; } for (i = adr + j; i < adr + j + 4; i++) { if ((dsdt[i] < 0x2F) || ((dsdt[i] > 0x39) && (dsdt[i] < 0x41)) || ((dsdt[i] > 0x5A) && (dsdt[i] != 0x5F))) { - return FALSE; + return false; } name[i - adr - j] = dsdt[i]; } @@ -1225,13 +1225,13 @@ BOOLEAN GetName(UINT8 *dsdt, INT32 adr, OUT CHAR8* name, OUT INTN *shift) if (shift) { *shift = j; } - return TRUE; + return true; } -BOOLEAN CmpAdr (UINT8 *dsdt, UINT32 j, UINT32 PciAdr) +XBool CmpAdr (UINT8 *dsdt, UINT32 j, UINT32 PciAdr) { // Name (_ADR, 0x001f0001) - return (BOOLEAN) + return ((dsdt[j + 4] == 0x08) && (dsdt[j + 5] == 0x5F) && (dsdt[j + 6] == 0x41) && @@ -1263,11 +1263,11 @@ BOOLEAN CmpAdr (UINT8 *dsdt, UINT32 j, UINT32 PciAdr) ); } -BOOLEAN CmpPNP (UINT8 *dsdt, UINT32 j, UINT16 PNP) +XBool CmpPNP (UINT8 *dsdt, UINT32 j, UINT16 PNP) { // Name (_HID, EisaId ("PNP0C0F")) for PNP=0x0C0F BigEndian if (PNP == 0) { - return (BOOLEAN) + return ((dsdt[j + 0] == 0x08) && (dsdt[j + 1] == 0x5F) && (dsdt[j + 2] == 0x48) && @@ -1277,7 +1277,7 @@ BOOLEAN CmpPNP (UINT8 *dsdt, UINT32 j, UINT16 PNP) (dsdt[j + 6] == 0x41) && (dsdt[j + 7] == 0xD0)); } - return (BOOLEAN) + return ((dsdt[j + 0] == 0x08) && (dsdt[j + 1] == 0x5F) && (dsdt[j + 2] == 0x48) && @@ -1333,13 +1333,13 @@ INT32 CmpDev(UINT8 *dsdt, UINT32 i, const XBuffer& Name) INT32 FindBin (UINT8 *dsdt, UINT32 len, const UINT8* bin, UINT32 N) { UINT32 i, j; - BOOLEAN eq; + XBool eq; for (i=0; len >= N && i < len - N; i++) { - eq = TRUE; + eq = true; for (j=0; j 0x20) { //find method that previous to adr k = i + 1; - if ((dsdt[i] == 0x14) && !CmpNum(dsdt, i, FALSE)) { //method candidate + if ((dsdt[i] == 0x14) && !CmpNum(dsdt, i, false)) { //method candidate size = get_size(dsdt, k); if (!size) { continue; @@ -1428,7 +1428,7 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) INT32 size = 0; INT32 offset = 0; // UINT32 SBSIZE = 0, SBADR = 0; - BOOLEAN SBFound = FALSE; + XBool SBFound = false; if (shift == 0) { return len; @@ -1438,21 +1438,21 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) while (i > 0x20) { //find devices that previous to adr //check device k = 0; - if ((dsdt[i] == 0x5B) && (dsdt[i+1] == 0x82) && !CmpNum(dsdt, i, TRUE)) { //device candidate + if ((dsdt[i] == 0x5B) && (dsdt[i+1] == 0x82) && !CmpNum(dsdt, i, true)) { //device candidate k = i + 2; } else if ((dsdt[i] == 0x10) && //looks like Scope (dsdt[i-1] != 0x14) && //this is Method() (dsdt[i-1] != 0xA0) && //this is If() (dsdt[i-1] != 0xA1) && //this is Else() (dsdt[i-1] != 0xA2) && //this is While() - !CmpNum(dsdt, i, TRUE)) { //device scope like Scope (_PCI) + !CmpNum(dsdt, i, true)) { //device scope like Scope (_PCI) //additional check for Field // a problem with fields 52 4D 53 33 10 41 4D 45 4D // 1. Search outer filed // 2. check the size of the field // 3. compare if we are in the filed j = i - 1; - SBFound = TRUE; + SBFound = true; while (j > 0x20) { if (((dsdt[j - 1] == 0x5B) && (dsdt[j] == 0x81)) || ((dsdt[j - 1] == 0x5B) && (dsdt[j] == 0x82)) || @@ -1460,7 +1460,7 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) size = (INT32)get_size(dsdt, j + 1); // if it is not a size then size = 0 if (j + size >= i) { // it is inside a Field, skip it - SBFound = FALSE; + SBFound = false; } break; // other field so we stop search } @@ -1489,7 +1489,7 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) if (dsdt[i-j] != 0x10) { continue; } - if (!CmpNum(dsdt, i-j, TRUE)) { + if (!CmpNum(dsdt, i-j, true)) { SBADR = i-j+1; SBSIZE = get_size(dsdt, SBADR); // DBG("found Scope(\\_SB) address = 0x%08X size = 0x%08X\n", SBADR, SBSIZE); @@ -1501,7 +1501,7 @@ UINT32 CorrectOuters (UINT8 *dsdt, UINT32 len, UINT32 adr, INT32 shift) offset = write_size(SBADR, dsdt, len, shift); shift += offset; len += offset; - SBFound = TRUE; + SBFound = true; break; //SB found } //else not an outer scope } @@ -1578,18 +1578,18 @@ UINT32 devFind(UINT8 *dsdt, UINT32 address) } -BOOLEAN CustProperties(AML_CHUNK* pack, UINT32 Dev) +XBool CustProperties(AML_CHUNK* pack, UINT32 Dev) { UINTN i; - BOOLEAN Injected = FALSE; + XBool Injected = false; if (gSettings.Devices.AddPropertyArray.size() == 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore - return FALSE; // not do this for Arbitrary properties? + return false; // not do this for Arbitrary properties? } for (i = 0; i < gSettings.Devices.AddPropertyArray.size(); i++) { if (gSettings.Devices.AddPropertyArray[i].Device != Dev) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -1672,12 +1672,12 @@ void findPciRoot (UINT8 *dsdt, UINT32 len) UINT32 PCIADR, PCISIZE = 0; //initialising - NetworkName = FALSE; - DisplayName1 = FALSE; - DisplayName2 = FALSE; - FirewireName = FALSE; - ArptName = FALSE; - XhciName = FALSE; + NetworkName = false; + DisplayName1 = false; + DisplayName2 = false; + FirewireName = false; + ArptName = false; + XhciName = false; PCIADR = GetPciDevice(dsdt, len); if (PCIADR) { @@ -1778,7 +1778,7 @@ UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer ToFind, const XBuff size_t sizeoffset; INT32 adr; UINT32 i; - BOOLEAN found = FALSE; + XBool found = false; if ( ToFind.isEmpty() || ToReplace.isEmpty() ) { DBG(" invalid patches!\n"); return len; @@ -1810,7 +1810,7 @@ UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer ToFind, const XBuff } // MsgLog(" (%X)", adr); - found = TRUE; + found = true; len = move_data(adr + i, dsdt, len, (INT32)sizeoffset); // safe cast, sizeoffset < MAX_INT32 CopyMem(dsdt + adr + i, ToReplace.data(), ToReplace.size()); len = CorrectOuterMethod(dsdt, len, adr + i - 2, (INT32)sizeoffset); // safe cast, sizeoffset < MAX_INT32 @@ -1825,7 +1825,7 @@ UINT32 FixAny (UINT8* dsdt, UINT32 len, const XBuffer ToFind, const XBuff UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, const XBuffer& TgtBrgName, const XBuffer& ToFind, const XBuffer& ToReplace) { INT32 adr; - BOOLEAN found = FALSE; + XBool found = false; UINT32 i, k; UINT32 BrdADR = 0, BridgeSize; @@ -1857,7 +1857,7 @@ UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, const XBuffer& TgtBrg if(BridgeSize <= ToFind.size()) continue; k = 0; - found = FALSE; + found = false; while (k <= 100) { adr = FindBin(dsdt + BrdADR, BridgeSize, ToFind); if (adr < 0) { @@ -1874,7 +1874,7 @@ UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, const XBuffer& TgtBrg } DBG(" (%X)", adr); - found = TRUE; + found = true; if ( ToReplace.notEmpty() ) { CopyMem(dsdt + BrdADR + adr, ToReplace.data(), ToReplace.size()); } @@ -2506,17 +2506,17 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) UINT32 PCIADR = 0, PCISIZE = 0, Size; CHAR8 *display; UINT32 devadr=0, devsize=0, devadr1=0, devsize1=0; - BOOLEAN DISPLAYFIX = FALSE; - BOOLEAN NonUsable = FALSE; - BOOLEAN DsmFound = FALSE; - BOOLEAN NeedHDMI = !!(gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI); + XBool DISPLAYFIX = false; + XBool NonUsable = false; + XBool DsmFound = false; + XBool NeedHDMI = !!(gSettings.ACPI.DSDT.FixDsdt & FIX_HDMI); AML_CHUNK *root = NULL; AML_CHUNK *gfx0, *peg0; AML_CHUNK *met, *met2; AML_CHUNK *pack; UINT32 FakeID = 0; UINT32 FakeVen = 0; - DisplayName1 = FALSE; + DisplayName1 = false; if (!DisplayADR1[VCard]) return len; @@ -2538,7 +2538,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) } devsize = get_size(dsdt, devadr); //sizeof PEG0 0x35 if (devsize) { - DisplayName1 = TRUE; + DisplayName1 = true; break; } } // End Display1 @@ -2555,7 +2555,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) devsize1 = get_size(dsdt, devadr1); if (devsize1) { MsgLog("Found internal video device %X @%X\n", DisplayADR2[VCard], devadr1); - DISPLAYFIX = TRUE; + DISPLAYFIX = true; break; } } @@ -2575,10 +2575,10 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) dsdt[j+11] = 0; MsgLog("Found internal video device FFFF@%X, ReUse as 0\n", devadr1); } else { - NonUsable = TRUE; + NonUsable = true; MsgLog("Found internal video device FFFF@%X, unusable\n", devadr1); } - DISPLAYFIX = TRUE; + DISPLAYFIX = true; break; } } @@ -2590,7 +2590,7 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard) i = devadr1; } else if (DisplayADR2[VCard] == 0xFFFE) { //builtin i = devadr; - DISPLAYFIX = TRUE; + DISPLAYFIX = true; devadr1 = devadr; MsgLog(" builtin display\n"); } @@ -2801,8 +2801,8 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len) UINT32 PCIADR = 0, PCISIZE = 0, Size; CHAR8 *hdmi = NULL; UINT32 devadr=0, BridgeSize=0, devadr1=0; //, devsize1=0; - BOOLEAN BridgeFound = FALSE; - BOOLEAN HdauFound = FALSE; + XBool BridgeFound = false; + XBool HdauFound = false; AML_CHUNK* brd = NULL; AML_CHUNK *root = NULL; AML_CHUNK *met, *met2; @@ -2828,7 +2828,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len) if (!BridgeSize) { continue; } - BridgeFound = TRUE; + BridgeFound = true; if (HDMIADR2 != 0xFFFE){ for (k = devadr + 9; k < devadr + BridgeSize; k++) { if (CmpAdr(dsdt, k, HDMIADR2)) @@ -2842,7 +2842,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len) DBG("found HDMI device [0x%08X:%X] at %X and Name is %s\n", HDMIADR1, HDMIADR2, devadr1, device_name[11]); ReplaceName(dsdt + devadr, BridgeSize, device_name[11], "HDAU"); - HdauFound = TRUE; + HdauFound = true; break; } } @@ -2985,7 +2985,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card) PCISIZE = get_size(dsdt, PCIADR); } if (!PCISIZE) return len; //what is the bad DSDT ?! - NetworkName = FALSE; + NetworkName = false; // Network Address for (i = 0x24; len >=10 && i < len - 10; i++) { if (CmpAdr(dsdt, i, NetworkADR1[card])) { //0x001C0004 @@ -3012,7 +3012,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card) NetworkADR1[card], NetworkADR2[card], NetworkADR, device_name[1]); //renaming disabled until better way will found // ReplaceName(dsdt + BrdADR, BridgeSize, device_name[1], "GIGE"); - NetworkName = TRUE; + NetworkName = true; break; } } @@ -3193,7 +3193,7 @@ DBG("FIXAirport dsdt len=%d\n", len); if (!PCISIZE) return len; //what is the bad DSDT ?! DBG("Start Airport Fix\n"); - ArptName = FALSE; + ArptName = false; for (i=0x20; len >= 10 && i < len - 10; i++) { // AirPort Address if ( CmpAdr(dsdt, i, ArptADR1) || (gSettings.Devices.AirportBridgeDeviceName.notEmpty() && CmpDev(dsdt, i, gSettings.Devices.AirportBridgeDeviceName)) ) { @@ -3215,7 +3215,7 @@ DBG("FIXAirport dsdt len=%d\n", len); DBG("found Airport device [%08X:%X] at %X And Name is %s\n", ArptADR1, ArptADR2, ArptADR, device_name[9]); // ReplaceName(dsdt + BrdADR, BridgeSize, device_name[9], "ARPT"); //sometimes dangeous - ArptName = TRUE; + ArptName = true; break; } } @@ -3650,7 +3650,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len) DBG("found Firewire device NAME(_ADR,0x%08X) at %X And Name is %s\n", FirewireADR2, k, device_name[2]); ReplaceName(dsdt + BrdADR, BridgeSize, device_name[2], "FRWR"); - FirewireName = TRUE; + FirewireName = true; break; } } @@ -3788,7 +3788,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, const MacOsVersion& OSVersion) DBG("found HDA device NAME(_ADR,0x%08X) And Name is %s\n", HDAADR1, device_name[4]); ReplaceName(dsdt, len, device_name[4], "HDEF"); - HDAFIX = FALSE; + HDAFIX = false; break; } // End HDA } @@ -4055,7 +4055,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len) // find USB adr for (j = 0x20; len >= 4 && j < len - 4; j++) { if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR - XhciName = FALSE; + XhciName = false; UsbName[i] = (__typeof_am__(UsbName[i]))AllocateZeroPool(5); // DBG("found USB at 0x%X\n", j); adr1 = devFind(dsdt, j + 2); @@ -4094,7 +4094,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len) } DBG(" %s\n", UsbName[i]); ReplaceName(dsdt + adr1, Size, device_name[10], UsbName[i]); - XhciName = TRUE; + XhciName = true; break; } } @@ -4265,14 +4265,14 @@ UINT8 VenIDE[] = {0x86,0x80,0x00,0x00}; UINT32 FIXIDE (UINT8 *dsdt, UINT32 len) { - UINT32 i, k; - UINT32 j; - UINT32 IDEADR = 0, BridgeSize = 0, Size; - INT32 sizeoffset; + UINT32 i, k; + UINT32 j; + UINT32 IDEADR = 0, BridgeSize = 0, Size; + INT32 sizeoffset; AML_CHUNK *root; AML_CHUNK *device; CHAR8 *ide; - BOOLEAN PATAFIX=TRUE; + XBool PATAFIX=true; AML_CHUNK *met, *met2; AML_CHUNK *pack; AML_CHUNK *device1; @@ -4300,7 +4300,7 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len) { if (CmpAdr(dsdt, j, 0)) { - PATAFIX = FALSE; + PATAFIX = false; break; } } @@ -4676,7 +4676,7 @@ UINT32 FIXWAK (UINT8 *dsdt, UINT32 len, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABL UINT32 waksize=0; UINT32 sizeoffset = 0, sizeoffset2 = 0; // UINT16 PM30 = 0x430; //default - BOOLEAN ReturnFound = FALSE; + XBool ReturnFound = false; DBG("Start _WAK Return Fix\n"); @@ -4694,7 +4694,7 @@ UINT32 FIXWAK (UINT8 *dsdt, UINT32 len, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABL if (dsdt[i+k] == 0xA4) { // Return DBG( "_WAK Method find return data, don't need to patch.\n"); // return len; - ReturnFound = TRUE; + ReturnFound = true; } } //Slice - this patch disabled as useless @@ -4758,9 +4758,9 @@ UINT32 FIXGPE (UINT8 *dsdt, UINT32 len) // UINT32 adr=0; INT32 offset=0; INT32 sizeoffset; -// BOOLEAN pwrbfix = FALSE; -// BOOLEAN usbpwrb = FALSE; -// BOOLEAN foundpwrb = FALSE; +// XBool pwrbfix = false; +// XBool usbpwrb = false; +// XBool foundpwrb = false; sizeoffset = sizeof(pwrb); if (!PWRBADR) { @@ -4783,7 +4783,7 @@ UINT32 FIXGPE (UINT8 *dsdt, UINT32 len) if (dsdt[k] == UsbName[l][0] && dsdt[k+1] == UsbName[l][1] && dsdt[k+2] == UsbName[l][2] && dsdt[k+3] == UsbName[l][3]) { //DBG( "found USB _GPE Method.\n"); - // usbpwrb = TRUE; + // usbpwrb = true; if (!usbcount) { //DBG( "will to find Scope(\\_GPE).\n"); @@ -5044,11 +5044,11 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len) void FixRegions (UINT8 *dsdt, UINT32 len) { UINTN i, j; - INTN shift; + INTN shift = 0; // to silence warning CHAR8 Name[8]; CHAR8 NameAdr[8]; OPER_REGION *p; -// BOOLEAN Corrected = FALSE; +// XBool Corrected = false; // OperationRegion (GNVS, SystemMemory, 0xDE2E9E18, 0x01CD) // 5B 80 47 4E 56 53 00 0C 18 9E 2E DE 0B CD 01 @@ -5084,7 +5084,7 @@ void FixRegions (UINT8 *dsdt, UINT32 len) if (dsdt[j+4] == 0x0C) { CopyMem(&oldAddress, &dsdt[j+5], 4); CopyMem(&dsdt[j+5], &p->Address, 4); - // Corrected = TRUE; + // Corrected = true; } else if (dsdt[j+4] == 0x0B) { CopyMem(&oldAddress, &dsdt[j+5], 2); CopyMem(&dsdt[j+5], &p->Address, 2); @@ -5111,7 +5111,8 @@ void GetBiosRegions(UINT8 *buffer) // UINT8 *buffer = NULL; UINT32 bufferLen = 0; UINTN i, j; - INTN shift, shift2; + INTN shift = 0; // to silence warning + INTN shift2; CHAR8 Name[8]; CHAR8 NameAdr[8]; @@ -5218,7 +5219,7 @@ Scope(\_SB) PSXS._ON() <- to not patch } */ -BOOLEAN isACPI_Char(CHAR8 C) +XBool isACPI_Char(CHAR8 C) { return (((C >= 'A') && (C <= 'Z')) || ((C >= '0') && (C <= '9')) || @@ -5226,7 +5227,7 @@ BOOLEAN isACPI_Char(CHAR8 C) } // all string in Bridge is supposed to be 4 chars long. -BOOLEAN CmpFullName(UINT8* Table, UINTN Len, const XString8Array& Bridge) +XBool CmpFullName(UINT8* Table, UINTN Len, const XString8Array& Bridge) { // "RP02" NameLen=4 // "_SB_PCI0RP02" NameLen=12 @@ -5237,7 +5238,7 @@ BOOLEAN CmpFullName(UINT8* Table, UINTN Len, const XString8Array& Bridge) while ((NameLen < Len) && isACPI_Char((CHAR8)Table[NameLen])) NameLen++; NameLen &= ~3; if (NameLen < 4) { - return FALSE; + return false; } Name = (__typeof__(Name))AllocateCopyPool(NameLen + 1, Table); Name[NameLen] = '\0'; @@ -5245,12 +5246,12 @@ BOOLEAN CmpFullName(UINT8* Table, UINTN Len, const XString8Array& Bridge) for (size_t idx = 0 ; idx < Bridge.size() && i >= 0 ; ++idx ) { if (AsciiStrStr(Name + i, Bridge[idx].c_str()) == NULL) { //compare Bridge->Name with RP02, Next->Name with PCI0 then _SB_ FreePool(Name); - return FALSE; + return false; } i -= 4; } FreePool(Name); - return TRUE; + return true; } void RenameDevices(UINT8* table) @@ -5264,7 +5265,7 @@ void RenameDevices(UINT8* table) INTN size; UINTN len = ((EFI_ACPI_DESCRIPTION_HEADER*)table)->Length; INTN adr, shift, Num = 0; - BOOLEAN found; + XBool found; for (UINTN index = 0; index < gSettings.ACPI.DeviceRename.size(); index++) { const ACPI_RENAME_DEVICE& deviceRename = gSettings.ACPI.DeviceRename[index]; XString8Array FindList = deviceRename.acpiName.getSplittedName(); @@ -5299,17 +5300,17 @@ void RenameDevices(UINT8* table) i -= 6; //skip size and device field // DBG("search for bridge since %lld\n", adr); while (i > 0x20) { //find devices that previous to adr - found = FALSE; + found = false; //check device - if ((table[i] == 0x5B) && (table[i + 1] == 0x82) && !CmpNum(table, (INT32)i, TRUE)) { //device candidate + if ((table[i] == 0x5B) && (table[i + 1] == 0x82) && !CmpNum(table, (INT32)i, true)) { //device candidate k = i + 2; - found = TRUE; + found = true; } //check scope - if ((table[i] == 0x10) && !CmpNum(table, (INT32)i, TRUE)) { + if ((table[i] == 0x10) && !CmpNum(table, (INT32)i, true)) { k = i + 1; - found = TRUE; + found = true; } if (found) { // i points to Device or Scope size = get_size(table, (UINT32)(UINTN)k); //k points to size // @@ -5357,9 +5358,9 @@ void FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, c } //Reenter requires ZERO values - HDAFIX = TRUE; - GFXHDAFIX = TRUE; - USBIDFIX = TRUE; + HDAFIX = true; + GFXHDAFIX = true; + USBIDFIX = true; EFI_ACPI_DESCRIPTION_HEADER* efi_acpi_description_header = (EFI_ACPI_DESCRIPTION_HEADER*)temp; DsdtLen = efi_acpi_description_header->Length; diff --git a/rEFIt_UEFI/Platform/HdaCodecDump.cpp b/rEFIt_UEFI/Platform/HdaCodecDump.cpp index 3bf328128..839cbbf3a 100644 --- a/rEFIt_UEFI/Platform/HdaCodecDump.cpp +++ b/rEFIt_UEFI/Platform/HdaCodecDump.cpp @@ -60,7 +60,7 @@ CONST CHAR8 *gColors[HDA_CONFIG_DEFAULT_COLOR_OTHER + 1] = { //#pragma clang diagnostic push //#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" -#define HdaLog(format, ...) MemLogf(FALSE, 0, format, ##__VA_ARGS__) +#define HdaLog(format, ...) MemLogf(false, 0, format, ##__VA_ARGS__) //#pragma clang diagnostic pop @@ -446,7 +446,7 @@ EFI_STATUS SaveHdaDumpBin() HdaWidget.ConnectionSelect = 0; HdaWidget.SupportedPowerStates = Widgets[w].SupportedPowerStates; HdaWidget.DefaultPowerState = Widgets[w].DefaultPowerState; - HdaWidget.AmpOverride = Widgets[w].AmpOverride; + HdaWidget.AmpOverride = Widgets[w].AmpOverride != 0; HdaWidget.AmpInCapabilities = Widgets[w].AmpInCapabilities; HdaWidget.AmpOutCapabilities = Widgets[w].AmpOutCapabilities; HdaWidget.AmpOutLeftDefaultGainMute = Widgets[w].AmpOutLeftDefaultGainMute; diff --git a/rEFIt_UEFI/Platform/HdaCodecDump.h b/rEFIt_UEFI/Platform/HdaCodecDump.h index 95878374a..3ac164d6c 100644 --- a/rEFIt_UEFI/Platform/HdaCodecDump.h +++ b/rEFIt_UEFI/Platform/HdaCodecDump.h @@ -33,33 +33,33 @@ #define HDA_MAX_NAMELEN 32 typedef struct { - UINT8 NodeId; - UINT8 Type; - UINT32 Capabilities; - UINT8 DefaultUnSol; - UINT32 ConnectionListLength; - UINT8 ConnectionSelect; - UINT16 Connections[HDA_MAX_CONNS]; - UINT32 SupportedPowerStates; - UINT32 DefaultPowerState; - BOOLEAN AmpOverride; - UINT32 AmpInCapabilities; - UINT32 AmpOutCapabilities; - UINT8 AmpInLeftDefaultGainMute[HDA_MAX_CONNS]; - UINT8 AmpInRightDefaultGainMute[HDA_MAX_CONNS]; - UINT8 AmpOutLeftDefaultGainMute; - UINT8 AmpOutRightDefaultGainMute; - UINT32 SupportedPcmRates; - UINT32 SupportedFormats; - UINT16 DefaultConvFormat; - UINT8 DefaultConvStreamChannel; - UINT8 DefaultConvChannelCount; - UINT32 PinCapabilities; - UINT8 DefaultEapd; - UINT8 DefaultPinControl; - UINT32 DefaultConfiguration; - UINT32 VolumeCapabilities; - UINT8 DefaultVolume; + UINT8 NodeId = 0; + UINT8 Type = 0; + UINT32 Capabilities = 0; + UINT8 DefaultUnSol = 0; + UINT32 ConnectionListLength = 0; + UINT8 ConnectionSelect = 0; + UINT16 Connections[HDA_MAX_CONNS] = { 0 }; + UINT32 SupportedPowerStates = 0; + UINT32 DefaultPowerState = 0; + XBool AmpOverride = false; + UINT32 AmpInCapabilities = 0; + UINT32 AmpOutCapabilities = 0; + UINT8 AmpInLeftDefaultGainMute[HDA_MAX_CONNS] = { 0 }; + UINT8 AmpInRightDefaultGainMute[HDA_MAX_CONNS] = { 0 }; + UINT8 AmpOutLeftDefaultGainMute = 0; + UINT8 AmpOutRightDefaultGainMute = 0; + UINT32 SupportedPcmRates = 0; + UINT32 SupportedFormats = 0; + UINT16 DefaultConvFormat = 0; + UINT8 DefaultConvStreamChannel = 0; + UINT8 DefaultConvChannelCount = 0; + UINT32 PinCapabilities = 0; + UINT8 DefaultEapd = 0; + UINT8 DefaultPinControl = 0; + UINT32 DefaultConfiguration = 0; + UINT32 VolumeCapabilities = 0; + UINT8 DefaultVolume = 0; } HdaWidget; typedef struct { diff --git a/rEFIt_UEFI/Platform/Hibernate.cpp b/rEFIt_UEFI/Platform/Hibernate.cpp index 1faf4120f..6c5445fde 100644 --- a/rEFIt_UEFI/Platform/Hibernate.cpp +++ b/rEFIt_UEFI/Platform/Hibernate.cpp @@ -578,10 +578,10 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume) } -/** Returns TRUE if /private/var/vm/sleepimage exists +/** Returns true if /private/var/vm/sleepimage exists * and it's modification time is close to volume modification time). */ -BOOLEAN +XBool IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume) { EFI_STATUS Status; @@ -608,13 +608,13 @@ IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume) Pages = EFI_SIZE_TO_PAGES(BlockIo->Media->BlockSize); Buffer = (__typeof__(Buffer))AllocatePages(Pages); if (Buffer == NULL) { - return FALSE; + return false; } Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, 2, BlockIo->Media->BlockSize, Buffer); if (EFI_ERROR(Status)) { DBG(" can not read HFS+ header -> %s\n", efiStrError(Status)); FreePages(Buffer, Pages); - return FALSE; + return false; } HFSHeader = (HFSPlusVolumeHeaderMin *)Buffer; HFSVolumeModifyDate = SwapBytes32(HFSHeader->modifyDate); @@ -635,19 +635,19 @@ IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume) //Slice - if image newer then volume it should be OK DBG(" image too old\n"); FreePages(Buffer, Pages); - return FALSE; + return false; } DBG(" machineSignature from FACS =0x%llX\n", machineSignature); // machineSignature = ((IOHibernateImageHeaderMin*)Buffer)->machineSignature; // DBG(" image has machineSignature =0x%X\n", machineSignature); FreePages(Buffer, Pages); - return TRUE; + return true; } -/** Returns TRUE if /private/var/vm/sleepimage exists +/** Returns true if /private/var/vm/sleepimage exists * and it's signature is kIOHibernateHeaderSignature. */ -BOOLEAN +XBool IsSleepImageValidBySignature (IN REFIT_VOLUME *Volume) { // We'll have to detect offset here also in case driver caches @@ -708,17 +708,17 @@ REFIT_VOLUME *FoundParentVolume(REFIT_VOLUME *Volume) STATIC CHAR16 OffsetHexStr[100]; -/** Returns TRUE if given OSX on given volume is hibernated. */ -BOOLEAN +/** Returns true if given OSX on given volume is hibernated. */ +XBool IsOsxHibernated (IN LOADER_ENTRY *Entry) { - EFI_STATUS Status = EFI_SUCCESS; - UINTN Size = 0; + EFI_STATUS Status = EFI_SUCCESS; + UINTN Size = 0; UINT8 *Data = NULL; // REFIT_VOLUME *ThisVolume = Entry->Volume; REFIT_VOLUME *Volume = Entry->Volume; EFI_GUID *BootGUID = NULL; - BOOLEAN ret = FALSE; + XBool ret = false; UINT8 *Value = NULL; // UINTN VolumeIndex; @@ -726,7 +726,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) // CHAR16 *VolumeUUIDStr = NULL; if (!Volume) { - return FALSE; + return false; } /* Status = GetRootUUID(ThisVolume); // already done @@ -777,7 +777,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) if (Volume) { DBG(" Found parent Volume with name %ls\n", Volume->VolName); if (Volume->RootDir == NULL) { - return FALSE; + return false; } } else { DBG(" Parent Volume not found, use this one\n"); @@ -807,7 +807,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) //or we choose "cancel hibernate wake" then it must be canceled if (gSettings.Boot.NeverHibernate) { DBG(" hibernated: set as never\n"); - return FALSE; + return false; } DBG(" Check if volume Is Hibernated:\n"); @@ -817,15 +817,15 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) if (IsSleepImageValidBySignature(Volume)) { if ((gSleepTime == 0) || IsSleepImageValidBySleepTime(Volume)) { DBG(" hibernated: yes\n"); - ret = TRUE; + ret = true; } else { DBG(" hibernated: no - time\n"); - return FALSE; + return false; } - // IsHibernate = TRUE; + // IsHibernate = true; } else { DBG(" hibernated: no - sign\n"); - return FALSE; //test + return false; //test } } @@ -835,10 +835,10 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) Status = GetVariable2 (L"Boot0082", &gEfiGlobalVariableGuid, (void**)&Data, &Size); if (EFI_ERROR(Status)) { DBG(" no, Boot0082 not exists\n"); - ret = FALSE; + ret = false; } else { DBG("yes\n"); - ret = TRUE; + ret = true; //1. Parse Media Device Path from Boot0082 load option //Cut Data pointer by 0x08 up to DevicePath // Data += 0x08; @@ -862,7 +862,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) } //DBG(" Volume has PartUUID=%s\n", strguid(VolumeUUID)); if (BootGUID != NULL && VolumeUUID != NULL && !CompareGuid(BootGUID, VolumeUUID)) { - ret = FALSE; + ret = false; } else { DBG(" Boot0082 points to Volume with UUID:%s\n", strguid(BootGUID)); @@ -887,7 +887,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) if (EFI_ERROR(Status)) { // leave it as is DBG(" boot-image not found while we want StrictHibernate\n"); - ret = FALSE; + ret = false; } else { EFI_DEVICE_PATH_PROTOCOL *BootImageDevPath; @@ -907,7 +907,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) EFI_GUID TmpGuid; // CHAR16 *TmpStr = NULL; - ResumeFromCoreStorage = TRUE; + ResumeFromCoreStorage = true; // DBG("got str=%ls\n", Ptr); XString8 xs8; xs8.takeValueFrom(Ptr); @@ -942,7 +942,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) Size , Value); if (EFI_ERROR(Status)) { DBG(" can not write boot-image -> %s\n", efiStrError(Status)); - ret = FALSE; + ret = false; } } } @@ -974,7 +974,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) * That's the only way for CloverEFI and should be OK for UEFI hack also. */ -BOOLEAN +XBool PrepareHibernation (IN REFIT_VOLUME *Volume) { EFI_STATUS Status; @@ -986,9 +986,9 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) UINT8 *VarData = NULL; REFIT_VOLUME *SleepImageVolume; UINT32 Attributes; - BOOLEAN HasIORTCVariables = FALSE; - BOOLEAN HasHibernateInfo = FALSE; - BOOLEAN HasHibernateInfoInRTC = FALSE; + XBool HasIORTCVariables = false; + XBool HasHibernateInfo = false; + XBool HasHibernateInfoInRTC = false; DBG("PrepareHibernation:\n"); @@ -998,7 +998,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) DBG(" SleepImageOffset: %llx\n", SleepImageOffset); if (SleepImageOffset == 0 || SleepImageVolume == NULL) { DBG(" sleepimage offset not found\n"); - return FALSE; + return false; } // Set boot-image var @@ -1020,7 +1020,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) Size , BootImageDevPath); if (EFI_ERROR(Status)) { DBG(" can not write boot-image -> %s\n", efiStrError(Status)); - return FALSE; + return false; } } @@ -1041,7 +1041,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) DBG(" boot-switch-vars present\n"); ZeroMem (Value, Size); gBS->FreePool(Value); - return TRUE; + return true; } // @@ -1062,7 +1062,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) // Prior to 10.13.6. // Status = GetVariable2 (L"IOHibernateRTCVariables", &gEfiAppleBootGuid, &Value, &Size); - DBG("get IOHR variable status=%s, size=%llu, RTC info=%d\n", efiStrError(Status), Size, HasHibernateInfoInRTC); + DBG("get IOHR variable status=%s, size=%llu, RTC info=%d\n", efiStrError(Status), Size, (bool)HasHibernateInfoInRTC); if (!HasHibernateInfo && !EFI_ERROR(Status) && Size == sizeof (RtcVars)) { CopyMem(RtcRawVars, Value, sizeof (RtcVars)); HasHibernateInfo = (RtcVars.signature[0] == 'A' && RtcVars.signature[1] == 'A' && @@ -1110,7 +1110,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) // We have everything we need now. // if (HasHibernateInfo) { - return TRUE; + return true; } } @@ -1129,7 +1129,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) Status = gRT->SetVariable(L"IOHibernateRTCVariables", &gEfiAppleBootGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, 0, NULL); - HasIORTCVariables = TRUE; + HasIORTCVariables = true; } else { // // No NVRAM support, trying unencrypted. @@ -1168,9 +1168,9 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) if (EFI_ERROR(Status)) { DBG(" can not write boot-switch-vars -> %s\n", efiStrError(Status)); - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/rEFIt_UEFI/Platform/Hibernate.h b/rEFIt_UEFI/Platform/Hibernate.h index f6064d9f8..a75bf3502 100644 --- a/rEFIt_UEFI/Platform/Hibernate.h +++ b/rEFIt_UEFI/Platform/Hibernate.h @@ -8,17 +8,17 @@ #ifndef PLATFORM_HIBERNATE_H_ #define PLATFORM_HIBERNATE_H_ -/** Returns TRUE if given macOS on given volume is hibernated +/** Returns true if given macOS on given volume is hibernated * (/private/var/vm/sleepimage exists and it's modification time is close to volume modification time). */ -BOOLEAN +XBool IsOsxHibernated ( IN LOADER_ENTRY *Entry ); /** Prepares nvram vars needed for boot.efi to wake from hibernation. */ -BOOLEAN +XBool PrepareHibernation ( IN REFIT_VOLUME *Volume ); diff --git a/rEFIt_UEFI/Platform/Injectors.cpp b/rEFIt_UEFI/Platform/Injectors.cpp index 71fce3ad8..575ccf50e 100644 --- a/rEFIt_UEFI/Platform/Injectors.cpp +++ b/rEFIt_UEFI/Platform/Injectors.cpp @@ -290,7 +290,7 @@ EFI_OS_INFO_PROTOCOL mEfiOSInfo = { ->LocateProtocol(gAppleGraphConfigProtocolGuid, 0, 78000000438/1F7DAEC8) = Success call sub_30150 ->GetVariable(boot-gamma, gEfiAppleBootGuid, 0/50, 0, 0) = Not Found - mRestored = TRUE; + mRestored = true; ->GraphConfig.RestoreConfig(2, 400, 1FFCE8B0, 1FFCE0B0, 1FFCD8B0) status=Success */ @@ -341,7 +341,7 @@ EFI_KEYBOARD_INFO_PROTOCOL mKeyboardInfo = { //EFIAPI //GetQuirksConfig (IN OCQUIRKS_PROTOCOL *This, // OUT OC_ABC_SETTINGS_4CLOVER *Buffer, -// OUT BOOLEAN *GopEnable +// OUT XBool *GopEnable // ) //{ // DBG("GetQuirksConfig called\n"); diff --git a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.cpp b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.cpp index dcce83509..a196d1ce5 100644 --- a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.cpp +++ b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.cpp @@ -8,18 +8,18 @@ #include "KERNEL_AND_KEXT_PATCHES.h" #include "MacOsVersion.h" -bool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build) +XBool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build) { - BOOLEAN ret = FALSE; + XBool ret = false; if (MatchBuild.isEmpty() || Build.isEmpty()) { - return TRUE; //undefined matched corresponds to old behavior + return true; //undefined matched corresponds to old behavior } XString8Array mos = Split(MatchBuild, ","_XS8).trimEachString(); if ( mos[0] == "All"_XS8) { - return TRUE; + return true; } for (size_t i = 0; i < mos.size(); ++i) { @@ -27,7 +27,7 @@ bool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build) MacOsVersion mosv = mos[i]; if ( mos[i].contains(Build) ) { // MatchBuild //DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]); - ret = TRUE; + ret = true; break; } } @@ -35,18 +35,18 @@ bool ABSTRACT_PATCH::IsPatchEnabledByBuildNumber(const XString8& Build) } -bool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) +XBool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) { - BOOLEAN ret = FALSE; + XBool ret = false; if (MatchOS.isEmpty() || CurrOS.isEmpty()) { - return TRUE; //undefined matched corresponds to old behavior + return true; //undefined matched corresponds to old behavior } XString8Array mos = Split(MatchOS, ","_XS8).trimEachString(); if ( mos[0] == "All"_XS8) { - return TRUE; + return true; } for (size_t i = 0; i < mos.size(); ++i) { @@ -54,7 +54,7 @@ bool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) MacOsVersion mosv = mos[i]; if ( CurrOS.match(mos[i]) ) { //DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]); - ret = TRUE; + ret = true; break; } } @@ -63,18 +63,18 @@ bool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) // -//bool KERNEL_AND_KEXT_PATCHES::IsPatchEnabledByBuildNumber(const XString8& Build) +//XBool KERNEL_AND_KEXT_PATCHES::IsPatchEnabledByBuildNumber(const XString8& Build) //{ -// BOOLEAN ret = FALSE; +// XBool ret = false; // // if (MatchBuild.isEmpty() || Build.isEmpty()) { -// return TRUE; //undefined matched corresponds to old behavior +// return true; //undefined matched corresponds to old behavior // } // // XString8Array mos = Split(MatchBuild, ","_XS8).trimEachString(); // // if ( mos[0] == "All"_XS8) { -// return TRUE; +// return true; // } // // for (size_t i = 0; i < mos.size(); ++i) { @@ -82,7 +82,7 @@ bool ABSTRACT_PATCH::IsPatchEnabled(const MacOsVersion& CurrOS) // MacOsVersion mosv = mos[i]; // if ( mos[i].contains(Build) ) { // MatchBuild // //DBG("\nthis patch will activated for OS %ls!\n", mos->array[i]); -// ret = TRUE; +// ret = true; // break; // } // } diff --git a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h index 865febf1d..41e94f631 100644 --- a/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h +++ b/rEFIt_UEFI/Platform/KERNEL_AND_KEXT_PATCHES.h @@ -22,7 +22,7 @@ extern "C" { class ABSTRACT_PATCH { public: - bool Disabled = bool(); + XBool Disabled = XBool(); XBuffer Find = XBuffer (); XBuffer Replace = XBuffer (); XBuffer MaskFind = XBuffer (); @@ -43,9 +43,9 @@ public: virtual ~ABSTRACT_PATCH() {} #if __cplusplus > 201703L - bool operator == (const ABSTRACT_PATCH&) const = default; + XBool operator == (const ABSTRACT_PATCH&) const = default; #endif - bool isEqual(const ABSTRACT_PATCH& other) const + XBool isEqual(const ABSTRACT_PATCH& other) const { if ( !(Disabled == other.Disabled ) ) return false; if ( !(Find == other.Find ) ) return false; @@ -82,8 +82,8 @@ public: } /** Returns a boolean and then enable disable the patch if MachOSEntry have a match for the booted OS. */ - bool IsPatchEnabledByBuildNumber(const XString8& Build); - bool IsPatchEnabled(const MacOsVersion& CurrOS); + XBool IsPatchEnabledByBuildNumber(const XString8& Build); + XBool IsPatchEnabled(const MacOsVersion& CurrOS); }; @@ -96,15 +96,15 @@ public: #if __cplusplus > 201703L - bool operator == (const ABSTRACT_KEXT_OR_KERNEL_PATCH&) const = default; + XBool operator == (const ABSTRACT_KEXT_OR_KERNEL_PATCH&) const = default; #endif - bool isEqual(const ABSTRACT_KEXT_OR_KERNEL_PATCH& other) const + XBool isEqual(const ABSTRACT_KEXT_OR_KERNEL_PATCH& other) const { if ( !super::isEqual (other) ) return false; if ( !(ProcedureName == other.ProcedureName ) ) return false; return true; } - bool takeValueFrom(const ConfigPlistClass::KernelAndKextPatches_Class::ABSTRACT_KEXT_OR_KERNEL_PATCH& other) + XBool takeValueFrom(const ConfigPlistClass::KernelAndKextPatches_Class::ABSTRACT_KEXT_OR_KERNEL_PATCH& other) { super::takeValueFrom(other); ProcedureName = other.dgetProcedureName(); @@ -119,15 +119,15 @@ class KEXT_PATCH : public ABSTRACT_KEXT_OR_KERNEL_PATCH using super = ABSTRACT_KEXT_OR_KERNEL_PATCH; public: XString8 Name = XString8(); - bool IsPlistPatch = BOOLEAN(); + XBool IsPlistPatch = XBool(); virtual XString8 getName() const { return Name; } #if __cplusplus > 201703L - bool operator == (const KEXT_PATCH&) const = default; + XBool operator == (const KEXT_PATCH&) const = default; #endif - bool isEqual(const KEXT_PATCH& other) const + XBool isEqual(const KEXT_PATCH& other) const { if ( !super::isEqual (other) ) return false; if ( !(Name == other.Name ) ) return false; @@ -150,9 +150,9 @@ public: virtual XString8 getName() const { return "kernel"_XS8; } #if __cplusplus > 201703L - bool operator == (const KERNEL_PATCH&) const = default; + XBool operator == (const KERNEL_PATCH&) const = default; #endif - bool isEqual(const KERNEL_PATCH& other) const + XBool isEqual(const KERNEL_PATCH& other) const { if ( !super::isEqual (other) ) return false; return true; @@ -171,9 +171,9 @@ public: virtual XString8 getName() const { return "boot.efi"_XS8; } #if __cplusplus > 201703L - bool operator == (const BOOT_PATCH&) const = default; + XBool operator == (const BOOT_PATCH&) const = default; #endif - bool isEqual(const BOOT_PATCH& other) const + XBool isEqual(const BOOT_PATCH& other) const { if ( !super::isEqual (other) ) return false; return true; @@ -187,15 +187,15 @@ public: class KERNEL_AND_KEXT_PATCHES { public: - bool KPDebug = bool(); - bool KPKernelLapic = bool(); - bool KPKernelXCPM = bool(); - bool _KPKernelPm = bool(); - bool KPPanicNoKextDump = bool(); - bool _KPAppleIntelCPUPM = bool(); - bool KPAppleRTC = bool(); - bool EightApple = bool(); - bool KPDELLSMBIOS = bool(); // Dell SMBIOS patch + XBool KPDebug = XBool(); + XBool KPKernelLapic = XBool(); + XBool KPKernelXCPM = XBool(); + XBool _KPKernelPm = XBool(); + XBool KPPanicNoKextDump = XBool(); + XBool _KPAppleIntelCPUPM = XBool(); + XBool KPAppleRTC = XBool(); + XBool EightApple = XBool(); + XBool KPDELLSMBIOS = XBool(); // Dell SMBIOS patch UINT32 FakeCPUID = UINT32(); XString8 KPATIConnectorsController = XString8(); XBuffer KPATIConnectorsData = XBuffer(); @@ -208,9 +208,9 @@ public: KERNEL_AND_KEXT_PATCHES() : ForceKextsToLoad(), KextPatches(), KernelPatches(), BootPatches() {} #if __cplusplus > 201703L - bool operator == (const KERNEL_AND_KEXT_PATCHES&) const = default; + XBool operator == (const KERNEL_AND_KEXT_PATCHES&) const = default; #endif - bool isEqual(const KERNEL_AND_KEXT_PATCHES& other) const + XBool isEqual(const KERNEL_AND_KEXT_PATCHES& other) const { if ( !(KPDebug == other.KPDebug ) ) return false; if ( !(KPKernelLapic == other.KPKernelLapic ) ) return false; diff --git a/rEFIt_UEFI/Platform/KextList.cpp b/rEFIt_UEFI/Platform/KextList.cpp index f96e9798a..2ed318f73 100644 --- a/rEFIt_UEFI/Platform/KextList.cpp +++ b/rEFIt_UEFI/Platform/KextList.cpp @@ -66,22 +66,22 @@ XStringW GetBundleVersion(const XStringW& pathUnderSelf) void GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath) { - REFIT_DIR_ITER DirIter; - EFI_FILE_INFO* DirEntry; - SIDELOAD_KEXT* mKext; - SIDELOAD_KEXT* mPlugInKext; - XStringW FullName; + REFIT_DIR_ITER DirIter; + EFI_FILE_INFO *DirEntry; + SIDELOAD_KEXT *mKext; + SIDELOAD_KEXT *mPlugInKext; + XStringW FullName; // XStringW FullPath = SWPrintf("%ls\\KEXTS\\%ls", OEMPath.wc_str(), KextDirNameUnderOEMPath); - REFIT_DIR_ITER PlugInsIter; + REFIT_DIR_ITER PlugInsIter; EFI_FILE_INFO *PlugInEntry; - XStringW PlugInsPath; + XStringW PlugInsPath; XStringW PlugInsName; - BOOLEAN Blocked = FALSE; + XBool Blocked = false; if( !selfOem.isKextsDirFound() ) return; if (StrCmp(KextDirNameUnderOEMPath, L"Off") == 0) { - Blocked = TRUE; + Blocked = true; } DirIterOpen(&selfOem.getKextsDir(), KextDirNameUnderOEMPath, &DirIter); diff --git a/rEFIt_UEFI/Platform/LegacyBiosThunk.cpp b/rEFIt_UEFI/Platform/LegacyBiosThunk.cpp index f77e5c84a..041387e87 100644 --- a/rEFIt_UEFI/Platform/LegacyBiosThunk.cpp +++ b/rEFIt_UEFI/Platform/LegacyBiosThunk.cpp @@ -175,7 +175,7 @@ DisconnectVga ( void ) Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci); if (!EFI_ERROR(Status)) { - if(IS_PCI_VGA(&Pci) == TRUE) + if(IS_PCI_VGA(&Pci) == true) { // disconnect VGA DBG("Disonnecting VGA\n"); @@ -199,11 +199,11 @@ DisconnectVga ( void ) @param BiosInt Processor interrupt vector to invoke @param Reg Register contexted passed into (and returned) from thunk to 16-bit mode - @retval TRUE Thunk completed, and there were no BIOS errors in the target code. + @retval true Thunk completed, and there were no BIOS errors in the target code. See Regs for status. - @retval FALSE There was a BIOS erro in the target code. + @retval false There was a BIOS erro in the target code. **/ -BOOLEAN +XBool EFIAPI LegacyBiosInt86 ( // IN BIOS_VIDEO_DEV *BiosDev, @@ -214,8 +214,8 @@ LegacyBiosInt86 ( UINTN Status; UINTN Eflags; IA32_REGISTER_SET ThunkRegSet; - BOOLEAN Ret; - UINT16 *Stack16; + XBool Ret; + UINT16 *Stack16; ZeroMem (&ThunkRegSet, sizeof (ThunkRegSet)); ThunkRegSet.E.EFLAGS.Bits.Reserved_0 = 1; @@ -252,7 +252,7 @@ LegacyBiosInt86 ( Status = gLegacy8259->SetMode (gLegacy8259, Efi8259LegacyMode, NULL, NULL); // ASSERT_EFI_ERROR(Status); if (EFI_ERROR(Status)) { - return FALSE; + return false; } Stack16 = (UINT16 *)((UINT8 *) mThunkContext->RealModeBuffer + mThunkContext->RealModeBufferSize - sizeof (UINT16)); @@ -271,7 +271,7 @@ LegacyBiosInt86 ( Status = gLegacy8259->SetMode (gLegacy8259, Efi8259ProtectedMode, NULL, NULL); // ASSERT_EFI_ERROR(Status); if (EFI_ERROR(Status)) { - return FALSE; + return false; } // @@ -295,12 +295,12 @@ LegacyBiosInt86 ( CopyMem(&(Regs->E.EFLAGS), &(ThunkRegSet.E.EFLAGS), sizeof (UINT32)); - Ret = (BOOLEAN) (Regs->E.EFLAGS.Bits.CF == 1); + Ret = Regs->E.EFLAGS.Bits.CF == 1; return Ret; } -BOOLEAN +XBool EFIAPI LegacyBiosFarCall86 ( // IN EFI_LEGACY_BIOS_THUNK_PROTOCOL *This, @@ -311,17 +311,17 @@ LegacyBiosFarCall86 ( // IN UINTN StackSize ) { - UINTN Status; - UINT32 Eflags; - IA32_REGISTER_SET ThunkRegSet; - BOOLEAN Ret; - UINT16 *Stack16; + UINTN Status; + UINT32 Eflags; + IA32_REGISTER_SET ThunkRegSet; + XBool Ret; + UINT16 *Stack16; // UINT16 BiosInt = 0x100; - EFI_TPL OriginalTpl; + EFI_TPL OriginalTpl; EFI_TIMER_ARCH_PROTOCOL *Timer; - UINT64 TimerPeriod = 0; + UINT64 TimerPeriod = 0; #if ENABLE_PS2MOUSE_LEGACYBOOT == 1 - UINT16 LegacyMaskOld, LegacyMaskNew; + UINT16 LegacyMaskOld, LegacyMaskNew; #endif // Disconnect EFI VGA driver (and switch to Text VGA Mode) @@ -449,7 +449,7 @@ LegacyBiosFarCall86 ( CopyMem(&(Regs->E.EFLAGS), &(ThunkRegSet.E.EFLAGS), sizeof (UINT32)); - Ret = (BOOLEAN) (Regs->E.EFLAGS.Bits.CF == 1); + Ret = Regs->E.EFLAGS.Bits.CF == 1; // Connect VGA EFI Driver BdsLibConnectAllDriversToAllControllers(); diff --git a/rEFIt_UEFI/Platform/LegacyBiosThunk.h b/rEFIt_UEFI/Platform/LegacyBiosThunk.h index b50e58410..4101f5b3d 100644 --- a/rEFIt_UEFI/Platform/LegacyBiosThunk.h +++ b/rEFIt_UEFI/Platform/LegacyBiosThunk.h @@ -56,7 +56,7 @@ InitializeInterruptRedirection ( // IN EFI_LEGACY_8259_PROTOCOL *Legacy8259 ); -BOOLEAN +XBool EFIAPI LegacyBiosInt86 ( // IN EFI_LEGACY_BIOS_THUNK_PROTOCOL *This, @@ -64,7 +64,7 @@ LegacyBiosInt86 ( IN IA32_REGISTER_SET *Regs ); -BOOLEAN +XBool EFIAPI LegacyBiosFarCall86 ( // IN EFI_LEGACY_BIOS_THUNK_PROTOCOL *This, diff --git a/rEFIt_UEFI/Platform/LegacyBoot.cpp b/rEFIt_UEFI/Platform/LegacyBoot.cpp index 3d1d50594..52a069e87 100644 --- a/rEFIt_UEFI/Platform/LegacyBoot.cpp +++ b/rEFIt_UEFI/Platform/LegacyBoot.cpp @@ -197,7 +197,7 @@ EFI_STATUS BiosReadSectorsFromDrive(UINT8 DriveNum, UINT64 Lba, UINTN NumSectors Regs.H.DL = DriveNum; Status = EFI_SUCCESS; if (LegacyBiosInt86(0x13, &Regs)) { - // TRUE = error + // true = error DBG("Reset 0 disk controller: %hhX\n", DriveNum); Regs.H.AH = 0x0D; // INT 13h AH=00h: Reset disk controller Regs.H.DL = DriveNum; @@ -220,7 +220,7 @@ EFI_STATUS BiosReadSectorsFromDrive(UINT8 DriveNum, UINT64 Lba, UINTN NumSectors Status = EFI_SUCCESS; if (LegacyBiosInt86(0x13, &Regs)) { - // TRUE = error + // true = error Regs.H.AH = 0x01; // INT 13h AH=01h: Get Status of Last Drive Operation LegacyBiosInt86(0x13, &Regs); Status = EFI_NOT_FOUND; @@ -681,7 +681,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume) Regs.H.DL = 0x80; Status = EFI_SUCCESS; if (LegacyBiosInt86(0x13, &Regs)) { - // TRUE = error + // true = error Status = EFI_NOT_FOUND; DBG("reset controller 0x80 error\n"); // return Status; @@ -749,7 +749,7 @@ gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); /** For BIOS and some UEFI boots. * Loads partition boot record (PBR) and starts it. */ -EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset) +EFI_STATUS bootPBR(REFIT_VOLUME* volume, XBool SataReset) { EFI_STATUS Status; EFI_BLOCK_IO *pDisk = volume->BlockIO; @@ -963,7 +963,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset) Regs.X.SI = (UINT16)(UINTN)pMBR; } - DBG("mbr: %d index: %llX pointer: %llX dx: %hX si: %hX\n", volume->IsMbrPartition, volume->MbrPartitionIndex, (uintptr_t)volume->MbrPartitionTable, Regs.X.DX, Regs.X.SI); + DBG("mbr: %d index: %llX pointer: %llX dx: %hX si: %hX\n", (bool)volume->IsMbrPartition, volume->MbrPartitionIndex, (uintptr_t)volume->MbrPartitionTable, Regs.X.DX, Regs.X.SI); DBG("pmbr: %llX start: %X size: %X\n", (uintptr_t)&pMBR[volume->MbrPartitionIndex], pMBR[volume->MbrPartitionIndex].StartLBA, pMBR[volume->MbrPartitionIndex].Size); // diff --git a/rEFIt_UEFI/Platform/LegacyBoot.h b/rEFIt_UEFI/Platform/LegacyBoot.h index 820af1353..2d264c3e6 100644 --- a/rEFIt_UEFI/Platform/LegacyBoot.h +++ b/rEFIt_UEFI/Platform/LegacyBoot.h @@ -23,7 +23,7 @@ bootMBR ( EFI_STATUS bootPBR ( - IN REFIT_VOLUME *volume, BOOLEAN SataReset + IN REFIT_VOLUME *volume, XBool SataReset ); EFI_STATUS diff --git a/rEFIt_UEFI/Platform/MacOsVersion.h b/rEFIt_UEFI/Platform/MacOsVersion.h index 3dbf06cca..4be6c57a9 100644 --- a/rEFIt_UEFI/Platform/MacOsVersion.h +++ b/rEFIt_UEFI/Platform/MacOsVersion.h @@ -26,8 +26,8 @@ class AbstractMacOsVersion int nbElement() const { int idx; for ( idx=0 ; idx < nbMaxElement && versionsNumber[idx] != -1 ; idx++ ) {}; return idx; } int lastElement() const { int idx; for ( idx=1 ; idx < nbMaxElement && versionsNumber[idx] != -1 ; idx++ ) {}; return versionsNumber[idx-1]; } void setEmpty() { lastError.setEmpty(); for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) versionsNumber[idx] = -1; } - bool isEmpty() const { return versionsNumber[0] == -1; } - bool notEmpty() const { return !isEmpty(); } + XBool isEmpty() const { return versionsNumber[0] == -1; } + XBool notEmpty() const { return !isEmpty(); } template int elementAt(IntegralType i) const { @@ -230,7 +230,7 @@ class MacOsVersion : public AbstractMacOsVersion } - bool match(const MacOsVersionPattern& pattern) const + XBool match(const MacOsVersionPattern& pattern) const { // int nbMax = nbElemen() <= pattern.nbMaxElement ? nbMaxElement : pattern.nbMaxElement; int idx; @@ -251,16 +251,16 @@ class MacOsVersion : public AbstractMacOsVersion return false; } - bool operator ==(const MacOsVersion &other) const + XBool operator ==(const MacOsVersion &other) const { for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) { if ( versionsNumber[idx] != other.elementAt(idx) ) return false; } return true; }; - bool operator !=(const MacOsVersion &other) const { return ! ( *this == other); } + XBool operator !=(const MacOsVersion &other) const { return ! ( *this == other); } - bool operator <(const MacOsVersion &other) const + XBool operator <(const MacOsVersion &other) const { for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) { if ( versionsNumber[idx] < other.elementAt(idx) ) return true; @@ -268,9 +268,9 @@ class MacOsVersion : public AbstractMacOsVersion } return false; // here, means it's equal }; - bool operator >=(const MacOsVersion &other) const { return ! ( *this < other); } + XBool operator >=(const MacOsVersion &other) const { return ! ( *this < other); } - bool operator >(const MacOsVersion &other) const + XBool operator >(const MacOsVersion &other) const { for ( size_t idx=0 ; idx < nbMaxElement ; idx++ ) { if ( versionsNumber[idx] > other.elementAt(idx) ) return true; @@ -278,7 +278,7 @@ class MacOsVersion : public AbstractMacOsVersion } return false; // here, means it's equal }; - bool operator <=(const MacOsVersion &other) const { return ! ( *this > other); } + XBool operator <=(const MacOsVersion &other) const { return ! ( *this > other); } }; diff --git a/rEFIt_UEFI/Platform/Nvram.cpp b/rEFIt_UEFI/Platform/Nvram.cpp index ce1f021e3..b74b97e52 100755 --- a/rEFIt_UEFI/Platform/Nvram.cpp +++ b/rEFIt_UEFI/Platform/Nvram.cpp @@ -282,7 +282,7 @@ DeleteNvramVariable ( return Status; } -BOOLEAN +XBool IsDeletableVariable ( IN CHAR16 *Name, IN EFI_GUID *Guid @@ -299,7 +299,7 @@ IsDeletableVariable ( CompareGuid(Guid, &gAppleSecureBootVariableGuid) || CompareGuid(Guid, &gAppleTamperResistantBootSecureVariableGuid) || CompareGuid(Guid, &gAppleTamperResistantBootEfiUserVariableGuid)) { - return TRUE; + return true; // Disable Clover Boot Options from being deleted // Global variable boot options @@ -308,26 +308,26 @@ IsDeletableVariable ( // I.e. BootOrder, Boot####, DriverOrder, Driver#### if (!StrnCmp (Name, L"Boot", StrLen(L"Boot")) || !StrnCmp (Name, L"Driver", StrLen(L"Driver"))) { - return TRUE; + return true; }*/ // Lilu / OpenCore extensions } else if (CompareGuid (Guid, &gOcVendorVariableGuid) || CompareGuid(Guid, &gOcReadOnlyVariableGuid) || CompareGuid(Guid, &gOcWriteOnlyVariableGuid)) { - return TRUE; + return true; // Ozmozis extensions } else if (CompareGuid (Guid, &mOzmosisProprietary1Guid) || CompareGuid (Guid, &mOzmosisProprietary2Guid)) { - return TRUE; + return true; // BootChime } else if (CompareGuid (Guid, &gBootChimeVendorVariableGuid)) { - return TRUE; + return true; } - return FALSE; + return false; } #ifdef JIEF_DEBUG @@ -372,7 +372,7 @@ ResetNativeNvram () CHAR16 *Name; UINTN NameSize; UINTN NewNameSize; - BOOLEAN Restart = TRUE; + XBool Restart = true; UINTN VolumeIndex; REFIT_VOLUME *Volume; EFI_FILE* FileHandle; @@ -385,11 +385,11 @@ ResetNativeNvram () return Status; } - while (TRUE) { + while (true) { if (Restart) { ZeroMem (&Guid, sizeof(Guid)); ZeroMem (Name, sizeof(Name)); - Restart = FALSE; + Restart = false; } NewNameSize = NameSize; @@ -414,7 +414,7 @@ ResetNativeNvram () Status = DeleteNvramVariable(Name, &Guid); if (!EFI_ERROR(Status)) { //DBG("OK\n"); - Restart = TRUE; + Restart = true; } else { //DBG("FAIL (%s)\n", efiStrError(Status)); break; @@ -492,7 +492,7 @@ INT8 SAdr[4] = {0, 0, 3, 0}; INT8 SNum[1] = {1}; void -GetSmcKeys (BOOLEAN WriteToSMC) +GetSmcKeys (XBool WriteToSMC) { EFI_STATUS Status; CHAR16 *Name; @@ -522,7 +522,7 @@ GetSmcKeys (BOOLEAN WriteToSMC) gAppleSmc = NULL; } - while (TRUE) { + while (true) { NewNameSize = NameSize; Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid); if (Status == EFI_BUFFER_TOO_SMALL) { @@ -629,14 +629,14 @@ EFI_GUID #define DBG_DP(...) //#define DBG_DP(...) DBG(__VA_ARGS__) -/** Returns TRUE if dev paths are equal. Ignores some differences. */ -BOOLEAN +/** Returns true if dev paths are equal. Ignores some differences. */ +XBool BootVolumeDevicePathEqual ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 ) { - BOOLEAN Equal; + XBool Equal; UINT8 Type1; UINT8 SubType1; UINT8 Type2; @@ -645,14 +645,14 @@ BootVolumeDevicePathEqual ( UINTN Len2; SATA_DEVICE_PATH *SataNode1; SATA_DEVICE_PATH *SataNode2; - BOOLEAN ForceEqualNodes; + XBool ForceEqualNodes; // DBG_DP (" BootVolumeDevicePathEqual:\n %ls\n %ls\n", FileDevicePathToStr (DevicePath1), FileDevicePathToStr (DevicePath2)); // DBG_DP (" N1: (Type, Subtype, Len) N2: (Type, Subtype, Len)\n"); - Equal = FALSE; - while (TRUE) { + Equal = false; + while (true) { Type1 = DevicePathType (DevicePath1); SubType1 = DevicePathSubType (DevicePath1); Len1 = DevicePathNodeLength (DevicePath1); @@ -661,7 +661,7 @@ BootVolumeDevicePathEqual ( SubType2 = DevicePathSubType (DevicePath2); Len2 = DevicePathNodeLength (DevicePath2); - ForceEqualNodes = FALSE; + ForceEqualNodes = false; // DBG_DP (" N1: (%d, %d, %lld)", Type1, SubType1, Len1); // DBG_DP (" N2: (%d, %d, %lld)", Type2, SubType2, Len2); @@ -681,12 +681,12 @@ BootVolumeDevicePathEqual ( if (Type1 == MESSAGING_DEVICE_PATH && SubType1 == MSG_SATA_DP) { if ((Type2 == HARDWARE_DEVICE_PATH && SubType2 == HW_VENDOR_DP) || (Type2 == MESSAGING_DEVICE_PATH && SubType2 == MSG_NVME_NAMESPACE_DP)) { - ForceEqualNodes = TRUE; + ForceEqualNodes = true; } } else if (Type2 == MESSAGING_DEVICE_PATH && SubType2 == MSG_SATA_DP && ((Type1 == HARDWARE_DEVICE_PATH && SubType1 == HW_VENDOR_DP) || (Type1 == MESSAGING_DEVICE_PATH && SubType1 == MSG_NVME_NAMESPACE_DP))) { - ForceEqualNodes = TRUE; + ForceEqualNodes = true; } // @@ -694,7 +694,7 @@ BootVolumeDevicePathEqual ( // we'll assume Acpi dev path nodes to be equal to cover that // if (Type1 == ACPI_DEVICE_PATH && Type2 == ACPI_DEVICE_PATH) { - ForceEqualNodes = TRUE; + ForceEqualNodes = true; } if (ForceEqualNodes) { @@ -716,7 +716,7 @@ BootVolumeDevicePathEqual ( // if (IsDevicePathEnd (DevicePath1)) { // END node - they are the same - Equal = TRUE; + Equal = true; // DBG_DP (" - END = equal\n"); break; } @@ -760,8 +760,8 @@ BootVolumeDevicePathEqual ( } -/** Returns TRUE if dev paths contain the same MEDIA_DEVICE_PATH. */ -BOOLEAN +/** Returns true if dev paths contain the same MEDIA_DEVICE_PATH. */ +XBool BootVolumeMediaDevicePathNodesEqual ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2 @@ -769,12 +769,12 @@ BootVolumeMediaDevicePathNodesEqual ( { DevicePath1 = Clover_FindDevicePathNodeWithType (DevicePath1, MEDIA_DEVICE_PATH, 0); if (DevicePath1 == NULL) { - return FALSE; + return false; } DevicePath2 = Clover_FindDevicePathNodeWithType (DevicePath2, MEDIA_DEVICE_PATH, 0); if (DevicePath2 == NULL) { - return FALSE; + return false; } return (DevicePathNodeLength (DevicePath1) == DevicePathNodeLength (DevicePath1)) @@ -1177,7 +1177,7 @@ PutNvramPlistToRtVars () keyTag->keyStringValue() == "BootNext"_XS8 ) { VendorGuid = &gEfiGlobalVariableGuid; // it may happen only in this case - gSettings.Boot.HibernationFixup = TRUE; + gSettings.Boot.HibernationFixup = true; } // AsciiStrToUnicodeStrS(Tag.stringValue(), KeyBuf, 128); @@ -1243,7 +1243,7 @@ FindStartupDiskVolume ( // LOADER_ENTRY *LoaderEntry; // REFIT_VOLUME *Volume; REFIT_VOLUME *DiskVolume; - BOOLEAN IsPartitionVolume; + XBool IsPartitionVolume; XStringW LoaderPath; XStringW EfiBootVolumeStr; diff --git a/rEFIt_UEFI/Platform/Nvram.h b/rEFIt_UEFI/Platform/Nvram.h index 819ac7a95..84a95e4aa 100644 --- a/rEFIt_UEFI/Platform/Nvram.h +++ b/rEFIt_UEFI/Platform/Nvram.h @@ -79,7 +79,7 @@ DeleteNvramVariable ( void ResetNvram (void); -BOOLEAN +XBool IsDeletableVariable ( IN CHAR16 *Name, IN EFI_GUID *Guid @@ -101,7 +101,7 @@ void PutNvramPlistToRtVars (void); void -GetSmcKeys(BOOLEAN WriteToSMC); +GetSmcKeys(XBool WriteToSMC); #if CHECK_SMC void DumpSmcKeys(); #endif diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index 5458ab540..a42e18fad 100755 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -63,7 +63,7 @@ INTN OldChosenTheme; INTN OldChosenConfig; INTN OldChosenDsdt; UINTN OldChosenAudio; -BOOLEAN SavePreBootLog; +XBool SavePreBootLog; UINT8 DefaultAudioVolume; INTN LayoutBannerOffset = 64; INTN LayoutTextOffset = 0; @@ -94,17 +94,17 @@ XStringWArray DsdtsList; XObjArray AudioList; // firmware -BOOLEAN gFirmwareClover = FALSE; +XBool gFirmwareClover = false; UINTN gEvent; UINT16 gBacklightLevel; -//BOOLEAN defDSM; -//UINT16 dropDSM; +//XBool defDSM; +//UINT16 dropDSM; -BOOLEAN ResumeFromCoreStorage = false; -//BOOLEAN gRemapSmBiosIsRequire; +XBool ResumeFromCoreStorage = false; +//XBool gRemapSmBiosIsRequire; // QPI -//BOOLEAN SetTable132 = FALSE; +//XBool SetTable132 = false; //EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //define in lib.h const INTN BCSMargin = 11; @@ -186,7 +186,7 @@ XString8Array CUSTOM_LOADER_SUBENTRY::getLoadOptions() const return LoadOptions; } -UINT8 CUSTOM_LOADER_SUBENTRY::getFlags(bool NoCachesDefault) const +UINT8 CUSTOM_LOADER_SUBENTRY::getFlags(XBool NoCachesDefault) const { UINT8 Flags = parent.getFlags(NoCachesDefault); if ( settings._Arguments.isDefined() ) Flags = OSFLAG_SET(Flags, OSFLAG_NODEFAULTARGS); @@ -226,7 +226,7 @@ const XString8& CUSTOM_LOADER_SUBENTRY::getFullTitle() const { }; -bool SETTINGS_DATA::GUIClass::getDarkEmbedded(bool isDaylight) const { +XBool SETTINGS_DATA::GUIClass::getDarkEmbedded(XBool isDaylight) const { if ( EmbeddedThemeType.isEqualIC("Dark") ) return true; if ( EmbeddedThemeType.isEqualIC("Daytime") ) return !isDaylight; return false; @@ -369,17 +369,17 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) { ACPI_DROP_TABLE *DropTable = GlobalConfig.ACPIDropTables; DBG(" - [%02zd]: Drop table : %.4s, %16llx : ", idx, (const char*)&settingsData.ACPI.ACPIDropTablesArray[idx].Signature, settingsData.ACPI.ACPIDropTablesArray[idx].TableId); - bool Dropped = FALSE; + XBool Dropped = false; while (DropTable) { if (((settingsData.ACPI.ACPIDropTablesArray[idx].Signature == DropTable->Signature) && (!settingsData.ACPI.ACPIDropTablesArray[idx].TableId || (DropTable->TableId == settingsData.ACPI.ACPIDropTablesArray[idx].TableId)) && (!settingsData.ACPI.ACPIDropTablesArray[idx].TabLength || (DropTable->Length == settingsData.ACPI.ACPIDropTablesArray[idx].TabLength))) || (!settingsData.ACPI.ACPIDropTablesArray[idx].Signature && (DropTable->TableId == settingsData.ACPI.ACPIDropTablesArray[idx].TableId))) { - DropTable->MenuItem.BValue = TRUE; + DropTable->MenuItem.BValue = true; DropTable->OtherOS = settingsData.ACPI.ACPIDropTablesArray[idx].OtherOS; - GlobalConfig.DropSSDT = FALSE; // if one item=true then dropAll=false by default + GlobalConfig.DropSSDT = false; // if one item=true then dropAll=false by default //DBG(" true"); - Dropped = TRUE; + Dropped = true; } DropTable = DropTable->Next; } @@ -419,7 +419,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // DBG("4: GlobalConfig.C3Latency=%x\n", GlobalConfig.C3Latency); if (settingsData.CPU.HWPEnable && (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U)) { - GlobalConfig.HWP = TRUE; + GlobalConfig.HWP = true; AsmWriteMsr64 (MSR_IA32_PM_ENABLE, 1); if ( settingsData.CPU.HWPValue.isDefined() ) { AsmWriteMsr64 (MSR_IA32_HWP_REQUEST, settingsData.CPU.HWPValue.value()); @@ -467,7 +467,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) if (NowHour >= 24 ) NowHour -= 24; ThemeX.Daylight = (NowHour > 8) && (NowHour < 20); } else { - ThemeX.Daylight = TRUE; + ThemeX.Daylight = true; } ThemeX.DarkEmbedded = settingsData.GUI.getDarkEmbedded(ThemeX.Daylight); @@ -586,7 +586,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // NGFX = 0; // NHDA = 0; // AudioList.setEmpty(); -// //Arpt.Valid = FALSE; //global variables initialized by 0 - c-language +// //Arpt.Valid = false; //global variables initialized by 0 - c-language // XStringW GopDevicePathStr; // XStringW DevicePathStr; // @@ -694,13 +694,13 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // } // gfx->Connectors = *(UINT32*)(gfx->Mmio + RADEON_BIOS_0_SCRATCH); // // DBG(" - RADEON_BIOS_0_SCRATCH = 0x%08X\n", gfx->Connectors); -// gfx->ConnChanged = FALSE; +// gfx->ConnChanged = false; // // SlotDevice = &gSettings.Smbios.SlotDevices[0]; // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "PCI Slot 0"_XS8; // SlotDevice->SlotID = 1; // SlotDevice->SlotType = SlotTypePciExpressX16; @@ -712,7 +712,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // DBG(" - GFX: Model=%s (Intel)\n", gfx->Model); // gfx->Ports = 1; // gfx->Connectors = (1 << NGFX); -// gfx->ConnChanged = FALSE; +// gfx->ConnChanged = false; // break; // // case 0x10de: @@ -767,7 +767,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "PCI Slot 0"_XS8; // SlotDevice->SlotID = 1; // SlotDevice->SlotType = SlotTypePciExpressX16; @@ -778,7 +778,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // snprintf (gfx->Model, 64, "pci%hx,%hx", Pci.Hdr.VendorId, Pci.Hdr.DeviceId); // gfx->Ports = 1; // gfx->Connectors = (1 << NGFX); -// gfx->ConnChanged = FALSE; +// gfx->ConnChanged = false; // // break; // } @@ -792,7 +792,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "AirPort"_XS8; // SlotDevice->SlotID = 0; // SlotDevice->SlotType = SlotTypePciExpressX1; @@ -830,7 +830,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "Ethernet"_XS8; // SlotDevice->SlotID = 2; // SlotDevice->SlotType = SlotTypePciExpressX1; @@ -875,7 +875,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "FireWire"_XS8; // SlotDevice->SlotID = 3; // SlotDevice->SlotType = SlotTypePciExpressX4; @@ -902,7 +902,7 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData) // SlotDevice->SegmentGroupNum = (UINT16)Segment; // SlotDevice->BusNum = (UINT8)Bus; // SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); -// SlotDevice->Valid = TRUE; +// SlotDevice->Valid = true; // SlotDevice->SlotName = "HDMI port"_XS8; // SlotDevice->SlotID = 5; // SlotDevice->SlotType = SlotTypePciExpressX4; @@ -943,8 +943,8 @@ SetDevices (LOADER_ENTRY *Entry) UINTN Bus; UINTN Device; UINTN Function; - BOOLEAN StringDirty = FALSE; - BOOLEAN TmpDirty = FALSE; + XBool StringDirty = false; + XBool TmpDirty = false; UINT32 Rcba; UINT32 Hptc; DevPropDevice *device = NULL; @@ -990,7 +990,7 @@ SetDevices (LOADER_ENTRY *Entry) }else{ DBG("Skip disabled properties with Path=%ls, Key=%s\n", Prop.DevicePathAsString.wc_str(), Prop2.Key.c_str()); } - StringDirty = TRUE; + StringDirty = true; } } @@ -1022,9 +1022,9 @@ SetDevices (LOADER_ENTRY *Entry) PCIdevice.revision = Pci.Hdr.RevisionID; PCIdevice.subclass = Pci.Hdr.ClassCode[0]; PCIdevice.class_id = *((UINT16*)(Pci.Hdr.ClassCode+1)); - PCIdevice.subsys_id.subsys.vendor_id = Pci.Device.SubsystemVendorID; - PCIdevice.subsys_id.subsys.device_id = Pci.Device.SubsystemID; - PCIdevice.used = FALSE; + PCIdevice.subsys_id_union.subsys.vendor_id = Pci.Device.SubsystemVendorID; + PCIdevice.subsys_id_union.subsys.device_id = Pci.Device.SubsystemID; + PCIdevice.used = false; //if (gSettings.Devices.AddPropertyArray.size() == 0xFFFE) { //yyyy it means Arbitrary // Looks like NrAddProperties == 0xFFFE is not used anymore //------------------ @@ -1039,7 +1039,7 @@ SetDevices (LOADER_ENTRY *Entry) } if (!PCIdevice.used) { device = devprop_add_device_pci(device_inject_string, &PCIdevice, NULL); - PCIdevice.used = TRUE; + PCIdevice.used = true; } for ( size_t jdx = 0 ; jdx < Prop.CustomPropertyArray.size() ; ++jdx ) { const SETTINGS_DATA::DevicesClass::SimplePropertyClass& Prop2 = Prop.CustomPropertyArray[jdx]; @@ -1051,7 +1051,7 @@ SetDevices (LOADER_ENTRY *Entry) devprop_add_value(device, Prop2.Key, Prop2.Value); } } - StringDirty = TRUE; + StringDirty = true; } } //------------------ @@ -1796,7 +1796,7 @@ SetDevices (LOADER_ENTRY *Entry) mProperties = (UINT8*)(UINTN)BufferPtr; // DBG(gDeviceProperties); // DBG("\n"); - // StringDirty = FALSE; + // StringDirty = false; //------- mPropSize = (UINT32)hex2bin(newDeviceProperties, mProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe as hex2bin return <= MAXUINT32 gDeviceProperties = newDeviceProperties.forgetDataWithoutFreeing(); // do this AFTER hex2bin @@ -1859,7 +1859,7 @@ ApplySettings() // to determine the use of Table 132 if (gSettings.CPU.QPI) { - GlobalConfig.SetTable132 = TRUE; + GlobalConfig.SetTable132 = true; //DBG("QPI: use Table 132\n"); } else { @@ -1868,7 +1868,7 @@ ApplySettings() case CPU_MODEL_WESTMERE:// Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm case CPU_MODEL_NEHALEM_EX:// Core i7, Nehalem-Ex Xeon, "Beckton" case CPU_MODEL_WESTMERE_EX:// Core i7, Nehalem-Ex Xeon, "Eagleton" - GlobalConfig.SetTable132 = TRUE; + GlobalConfig.SetTable132 = true; DBG("QPI: use Table 132\n"); break; default: @@ -1882,7 +1882,7 @@ ApplySettings() return EFI_SUCCESS; } -XStringW GetOtherKextsDir (BOOLEAN On) +XStringW GetOtherKextsDir (XBool On) { if ( !selfOem.isKextsDirFound() ) return NullXStringW; if ( FileExists(&selfOem.getKextsDir(), On ? L"Other" : L"Off") ) { @@ -1943,11 +1943,11 @@ XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion) // Do we need that with OC ? For old version ? //EFI_STATUS LOADER_ENTRY::SetFSInjection() //{ -// EFI_STATUS Status; +// EFI_STATUS Status; // FSINJECTION_PROTOCOL *FSInject; // XStringW SrcDir; -// //BOOLEAN InjectionNeeded = FALSE; -// //BOOLEAN BlockCaches = FALSE; +// //XBool InjectionNeeded = false; +// //XBool BlockCaches = false; // FSI_STRING_LIST *Blacklist = 0; // FSI_STRING_LIST *ForceLoadKexts = NULL; // @@ -1964,7 +1964,7 @@ XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion) // // check if blocking of caches is needed // if ( OSFLAG_ISSET(Flags, OSFLAG_NOCACHES) || LoadOptions.contains("-f") ) { // MsgLog ("Blocking kext caches\n"); -// // BlockCaches = TRUE; +// // BlockCaches = true; // // add caches to blacklist // Blacklist = FSInject->CreateStringList(); // if (Blacklist == NULL) { @@ -2030,7 +2030,7 @@ XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion) // // (will be done only if caches are blocked or if boot.efi refuses to load kernelcache) // //SrcDir = NULL; // if (OSFLAG_ISSET(Flags, OSFLAG_WITHKEXTS)) { -// SrcDir = GetOtherKextsDir(TRUE); +// SrcDir = GetOtherKextsDir(true); // Status = FSInject->Install( // Volume->DeviceHandle, // L"\\System\\Library\\Extensions", diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index 5154fb006..10dc7f3c3 100755 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -33,7 +33,7 @@ //}; extern CONST CHAR8 *AudioOutputNames[]; -extern BOOLEAN gFirmwareClover; +extern XBool gFirmwareClover; class HDA_OUTPUTS @@ -59,8 +59,8 @@ typedef struct { //UINT16 Height; CHAR8 Model[64]; CHAR8 Config[64]; - BOOLEAN LoadVBios; -//BOOLEAN PatchVBios; + XBool LoadVBios; +//XBool PatchVBios; UINTN Segment; UINTN Bus; UINTN Device; @@ -68,7 +68,7 @@ typedef struct { EFI_HANDLE Handle; UINT8 *Mmio; UINT32 Connectors; - BOOLEAN ConnChanged; + XBool ConnChanged; } GFX_PROPERTIES; typedef struct { @@ -93,9 +93,9 @@ public: XString8 Name = XString8(); #if __cplusplus > 201703L - bool operator == (const ACPI_NAME&) const = default; + XBool operator == (const ACPI_NAME&) const = default; #endif - bool isEqual(const ACPI_NAME& other) const + XBool isEqual(const ACPI_NAME& other) const { if ( !(Name == other.Name) ) return false; return true; @@ -126,9 +126,9 @@ public: XString8 renameTo = XString8(); #if __cplusplus > 201703L - bool operator == (const ACPI_RENAME_DEVICE&) const = default; + XBool operator == (const ACPI_RENAME_DEVICE&) const = default; #endif - bool isEqual(const ACPI_RENAME_DEVICE& other) const + XBool isEqual(const ACPI_RENAME_DEVICE& other) const { if ( !acpiName.isEqual(other.acpiName) ) return false; if ( !(renameTo == other.renameTo) ) return false; @@ -161,9 +161,9 @@ public: UINT32 Length; UINT64 TableId; INPUT_ITEM MenuItem = INPUT_ITEM(); - BOOLEAN OtherOS; + XBool OtherOS; - ACPI_DROP_TABLE() : Next(0), Signature(0), Length(0), TableId(0), OtherOS(0) {} + ACPI_DROP_TABLE() : Next(0), Signature(0), Length(0), TableId(0), OtherOS(false) {} ACPI_DROP_TABLE(const ACPI_DROP_TABLE& other) = delete; // Can be defined if needed const ACPI_DROP_TABLE& operator = ( const ACPI_DROP_TABLE & ) = delete; // Can be defined if needed ~ACPI_DROP_TABLE() {} @@ -177,12 +177,12 @@ class CUSTOM_LOADER_SUBENTRY; //template class XmlArray; //void CompareCustomSubEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); -//BOOLEAN FillinCustomSubEntry(UINT8 parentType, IN OUT CUSTOM_LOADER_SUBENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); +//XBool FillinCustomSubEntry(UINT8 parentType, IN OUT CUSTOM_LOADER_SUBENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN XBool SubEntry); class CUSTOM_LOADER_SUBENTRY_SETTINGS { public: - bool Disabled = 0; + XBool Disabled = false; public: // temporary, must be protected: // member defined with _ prefix should not be accessed from outside. I left them public for now for CompareCustomEntries() undefinable_XString8 _Arguments = undefinable_XString8(); @@ -194,9 +194,9 @@ public: // temporary, must be protected: undefinable_bool _NoCaches = undefinable_bool(); #if __cplusplus > 201703L - bool operator == (const CUSTOM_LOADER_SUBENTRY_SETTINGS&) const = default; + XBool operator == (const CUSTOM_LOADER_SUBENTRY_SETTINGS&) const = default; #endif - bool isEqual(const CUSTOM_LOADER_SUBENTRY_SETTINGS& other) const + XBool isEqual(const CUSTOM_LOADER_SUBENTRY_SETTINGS& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(_Arguments == other._Arguments) ) return false; @@ -219,7 +219,7 @@ public: // temporary, must be protected: public: // friend void ::CompareCustomSubEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); -// friend BOOLEAN FillinCustomSubEntry(UINT8 parentType, IN OUT CUSTOM_LOADER_SUBENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); +// friend XBool FillinCustomSubEntry(UINT8 parentType, IN OUT CUSTOM_LOADER_SUBENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN XBool SubEntry); // friend class ::CUSTOM_LOADER_SUBENTRY; }; @@ -234,7 +234,7 @@ public: CUSTOM_LOADER_SUBENTRY(const CUSTOM_LOADER_ENTRY& _customLoaderEntry, const CUSTOM_LOADER_SUBENTRY_SETTINGS& _settings) : parent(_customLoaderEntry), settings(_settings) {} XString8Array getLoadOptions() const; - UINT8 getFlags(bool NoCachesDefault) const; + UINT8 getFlags(XBool NoCachesDefault) const; const XString8& getTitle() const; const XString8& getFullTitle() const; @@ -244,7 +244,7 @@ public: class CUSTOM_LOADER_ENTRY_SETTINGS; // //void CompareCustomEntries(const XString8& label, const XObjArray& olDCustomEntries, const XmlArray& newCustomEntries); -//BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN BOOLEAN SubEntry); +//XBool FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY_SETTINGS *Entry, const TagDict* DictPointer, IN XBool SubEntry); extern const XString8 defaultInstallTitle; extern const XString8 defaultRecoveryTitle; @@ -261,7 +261,7 @@ public: EFI_GRAPHICS_OUTPUT_BLT_PIXELClass(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& other) { Blue = other.Blue; Green = other.Green; Red = other.Red; Reserved = other.Reserved; } - bool operator == (const EFI_GRAPHICS_OUTPUT_BLT_PIXELClass& other) const { + XBool operator == (const EFI_GRAPHICS_OUTPUT_BLT_PIXELClass& other) const { if ( !(Blue == other.Blue) ) return false; if ( !(Green == other.Green) ) return false; if ( !(Red == other.Red) ) return false; @@ -273,7 +273,7 @@ public: class CUSTOM_LOADER_ENTRY_SETTINGS { public: - bool Disabled = 0; + XBool Disabled = false; XBuffer ImageData = XBuffer(); XBuffer DriveImageData = XBuffer(); XStringW Volume = XStringW(); @@ -283,10 +283,10 @@ public: XString8 FullTitle = XStringW(); XStringW Settings = XStringW(); // path of a config.plist that'll be read at the beginning of startloader char32_t Hotkey = 0; - BOOLEAN CommonSettings = 0; + XBool CommonSettings = false; // UINT8 Flags = 0; - bool Hidden = 0; - bool AlwaysHidden = 0; + XBool Hidden = false; + XBool AlwaysHidden = false; UINT8 Type = 0; UINT8 VolumeType = 0; UINT8 KernelScan = KERNEL_SCAN_ALL; @@ -304,14 +304,14 @@ public: // temporary, must be protected: UINT8 CustomLogoTypeSettings = 0; XStringW m_ImagePath = XStringW(); - bool ForceTextMode = 0; // 2021-04-22 + XBool ForceTextMode = false; // 2021-04-22 public: #if __cplusplus > 201703L - bool operator == (const CUSTOM_LOADER_ENTRY_SETTINGS&) const = default; + XBool operator == (const CUSTOM_LOADER_ENTRY_SETTINGS&) const = default; #endif - bool isEqual(const CUSTOM_LOADER_ENTRY_SETTINGS& other) const + XBool isEqual(const CUSTOM_LOADER_ENTRY_SETTINGS& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(ImageData == other.ImageData) ) return false; @@ -417,7 +417,7 @@ public: XString8Array getLoadOptions() const; - UINT8 getFlags(bool NoCachesDefault) const { + UINT8 getFlags(XBool NoCachesDefault) const { UINT8 Flags = 0; if ( settings.Arguments.isDefined() ) Flags = OSFLAG_SET(Flags, OSFLAG_NODEFAULTARGS); if ( settings.AlwaysHidden ) Flags = OSFLAG_SET(Flags, OSFLAG_DISABLED); @@ -440,7 +440,7 @@ public: class CUSTOM_LEGACY_ENTRY_SETTINGS { public: - bool Disabled = 0; + XBool Disabled = false; XStringW ImagePath = XStringW(); XBuffer ImageData = XBuffer(); XStringW DriveImagePath = XStringW(); @@ -450,15 +450,15 @@ public: XStringW Title = XStringW(); char32_t Hotkey = 0; // UINT8 Flags = 0; - bool Hidden = 0; - bool AlwaysHidden = 0; + XBool Hidden = false; + XBool AlwaysHidden = false; UINT8 Type = 0; UINT8 VolumeType = 0; #if __cplusplus > 201703L - bool operator == (const CUSTOM_LEGACY_ENTRY_SETTINGS&) const = default; + XBool operator == (const CUSTOM_LEGACY_ENTRY_SETTINGS&) const = default; #endif - bool isEqual(const CUSTOM_LEGACY_ENTRY_SETTINGS& other) const + XBool isEqual(const CUSTOM_LEGACY_ENTRY_SETTINGS& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(ImagePath == other.ImagePath) ) return false; @@ -528,7 +528,7 @@ public: class CUSTOM_TOOL_ENTRY_SETTINGS { public: - bool Disabled = 0; + XBool Disabled = false; XStringW ImagePath = XStringW(); XBuffer ImageData = XBuffer(); XStringW Volume = XStringW(); @@ -539,14 +539,14 @@ public: XStringW Title = XStringW(); char32_t Hotkey = 0; // UINT8 Flags = 0; - bool Hidden = 0; - bool AlwaysHidden = 0; + XBool Hidden = false; + XBool AlwaysHidden = false; UINT8 VolumeType = 0; #if __cplusplus > 201703L - bool operator == (const CUSTOM_TOOL_ENTRY_SETTINGS&) const = default; + XBool operator == (const CUSTOM_TOOL_ENTRY_SETTINGS&) const = default; #endif - bool isEqual(const CUSTOM_TOOL_ENTRY_SETTINGS& other) const + XBool isEqual(const CUSTOM_TOOL_ENTRY_SETTINGS& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(ImagePath == other.ImagePath) ) return false; @@ -645,9 +645,9 @@ public: XBuffer Replace = XBuffer(); #if __cplusplus > 201703L - bool operator == (const VBIOS_PATCH&) const = default; + XBool operator == (const VBIOS_PATCH&) const = default; #endif - bool isEqual(const VBIOS_PATCH& other) const + XBool isEqual(const VBIOS_PATCH& other) const { if ( !(Find == other.Find) ) return false; if ( !(Replace == other.Replace) ) return false; @@ -666,7 +666,7 @@ class PatchVBiosBytesNewClass : public XObjArrayWithTakeValueFromXmlArray 201703L - bool operator == (const PatchVBiosBytesNewClass& other) const { return XObjArray::operator ==(other); } + XBool operator == (const PatchVBiosBytesNewClass& other) const { return XObjArray::operator ==(other); } #endif // Temporary bridge to old struct. @@ -683,7 +683,7 @@ public: return size(); } - bool isEqual(const PatchVBiosBytesNewClass& other) const + XBool isEqual(const PatchVBiosBytesNewClass& other) const { return XObjArray::isEqual(other); // getVBIOS_PATCH_BYTES(); @@ -705,7 +705,7 @@ public: class SETTINGS_DATA; class ConfigPlistClass; class TagDict; -//bool CompareOldNewSettings(const SETTINGS_DATA& , const ConfigPlistClass& ); +//XBool CompareOldNewSettings(const SETTINGS_DATA& , const ConfigPlistClass& ); //EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings); class SETTINGS_DATA { @@ -714,22 +714,22 @@ public: class BootClass { public: INTN Timeout = -1; - bool SkipHibernateTimeout = false; - bool DisableCloverHotkeys = false; + XBool SkipHibernateTimeout = false; + XBool DisableCloverHotkeys = false; XString8 BootArgs = XString8(); - bool NeverDoRecovery = 0; - bool LastBootedVolume = false; + XBool NeverDoRecovery = false; + XBool LastBootedVolume = false; XStringW DefaultVolume = XStringW(); XStringW DefaultLoader = XStringW(); - bool DebugLog = false; - bool FastBoot = false; - bool NoEarlyProgress = false; - bool NeverHibernate = false; - bool StrictHibernate = false; - bool RtcHibernateAware = false; - bool HibernationFixup = false; - bool SignatureFixup = false; - INT8 SecureSetting = 0; // 0 == false, 1 == true, -1 == undefined + XBool DebugLog = false; + XBool FastBoot = false; + XBool NoEarlyProgress = false; + XBool NeverHibernate = false; + XBool StrictHibernate = false; + XBool RtcHibernateAware = false; + XBool HibernationFixup = false; + XBool SignatureFixup = false; + INT8 SecureSetting = 0; // 0 == false, 1 == true, -1 == undefined //UINT8 SecureBoot = 0; //UINT8 SecureBootSetupMode = 0; UINT8 SecureBootPolicy = 0; @@ -745,9 +745,9 @@ public: XBuffer CustomLogoAsData = XBuffer(); #if __cplusplus > 201703L - bool operator == (const BootClass&) const = default; + XBool operator == (const BootClass&) const = default; #endif - bool isEqual(const BootClass& other) const + XBool isEqual(const BootClass& other) const { if ( !(Timeout == other.Timeout) ) return false; if ( !(SkipHibernateTimeout == other.SkipHibernateTimeout) ) return false; @@ -820,12 +820,12 @@ public: }; UINT64 TableId = 0; UINT32 TabLength = 0; - bool OtherOS = 0; + XBool OtherOS = false; #if __cplusplus > 201703L - bool operator == (const ACPIDropTablesClass&) const = default; + XBool operator == (const ACPIDropTablesClass&) const = default; #endif - bool isEqual(const ACPIDropTablesClass& other) const + XBool isEqual(const ACPIDropTablesClass& other) const { if ( !(Signature == other.Signature) ) return false; if ( !(TableId == other.TableId) ) return false; @@ -848,7 +848,7 @@ public: class DSDT_Patch { public : - bool Disabled = bool(); + XBool Disabled = XBool(); XString8 PatchDsdtLabel = XString8(); XBuffer PatchDsdtFind = XBuffer(); XBuffer PatchDsdtReplace = XBuffer(); @@ -856,9 +856,9 @@ public: INPUT_ITEM PatchDsdtMenuItem = INPUT_ITEM(); // Not read from config.plist. Should be moved out. #if __cplusplus > 201703L - bool operator == (const DSDT_Patch&) const = default; + XBool operator == (const DSDT_Patch&) const = default; #endif - bool isEqual(const DSDT_Patch& other) const + XBool isEqual(const DSDT_Patch& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(PatchDsdtLabel == other.PatchDsdtLabel) ) return false; @@ -880,20 +880,20 @@ public: }; XStringW DsdtName = XStringW(); - bool DebugDSDT = 0; - bool Rtc8Allowed = 0; + XBool DebugDSDT = false; + XBool Rtc8Allowed = false; UINT8 PNLF_UID = 0; UINT32 FixDsdt = 0; - bool ReuseFFFF = 0; - bool SuspendOverride = 0; + XBool ReuseFFFF = false; + XBool SuspendOverride = false; // XObjArray DSDTPatchArray = XObjArray(); XObjArrayWithTakeValueFromXmlArray DSDTPatchArray = XObjArrayWithTakeValueFromXmlArray(); #if __cplusplus > 201703L - bool operator == (const DSDTClass&) const = default; + XBool operator == (const DSDTClass&) const = default; #endif - bool isEqual(const DSDTClass& other) const + XBool isEqual(const DSDTClass& other) const { if ( !(DsdtName == other.DsdtName) ) return false; if ( !(DebugDSDT == other.DebugDSDT) ) return false; @@ -924,16 +924,16 @@ public: class GenerateClass { public: - bool GeneratePStates = 0; - bool GenerateCStates = 0; - bool GenerateAPSN = 0; - bool GenerateAPLF = 0; - bool GeneratePluginType = 0; + XBool GeneratePStates = false; + XBool GenerateCStates = false; + XBool GenerateAPSN = false; + XBool GenerateAPLF = false; + XBool GeneratePluginType = false; #if __cplusplus > 201703L - bool operator == (const GenerateClass&) const = default; + XBool operator == (const GenerateClass&) const = default; #endif - bool isEqual(const GenerateClass& other) const + XBool isEqual(const GenerateClass& other) const { if ( !(GeneratePStates == other.GeneratePStates) ) return false; if ( !(GenerateCStates == other.GenerateCStates) ) return false; @@ -952,27 +952,27 @@ public: } }; - bool DropSSDTSetting = 0; - bool NoOemTableId = 0; - bool NoDynamicExtract = 0; - bool EnableISS = 0; - bool EnableC7 = 0; - bool _EnableC6 = 0; - bool _EnableC4 = 0; - bool _EnableC2 = 0; + XBool DropSSDTSetting = false; + XBool NoOemTableId = false; + XBool NoDynamicExtract = false; + XBool EnableISS = false; + XBool EnableC7 = false; + XBool _EnableC6 = false; + XBool _EnableC4 = false; + XBool _EnableC2 = false; UINT16 _C3Latency = 0; UINT8 PLimitDict = 0; UINT8 UnderVoltStep = 0; - bool DoubleFirstState = 0; + XBool DoubleFirstState = false; UINT8 MinMultiplier = 0; UINT8 MaxMultiplier = 0; UINT8 PluginType = 0; GenerateClass Generate = GenerateClass(); #if __cplusplus > 201703L - bool operator == (const SSDTClass&) const = default; + XBool operator == (const SSDTClass&) const = default; #endif - bool isEqual(const SSDTClass& other) const + XBool isEqual(const SSDTClass& other) const { if ( !(DropSSDTSetting == other.DropSSDTSetting) ) return false; if ( !(NoOemTableId == other.NoOemTableId) ) return false; @@ -1015,13 +1015,13 @@ public: UINT64 ResetAddr = 0; UINT8 ResetVal = 0; - bool SlpSmiEnable = 0; - bool FixHeaders = 0; - bool FixMCFG = 0; - bool NoASPM = 0; - bool smartUPS = 0; - bool PatchNMI = 0; - bool AutoMerge = 0; + XBool SlpSmiEnable = false; + XBool FixHeaders = false; + XBool FixMCFG = false; + XBool NoASPM = false; + XBool smartUPS = false; + XBool PatchNMI = false; + XBool AutoMerge = false; XStringWArray DisabledAML = XStringWArray(); XString8Array SortedACPI = XString8Array(); // XObjArray DeviceRename = XObjArray(); @@ -1066,9 +1066,9 @@ public: SSDTClass SSDT = SSDTClass(); #if __cplusplus > 201703L - bool operator == (const ACPIClass&) const = default; + XBool operator == (const ACPIClass&) const = default; #endif - bool isEqual(const ACPIClass& other) const + XBool isEqual(const ACPIClass& other) const { if ( !(ResetAddr == other.ResetAddr) ) return false; if ( !(ResetVal == other.ResetVal) ) return false; @@ -1112,14 +1112,14 @@ public: class MouseClass { public: INTN PointerSpeed = 0; - bool PointerEnabled = 0; + XBool PointerEnabled = false; UINT64 DoubleClickTime = 0; - bool PointerMirror = 0; + XBool PointerMirror = false; #if __cplusplus > 201703L - bool operator == (const MouseClass&) const = default; + XBool operator == (const MouseClass&) const = default; #endif - bool isEqual(const MouseClass& other) const + XBool isEqual(const MouseClass& other) const { if ( !(PointerSpeed == other.PointerSpeed) ) return false; if ( !(PointerEnabled == other.PointerEnabled) ) return false; @@ -1137,17 +1137,17 @@ public: } ; class ScanClass { public: - bool DisableEntryScan = 0; - bool DisableToolScan = 0; + XBool DisableEntryScan = false; + XBool DisableToolScan = false; UINT8 KernelScan = 0; - bool LinuxScan = 0; - bool LegacyFirst = false; - bool NoLegacy = false; + XBool LinuxScan = false; + XBool LegacyFirst = false; + XBool NoLegacy = false; #if __cplusplus > 201703L - bool operator == (const ScanClass&) const = default; + XBool operator == (const ScanClass&) const = default; #endif - bool isEqual(const ScanClass& other) const + XBool isEqual(const ScanClass& other) const { if ( !(DisableEntryScan == other.DisableEntryScan) ) return false; if ( !(DisableToolScan == other.DisableToolScan) ) return false; @@ -1170,18 +1170,18 @@ public: INT32 Timezone = 0xFF; XStringW Theme = XStringW(); - //bool DarkEmbedded = 0; + //XBool DarkEmbedded = 0; XString8 EmbeddedThemeType = XString8(); - bool PlayAsync = 0; - bool CustomIcons = false; - bool TextOnly = false; - bool ShowOptimus = false; + XBool PlayAsync = false; + XBool CustomIcons = false; + XBool TextOnly = false; + XBool ShowOptimus = false; XStringW ScreenResolution = XStringW(); - bool ProvideConsoleGop = 0; + XBool ProvideConsoleGop = false; INTN ConsoleMode = 0; XString8 Language = XString8(); LanguageCode languageCode = english; - bool KbdPrevLang = 0; + XBool KbdPrevLang = false; XString8Array HVHideStrings = XString8Array(); ScanClass Scan = ScanClass(); MouseClass Mouse = MouseClass(); @@ -1195,12 +1195,12 @@ public: XObjArrayWithTakeValueFromXmlArray CustomToolSettings = XObjArrayWithTakeValueFromXmlArray(); - bool getDarkEmbedded(bool isDaylight) const; + XBool getDarkEmbedded(XBool isDaylight) const; #if __cplusplus > 201703L - bool operator == (const GUIClass&) const = default; + XBool operator == (const GUIClass&) const = default; #endif - bool isEqual(const GUIClass& other) const + XBool isEqual(const GUIClass& other) const { if ( !(Timezone == other.Timezone) ) return false; if ( !(Theme == other.Theme) ) return false; @@ -1253,23 +1253,23 @@ public: UINT16 QPI = 0; UINT32 CpuFreqMHz = 0; UINT16 CpuType = 0; - bool QEMU = 0; - bool UseARTFreq = 0; + XBool QEMU = false; + XBool UseARTFreq = false; UINT32 BusSpeed = 0; //in kHz - bool UserChange = 0; + XBool UserChange = false; UINT8 SavingMode = 0; - bool HWPEnable = false; + XBool HWPEnable = false; undefinable_uint32 HWPValue = undefinable_uint32(); UINT8 TDP = 0; - bool TurboDisabled = 0; + XBool TurboDisabled = false; undefinable_bool _EnableC6 = undefinable_bool(); undefinable_bool _EnableC4 = undefinable_bool(); undefinable_bool _EnableC2 = undefinable_bool(); #if __cplusplus > 201703L - bool operator == (const CPUClass&) const = default; + XBool operator == (const CPUClass&) const = default; #endif - bool isEqual(const CPUClass& other) const + XBool isEqual(const CPUClass& other) const { if ( !(QPI == other.QPI) ) return false; if ( !(CpuFreqMHz == other.CpuFreqMHz) ) return false; @@ -1310,24 +1310,24 @@ public: class SystemParametersClass { public: - bool WithKexts = true; - bool WithKextsIfNoFakeSMC = 0; - bool NoCaches = 0; + XBool WithKexts = true; + XBool WithKextsIfNoFakeSMC = false; + XBool NoCaches = false; uint16_t BacklightLevel = 0xFFFF; - bool BacklightLevelConfig = false; + XBool BacklightLevelConfig = false; XString8 CustomUuid = XString8(); public: // temporary, must be protected: UINT8 _InjectSystemID = 2; // 0=false, 1=true, other value = default. public: - bool NvidiaWeb = 0; + XBool NvidiaWeb = false; // friend class ::SETTINGS_DATA; // friend unsigned long long ::GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings); #if __cplusplus > 201703L - bool operator == (const SystemParametersClass&) const = default; + XBool operator == (const SystemParametersClass&) const = default; #endif - bool isEqual(const SystemParametersClass& other) const + XBool isEqual(const SystemParametersClass& other) const { if ( !(WithKexts == other.WithKexts) ) return false; if ( !(WithKextsIfNoFakeSMC == other.WithKextsIfNoFakeSMC) ) return false; @@ -1356,7 +1356,7 @@ public: public: class EDIDClass { public: - bool InjectEDID = bool(); + XBool InjectEDID = XBool(); XBuffer CustomEDID = XBuffer (); UINT16 VendorEDID = UINT16(); UINT16 ProductEDID = UINT16(); @@ -1364,9 +1364,9 @@ public: UINT8 EdidFixVideoInputSignal = UINT8(); #if __cplusplus > 201703L - bool operator == (const EDIDClass&) const = default; + XBool operator == (const EDIDClass&) const = default; #endif - bool isEqual(const EDIDClass& other) const + XBool isEqual(const EDIDClass& other) const { if ( !(InjectEDID == other.InjectEDID) ) return false; if ( !(CustomEDID == other.CustomEDID) ) return false; @@ -1389,15 +1389,15 @@ public: class InjectAsDictClass { public: - bool GraphicsInjector = bool(); - bool InjectIntel = bool(); - bool InjectATI = bool(); - bool InjectNVidia = bool(); + XBool GraphicsInjector = XBool(); + XBool InjectIntel = XBool(); + XBool InjectATI = XBool(); + XBool InjectNVidia = XBool(); #if __cplusplus > 201703L - bool operator == (const InjectAsDictClass&) const = default; + XBool operator == (const InjectAsDictClass&) const = default; #endif - bool isEqual(const InjectAsDictClass& other) const + XBool isEqual(const InjectAsDictClass& other) const { if ( !(GraphicsInjector == other.GraphicsInjector) ) return false; if ( !(InjectIntel == other.InjectIntel) ) return false; @@ -1422,12 +1422,12 @@ public: UINT32 SubId = 0; UINT64 VideoRam = 0; UINTN VideoPorts = 0; - bool LoadVBios = 0; + XBool LoadVBios = false; #if __cplusplus > 201703L - bool operator == (const GRAPHIC_CARD&) const = default; + XBool operator == (const GRAPHIC_CARD&) const = default; #endif - bool isEqual(const GRAPHIC_CARD& other) const + XBool isEqual(const GRAPHIC_CARD& other) const { if ( !(Signature == other.Signature) ) return false; if ( !(Model == other.Model) ) return false; @@ -1450,18 +1450,18 @@ public: } }; - bool PatchVBios = bool(); + XBool PatchVBios = XBool(); PatchVBiosBytesNewClass PatchVBiosBytes = PatchVBiosBytesNewClass(); // undefinable_bool InjectAsBool = undefinable_bool(); - bool RadeonDeInit = bool(); - bool LoadVBios = bool(); - UINT64 VRAM = bool(); + XBool RadeonDeInit = XBool(); + XBool LoadVBios = XBool(); + UINT64 VRAM = XBool(); UINT32 RefCLK = UINT32(); XStringW FBName = XStringW(); UINT16 VideoPorts = UINT16(); - bool NvidiaGeneric = bool(); - bool NvidiaNoEFI = bool(); - bool NvidiaSingle = bool(); + XBool NvidiaGeneric = XBool(); + XBool NvidiaNoEFI = XBool(); + XBool NvidiaSingle = XBool(); XArray Dcfg = XArray(); XArray NVCAP = XArray(); INT8 BootDisplay = INT8(); @@ -1480,9 +1480,9 @@ public: } #if __cplusplus > 201703L - bool operator == (const GraphicsClass&) const = default; + XBool operator == (const GraphicsClass&) const = default; #endif - bool isEqual(const GraphicsClass& other) const + XBool isEqual(const GraphicsClass& other) const { if ( !(PatchVBios == other.PatchVBios) ) return false; if ( !PatchVBiosBytes.isEqual(other.PatchVBiosBytes) ) return false; @@ -1530,10 +1530,10 @@ public: NVIDIACardList.takeValueFrom(configPlist.NVIDIA); } - //bool getGraphicsInjector() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.GraphicsInjector; } - //bool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; } - //bool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; } - //bool InjectNVidia() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectNVidia; } + //XBool getGraphicsInjector() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.GraphicsInjector; } + //XBool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; } + //XBool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; } + //XBool InjectNVidia() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectNVidia; } }; @@ -1542,15 +1542,15 @@ public: class AudioClass { public: - bool ResetHDA = bool(); - bool HDAInjection = bool(); + XBool ResetHDA = XBool(); + XBool HDAInjection = XBool(); INT32 HDALayoutId = INT32(); - bool AFGLowPowerState = bool(); + XBool AFGLowPowerState = XBool(); #if __cplusplus > 201703L - bool operator == (const AudioClass&) const = default; + XBool operator == (const AudioClass&) const = default; #endif - bool isEqual(const AudioClass& other) const + XBool isEqual(const AudioClass& other) const { if ( !(ResetHDA == other.ResetHDA) ) return false; if ( !(HDAInjection == other.HDAInjection) ) return false; @@ -1568,17 +1568,17 @@ public: }; class USBClass { public: - bool USBInjection = bool(); - bool USBFixOwnership = bool(); - bool InjectClockID = bool(); - bool HighCurrent = bool(); - bool NameEH00 = bool(); - bool NameXH00 = bool(); // is it used? + XBool USBInjection = XBool(); + XBool USBFixOwnership = XBool(); + XBool InjectClockID = XBool(); + XBool HighCurrent = XBool(); + XBool NameEH00 = XBool(); + XBool NameXH00 = XBool(); // is it used? #if __cplusplus > 201703L - bool operator == (const USBClass&) const = default; + XBool operator == (const USBClass&) const = default; #endif - bool isEqual(const USBClass& other) const + XBool isEqual(const USBClass& other) const { if ( !(USBInjection == other.USBInjection) ) return false; if ( !(USBFixOwnership == other.USBFixOwnership) ) return false; @@ -1613,9 +1613,9 @@ public: AddPropertyClass() {} #if __cplusplus > 201703L - bool operator == (const AddPropertyClass&) const = default; + XBool operator == (const AddPropertyClass&) const = default; #endif - bool isEqual(const AddPropertyClass& other) const + XBool isEqual(const AddPropertyClass& other) const { if ( !(Device == other.Device) ) return false; if ( !(Key == other.Key) ) return false; @@ -1650,9 +1650,9 @@ public: SimplePropertyClass() {} #if __cplusplus > 201703L - bool operator == (const SimplePropertyClass&) const = default; + XBool operator == (const SimplePropertyClass&) const = default; #endif - bool isEqual(const SimplePropertyClass& other) const + XBool isEqual(const SimplePropertyClass& other) const { if ( !(Key == other.Key) ) return false; if ( !(Value == other.Value) ) return false; @@ -1684,7 +1684,7 @@ public: { public: - bool Enabled = true; + XBool Enabled = true; XStringW DevicePathAsString = XStringW(); // XString8 Label = XString8(); // Label is the same as DevicePathAsString, so it's not needed. XObjArrayWithTakeValueFromXmlRepeatingDict propertiesArray = XObjArrayWithTakeValueFromXmlRepeatingDict(); @@ -1707,9 +1707,9 @@ public: #endif #if __cplusplus > 201703L - bool operator == (const PropertyClass&) const = default; + XBool operator == (const PropertyClass&) const = default; #endif - bool isEqual(const PropertyClass& other) const + XBool isEqual(const PropertyClass& other) const { if ( !(Enabled == other.Enabled) ) return false; if ( !(DevicePathAsString == other.DevicePathAsString) ) return false; @@ -1730,9 +1730,9 @@ public: XObjArrayWithTakeValueFromXmlRepeatingDict PropertyArray = XObjArrayWithTakeValueFromXmlRepeatingDict(); #if __cplusplus > 201703L - bool operator == (const PropertiesClass&) const = default; + XBool operator == (const PropertiesClass&) const = default; #endif - bool isEqual(const PropertiesClass& other) const + XBool isEqual(const PropertiesClass& other) const { if ( !(propertiesAsString == other.propertiesAsString) ) return false; if ( !PropertyArray.isEqual(other.PropertyArray) ) return false; @@ -1753,9 +1753,9 @@ public: ArbitraryPropertyClass() {} #if __cplusplus > 201703L - bool operator == (const ArbitraryPropertyClass&) const = default; + XBool operator == (const ArbitraryPropertyClass&) const = default; #endif - bool isEqual(const ArbitraryPropertyClass& other) const + XBool isEqual(const ArbitraryPropertyClass& other) const { if ( !(Device == other.Device) ) return false; if ( !(Label == other.Label) ) return false; @@ -1783,9 +1783,9 @@ public: UINT32 FakeIMEI = UINT32(); //106 #if __cplusplus > 201703L - bool operator == (const FakeIDClass&) const = default; + XBool operator == (const FakeIDClass&) const = default; #endif - bool isEqual(const FakeIDClass& other) const + XBool isEqual(const FakeIDClass& other) const { if ( !(FakeATI == other.FakeATI) ) return false; if ( !(FakeNVidia == other.FakeNVidia) ) return false; @@ -1810,15 +1810,15 @@ public: } }; - bool StringInjector = bool(); - bool IntelMaxBacklight = bool(); - bool IntelBacklight = bool(); + XBool StringInjector = XBool(); + XBool IntelMaxBacklight = XBool(); + XBool IntelBacklight = XBool(); UINT32 IntelMaxValue = UINT32(); - bool LANInjection = bool(); - bool HDMIInjection = bool(); - bool NoDefaultProperties = bool(); - bool UseIntelHDMI = bool(); - bool ForceHPET = bool(); + XBool LANInjection = XBool(); + XBool HDMIInjection = XBool(); + XBool NoDefaultProperties = XBool(); + XBool UseIntelHDMI = XBool(); + XBool ForceHPET = XBool(); UINT32 DisableFunctions = UINT32(); XString8 AirportBridgeDeviceName = XString8(); AudioClass Audio = AudioClass(); @@ -1831,9 +1831,9 @@ public: #if __cplusplus > 201703L - bool operator == (const DevicesClass&) const = default; + XBool operator == (const DevicesClass&) const = default; #endif - bool isEqual(const DevicesClass& other) const + XBool isEqual(const DevicesClass& other) const { if ( !(StringInjector == other.StringInjector) ) return false; if ( !(IntelMaxBacklight == other.IntelMaxBacklight) ) return false; @@ -1882,7 +1882,7 @@ public: public: void FillDevicePropertiesOld(SETTINGS_DATA& gSettings, const TagDict* DevicesDict); - bool compareDevProperty(const XString8& label, const DEV_PROPERTY& oldProp, const DEV_PROPERTY& newProp) const + XBool compareDevProperty(const XString8& label, const DEV_PROPERTY& oldProp, const DEV_PROPERTY& newProp) const { if ( newProp.Device != oldProp.Device ) { @@ -1958,7 +1958,7 @@ printf("%s", ""); return true; } - bool compareOldAndCompatibleArb() + XBool compareOldAndCompatibleArb() { // { // size_t oldArbIdx = 0; @@ -2050,12 +2050,12 @@ printf("%s", ""); public : UINTN address = 0; XString8 comment = XString8(); - bool enabled = 0; + XBool enabled = false; #if __cplusplus > 201703L - bool operator == (const MMIOWhiteList&) const = default; + XBool operator == (const MMIOWhiteList&) const = default; #endif - bool isEqual(const MMIOWhiteList& other) const + XBool isEqual(const MMIOWhiteList& other) const { if ( !(address == other.address) ) return false; if ( !(comment == other.comment) ) return false; @@ -2072,28 +2072,28 @@ printf("%s", ""); class OcKernelQuirksClass { public: - // bool AppleCpuPmCfgLock = false; - // bool AppleXcpmCfgLock = false; - bool AppleXcpmExtraMsrs = false; - bool AppleXcpmForceBoost = false; - // bool CustomSmbiosGuid = false; - bool DisableIoMapper = false; - bool DisableLinkeditJettison = false; - // bool DisableRtcChecksum = false; - bool DummyPowerManagement = false; - bool ExtendBTFeatureFlags = false; - bool ExternalDiskIcons = false; - bool IncreasePciBarSize = false; - // bool LapicKernelPanic = false; - // bool PanicNoKextDump = false; - bool PowerTimeoutKernelPanic = false; - bool ThirdPartyDrives = false; - bool XhciPortLimit = false; + // XBool AppleCpuPmCfgLock = false; + // XBool AppleXcpmCfgLock = false; + XBool AppleXcpmExtraMsrs = false; + XBool AppleXcpmForceBoost = false; + // XBool CustomSmbiosGuid = false; + XBool DisableIoMapper = false; + XBool DisableLinkeditJettison = false; + // XBool DisableRtcChecksum = false; + XBool DummyPowerManagement = false; + XBool ExtendBTFeatureFlags = false; + XBool ExternalDiskIcons = false; + XBool IncreasePciBarSize = false; + // XBool LapicKernelPanic = false; + // XBool PanicNoKextDump = false; + XBool PowerTimeoutKernelPanic = false; + XBool ThirdPartyDrives = false; + XBool XhciPortLimit = false; #if __cplusplus > 201703L - bool operator == (const OcKernelQuirksClass&) const = default; + XBool operator == (const OcKernelQuirksClass&) const = default; #endif - bool isEqual(const OcKernelQuirksClass& other) const + XBool isEqual(const OcKernelQuirksClass& other) const { if ( !(AppleXcpmExtraMsrs == other.AppleXcpmExtraMsrs) ) return false; if ( !(AppleXcpmForceBoost == other.AppleXcpmForceBoost) ) return false; @@ -2127,28 +2127,28 @@ printf("%s", ""); class OcBooterQuirksClass { public: - bool AvoidRuntimeDefrag = false; - bool DevirtualiseMmio = false; - bool DisableSingleUser = false; - bool DisableVariableWrite = false; - bool DiscardHibernateMap = false; - bool EnableSafeModeSlide = false; - bool EnableWriteUnprotector = false; - bool ForceExitBootServices = false; - bool ProtectMemoryRegions = false; - bool ProtectSecureBoot = false; - bool ProtectUefiServices = false; - bool ProvideCustomSlide = false; + XBool AvoidRuntimeDefrag = false; + XBool DevirtualiseMmio = false; + XBool DisableSingleUser = false; + XBool DisableVariableWrite = false; + XBool DiscardHibernateMap = false; + XBool EnableSafeModeSlide = false; + XBool EnableWriteUnprotector = false; + XBool ForceExitBootServices = false; + XBool ProtectMemoryRegions = false; + XBool ProtectSecureBoot = false; + XBool ProtectUefiServices = false; + XBool ProvideCustomSlide = false; uint8_t ProvideMaxSlide = false; - bool RebuildAppleMemoryMap = false; - bool SetupVirtualMap = false; - bool SignalAppleOS = false; - bool SyncRuntimePermissions = false; + XBool RebuildAppleMemoryMap = false; + XBool SetupVirtualMap = false; + XBool SignalAppleOS = false; + XBool SyncRuntimePermissions = false; #if __cplusplus > 201703L - bool operator == (const OcBooterQuirksClass&) const = default; + XBool operator == (const OcBooterQuirksClass&) const = default; #endif - bool isEqual(const OcBooterQuirksClass& other) const + XBool isEqual(const OcBooterQuirksClass& other) const { if ( !(AvoidRuntimeDefrag == other.AvoidRuntimeDefrag) ) return false; if ( !(DevirtualiseMmio == other.DevirtualiseMmio) ) return false; @@ -2192,7 +2192,7 @@ printf("%s", ""); }; - bool FuzzyMatch = bool(); + XBool FuzzyMatch = XBool(); XString8 OcKernelCache = XString8(); // UINTN MaxSlide; OcKernelQuirksClass OcKernelQuirks = OcKernelQuirksClass(); @@ -2201,9 +2201,9 @@ printf("%s", ""); UINT32 QuirksMask = 0; #if __cplusplus > 201703L - bool operator == (const QuirksClass&) const = default; + XBool operator == (const QuirksClass&) const = default; #endif - bool isEqual(const QuirksClass& other) const + XBool isEqual(const QuirksClass& other) const { if ( !(FuzzyMatch == other.FuzzyMatch) ) return false; if ( !(OcKernelCache == other.OcKernelCache) ) return false; @@ -2229,15 +2229,15 @@ printf("%s", ""); class RT_VARIABLES { public: - bool Disabled = bool(); + XBool Disabled = XBool(); XString8 Comment = XStringW(); XStringW Name = XStringW(); EFI_GUIDClass Guid = EFI_GUIDClass(); #if __cplusplus > 201703L - bool operator == (const RT_VARIABLES&) const = default; + XBool operator == (const RT_VARIABLES&) const = default; #endif - bool isEqual(const RT_VARIABLES& other) const + XBool isEqual(const RT_VARIABLES& other) const { if ( !(Disabled == other.Disabled) ) return false; if ( !(Comment == other.Comment) ) return false; @@ -2262,14 +2262,14 @@ printf("%s", ""); XString8 BooterCfgStr = XString8(); XObjArrayWithTakeValueFromXmlArray BlockRtVariableArray = XObjArrayWithTakeValueFromXmlArray(); - bool GetLegacyLanAddress() const { + XBool GetLegacyLanAddress() const { return RtROMAsString.isEqualIC("UseMacAddr0") || RtROMAsString.isEqualIC("UseMacAddr1"); } #if __cplusplus > 201703L - bool operator == (const RtVariablesClass&) const = default; + XBool operator == (const RtVariablesClass&) const = default; #endif - bool isEqual(const RtVariablesClass& other) const + XBool isEqual(const RtVariablesClass& other) const { if ( !(RtROMAsString == other.RtROMAsString) ) return false; if ( !(RtROMAsData == other.RtROMAsData) ) return false; @@ -2311,9 +2311,9 @@ printf("%s", ""); SlotDeviceClass() {} #if __cplusplus > 201703L - bool operator == (const SLOT_DEVICE&) const = default; + XBool operator == (const SLOT_DEVICE&) const = default; #endif - bool isEqual(const SlotDeviceClass& other) const + XBool isEqual(const SlotDeviceClass& other) const { if ( !(SmbiosIndex == other.SmbiosIndex) ) return false; if ( !(SlotID == other.SlotID) ) return false; @@ -2333,7 +2333,7 @@ printf("%s", ""); class SlotDeviceArrayClass : public XObjArrayWithTakeValueFromXmlArray { public: - bool doesSlotForIndexExist(uint8_t idx2Look4) const { + XBool doesSlotForIndexExist(uint8_t idx2Look4) const { for ( size_t idx = 0 ; idx < size() ; ++idx ) { if ( ElementAt(idx).SmbiosIndex == idx2Look4 ) return true; } @@ -2363,14 +2363,14 @@ printf("%s", ""); XString8 PartNo = XString8(); XString8 SerialNo = XString8(); UINT8 Type = UINT8(); - bool InUse = bool(); + XBool InUse = XBool(); RamSlotInfo() {} #if __cplusplus > 201703L - bool operator == (const RamSlotInfo&) const = default; + XBool operator == (const RamSlotInfo&) const = default; #endif - bool isEqual(const RamSlotInfo& other) const + XBool isEqual(const RamSlotInfo& other) const { if ( !(Slot == other.Slot ) ) return false; if ( !(ModuleSize == other.ModuleSize ) ) return false; @@ -2382,7 +2382,7 @@ printf("%s", ""); if ( !(InUse == other.InUse ) ) return false; return true; } - bool takeValueFrom(const SmbiosPlistClass::SmbiosDictClass::MemoryDictClass::ModuleDictClass& other) + XBool takeValueFrom(const SmbiosPlistClass::SmbiosDictClass::MemoryDictClass::ModuleDictClass& other) { Slot = other.dgetSlotNo(); ModuleSize = other.dgetModuleSize(); @@ -2405,9 +2405,9 @@ printf("%s", ""); RamSlotInfoArrayClass() {} #if __cplusplus > 201703L - bool operator == (const RamSlotInfoArrayClass&) const = default; + XBool operator == (const RamSlotInfoArrayClass&) const = default; #endif - bool isEqual(const RamSlotInfoArrayClass& other) const + XBool isEqual(const RamSlotInfoArrayClass& other) const { if ( !(SlotCounts == other.SlotCounts) ) return false; if ( !(UserChannels == other.UserChannels) ) return false; @@ -2444,7 +2444,7 @@ printf("%s", ""); XString8 BoardVersion = XString8(); UINT8 BoardType = UINT8(); // SMBIOS TYPE3 - bool Mobile = bool(); + XBool Mobile = XBool(); UINT8 ChassisType = UINT8(); XString8 ChassisManufacturer = XString8(); XString8 ChassisAssetTag = XString8(); @@ -2459,12 +2459,12 @@ printf("%s", ""); // XString8 MemorySpeed; // SMBIOS TYPE131 // SMBIOS TYPE132 - bool TrustSMBIOS = 0; - bool InjectMemoryTables = bool(); // same as Memory.SlotCounts + XBool TrustSMBIOS = false; + XBool InjectMemoryTables = XBool(); // same as Memory.SlotCounts // SMBIOS TYPE133 UINT64 gPlatformFeature = UINT64(); // PatchTableType11 - bool NoRomInfo = bool(); + XBool NoRomInfo = XBool(); UINT32 FirmwareFeatures = UINT32(); UINT32 FirmwareFeaturesMask = UINT32(); @@ -2476,9 +2476,9 @@ printf("%s", ""); SmbiosClass() {} #if __cplusplus > 201703L - bool operator == (const SmbiosClass&) const = default; + XBool operator == (const SmbiosClass&) const = default; #endif - bool isEqual(const SmbiosClass& other) const + XBool isEqual(const SmbiosClass& other) const { // SMBIOS TYPE0 if ( !(BiosVendor == other.BiosVendor) ) return false; @@ -2587,9 +2587,9 @@ printf("%s", ""); } #if __cplusplus > 201703L - bool operator == (const BootGraphicsClass&) const = default; + XBool operator == (const BootGraphicsClass&) const = default; #endif - bool isEqual(const BootGraphicsClass& other) const + XBool isEqual(const BootGraphicsClass& other) const { if ( !(DefaultBackgroundColor == other.DefaultBackgroundColor) ) return false; if ( !(UIScale == other.UIScale) ) return false; @@ -2623,16 +2623,16 @@ printf("%s", ""); //other // UINT16 DropOEM_DSM; // not used anymore. -// BOOLEAN LpcTune; // never set to true. +// XBool LpcTune; // never set to true. SETTINGS_DATA() {} // SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed // const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed #if __cplusplus > 201703L - bool operator == (const SETTINGS_DATA&) const = default; + XBool operator == (const SETTINGS_DATA&) const = default; #endif - bool isEqual(const SETTINGS_DATA& other) const + XBool isEqual(const SETTINGS_DATA& other) const { if ( !Boot.isEqual(other.Boot) ) return false; if ( !ACPI.isEqual(other.ACPI) ) return false; @@ -2673,25 +2673,25 @@ printf("%s", ""); const XString8& getUUID(EFI_GUIDClass* efiGuid); // If CustomUuid is defined, return false by default // If SmUUID is defined, return true by default. - bool ShouldInjectSystemID() { + XBool ShouldInjectSystemID() { if ( SystemParameters.CustomUuid.notEmpty() && SystemParameters.CustomUuid != nullGuidAsString ) { if ( SystemParameters._InjectSystemID == 2 ) return false; - else return SystemParameters._InjectSystemID; + else return SystemParameters._InjectSystemID != 0; } if ( Smbios.SmUUID.isEmpty() || Smbios.SmUUID == nullGuidAsString ) return false; if ( SystemParameters._InjectSystemID == 2 ) return true; - return SystemParameters._InjectSystemID; + return SystemParameters._InjectSystemID != 0; } - bool getEnableC6() const { + XBool getEnableC6() const { if ( CPU._EnableC6.isDefined() ) return CPU._EnableC6.value(); return ACPI.SSDT._EnableC6; } - bool getEnableC4() const { + XBool getEnableC4() const { if ( CPU._EnableC4.isDefined() ) return CPU._EnableC4.value(); return ACPI.SSDT._EnableC4; } - bool getEnableC2() const { + XBool getEnableC2() const { if ( CPU._EnableC2.isDefined() ) return CPU._EnableC2.value(); return ACPI.SSDT._EnableC2; } @@ -2762,7 +2762,7 @@ extern INTN OldChosenTheme; extern INTN OldChosenConfig; extern INTN OldChosenDsdt; extern UINTN OldChosenAudio; -extern BOOLEAN SavePreBootLog; +extern XBool SavePreBootLog; extern UINT8 DefaultAudioVolume; @@ -2772,7 +2772,7 @@ extern UINT8 DefaultAudioVolume; //extern UINTN NHDA; //extern UINT16 gCPUtype; extern SETTINGS_DATA gSettings; -extern BOOLEAN gFirmwareClover; +extern XBool gFirmwareClover; extern DRIVERS_FLAGS gDriversFlags; extern EFI_EDID_DISCOVERED_PROTOCOL *EdidDiscovered; //extern UINT8 *gEDID; @@ -2781,7 +2781,7 @@ extern UINTN gEvent; extern UINT16 gBacklightLevel; -//extern BOOLEAN defDSM; +//extern XBool defDSM; //extern UINT16 dropDSM; //extern TagDict* gConfigDict[]; @@ -2797,8 +2797,8 @@ extern XObjArray ACPIPatchedAML; extern CHAR16 *IconFormat; -extern BOOLEAN ResumeFromCoreStorage; -//extern BOOLEAN gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here +extern XBool ResumeFromCoreStorage; +//extern XBool gRemapSmBiosIsRequire; // syscl: pass argument for Dell SMBIOS here extern EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl; @@ -2811,29 +2811,29 @@ class REFIT_CONFIG { public: UINTN DisableFlags = 0; //to disable some volume types (optical, firewire etc) - BOOLEAN Quiet = true; - BOOLEAN SpecialBootMode = false; // content of nvram var "aptiofixflag" + XBool Quiet = true; + XBool SpecialBootMode = false; // content of nvram var "aptiofixflag" - BOOLEAN gBootChanged = FALSE; - BOOLEAN gThemeChanged = FALSE; - BOOLEAN NeedPMfix = FALSE; + XBool gBootChanged = false; + XBool gThemeChanged = false; + XBool NeedPMfix = false; ACPI_DROP_TABLE *ACPIDropTables = NULL; UINT8 CustomLogoType = 0; // this will be initialized with gSettings.Boot.CustomBoot and set back to CUSTOM_BOOT_DISABLED if CustomLogo could not be loaded or decoded (see afterGetUserSettings) XImage *CustomLogo = 0; - bool DropSSDT = 0; // init with gSettings.Boot.DropSSDTSetting. Put back to false if one table is dropped (see afterGetUserSettings) + XBool DropSSDT = false; // init with gSettings.Boot.DropSSDTSetting. Put back to false if one table is dropped (see afterGetUserSettings) UINT8 SecureBoot = 0; UINT8 SecureBootSetupMode = 0; - BOOLEAN SetTable132 = 0; - BOOLEAN HWP = 0; + XBool SetTable132 = false; + XBool HWP = false; - bool EnableC6 = 0; - bool EnableC4 = 0; - bool EnableC2 = 0; - uint16_t C3Latency = 0; + XBool EnableC6 = false; + XBool EnableC4 = false; + XBool EnableC2 = false; + uint16_t C3Latency = 0; XObjArray CustomEntries = XObjArray(); XObjArray CustomLegacyEntries = XObjArray(); @@ -2842,28 +2842,28 @@ public: INTN Codepage = 0xC0; INTN CodepageSize = 0xC0; - bool KPKernelPm = bool(); - bool KPAppleIntelCPUPM = bool(); + XBool KPKernelPm = XBool(); + XBool KPAppleIntelCPUPM = XBool(); XBuffer RtROM = XBuffer(); XString8 RtMLB = XString8(); - bool Turbo = true; + XBool Turbo = true; - XString8 OEMProductFromSmbios = XString8(); - XString8 OEMVendorFromSmbios = XString8(); - XString8 OEMBoardFromSmbios = XString8(); - UINT8 EnabledCores = 0; + XString8 OEMProductFromSmbios = XString8(); + XString8 OEMVendorFromSmbios = XString8(); + XString8 OEMBoardFromSmbios = XString8(); + UINT8 EnabledCores = 0; // XStringW ConfigName; // Set but never used - UINT32 OptionsBits = 0; - UINT32 FlagsBits = 0; + UINT32 OptionsBits = 0; + UINT32 FlagsBits = 0; XStringW BlockKexts = XStringW(); // KernelAndKextPatches - BOOLEAN KextPatchesAllowed = true; - BOOLEAN KernelPatchesAllowed = true; //From GUI: Only for user patches, not internal Clover + XBool KextPatchesAllowed = true; + XBool KernelPatchesAllowed = true; //From GUI: Only for user patches, not internal Clover XString8 BiosVersionUsed = XString8(); XString8 EfiVersionUsed = XString8(); @@ -2880,7 +2880,7 @@ public: const REFIT_CONFIG& operator = ( const REFIT_CONFIG & ) = delete; // Can be defined if needed ~REFIT_CONFIG() { } - bool isFastBoot() { return SpecialBootMode || gSettings.Boot.FastBoot; } + XBool isFastBoot() { return SpecialBootMode || gSettings.Boot.FastBoot; } } ; @@ -2914,7 +2914,7 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *LoadedEntry); void afterGetUserSettings(SETTINGS_DATA& gSettings); XStringW -GetOtherKextsDir (BOOLEAN On); +GetOtherKextsDir (XBool On); XStringW GetOSVersionKextsDir(const MacOsVersion& OSVersion); diff --git a/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.cpp b/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.cpp index 3b0ca5679..8116b0ee6 100644 --- a/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.cpp +++ b/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.cpp @@ -70,7 +70,7 @@ static void SmbiosFillPatchingValues(const SETTINGS_DATA::SmbiosClass::RamSlotIn SmbiosFillPatchingValues(other.User, &Memory._User); } -void SmbiosFillPatchingValues(bool _SetTable132, uint8_t pEnabledCores, uint16_t pRamSlotCount, const SlotDeviceArrayClass& SlotDeviceArray, const SETTINGS_DATA& globalSettings, const CPU_STRUCTURE& CPUStructure, SmbiosInjectedSettings* smbiosInjectedSettingsPtr) +void SmbiosFillPatchingValues(XBool _SetTable132, uint8_t pEnabledCores, uint16_t pRamSlotCount, const SlotDeviceArrayClass& SlotDeviceArray, const SETTINGS_DATA& globalSettings, const CPU_STRUCTURE& CPUStructure, SmbiosInjectedSettings* smbiosInjectedSettingsPtr) { SmbiosInjectedSettings& smbiosInjectedSetting = *smbiosInjectedSettingsPtr; // from CPUStructure diff --git a/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.h b/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.h index 2f71604ad..1231b1f6d 100644 --- a/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.h +++ b/rEFIt_UEFI/Platform/SmbiosFillPatchingValues.h @@ -12,7 +12,7 @@ #include "../Platform/Settings.h" #include "../Platform/smbios.h" -void SmbiosFillPatchingValues(bool _SetTable132, uint8_t pEnabledCores, uint16_t pRamSlotCount, const SlotDeviceArrayClass& SlotDeviceArray, const SETTINGS_DATA& globalSettings, const CPU_STRUCTURE& CPUStructure, SmbiosInjectedSettings* smbiosInjectedSettingsPtr); +void SmbiosFillPatchingValues(XBool _SetTable132, uint8_t pEnabledCores, uint16_t pRamSlotCount, const SlotDeviceArrayClass& SlotDeviceArray, const SETTINGS_DATA& globalSettings, const CPU_STRUCTURE& CPUStructure, SmbiosInjectedSettings* smbiosInjectedSettingsPtr); diff --git a/rEFIt_UEFI/Platform/StartupSound.cpp b/rEFIt_UEFI/Platform/StartupSound.cpp index 983e41ce4..a6321be53 100644 --- a/rEFIt_UEFI/Platform/StartupSound.cpp +++ b/rEFIt_UEFI/Platform/StartupSound.cpp @@ -369,12 +369,12 @@ DONE: return Status; } -EFI_STATUS CheckSyncSound(BOOLEAN Stop) +EFI_STATUS CheckSyncSound(XBool Stop) { EFI_STATUS Status; AUDIO_IO_PRIVATE_DATA *AudioIoPrivateData; EFI_HDA_IO_PROTOCOL *HdaIo; - BOOLEAN StreamRunning = FALSE; + BOOLEAN StreamRunning = false; if (!AudioIo) { return EFI_NOT_STARTED; } diff --git a/rEFIt_UEFI/Platform/StartupSound.h b/rEFIt_UEFI/Platform/StartupSound.h index e677ff14f..fc45b8ab8 100644 --- a/rEFIt_UEFI/Platform/StartupSound.h +++ b/rEFIt_UEFI/Platform/StartupSound.h @@ -25,6 +25,6 @@ StartupSoundPlay(const EFI_FILE* Dir, CONST CHAR16* SoundFile); void GetOutputs(); -EFI_STATUS CheckSyncSound(BOOLEAN Stop); +EFI_STATUS CheckSyncSound(XBool Stop); #endif /* PLATFORM_STARTUPSOUND_H_ */ diff --git a/rEFIt_UEFI/Platform/StateGenerator.cpp b/rEFIt_UEFI/Platform/StateGenerator.cpp index c3040175c..d37a82625 100644 --- a/rEFIt_UEFI/Platform/StateGenerator.cpp +++ b/rEFIt_UEFI/Platform/StateGenerator.cpp @@ -113,9 +113,9 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) if (gMobile) { switch (gCPUStructure.Model) { case CPU_MODEL_IVY_BRIDGE: - if (AsciiStrStr(gCPUStructure.BrandString, "U")) { + if ( gCPUStructure.BrandString.contains("U") ) { Aplf = 0; - } else if (AsciiStrStr(gCPUStructure.BrandString, "M")) { + } else if ( gCPUStructure.BrandString.contains("M") ) { Aplf = 4; } break; @@ -137,7 +137,7 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) } } } else { - gSettings.ACPI.SSDT.Generate.GenerateAPLF = FALSE; + gSettings.ACPI.SSDT.Generate.GenerateAPLF = false; } if (Number > 0) { @@ -503,11 +503,11 @@ SSDT_TABLE *generate_pss_ssdt(UINTN Number) SSDT_TABLE *generate_cst_ssdt(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, UINTN Number) { - BOOLEAN c2_enabled = GlobalConfig.EnableC2; - BOOLEAN c3_enabled; - BOOLEAN c4_enabled = GlobalConfig.EnableC4; -// BOOLEAN c6_enabled = GlobalConfig.EnableC6; - BOOLEAN cst_using_systemio = gSettings.ACPI.SSDT.EnableISS; + XBool c2_enabled = GlobalConfig.EnableC2; + XBool c3_enabled; + XBool c4_enabled = GlobalConfig.EnableC4; +// XBool c6_enabled = GlobalConfig.EnableC6; + XBool cst_using_systemio = gSettings.ACPI.SSDT.EnableISS; UINT8 p_blk_lo, p_blk_hi; UINT8 cstates_count; UINT32 acpi_cpu_p_blk; diff --git a/rEFIt_UEFI/Platform/Utils.cpp b/rEFIt_UEFI/Platform/Utils.cpp index fdb30b639..38d77baa9 100755 --- a/rEFIt_UEFI/Platform/Utils.cpp +++ b/rEFIt_UEFI/Platform/Utils.cpp @@ -53,12 +53,12 @@ UINT8 hexstrtouint8 (const CHAR8* buf) return i; } -BOOLEAN IsHexDigit(char c) { - return (IS_DIGIT(c) || (IS_HEX(c)))?TRUE:FALSE; +XBool IsHexDigit(char c) { + return (IS_DIGIT(c) || (IS_HEX(c)))?true:false; } -BOOLEAN IsHexDigit(wchar_t c) { - return (IS_DIGIT(c) || (IS_HEX(c)))?TRUE:FALSE; +XBool IsHexDigit(wchar_t c) { + return (IS_DIGIT(c) || (IS_HEX(c)))?true:false; } //out value is a number of byte. out = len @@ -72,7 +72,7 @@ BOOLEAN IsHexDigit(wchar_t c) { // // if (hex == NULL || bin == NULL || len <= 0 || AsciiStrLen(hex) < len * 2) { // // DBG("[ERROR] bin2hex input error\n"); //this is not error, this is empty value -// return FALSE; +// return false; // } // // buf[2] = '\0'; @@ -143,5 +143,5 @@ UINT32 GetCrc32(UINT8 *Buffer, UINTN Size) } -BOOLEAN haveError = FALSE; +XBool haveError = false; diff --git a/rEFIt_UEFI/Platform/Utils.h b/rEFIt_UEFI/Platform/Utils.h index 73f8202f8..ac9dc979a 100755 --- a/rEFIt_UEFI/Platform/Utils.h +++ b/rEFIt_UEFI/Platform/Utils.h @@ -35,12 +35,12 @@ #define IS_PUNCT(x) ((x == '.') || (x == '-')) #define IS_BLANK(x) ((x == ' ') || (x == '\t')) -inline bool isPathSeparator(char32_t c) { return c == '/' || c == '\\'; } +inline XBool isPathSeparator(char32_t c) { return c == '/' || c == '\\'; } ////void LowCase (IN OUT CHAR8 *Str); //UINT32 hex2bin(IN const CHAR8 *hex, OUT UINT8 *bin, UINT32 len); -BOOLEAN IsHexDigit (CHAR8 c); +XBool IsHexDigit (CHAR8 c); UINT8 hexstrtouint8 (CONST CHAR8* buf); //one or two hex letters to one byte @@ -126,7 +126,7 @@ UINT32 GetCrc32(UINT8 *Buffer, UINTN Size); -extern BOOLEAN haveError; +extern XBool haveError; #endif // __cplusplus diff --git a/rEFIt_UEFI/Platform/Volume.cpp b/rEFIt_UEFI/Platform/Volume.cpp index a53a56143..b87383e68 100644 --- a/rEFIt_UEFI/Platform/Volume.cpp +++ b/rEFIt_UEFI/Platform/Volume.cpp @@ -25,9 +25,9 @@ GetRootUUID (IN REFIT_VOLUME *Volume) CONST CHAR16* SystemPlistP; CONST CHAR16* SystemPlistS; - BOOLEAN HasRock; - BOOLEAN HasPaper; - BOOLEAN HasScissors; + XBool HasRock; + XBool HasPaper; + XBool HasScissors; Status = EFI_NOT_FOUND; if (Volume == NULL) { diff --git a/rEFIt_UEFI/Platform/Volume.h b/rEFIt_UEFI/Platform/Volume.h index 3af5397e4..c43c17fd1 100644 --- a/rEFIt_UEFI/Platform/Volume.h +++ b/rEFIt_UEFI/Platform/Volume.h @@ -37,11 +37,11 @@ public: XStringW VolLabel = XStringW(); // comes from \\.VolumeLabel.txt, or empty. UINT8 DiskKind = 0; LEGACY_OS *LegacyOS = 0; - BOOLEAN Hidden = 0; + XBool Hidden = false; UINT8 BootType = 0; - BOOLEAN IsAppleLegacy = 0; - BOOLEAN HasBootCode = 0; - BOOLEAN IsMbrPartition = 0; + XBool IsAppleLegacy = false; + XBool HasBootCode = false; + XBool IsMbrPartition = false; UINTN MbrPartitionIndex = 0; EFI_BLOCK_IO *BlockIO = 0; UINT64 BlockIOOffset = 0; diff --git a/rEFIt_UEFI/Platform/ati.cpp b/rEFIt_UEFI/Platform/ati.cpp index 7fc70b236..c0b3d30ce 100644 --- a/rEFIt_UEFI/Platform/ati.cpp +++ b/rEFIt_UEFI/Platform/ati.cpp @@ -1169,82 +1169,82 @@ const CHAR8 *chip_family_name[] = { }; AtiDevProp ati_devprop_list[] = { - {FLAGTRUE, FALSE, "@0,AAPL,boot-display", get_bootdisplay_val, NULVAL }, - // {FLAGTRUE, FALSE, "@0,ATY,EFIDisplay", NULL, STRVAL("TMDSA") }, + {FLAGTRUE, false, "@0,AAPL,boot-display", get_bootdisplay_val, NULVAL }, + // {FLAGTRUE, false, "@0,ATY,EFIDisplay", NULL, STRVAL("TMDSA") }, - //{FLAGTRUE, TRUE, "@0,AAPL,vram-memory", get_vrammemory_val, NULVAL }, - {FLAGDYNAMIC, TRUE, "AAPL00,override-no-connect", get_edid_val, NULVAL }, - {FLAGNOTFAKE, TRUE, "@0,compatible", get_name_val, NULVAL }, - {FLAGTRUE, TRUE, "@0,connector-type", get_conntype_val, NULVAL }, - {FLAGTRUE, TRUE, "@0,device_type", NULL, STRVAL("display") }, - // {FLAGTRUE, FALSE, "@0,display-connect-flags", NULL, DWRVAL(0) }, + //{FLAGTRUE, true, "@0,AAPL,vram-memory", get_vrammemory_val, NULVAL }, + {FLAGDYNAMIC, true, "AAPL00,override-no-connect", get_edid_val, NULVAL }, + {FLAGNOTFAKE, true, "@0,compatible", get_name_val, NULVAL }, + {FLAGTRUE, true, "@0,connector-type", get_conntype_val, NULVAL }, + {FLAGTRUE, true, "@0,device_type", NULL, STRVAL("display") }, + // {FLAGTRUE, false, "@0,display-connect-flags", NULL, DWRVAL(0) }, //some set of properties for mobile radeons - {FLAGMOBILE, FALSE, "@0,display-link-component-bits", NULL, DWRVAL(6) }, - {FLAGMOBILE, FALSE, "@0,display-pixel-component-bits", NULL, DWRVAL(6) }, - {FLAGMOBILE, FALSE, "@0,display-dither-support", NULL, DWRVAL(0) }, - {FLAGMOBILE, FALSE, "@0,backlight-control", NULL, DWRVAL(1) }, - {FLAGTRUE, FALSE, "AAPL00,Dither", NULL, DWRVAL(0) }, + {FLAGMOBILE, false, "@0,display-link-component-bits", NULL, DWRVAL(6) }, + {FLAGMOBILE, false, "@0,display-pixel-component-bits", NULL, DWRVAL(6) }, + {FLAGMOBILE, false, "@0,display-dither-support", NULL, DWRVAL(0) }, + {FLAGMOBILE, false, "@0,backlight-control", NULL, DWRVAL(1) }, + {FLAGTRUE, false, "AAPL00,Dither", NULL, DWRVAL(0) }, - // {FLAGTRUE, TRUE, "@0,display-type", NULL, STRVAL("NONE") }, - {FLAGTRUE, TRUE, "@0,name", get_name_val, NULVAL }, - {FLAGTRUE, TRUE, "@0,VRAM,memsize", get_vrammemsize_val, NULVAL }, - // {FLAGTRUE, TRUE, "@0,ATY,memsize", get_vrammemsize_val, NULVAL }, + // {FLAGTRUE, true, "@0,display-type", NULL, STRVAL("NONE") }, + {FLAGTRUE, true, "@0,name", get_name_val, NULVAL }, + {FLAGTRUE, true, "@0,VRAM,memsize", get_vrammemsize_val, NULVAL }, + // {FLAGTRUE, true, "@0,ATY,memsize", get_vrammemsize_val, NULVAL }, - {FLAGTRUE, FALSE, "AAPL,aux-power-connected", NULL, DWRVAL(1) }, - {FLAGTRUE, FALSE, "AAPL00,DualLink", get_dual_link_val, NULVAL }, - {FLAGMOBILE, FALSE, "AAPL,HasPanel", NULL, DWRVAL(1) }, - {FLAGMOBILE, FALSE, "AAPL,HasLid", NULL, DWRVAL(1) }, - {FLAGMOBILE, FALSE, "AAPL,backlight-control", NULL, DWRVAL(1) }, - {FLAGTRUE, FALSE, "AAPL,overwrite_binimage", get_binimage_owr, NULVAL }, - {FLAGDYNAMIC, FALSE, "ATY,bin_image", get_binimage_val, NULVAL }, - {FLAGTRUE, FALSE, "ATY,Copyright", NULL, STRVAL("Copyright AMD Inc. All Rights Reserved. 2005-2011") }, - {FLAGTRUE, FALSE, "ATY,EFIVersion", NULL, STRVAL("01.00.3180") }, - {FLAGTRUE, FALSE, "ATY,Card#", get_romrevision_val, NULVAL }, - // {FLAGTRUE, FALSE, "ATY,Rom#", NULL, STRVAL("www.amd.com") }, - {FLAGNOTFAKE, FALSE, "ATY,VendorID", NULL, WRDVAL(0x1002) }, - {FLAGNOTFAKE, FALSE, "ATY,DeviceID", get_deviceid_val, NULVAL }, + {FLAGTRUE, false, "AAPL,aux-power-connected", NULL, DWRVAL(1) }, + {FLAGTRUE, false, "AAPL00,DualLink", get_dual_link_val, NULVAL }, + {FLAGMOBILE, false, "AAPL,HasPanel", NULL, DWRVAL(1) }, + {FLAGMOBILE, false, "AAPL,HasLid", NULL, DWRVAL(1) }, + {FLAGMOBILE, false, "AAPL,backlight-control", NULL, DWRVAL(1) }, + {FLAGTRUE, false, "AAPL,overwrite_binimage", get_binimage_owr, NULVAL }, + {FLAGDYNAMIC, false, "ATY,bin_image", get_binimage_val, NULVAL }, + {FLAGTRUE, false, "ATY,Copyright", NULL, STRVAL("Copyright AMD Inc. All Rights Reserved. 2005-2011") }, + {FLAGTRUE, false, "ATY,EFIVersion", NULL, STRVAL("01.00.3180") }, + {FLAGTRUE, false, "ATY,Card#", get_romrevision_val, NULVAL }, + // {FLAGTRUE, false, "ATY,Rom#", NULL, STRVAL("www.amd.com") }, + {FLAGNOTFAKE, false, "ATY,VendorID", NULL, WRDVAL(0x1002) }, + {FLAGNOTFAKE, false, "ATY,DeviceID", get_deviceid_val, NULVAL }, - // {FLAGTRUE, FALSE, "ATY,MCLK", get_mclk_val, NULVAL }, - // {FLAGTRUE, FALSE, "ATY,SCLK", get_sclk_val, NULVAL }, - {FLAGTRUE, FALSE, "ATY,RefCLK", get_refclk_val, DWRVAL(0x0a8c) }, + // {FLAGTRUE, false, "ATY,MCLK", get_mclk_val, NULVAL }, + // {FLAGTRUE, false, "ATY,SCLK", get_sclk_val, NULVAL }, + {FLAGTRUE, false, "ATY,RefCLK", get_refclk_val, DWRVAL(0x0a8c) }, - {FLAGTRUE, FALSE, "ATY,PlatformInfo", get_platforminfo_val, NULVAL }, - {FLAGOLD, FALSE, "compatible", get_name_pci_val, NULVAL }, - {FLAGTRUE, FALSE, "name", get_nameparent_val, NULVAL }, - {FLAGTRUE, FALSE, "device_type", get_nameparent_val, NULVAL }, - {FLAGTRUE, FALSE, "model", get_model_val, STRVAL("ATI Radeon")}, - // {FLAGTRUE, FALSE, "VRAM,totalsize", get_vramtotalsize_val, NULVAL }, + {FLAGTRUE, false, "ATY,PlatformInfo", get_platforminfo_val, NULVAL }, + {FLAGOLD, false, "compatible", get_name_pci_val, NULVAL }, + {FLAGTRUE, false, "name", get_nameparent_val, NULVAL }, + {FLAGTRUE, false, "device_type", get_nameparent_val, NULVAL }, + {FLAGTRUE, false, "model", get_model_val, STRVAL("ATI Radeon")}, + // {FLAGTRUE, false, "VRAM,totalsize", get_vramtotalsize_val, NULVAL }, - {FLAGTRUE, FALSE, NULL, NULL, NULVAL} + {FLAGTRUE, false, NULL, NULL, NULVAL} }; -BOOLEAN get_bootdisplay_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_bootdisplay_val(value_t *val, INTN index, XBool Sier) { static UINT32 v = 0; if (v) { - return FALSE; + return false; } if (!card->posted) { - return FALSE; + return false; } v = 1; val->type = kCst; val->size = 4; val->data = (__typeof__(val->data))AllocatePool(4); *(val->data) = (UINT8)v; - return TRUE; + return true; } -BOOLEAN get_dual_link_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_dual_link_val(value_t *val, INTN index, XBool Sier) { UINT32 DualLink = 1; static UINT32 v = 0; if (v) { - return FALSE; + return false; } if ((gSettings.Graphics.DualLink == 0) || (gSettings.Graphics.DualLink == 1)) { @@ -1257,40 +1257,40 @@ BOOLEAN get_dual_link_val(value_t *val, INTN index, BOOLEAN Sier) val->size = 4; val->data = (__typeof__(val->data))AllocatePool(4); *(val->data) = (UINT8)v; - return TRUE; + return true; } -BOOLEAN get_vrammemory_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_vrammemory_val(value_t *val, INTN index, XBool Sier) { - return FALSE; + return false; } -BOOLEAN get_edid_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_edid_val(value_t *val, INTN index, XBool Sier) { static UINT32 v = 0; if (!gSettings.Graphics.EDID.InjectEDID) { - return FALSE; + return false; } if (v) { - return FALSE; + return false; } //CustomEDID will point to user EDID if set else to EdidDiscovered if (gSettings.Graphics.EDID.CustomEDID.isEmpty()) { - return FALSE; + return false; } v = 1; val->type = kPtr; val->size = 128; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, gSettings.Graphics.EDID.CustomEDID.data()); - return TRUE; + return true; } static CONST CHAR8* dtyp[] = {"LCD", "CRT", "DVI", "NONE"}; static UINT32 dti = 0; -BOOLEAN get_display_type(value_t *val, INTN index, BOOLEAN Sier) +XBool get_display_type(value_t *val, INTN index, XBool Sier) { dti++; @@ -1300,47 +1300,47 @@ BOOLEAN get_display_type(value_t *val, INTN index, BOOLEAN Sier) val->type = kStr; val->size = (UINT32)AsciiStrSize(dtyp[dti]); val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)dtyp[dti]); - return TRUE; + return true; } -BOOLEAN get_name_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_name_val(value_t *val, INTN index, XBool Sier) { val->type = aty_name.type; val->size = aty_name.size; val->data = (__typeof__(val->data))AllocateCopyPool(aty_name.size, (UINT8 *)aty_name.data); - return TRUE; + return true; } -BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_nameparent_val(value_t *val, INTN index, XBool Sier) { val->type = aty_nameparent.type; val->size = aty_nameparent.size; val->data = (__typeof__(val->data))AllocateCopyPool(aty_nameparent.size, (UINT8 *)aty_nameparent.data); - return TRUE; + return true; } //static CHAR8 pciName[15]; -BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_name_pci_val(value_t *val, INTN index, XBool Sier) { CHAR8* pciName = (__typeof__(pciName))AllocateZeroPool(15); if (!card->info->model_name || !gSettings.Devices.FakeID.FakeATI) { - return FALSE; + return false; } snprintf(pciName, 15, "pci1002,%x", gSettings.Devices.FakeID.FakeATI >> 16); val->type = kStr; val->size = 13; val->data = (UINT8 *)pciName; - return TRUE; + return true; } -BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_model_val(value_t *val, INTN index, XBool Sier) { CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35); if (!card->info->model_name) { - return FALSE; + return false; } val->type = kStr; if (card->pci_dev->device_id != 0x67DF) { @@ -1374,7 +1374,7 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier) val->data = (__typeof__(val->data))AllocateCopyPool(val->size, ModelName); } FreePool(ModelName); - return TRUE; + return true; } //static CONST UINT32 ctm[] = {0x02, 0x10, 0x800, 0x400}; //mobile @@ -1384,7 +1384,7 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier) KERNEL_AND_KEXT_PATCHES *CurrentPatches; //TODO - get connectors from ATIConnectorsPatch -BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_conntype_val(value_t *val, INTN index, XBool Sier) { UINT8 *ct; INTN Len; @@ -1396,7 +1396,7 @@ BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier) //0x02: LVDS if ((CurrentPatches == NULL) || (CurrentPatches->KPATIConnectorsData.isEmpty())) { - return FALSE; + return false; } ct = CurrentPatches->KPATIConnectorsPatch.data(); Len = Sier?24:16; @@ -1413,10 +1413,10 @@ BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier) // cti++; // if(cti > 3) cti = 0; - return TRUE; + return true; } -BOOLEAN get_vrammemsize_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_vrammemsize_val(value_t *val, INTN index, XBool Sier) { static INTN idx = -1; UINT64 memsize; @@ -1429,33 +1429,33 @@ BOOLEAN get_vrammemsize_val(value_t *val, INTN index, BOOLEAN Sier) val->type = kCst; val->size = 8; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&memsize); - return TRUE; + return true; } -BOOLEAN get_binimage_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_binimage_val(value_t *val, INTN index, XBool Sier) { if (!card->rom) { - return FALSE; + return false; } val->type = kPtr; val->size = card->rom_size; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)card->rom); - return TRUE; + return true; } -BOOLEAN get_binimage_owr(value_t *val, INTN index, BOOLEAN Sier) +XBool get_binimage_owr(value_t *val, INTN index, XBool Sier) { if (!gSettings.Graphics.LoadVBios) { - return FALSE; + return false; } val->type = kCst; val->size = 4; val->data = (__typeof__(val->data))AllocatePool(4); *(val->data) = 1; - return TRUE; + return true; } -BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_romrevision_val(value_t *val, INTN index, XBool Sier) { CONST CHAR8* cRev="109-B77101-00"; UINT8 *rev; @@ -1463,7 +1463,7 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier) val->type = kPtr; val->size = 13; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, cRev); - return TRUE; + return true; } rev = card->rom + *(UINT8 *)(card->rom + OFFSET_TO_GET_ATOMBIOS_STRINGS_START); @@ -1475,60 +1475,60 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier) val->size = 13; } val->data = (__typeof__(val->data))AllocateCopyPool(val->size, rev); - return TRUE; + return true; } -BOOLEAN get_deviceid_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_deviceid_val(value_t *val, INTN index, XBool Sier) { val->type = kCst; val->size = 2; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->pci_dev->device_id); - return TRUE; + return true; } -BOOLEAN get_mclk_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_mclk_val(value_t *val, INTN index, XBool Sier) { - return FALSE; + return false; } -BOOLEAN get_sclk_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_sclk_val(value_t *val, INTN index, XBool Sier) { - return FALSE; + return false; } -BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_refclk_val(value_t *val, INTN index, XBool Sier) { if (!gSettings.Graphics.RefCLK) { - return FALSE; + return false; } // val->type = kCst; val->size = 4; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&gSettings.Graphics.RefCLK); - return TRUE; + return true; } -BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_platforminfo_val(value_t *val, INTN index, XBool Sier) { val->data = (__typeof__(val->data))AllocateZeroPool(0x80); if (!val->data) - return FALSE; + return false; // bzero(val->data, 0x80); val->type = kPtr; val->size = 0x80; val->data[0] = 1; - return TRUE; + return true; } -BOOLEAN get_vramtotalsize_val(value_t *val, INTN index, BOOLEAN Sier) +XBool get_vramtotalsize_val(value_t *val, INTN index, XBool Sier) { val->type = kCst; val->size = 4; val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->vram_size); - return TRUE; + return true; } void free_val(value_t *val ) @@ -1539,20 +1539,20 @@ void free_val(value_t *val ) ZeroMem(val, sizeof(value_t)); } -// {FLAGTRUE, TRUE, "@0,compatible", get_name_val, NULVAL }, -// {FLAGTRUE, FALSE, "ATY,VendorID", NULL, WRDVAL(0x1002) }, +// {FLAGTRUE, true, "@0,compatible", get_name_val, NULVAL }, +// {FLAGTRUE, false, "ATY,VendorID", NULL, WRDVAL(0x1002) }, /*typedef struct { UINT32 flags; - BOOLEAN all_ports; + XBool all_ports; CHAR8 *name; - BOOLEAN (*get_value)(value_t *val, INTN index, BOOLEAN Sier); + XBool (*get_value)(value_t *val, INTN index, XBool Sier); value_t default_val; } AtiDevProp; */ void devprop_add_list(AtiDevProp devprop_list[], const MacOsVersion& OSVersion) { INTN i, pnum; - BOOLEAN Sier; + XBool Sier; value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t)); Sier = ( OSVersion.isEmpty() || OSVersion >= MacOsVersion("10.12"_XS8)); @@ -1606,31 +1606,31 @@ void devprop_add_list(AtiDevProp devprop_list[], const MacOsVersion& OSVersion) FreePool(val); } -BOOLEAN validate_rom(option_rom_header_t *rom_header, pci_dt_t *pci_dev) +XBool validate_rom(option_rom_header_t *rom_header, pci_dt_t *pci_dev) { option_rom_pci_header_t *rom_pci_header; if (rom_header->signature != 0xaa55) { DBG("invalid ROM signature %hX\n", rom_header->signature); - return FALSE; + return false; } rom_pci_header = (option_rom_pci_header_t *)((UINT8 *)rom_header + rom_header->pci_header_offset); if (rom_pci_header->signature != 0x52494350) { DBG("invalid ROM header %X\n", rom_pci_header->signature); - return FALSE; + return false; } if (rom_pci_header->vendor_id != pci_dev->vendor_id || rom_pci_header->device_id != pci_dev->device_id){ DBG("invalid ROM vendor=%04hX deviceID=%04hX\n", rom_pci_header->vendor_id, rom_pci_header->device_id); - return FALSE; + return false; } - return TRUE; + return true; } -BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id) +XBool load_vbios_file(UINT16 vendor_id, UINT16 device_id) { EFI_STATUS Status = EFI_NOT_FOUND; UINTN bufferLen = 0; @@ -1654,13 +1654,13 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id) DBG("ATI ROM not found \n"); card->rom_size = 0; card->rom = 0; - return FALSE; + return false; } DBG("Loaded ROM len=%llu\n", bufferLen); card->rom_size = (UINT32)bufferLen; card->rom = (__typeof__(card->rom))AllocateZeroPool(bufferLen); if (!card->rom) { - return FALSE; + return false; } CopyMem(card->rom, buffer, bufferLen); // read(fd, (CHAR8 *)card->rom, card->rom_size); @@ -1671,7 +1671,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id) FreePool(card->rom); card->rom = 0; FreePool(buffer); - return FALSE; + return false; } bufferLen = ((option_rom_header_t *)card->rom)->rom_size; card->rom_size = (UINT32)(bufferLen << 9); @@ -1679,7 +1679,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id) // close(fd); FreePool(buffer); - return TRUE; + return true; } void get_vram_size(void) @@ -1716,7 +1716,7 @@ void get_vram_size(void) DBG("ATI: get_vram_size returned 0x%llX\n", card->vram_size); } -BOOLEAN read_vbios(BOOLEAN from_pci) +XBool read_vbios(XBool from_pci) { option_rom_header_t *rom_addr; @@ -1730,30 +1730,30 @@ BOOLEAN read_vbios(BOOLEAN from_pci) if (!validate_rom(rom_addr, card->pci_dev)) { DBG("There is no ROM @0x%llX\n", (uintptr_t)rom_addr); // gBS->Stall(3000000); - return FALSE; + return false; } card->rom_size = (UINT32)(rom_addr->rom_size) << 9; if (!card->rom_size) { DBG("invalid ROM size =0\n"); - return FALSE; + return false; } card->rom = (__typeof__(card->rom))AllocateZeroPool(card->rom_size); if (!card->rom) { - return FALSE; + return false; } CopyMem(card->rom, (void *)rom_addr, card->rom_size); - return TRUE; + return true; } -BOOLEAN read_disabled_vbios(void) +XBool read_disabled_vbios(void) { - BOOLEAN ret = FALSE; + XBool ret = false; ati_chip_family_t chip_family = card->info->chip_family; if (chip_family > CHIP_FAMILY_TURKS) { - return FALSE; + return false; } else if (chip_family >= CHIP_FAMILY_RV770) { UINT32 viph_control = REG32(card->mmio, RADEON_VIPH_CONTROL); UINT32 bus_cntl = REG32(card->mmio, RADEON_BUS_CNTL); @@ -1791,7 +1791,7 @@ BOOLEAN read_disabled_vbios(void) WRITEREG32(card->mmio, R600_ROM_CNTL, (rom_cntl | R600_SCK_OVERWRITE)); } - ret = read_vbios(TRUE); + ret = read_vbios(true); // restore regs if (chip_family == CHIP_FAMILY_RV730) { @@ -1841,7 +1841,7 @@ BOOLEAN read_disabled_vbios(void) WRITEREG32(card->mmio, R600_CTXSW_VID_LOWER_GPIO_CNTL, (ctxsw_vid_lower_gpio_cntl & ~0x400)); WRITEREG32(card->mmio, R600_LOWER_GPIO_ENABLE, (lower_gpio_enable | 0x400)); - ret = read_vbios(TRUE); + ret = read_vbios(true); // restore regs WRITEREG32(card->mmio, RADEON_VIPH_CONTROL, viph_control); @@ -1861,7 +1861,7 @@ BOOLEAN read_disabled_vbios(void) return ret; } -BOOLEAN radeon_card_posted(void) +XBool radeon_card_posted(void) { UINTN reg; // ati_chip_family_t chip_family = card->info->chip_family; @@ -1888,29 +1888,29 @@ BOOLEAN radeon_card_posted(void) DBG("RADEON_CRTC2_GEN_CNTL == 0x%08X\n", REG32(card->mmio, RADEON_CRTC2_GEN_CNTL)); if ((reg & 0xFFFFFFFF) == 0xFFFFFFFF) { DBG(" card not posted because GEN_CNTL = -1\n"); - return FALSE; + return false; } if (reg & RADEON_CRTC_EN) { DBG(" card posted because CRTC_EN, GEN_CNTL=%llX\n", reg); - return TRUE; + return true; } // then check MEM_SIZE, in case something turned the crtcs off reg = (UINTN)REG32(card->mmio, R600_CONFIG_MEMSIZE); if (reg) { DBG(" card posted because CONFIG_MEMSIZE=0x%llX\n", reg); - return TRUE; + return true; } - return FALSE; + return false; } #if 0 //may be inject this as saved-config? -BOOLEAN devprop_add_pci_config_space(void) +XBool devprop_add_pci_config_space(void) { int offset; UINT8 *config_space = (__typeof__(config_space))AllocateZeroPool(0x100); if (!config_space) - return FALSE; + return false; for (offset = 0; offset < 0x100; offset += 4) config_space[offset / 4] = pci_config_read32(card->pci_dev, offset); @@ -1918,13 +1918,13 @@ BOOLEAN devprop_add_pci_config_space(void) devprop_add_value(card->device, "ATY,PCIConfigSpace", config_space, 0x100); FreePool(config_space); - return TRUE; + return true; } #endif -static BOOLEAN init_card(pci_dt_t *pci_dev) +static XBool init_card(pci_dt_t *pci_dev) { - BOOLEAN add_vbios = gSettings.Graphics.LoadVBios; + XBool add_vbios = gSettings.Graphics.LoadVBios; CHAR8 *name; CHAR8 *name_parent; // CHAR8 *model; @@ -1936,7 +1936,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev) card = (__typeof__(card))AllocateZeroPool(sizeof(card_t)); if (!card) { - return FALSE; + return false; } card->pci_dev = pci_dev; @@ -1963,7 +1963,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev) if (!card->info || !card->info->device_id || !card->info->cfg_name) { DBG("Unsupported ATI card! Device ID: [%04hX:%04hX] Subsystem ID: [%08X] \n", - pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys_id); + pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id_union.subsys_id); DBG("search for brothers family\n"); for (i = 0; radeon_cards[i].device_id ; i++) { if ((radeon_cards[i].device_id & ~0xf) == (pci_dev->device_id & ~0xf)) { @@ -1974,7 +1974,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev) if (!card->info->cfg_name) { DBG("...compatible config is not found, set common\n"); card->info->cfg_name = kRadeon; -// return FALSE; +// return false; } } @@ -2004,7 +2004,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev) if (!card->rom) { DBG("reading VBIOS from %s", card->posted ? "legacy space" : "PCI ROM"); if (card->posted) { // && ExpansionRom != 0) - read_vbios(FALSE); + read_vbios(false); } else { read_disabled_vbios(); } @@ -2077,10 +2077,10 @@ static BOOLEAN init_card(pci_dt_t *pci_dev) aty_nameparent.size = (UINT32)AsciiStrLen(name_parent); aty_nameparent.data = (UINT8 *)name_parent; //how can we free pool when we leave the procedure? Make all pointers global? - return TRUE; + return true; } -BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) +XBool setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) { CHAR8 compatible[64]; XString8 devicepath; @@ -2088,7 +2088,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) UINTN i; if (!init_card(ati_dev)) { - return FALSE; + return false; } CurrentPatches = &Entry->KernelAndKextPatches; @@ -2102,11 +2102,11 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) //card->device = devprop_add_device(string, devicepath); if (ati_dev && !ati_dev->used) { card->device = devprop_add_device_pci(device_inject_string, ati_dev, NULL); - ati_dev->used = TRUE; + ati_dev->used = true; } if (!card->device) { - return FALSE; + return false; } // ------------------------------------------------- @@ -2159,7 +2159,7 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) chip_family_name[card->info->chip_family], card->info->model_name, (UINT32)RShiftU64(card->vram_size, 20), card->cfg_name, ati_dev->vendor_id, ati_dev->device_id, - ati_dev->subsys_id.subsys.vendor_id, ati_dev->subsys_id.subsys.device_id, + ati_dev->subsys_id_union.subsys.vendor_id, ati_dev->subsys_id_union.subsys.device_id, devicepath.c_str()); FreePool(card->info); @@ -2167,5 +2167,5 @@ BOOLEAN setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev) FreePool(aty_name.data); FreePool(aty_nameparent.data); - return TRUE; + return true; } diff --git a/rEFIt_UEFI/Platform/ati.h b/rEFIt_UEFI/Platform/ati.h index 9d3d680a0..85a2b9649 100644 --- a/rEFIt_UEFI/Platform/ati.h +++ b/rEFIt_UEFI/Platform/ati.h @@ -245,7 +245,7 @@ typedef struct { const CHAR8 *cfg_name; UINT8 ports; UINT32 flags; - BOOLEAN posted; + XBool posted; } card_t; // Chip flags @@ -278,32 +278,32 @@ typedef struct { typedef struct { UINT32 flags; - BOOLEAN all_ports; + XBool all_ports; CONST CHAR8 *name; - BOOLEAN (*get_value)(value_t *val, INTN index, BOOLEAN Sier); + XBool (*get_value)(value_t *val, INTN index, XBool Sier); value_t default_val; } AtiDevProp; -BOOLEAN get_bootdisplay_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_vrammemory_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_edid_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_display_type(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_name_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_vrammemsize_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_binimage_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_binimage_owr(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_deviceid_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_mclk_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_sclk_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_vramtotalsize_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_dual_link_val(value_t *val, INTN index, BOOLEAN Sier); -BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier); +XBool get_bootdisplay_val(value_t *val, INTN index, XBool Sier); +XBool get_vrammemory_val(value_t *val, INTN index, XBool Sier); +XBool get_edid_val(value_t *val, INTN index, XBool Sier); +XBool get_display_type(value_t *val, INTN index, XBool Sier); +XBool get_name_val(value_t *val, INTN index, XBool Sier); +XBool get_nameparent_val(value_t *val, INTN index, XBool Sier); +XBool get_model_val(value_t *val, INTN index, XBool Sier); +XBool get_conntype_val(value_t *val, INTN index, XBool Sier); +XBool get_vrammemsize_val(value_t *val, INTN index, XBool Sier); +XBool get_binimage_val(value_t *val, INTN index, XBool Sier); +XBool get_binimage_owr(value_t *val, INTN index, XBool Sier); +XBool get_romrevision_val(value_t *val, INTN index, XBool Sier); +XBool get_deviceid_val(value_t *val, INTN index, XBool Sier); +XBool get_mclk_val(value_t *val, INTN index, XBool Sier); +XBool get_sclk_val(value_t *val, INTN index, XBool Sier); +XBool get_refclk_val(value_t *val, INTN index, XBool Sier); +XBool get_platforminfo_val(value_t *val, INTN index, XBool Sier); +XBool get_vramtotalsize_val(value_t *val, INTN index, XBool Sier); +XBool get_dual_link_val(value_t *val, INTN index, XBool Sier); +XBool get_name_pci_val(value_t *val, INTN index, XBool Sier); // Constants. Can be defined even if DONT_DEFINE_GLOBALS extern const radeon_card_info_t radeon_cards[]; @@ -314,7 +314,7 @@ extern AtiDevProp ati_devprop_list[]; extern const CHAR8 *chip_family_name[]; #endif -BOOLEAN +XBool setup_ati_devprop ( LOADER_ENTRY *Entry, pci_dt_t *ati_dev diff --git a/rEFIt_UEFI/Platform/card_vlist.cpp b/rEFIt_UEFI/Platform/card_vlist.cpp index fee8ac73c..7ad36f451 100644 --- a/rEFIt_UEFI/Platform/card_vlist.cpp +++ b/rEFIt_UEFI/Platform/card_vlist.cpp @@ -68,7 +68,7 @@ //LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList); -//void AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios) +//void AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, XBool LoadVBios) //{ // CARDLIST* new_card = new CARDLIST; // new_card->Signature = CARDLIST_SIGNATURE; diff --git a/rEFIt_UEFI/Platform/card_vlist.h b/rEFIt_UEFI/Platform/card_vlist.h index c04713963..0cc64c54e 100644 --- a/rEFIt_UEFI/Platform/card_vlist.h +++ b/rEFIt_UEFI/Platform/card_vlist.h @@ -27,7 +27,7 @@ FindCardWithIds ( // UINT32 SubId, // UINT64 VideoRam, // UINTN VideoPorts, -// BOOLEAN LoadVBios +// XBool LoadVBios // ); diff --git a/rEFIt_UEFI/Platform/cpu.cpp b/rEFIt_UEFI/Platform/cpu.cpp index da7a80761..57c30cd2a 100755 --- a/rEFIt_UEFI/Platform/cpu.cpp +++ b/rEFIt_UEFI/Platform/cpu.cpp @@ -142,7 +142,7 @@ void GetCPUProperties (void) gSettings.CPU.CpuFreqMHz = 0; gCPUStructure.FSBFrequency = MultU64x32(gCPUStructure.ExternalClock, Kilo); //kHz -> Hz gCPUStructure.ProcessorInterconnectSpeed = 0; - gCPUStructure.Mobile = FALSE; //not same as gMobile + gCPUStructure.Mobile = false; //not same as gMobile if (!gCPUStructure.CurrentSpeed) { gCPUStructure.CurrentSpeed = (UINT32)DivU64x32(gCPUStructure.TSCCalibr + (Mega >> 1), Mega); @@ -212,13 +212,13 @@ void GetCPUProperties (void) for (s = str; *s != '\0'; s++){ if (*s != ' ') break; //remove leading spaces } - AsciiStrnCpyS(gCPUStructure.BrandString, 48, s, 48); + gCPUStructure.BrandString.takeValueFrom(s); + gCPUStructure.BrandString.trim(); - if (!strncmp((const CHAR8*)gCPUStructure.BrandString, CPU_STRING_UNKNOWN, iStrLen((gCPUStructure.BrandString) + 1, 48))) { - gCPUStructure.BrandString[0] = '\0'; + if ( gCPUStructure.BrandString.isEqual(CPU_STRING_UNKNOWN) ) { + gCPUStructure.BrandString.setEmpty(); } - gCPUStructure.BrandString[47] = '\0'; - DBG("BrandString = %s\n", gCPUStructure.BrandString); + DBG("BrandString = %s\n", gCPUStructure.BrandString.c_str()); } //Calculate Nr of Cores @@ -278,16 +278,16 @@ void GetCPUProperties (void) } // if ((bit(9) & gCPUStructure.CPUID[CPUID_1][ECX]) != 0) { -// SSSE3 = TRUE; +// SSSE3 = true; // } - gCPUStructure.Turbo = FALSE; + gCPUStructure.Turbo = false; if (gCPUStructure.Vendor == CPU_VENDOR_INTEL) { // Determine turbo boost support DoCpuid(6, gCPUStructure.CPUID[CPUID_6]); gCPUStructure.Turbo = ((gCPUStructure.CPUID[CPUID_6][EAX] & BIT1) != 0); DBG(" The CPU%s supported turbo\n", gCPUStructure.Turbo?"":" not"); //get cores and threads - BOOLEAN PerfBias = (gCPUStructure.CPUID[CPUID_6][ECX] & BIT3) != 0; + XBool PerfBias = (gCPUStructure.CPUID[CPUID_6][ECX] & BIT3) != 0; DBG(" Energy PerfBias is %s visible:\n", PerfBias?"":" not"); switch (gCPUStructure.Model) { @@ -368,18 +368,19 @@ void GetCPUProperties (void) //workaround for Xeon Harpertown and Yorkfield if ((gCPUStructure.Model == CPU_MODEL_PENRYN) && (gCPUStructure.Cores == 0)) { - if ((AsciiStrStr(gCPUStructure.BrandString, "X54")) || - (AsciiStrStr(gCPUStructure.BrandString, "E54")) || - (AsciiStrStr(gCPUStructure.BrandString, "W35")) || - (AsciiStrStr(gCPUStructure.BrandString, "X34")) || - (AsciiStrStr(gCPUStructure.BrandString, "X33")) || - (AsciiStrStr(gCPUStructure.BrandString, "L33")) || - (AsciiStrStr(gCPUStructure.BrandString, "X32")) || - (AsciiStrStr(gCPUStructure.BrandString, "L3426")) || - (AsciiStrStr(gCPUStructure.BrandString, "L54"))) { + if ( gCPUStructure.BrandString.contains("X54") || + gCPUStructure.BrandString.contains("E54") || + gCPUStructure.BrandString.contains("W35") || + gCPUStructure.BrandString.contains("X34") || + gCPUStructure.BrandString.contains("X33") || + gCPUStructure.BrandString.contains("L33") || + gCPUStructure.BrandString.contains("X32") || + gCPUStructure.BrandString.contains("L3426") || + gCPUStructure.BrandString.contains("L54") + ) { gCPUStructure.Cores = 4; gCPUStructure.Threads = 4; - } else if (AsciiStrStr(gCPUStructure.BrandString, "W36")) { + } else if ( gCPUStructure.BrandString.contains("W36") ) { gCPUStructure.Cores = 6; gCPUStructure.Threads = 6; } else { //other Penryn and Wolfdale @@ -397,14 +398,13 @@ void GetCPUProperties (void) } //workaround for N270. I don't know why it detected wrong - if ((gCPUStructure.Model == CPU_MODEL_ATOM) && - (AsciiStrStr(gCPUStructure.BrandString, "270"))) { + if ((gCPUStructure.Model == CPU_MODEL_ATOM) && gCPUStructure.BrandString.contains("270") ) { gCPUStructure.Cores = 1; gCPUStructure.Threads = 2; } //workaround for Quad - if (AsciiStrStr(gCPUStructure.BrandString, "Quad")) { + if ( gCPUStructure.BrandString.contains("Quad") ) { gCPUStructure.Cores = 4; gCPUStructure.Threads = 4; } @@ -530,7 +530,7 @@ void GetCPUProperties (void) MsgLog("MSR 0xE2 before patch %08llX\n", msr); if (msr & 0x8000) { MsgLog("MSR 0xE2 is locked, PM patches will be turned on\n"); - GlobalConfig.NeedPMfix = TRUE; + GlobalConfig.NeedPMfix = true; } // AsmWriteMsr64(MSR_PKG_CST_CONFIG_CONTROL, (msr & 0x8000000ULL)); // msr = AsmReadMsr64(MSR_PKG_CST_CONFIG_CONTROL); @@ -613,7 +613,7 @@ void GetCPUProperties (void) case CPU_MODEL_PENRYN:// Core 2 Duo/Extreme, Xeon, 45nm , Mobile //case CPU_MODEL_WOLFDALE:// Core 2 Duo/Extreme, Xeon, 45nm, Desktop like Penryn but not Mobile if(AsmReadMsr64(MSR_IA32_PLATFORM_ID) & (1 << 28)){ - gCPUStructure.Mobile = TRUE; + gCPUStructure.Mobile = true; } gCPUStructure.TSCFrequency = MultU64x32(gCPUStructure.MaxSpeed, Mega); //MHz -> Hz gCPUStructure.CPUFrequency = gCPUStructure.TSCFrequency; @@ -636,7 +636,7 @@ void GetCPUProperties (void) gCPUStructure.MaxRatio = (UINT32)DivU64x32(gCPUStructure.TSCFrequency, 200 * Mega); } gCPUStructure.MaxRatio = gCPUStructure.MaxRatio * 10 + gCPUStructure.SubDivider * 5; - if (AsciiStrStr(gCPUStructure.BrandString, "P8400")) { + if ( gCPUStructure.BrandString.contains("P8400") ) { gCPUStructure.MaxRatio = 85; gCPUStructure.FSBFrequency = DivU64x32(MultU64x32(gCPUStructure.TSCFrequency, 10), gCPUStructure.MaxRatio); DBG("workaround for Code2Duo P8400, MaxRatio=8.5\n"); @@ -1290,7 +1290,7 @@ UINT16 GetAdvancedCpuType() case CPU_MODEL_CELERON: //M520 case CPU_MODEL_MEROM: // Merom case CPU_MODEL_PENRYN:// Penryn - if (AsciiStrStr(gCPUStructure.BrandString, "Xeon")) + if ( gCPUStructure.BrandString.contains("Xeon") ) return 0x402; // Xeon case CPU_MODEL_ATOM: // Atom (45nm) return GetStandardCpuType(); @@ -1299,21 +1299,21 @@ UINT16 GetAdvancedCpuType() return 0x402; case CPU_MODEL_NEHALEM: // Intel Core i7 LGA1366 (45nm) - if (AsciiStrStr(gCPUStructure.BrandString, "Xeon")) + if ( gCPUStructure.BrandString.contains("Xeon") ) return 0x501; // Xeon return 0x701; // Core i7 case CPU_MODEL_FIELDS: // Lynnfield, Clarksfield, Jasper - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x601; // Core i5 return 0x701; // Core i7 case CPU_MODEL_DALES: // Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale) - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x901; // Core i3 //why not 902? Ask Apple - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x602; // Core i5 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x702; // Core i7 if (gCPUStructure.Cores <= 2) { return 0x602; @@ -1323,11 +1323,11 @@ UINT16 GetAdvancedCpuType() //case CPU_MODEL_ARRANDALE: case CPU_MODEL_CLARKDALE: // Intel Core i3, i5, i7 LGA1156 (32nm) (Clarkdale, Arrandale) - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x901; // Core i3 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x601; // Core i5 - (M540 -> 0x0602) - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x701; // Core i7 if (gCPUStructure.Cores <= 2) { return 0x601; @@ -1336,26 +1336,26 @@ UINT16 GetAdvancedCpuType() case CPU_MODEL_WESTMERE: // Intel Core i7 LGA1366 (32nm) 6 Core (Gulftown, Westmere-EP, Westmere-WS) case CPU_MODEL_WESTMERE_EX: // Intel Core i7 LGA1366 (45nm) 6 Core ??? - if (AsciiStrStr(gCPUStructure.BrandString, "Xeon")) + if ( gCPUStructure.BrandString.contains("Xeon") ) return 0x501; // Xeon return 0x701; // Core i7 case CPU_MODEL_SANDY_BRIDGE: - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x903; // Core i3 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x603; // Core i5 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x703; // Core i7 if (gCPUStructure.Cores <= 2) { return 0x603; } return 0x703; case CPU_MODEL_IVY_BRIDGE: - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x903; // Core i3 - Apple doesn't use it - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x604; // Core i5 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x704; // Core i7 if (gCPUStructure.Cores <= 2) { return 0x604; @@ -1363,13 +1363,13 @@ UINT16 GetAdvancedCpuType() return 0x704; case CPU_MODEL_HASWELL_U5: // case CPU_MODEL_SKYLAKE_S: - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) M")) + if ( gCPUStructure.BrandString.contains("Core(TM) M") ) return 0xB06; // Core M - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x906; // Core i3 - Apple doesn't use it - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x606; // Core i5 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x706; // Core i7 if (gCPUStructure.Cores <= 2) { return 0x606; @@ -1401,27 +1401,27 @@ UINT16 GetAdvancedCpuType() case CPU_MODEL_COMETLAKE_U: case CPU_MODEL_TIGERLAKE_C: case CPU_MODEL_TIGERLAKE_D: - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i3")) + if ( gCPUStructure.BrandString.contains("Core(TM) i3") ) return 0x905; // Core i3 - Apple doesn't use it - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i5")) + if ( gCPUStructure.BrandString.contains("Core(TM) i5") ) return 0x605; // Core i5 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7-8")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7-8") ) return 0x709; // Core i7 CoffeeLake - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7-9")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7-9") ) return 0x1005; // Core i7 CoffeeLake - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7-1")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7-1") ) return 0x070B; // Core i7 IceLake - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i7")) + if ( gCPUStructure.BrandString.contains("Core(TM) i7") ) return 0x705; // Core i7 - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) i9")) + if ( gCPUStructure.BrandString.contains("Core(TM) i9") ) return 0x1009; // Core i7 CoffeeLake - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) m3")) + if ( gCPUStructure.BrandString.contains("Core(TM) m3") ) return 0xC05; - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) m5")) + if ( gCPUStructure.BrandString.contains("Core(TM) m5") ) return 0xD05; - if (AsciiStrStr(gCPUStructure.BrandString, "Core(TM) m7")) + if ( gCPUStructure.BrandString.contains("Core(TM) m7") ) return 0xE05; - if (AsciiStrStr(gCPUStructure.BrandString, "Xeon")) + if ( gCPUStructure.BrandString.contains("Xeon") ) return 0xF01; if (gCPUStructure.Cores <= 2) { return 0x605; @@ -1441,7 +1441,7 @@ MACHINE_TYPES GetDefaultModel() return MacPro61; } // TODO: Add more CPU models and configure the correct machines per CPU/GFX model - bool isMobile = getMobileFromSmbios(); + XBool isMobile = getMobileFromSmbios(); if(isMobile) { switch (gCPUStructure.Model) { @@ -1470,8 +1470,7 @@ MACHINE_TYPES GetDefaultModel() break; case CPU_MODEL_JAKETOWN: case CPU_MODEL_SANDY_BRIDGE: - if((AsciiStrStr(gCPUStructure.BrandString, "i3")) || - (AsciiStrStr(gCPUStructure.BrandString, "i5"))) { + if ( gCPUStructure.BrandString.contains("i3") || gCPUStructure.BrandString.contains("i5") ) { DefaultType = MacBookPro81; break; } @@ -1492,21 +1491,21 @@ MACHINE_TYPES GetDefaultModel() DefaultType = MacBookPro111; break; case CPU_MODEL_HASWELL_U5: // Broadwell Mobile - if(AsciiStrStr(gCPUStructure.BrandString, "M")) { + if ( gCPUStructure.BrandString.contains("M") ) { DefaultType = MacBook81; break; } DefaultType = MacBookPro121; break; case CPU_MODEL_SKYLAKE_U: - if(AsciiStrStr(gCPUStructure.BrandString, "m")) { + if ( gCPUStructure.BrandString.contains("m") ) { DefaultType = MacBook91; break; } DefaultType = MacBookPro131; break; case CPU_MODEL_KABYLAKE1: - if(AsciiStrStr(gCPUStructure.BrandString, "Y")) { + if ( gCPUStructure.BrandString.contains("Y") ) { DefaultType = MacBook101; break; } @@ -1550,7 +1549,7 @@ MACHINE_TYPES GetDefaultModel() DefaultType = MacPro41; break; case CPU_MODEL_FIELDS: - if(AsciiStrStr(gCPUStructure.BrandString, "Xeon")) { + if ( gCPUStructure.BrandString.contains("Xeon") ) { DefaultType = MacPro41; break; } @@ -1573,12 +1572,11 @@ MACHINE_TYPES GetDefaultModel() DefaultType = MacMini51; break; } - if((AsciiStrStr(gCPUStructure.BrandString, "i3")) || - (AsciiStrStr(gCPUStructure.BrandString, "i5"))) { + if ( gCPUStructure.BrandString.contains("i3") || gCPUStructure.BrandString.contains("i5") ) { DefaultType = iMac121; break; } - if(AsciiStrStr(gCPUStructure.BrandString, "i7")) { + if ( gCPUStructure.BrandString.contains("i7") ) { DefaultType = iMac122; break; } @@ -1591,7 +1589,7 @@ MACHINE_TYPES GetDefaultModel() DefaultType = MacMini62; break; } - if (AsciiStrStr(gCPUStructure.BrandString, "i3")) { + if ( gCPUStructure.BrandString.contains("i3") ) { DefaultType = iMac131; break; } @@ -1608,7 +1606,7 @@ MACHINE_TYPES GetDefaultModel() break; case CPU_MODEL_KABYLAKE1: case CPU_MODEL_KABYLAKE2: - if (AsciiStrStr(gCPUStructure.BrandString, "i5")) { + if ( gCPUStructure.BrandString.contains("i5") ) { DefaultType = iMac182; break; } @@ -1617,7 +1615,7 @@ MACHINE_TYPES GetDefaultModel() case CPU_MODEL_HASWELL: case CPU_MODEL_HASWELL_E: DefaultType = iMac142; - if (AsciiStrStr(gCPUStructure.BrandString, "70S")) { + if ( gCPUStructure.BrandString.contains("70S") ) { DefaultType = iMac141; break; } diff --git a/rEFIt_UEFI/Platform/cpu.h b/rEFIt_UEFI/Platform/cpu.h index 2099ea12c..f4641233d 100644 --- a/rEFIt_UEFI/Platform/cpu.h +++ b/rEFIt_UEFI/Platform/cpu.h @@ -343,53 +343,53 @@ MSR C001006B 0000-0000-0000-0000 typedef struct { //values from CPUID - UINT32 CPUID[CPUID_MAX][4]; - UINT32 Vendor; - UINT32 Signature; - UINT32 Family; - UINT32 Model; - UINT32 Stepping; - UINT32 Type; - UINT32 Extmodel; - UINT32 Extfamily; - UINT64 Features; - UINT64 ExtFeatures; - UINT32 CoresPerPackage; - UINT32 LogicalPerPackage; - CHAR8 BrandString[48]; + UINT32 CPUID[CPUID_MAX][4] = {{0}}; + UINT32 Vendor = 0; + UINT32 Signature = 0; + UINT32 Family = 0; + UINT32 Model = 0; + UINT32 Stepping = 0; + UINT32 Type = 0; + UINT32 Extmodel = 0; + UINT32 Extfamily = 0; + UINT64 Features = 0; + UINT64 ExtFeatures = 0; + UINT32 CoresPerPackage = 0; + UINT32 LogicalPerPackage = 0; + XString8 BrandString = XString8(); //values from BIOS - UINT64 ExternalClock; - UINT32 MaxSpeed; //MHz - UINT32 CurrentSpeed; //MHz -// UINT32 Pad; + UINT64 ExternalClock = 0; + UINT32 MaxSpeed = 0; //MHz + UINT32 CurrentSpeed = 0; //MHz +// UINT32 Pad = 0; //calculated from MSR - UINT64 MicroCode; - UINT64 ProcessorFlag; - UINT32 MaxRatio; - UINT32 SubDivider; - UINT32 MinRatio; - UINT32 DynFSB; - UINT64 ProcessorInterconnectSpeed; //MHz - UINT64 FSBFrequency; //Hz - UINT64 CPUFrequency; - UINT64 TSCFrequency; - UINT8 Cores; - UINT8 EnabledCores; - UINT8 Threads; - UINT8 Mobile; //not for i3-i7 - BOOLEAN Turbo; - UINT8 Pad2[3]; + UINT64 MicroCode = 0; + UINT64 ProcessorFlag = 0; + UINT32 MaxRatio = 0; + UINT32 SubDivider = 0; + UINT32 MinRatio = 0; + UINT32 DynFSB = 0; + UINT64 ProcessorInterconnectSpeed = 0; //MHz + UINT64 FSBFrequency = 0; //Hz + UINT64 CPUFrequency = 0; + UINT64 TSCFrequency = 0; + UINT8 Cores = 0; + UINT8 EnabledCores = 0; + UINT8 Threads = 0; + UINT8 Mobile = 0; //not for i3-i7 + XBool Turbo = false; + UINT8 Pad2[3] = {0}; /* Core i7,5,3 */ - UINT16 Turbo1; //1 Core - UINT16 Turbo2; //2 Core - UINT16 Turbo3; //3 Core - UINT16 Turbo4; //4 Core + UINT16 Turbo1 = 0; //1 Core + UINT16 Turbo2 = 0; //2 Core + UINT16 Turbo3 = 0; //3 Core + UINT16 Turbo4 = 0; //4 Core - UINT64 TSCCalibr; - UINT64 ARTFrequency; + UINT64 TSCCalibr = 0; + UINT64 ARTFrequency = 0; } CPU_STRUCTURE; diff --git a/rEFIt_UEFI/Platform/device_inject.cpp b/rEFIt_UEFI/Platform/device_inject.cpp index 6b373bcf3..ba0e6afda 100644 --- a/rEFIt_UEFI/Platform/device_inject.cpp +++ b/rEFIt_UEFI/Platform/device_inject.cpp @@ -213,7 +213,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt, -BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len) +XBool devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len) { UINT32 offset; UINT32 off; @@ -224,7 +224,7 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *v UINT8 *newdata; if(!device || !nm || !vl /*|| !len*/) //rehabman: allow zero length data - return FALSE; + return false; /* DBG("devprop_add_value %s=", nm); for (i=0; idata) && (offset > 1)) { CopyMem((void*)newdata, (void*)device->data, offset); } @@ -273,10 +273,10 @@ BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *v device->data = newdata; FreePool(data); - return TRUE; + return true; } -bool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer& vl) +XBool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer& vl) { return devprop_add_value(device, nm.data(), vl.data(), vl.size()); } @@ -343,19 +343,19 @@ void devprop_free_string(DevPropString *StringBuf) } // Ethernet built-in device injection -BOOLEAN set_eth_props(pci_dt_t *eth_dev) +XBool set_eth_props(pci_dt_t *eth_dev) { #if DEBUG_INJECT // CHAR8 *devicepath; #endif DevPropDevice *device = NULL; UINT8 builtin = 0x0; - BOOLEAN Injected = FALSE; + XBool Injected = false; UINTN i; CHAR8 compatible[64]; if (!gSettings.Devices.LANInjection) { - return FALSE; + return false; } if (!device_inject_string) { @@ -366,11 +366,11 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev) #endif if (eth_dev && !eth_dev->used) { device = devprop_add_device_pci(device_inject_string, eth_dev, NULL); - eth_dev->used = TRUE; + eth_dev->used = true; } if (!device) { - return FALSE; + return false; } // ------------------------------------------------- // DBG("LAN Controller [%04X:%04X] :: %s\n", eth_dev->vendor_id, eth_dev->device_id, devicepath); @@ -384,7 +384,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev) if (gSettings.Devices.AddPropertyArray[i].Device != DEV_LAN) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -396,7 +396,7 @@ BOOLEAN set_eth_props(pci_dt_t *eth_dev) } if (Injected) { DBG("custom LAN properties injected, continue\n"); - // return TRUE; + // return true; } // DBG("Setting dev.prop built-in=0x%X\n", builtin); @@ -430,14 +430,14 @@ static UINT16 current_in_sleep = 1000; static UINT16 current_available_high = 2100; //mA static UINT16 current_extra_high = 3200; -BOOLEAN set_usb_props(pci_dt_t *usb_dev) +XBool set_usb_props(pci_dt_t *usb_dev) { #if DEBUG_INJECT // CHAR8 *devicepath; #endif DevPropDevice *device = NULL; UINT32 fake_devid; - BOOLEAN Injected = FALSE; + XBool Injected = false; UINTN i; if (!device_inject_string) @@ -448,11 +448,11 @@ BOOLEAN set_usb_props(pci_dt_t *usb_dev) if (usb_dev && !usb_dev->used) { device = devprop_add_device_pci(device_inject_string, usb_dev, NULL); - usb_dev->used = TRUE; + usb_dev->used = true; } if (!device) { - return FALSE; + return false; } // ------------------------------------------------- // DBG("USB Controller [%04X:%04X] :: %s\n", usb_dev->vendor_id, usb_dev->device_id, devicepath); @@ -463,7 +463,7 @@ BOOLEAN set_usb_props(pci_dt_t *usb_dev) if (gSettings.Devices.AddPropertyArray[i].Device != DEV_USB) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -475,7 +475,7 @@ BOOLEAN set_usb_props(pci_dt_t *usb_dev) } if (Injected) { DBG("custom USB properties injected, continue\n"); - // return TRUE; + // return true; } if (gSettings.Devices.USB.InjectClockID) { diff --git a/rEFIt_UEFI/Platform/device_inject.h b/rEFIt_UEFI/Platform/device_inject.h index 67f8e8013..a613356c8 100644 --- a/rEFIt_UEFI/Platform/device_inject.h +++ b/rEFIt_UEFI/Platform/device_inject.h @@ -121,13 +121,13 @@ extern UINT32 device_inject_stringlength; DevPropString *devprop_create_string(void); //DevPropDevice *devprop_add_device(DevPropString *string, char *path); DevPropDevice *devprop_add_device_pci(DevPropString *string, pci_dt_t *PciDt, EFI_DEVICE_PATH_PROTOCOL *DevicePath); -BOOLEAN devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len); // to be removed -bool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer& vl); +XBool devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len); // to be removed +XBool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer& vl); XBuffer devprop_generate_string(DevPropString *string); void devprop_free_string(DevPropString *string); -BOOLEAN set_eth_props(pci_dt_t *eth_dev); -BOOLEAN set_usb_props(pci_dt_t *usb_dev); +XBool set_eth_props(pci_dt_t *eth_dev); +XBool set_usb_props(pci_dt_t *usb_dev); UINT32 PciAddrFromDevicePath(EFI_DEVICE_PATH_PROTOCOL* DevicePath); diff --git a/rEFIt_UEFI/Platform/gma.cpp b/rEFIt_UEFI/Platform/gma.cpp index 6c2ea202b..6dc0b1fc5 100755 --- a/rEFIt_UEFI/Platform/gma.cpp +++ b/rEFIt_UEFI/Platform/gma.cpp @@ -959,7 +959,7 @@ CONST CHAR8 *get_gma_model(UINT16 id) } -BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildVersion, EFI_FILE* RootDir, pci_dt_t *gma_dev) +XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildVersion, EFI_FILE* RootDir, pci_dt_t *gma_dev) { UINTN j; UINTN i; @@ -970,12 +970,12 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil UINT32 FakeID; UINT32 DualLink = 1; // UINT64 os_version = AsciiOSVersionToUint64(macOSVersion); - BOOLEAN SetUGAWidth = FALSE; - BOOLEAN SetUGAHeight = FALSE; - BOOLEAN Injected = FALSE; - BOOLEAN SetFake = FALSE; - BOOLEAN SetSnb = FALSE; - BOOLEAN SetIg = FALSE; + XBool SetUGAWidth = false; + XBool SetUGAHeight = false; + XBool Injected = false; + XBool SetFake = false; + XBool SetSnb = false; + XBool SetIg = false; MACHINE_TYPES MacModel = GetModelFromString(gSettings.Smbios.ProductName); @@ -998,14 +998,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil // Resolution switch (UGAWidth) { case 640: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 360: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found one ninth of a Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 480: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1014,14 +1014,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 800: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 480: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide VGA Display - 5:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 600: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Super VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1030,23 +1030,23 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 854: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 480) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Full Wide VGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 960: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 540: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found one quarter of Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 640: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Double-size VGA Display - 3:2 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1055,18 +1055,18 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 1024: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 576: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Super VGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 600: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Super VGA Display - 17:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 768: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1075,31 +1075,31 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 1152: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 864) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found XGA Plus Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 1280: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 720: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 768: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide XGA Display - 5:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 800: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 1024: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Super XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1108,41 +1108,41 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 1366: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 768) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Full Wide XGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 1400: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 1050) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Super XGA Plus Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 1440: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 900) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide XGA Plus Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 1600: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 900: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 1200: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1151,10 +1151,10 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 1680: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 1050: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Widescreen Super XGA Plus Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1163,14 +1163,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 1920: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 1080: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 1200: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1179,14 +1179,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 2048: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 1152: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad Wide XGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 1536: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1195,18 +1195,18 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 2560: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 1440: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 1600: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Quad XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 2048: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad Wide XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1215,27 +1215,27 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 2880: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 1800) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Quad XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 3200: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 1800: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 2048: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Quad Super XGA Display - 25:16 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 2400: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Quad Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1244,14 +1244,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 3840: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 2160: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Ultra HD, 4K Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 2400: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Quad Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1260,27 +1260,27 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 4096: - SetUGAWidth = TRUE; + SetUGAWidth = true; if(UGAHeight == 3072) { - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Hex XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } else { DBG(" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); } break; case 5120: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 2880: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Ultra HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 3200: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Hex XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 4096: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Hex Super XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1289,14 +1289,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 6400: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 4096: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Hex Super XGA Display - 25:16 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 4800: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Hex Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1305,14 +1305,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil } break; case 7680: - SetUGAWidth = TRUE; + SetUGAWidth = true; switch (UGAHeight) { case 4320: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Full Ultra HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; case 4800: - SetUGAHeight = TRUE; + SetUGAHeight = true; DBG(" Found Wide Hex Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight); break; default: @@ -1331,11 +1331,11 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil if (gma_dev && !gma_dev->used) { device = devprop_add_device_pci(device_inject_string, gma_dev, NULL); - gma_dev->used = TRUE; + gma_dev->used = true; } if (!device) { - return FALSE; + return false; } if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore @@ -1343,7 +1343,7 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil if (gSettings.Devices.AddPropertyArray[i].Device != DEV_INTEL) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -1468,7 +1468,7 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4); FakeID = gSettings.Devices.FakeID.FakeIntel & 0xFFFF; devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4); - SetFake = TRUE; + SetFake = true; MsgLog(" FakeID Intel GFX = 0x%08x\n", gSettings.Devices.FakeID.FakeIntel); } else { DBG(" FakeID Intel GFX: not set\n"); @@ -1486,7 +1486,7 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil if (GlobalConfig.IgPlatform != 0) { devprop_add_value(device, "AAPL,snb-platform-id", (UINT8*)&GlobalConfig.IgPlatform, 4); MsgLog(" snb-platform-id = 0x%08x\n", GlobalConfig.IgPlatform); - SetSnb = TRUE; + SetSnb = true; } else { DBG(" snb-platform-id: not set\n"); } @@ -1495,7 +1495,7 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil if (GlobalConfig.IgPlatform != 0) { devprop_add_value(device, "AAPL,ig-platform-id", (UINT8*)&GlobalConfig.IgPlatform, 4); MsgLog(" ig-platform-id = 0x%08x\n", GlobalConfig.IgPlatform); - SetIg = TRUE; + SetIg = true; } else { DBG(" ig-platform-id: not set\n"); } @@ -1504,7 +1504,7 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil if (gSettings.Devices.NoDefaultProperties) { MsgLog(" Intel: no default properties\n"); - return TRUE; + return true; } devprop_add_value(device, "model", (UINT8*)model, (UINT32)AsciiStrLen(model)); @@ -3344,14 +3344,14 @@ BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& Buil default: DBG(" Intel card id=%hX unsupported, please report to the clover thread\n", gma_dev->device_id); - return FALSE; + return false; } #if DEBUG_GMA == 2 gBS->Stall(5000000); #endif - return TRUE; + return true; } //thanks to jalavoui #if 0 diff --git a/rEFIt_UEFI/Platform/gma.h b/rEFIt_UEFI/Platform/gma.h index bc3fcc899..028a9f845 100644 --- a/rEFIt_UEFI/Platform/gma.h +++ b/rEFIt_UEFI/Platform/gma.h @@ -7,8 +7,8 @@ //#include "device_inject.h" //#include "../gui/menu_items/menu_items.h" -//BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev); // do not use LOADER_ENTRY to avoid dependency -BOOLEAN setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildVersion, EFI_FILE* RootDir, pci_dt_t *gma_dev); +//XBool setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev); // do not use LOADER_ENTRY to avoid dependency +XBool setup_gma_devprop(const MacOsVersion& macOSVersion, const XString8& BuildVersion, EFI_FILE* RootDir, pci_dt_t *gma_dev); struct gma_gpu_t { UINT32 device; diff --git a/rEFIt_UEFI/Platform/guid.h b/rEFIt_UEFI/Platform/guid.h index 5e4ae40fc..0e12c963f 100644 --- a/rEFIt_UEFI/Platform/guid.h +++ b/rEFIt_UEFI/Platform/guid.h @@ -28,7 +28,7 @@ public: EFI_GUIDClass(const EFI_GUID& other) { Data1 = other.Data1; Data2 = other.Data2; Data3 = other.Data3; memcpy(Data4, other.Data4, sizeof(Data4)); } - bool operator == (const EFI_GUID& other) const { + XBool operator == (const EFI_GUID& other) const { if ( !(Data1 == other.Data1) ) return false; if ( !(Data2 == other.Data2) ) return false; if ( !(Data3 == other.Data3) ) return false; @@ -40,20 +40,20 @@ public: extern const XString8 nullGuidAsString; extern EFI_GUID nullGuid; -/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ +/** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ template -BOOLEAN IsValidGuidString(const T* Str, IntegralType n) +XBool IsValidGuidString(const T* Str, IntegralType n) { UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace if ( n != 36 ) { - return FALSE; + return false; } for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) { if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) { if (Str[Index4IsValidGuidAsciiString] != '-') { - return FALSE; + return false; } } else { if (!( @@ -63,36 +63,36 @@ BOOLEAN IsValidGuidString(const T* Str, IntegralType n) ) ) { - return FALSE; + return false; } } } - return TRUE; + return true; } -/** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ +/** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ template -BOOLEAN IsValidGuidString(const T& Str) +XBool IsValidGuidString(const T& Str) { if ( Str.isEmpty() ) return false; return IsValidGuidString(Str.data(), Str.length()); } -///** Returns TRUE is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ +///** Returns true is Str is ascii Guid in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */ //template -//BOOLEAN IsValidGuidAsciiString(const T& Str) +//XBool IsValidGuidAsciiString(const T& Str) //{ // UINTN Index4IsValidGuidAsciiString; // stupid name to avoid warning : Declaration shadows a variable in the global namespace // // if ( Str.length() != 36 ) { -// return FALSE; +// return false; // } // // for (Index4IsValidGuidAsciiString = 0; Index4IsValidGuidAsciiString < 36; Index4IsValidGuidAsciiString++) { // if (Index4IsValidGuidAsciiString == 8 || Index4IsValidGuidAsciiString == 13 || Index4IsValidGuidAsciiString == 18 || Index4IsValidGuidAsciiString == 23) { // if (Str[Index4IsValidGuidAsciiString] != '-') { -// return FALSE; +// return false; // } // } else { // if (!( @@ -102,12 +102,12 @@ BOOLEAN IsValidGuidString(const T& Str) // ) // ) // { -// return FALSE; +// return false; // } // } // } // -// return TRUE; +// return true; //} diff --git a/rEFIt_UEFI/Platform/hda.cpp b/rEFIt_UEFI/Platform/hda.cpp index cf1fe6ee8..23136a3ac 100644 --- a/rEFIt_UEFI/Platform/hda.cpp +++ b/rEFIt_UEFI/Platform/hda.cpp @@ -117,7 +117,7 @@ UINT32 HDA_IC_sendVerb(EFI_PCI_IO_PROTOCOL *PciIo, UINT32 codecAdr, UINT32 nodeI #endif -BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle) +XBool EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle) { EFI_STATUS Status; EFI_PCI_IO_PROTOCOL *PciIo; @@ -130,13 +130,13 @@ BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle) // get device PciIo protocol Status = gBS->OpenProtocol(PciDevHandle, &gEfiPciIoProtocolGuid, (void **)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (EFI_ERROR(Status)) { - return FALSE; + return false; } // get device location Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function); if (EFI_ERROR(Status)) { - return FALSE; + return false; } // iterate over all GFX devices and check for sibling @@ -144,19 +144,19 @@ BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle) if (gConf.GfxPropertiesArray[Index].Segment == Segment && gConf.GfxPropertiesArray[Index].Bus == Bus && gConf.GfxPropertiesArray[Index].Device == Device) { - return TRUE; + return true; } } - return FALSE; + return false; } -BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const MacOsVersion& OSVersion) +XBool setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const MacOsVersion& OSVersion) { DevPropDevice *device = NULL; UINT32 layoutId = 0; UINT32 codecId = 0; - BOOLEAN Injected = FALSE; + XBool Injected = false; UINTN i; if (!device_inject_string) { @@ -164,15 +164,15 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M } if (IsHDMIAudio(hda_dev->DeviceHandle)) { if (!gSettings.Devices.HDMIInjection) { - return FALSE; + return false; } if (hda_dev && !hda_dev->used) { device = devprop_add_device_pci(device_inject_string, hda_dev, NULL); - hda_dev->used = TRUE; + hda_dev->used = true; } if (!device) { - return FALSE; + return false; } if (gSettings.Devices.AddPropertyArray.size() != 0xFFFE) { // Looks like NrAddProperties == 0xFFFE is not used anymore @@ -180,7 +180,7 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M if (gSettings.Devices.AddPropertyArray[i].Device != DEV_HDMI) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -192,7 +192,7 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M } if (Injected) { DBG("Additional HDMI properties injected, continue\n"); - //return TRUE; + //return true; } else { if (gSettings.Devices.UseIntelHDMI) { DBG(" HDMI Audio, used with HDA setting hda-gfx=onboard-2\n"); @@ -204,14 +204,14 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M } } else { if (!gSettings.Devices.Audio.HDAInjection) { - return FALSE; + return false; } if (hda_dev && !hda_dev->used) { device = devprop_add_device_pci(device_inject_string, hda_dev, NULL); - hda_dev->used = TRUE; + hda_dev->used = true; } if (!device) { - return FALSE; + return false; } // HDA - determine layout-id if (gSettings.Devices.Audio.HDALayoutId > 0) { @@ -226,7 +226,7 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M if (gSettings.Devices.AddPropertyArray[i].Device != DEV_HDA) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -253,7 +253,7 @@ BOOLEAN setup_hda_devprop(EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const M devprop_add_value(device, "PinConfigurations", (UINT8 *)&layoutId, 1); } } - return TRUE; + return true; } diff --git a/rEFIt_UEFI/Platform/hda.h b/rEFIt_UEFI/Platform/hda.h index 10da71d9f..93b32550b 100644 --- a/rEFIt_UEFI/Platform/hda.h +++ b/rEFIt_UEFI/Platform/hda.h @@ -341,14 +341,14 @@ typedef enum { } HRDW_MANUFACTERER; -BOOLEAN +XBool setup_hda_devprop ( EFI_PCI_IO_PROTOCOL *PciIo, pci_dt_t *hda_dev, const MacOsVersion& OSVersion ); -BOOLEAN EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle); +XBool EFIAPI IsHDMIAudio(EFI_HANDLE PciDevHandle); void ResetHDA(); #endif /* !__LIBSAIO_GMA_H */ diff --git a/rEFIt_UEFI/Platform/kernel_patcher.cpp b/rEFIt_UEFI/Platform/kernel_patcher.cpp index 20aa62684..1758eb2b9 100644 --- a/rEFIt_UEFI/Platform/kernel_patcher.cpp +++ b/rEFIt_UEFI/Platform/kernel_patcher.cpp @@ -52,13 +52,13 @@ //UINT32 *dtLength; //UINT8 *KernelData = NULL; //UINT32 KernelSlide = 0; -//BOOLEAN isKernelcache = FALSE; -//BOOLEAN is64BitKernel = FALSE; -//BOOLEAN SSSE3; +//XBool isKernelcache = false; +//XBool is64BitKernel = false; +//XBool SSSE3; -//BOOLEAN PatcherInited = FALSE; -//BOOLEAN gSNBEAICPUFixRequire = FALSE; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not -//BOOLEAN gBDWEIOPCIFixRequire = FALSE; // Broadwell-E IOPCIFamily fix require or not +//XBool PatcherInited = false; +//XBool gSNBEAICPUFixRequire = false; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not +//XBool gBDWEIOPCIFixRequire = false; // Broadwell-E IOPCIFamily fix require or not extern EFI_GUID gEfiAppleBootGuid; @@ -224,7 +224,7 @@ UINTN LOADER_ENTRY::searchProcInDriver(UINT8 * driver, UINT32 driverLen, const X } INT32 i; UINT32 Offset = 0; // Init to avoid warning - bool found = false; + XBool found = false; for (i = 0; i < lSizeVtable; ++i) { Offset = vArray[i].n_un.n_strx; if (strstr(&Names[Offset], procedure.c_str())) { @@ -334,7 +334,7 @@ UINTN LOADER_ENTRY::searchProc(const XString8& procedure) //search for the name // gBS->Stall(9000000); size_t i; - bool found = false; + XBool found = false; for (i=0; i> 4) & 0x0f; UINT8 FakeExt = (KernelAndKextPatches.FakeCPUID >> 0x10) & 0x0f; for (Num = 0; Num < 2; Num++) { @@ -847,7 +847,7 @@ BOOLEAN LOADER_ENTRY::PatchCPUID(const UINT8* Location, INT32 LenLoc, CopyMem(&KernelData[Adr + patchLocation1], ReplaceExt, Len); KernelData[Adr + patchLocation1 + 1] = FakeExt; } - Patched = TRUE; + Patched = true; } } return Patched; @@ -917,7 +917,7 @@ void LOADER_ENTRY::KernelCPUIDPatch() #define NEW_PM 1 -BOOLEAN LOADER_ENTRY::KernelPatchPm() +XBool LOADER_ENTRY::KernelPatchPm() { DBG_RT("Patching kernel power management...\n"); #if NEW_PM @@ -987,7 +987,7 @@ BOOLEAN LOADER_ENTRY::KernelPatchPm() UINT64* Ptr = (UINT64*)KernelData; UINT64* End = Ptr + 0x1000000/sizeof(UINT64); if (Ptr == NULL) { - return FALSE; + return false; } @@ -1032,24 +1032,24 @@ BOOLEAN LOADER_ENTRY::KernelPatchPm() gBS->Stall(3000000); } #endif - return TRUE; + return true; } const UINT8 PanicNoKextDumpFind[] = {0x00, 0x25, 0x2E, 0x2A, 0x73, 0x00}; //STATIC UINT8 PanicNoKextDumpReplace[6] = {0x00, 0x00, 0x2E, 0x2A, 0x73, 0x00}; -BOOLEAN LOADER_ENTRY::KernelPanicNoKextDump() +XBool LOADER_ENTRY::KernelPanicNoKextDump() { INT32 patchLocation; patchLocation = FindBin(KernelData, 0xF00000, PanicNoKextDumpFind, 6); if (patchLocation > 0) { KernelData[patchLocation + 1] = 0; - return TRUE; + return true; } - return FALSE; + return false; } -BOOLEAN LOADER_ENTRY::KernelLapicPatch_64() +XBool LOADER_ENTRY::KernelLapicPatch_64() { // Credits to donovan6000 and Sherlocks for providing the lapic kernel patch source used to build this function @@ -1125,7 +1125,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64() if (!patchLocation1) { DBG_RT( "Can't find Lapic panic, kernel patch aborted.\n"); - return FALSE; + return false; } // Already patched? May be running a non-vanilla kernel already? @@ -1133,11 +1133,11 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64() bytes[patchLocation1 + 2] == 0x90 && bytes[patchLocation1 + 3] == 0x90 && bytes[patchLocation1 + 4] == 0x90) { DBG_RT( "Lapic panic already patched, kernel file (10.6 - 10.9) manually patched?\n"); - return FALSE; + return false; } else if (bytes[patchLocation1 + 0] == 0x31 && bytes[patchLocation1 + 1] == 0xC0 && bytes[patchLocation1 + 2] == 0x90 && bytes[patchLocation1 + 3] == 0x90) { DBG_RT( "Lapic panic already patched, kernel file (10.10 - recent macOS) manually patched?\n"); - return FALSE; + return false; } else { if (bytes[patchLocation1 + 8] == 0x3B && bytes[patchLocation1 + 9] == 0x05 && bytes[patchLocation1 + 13] == 0x00) { @@ -1174,13 +1174,13 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64() if (!patchLocation2) { DBG_RT( "Can't find Lapic panic master (10.10 - recent macOS), kernel patch aborted.\n"); - return FALSE; + return false; } // Already patched? May be running a non-vanilla kernel already? if (bytes[patchLocation2 + 5] == 0x31 && bytes[patchLocation2 + 6] == 0xC0) { DBG_RT( "Lapic panic master already patched, kernel file (10.10 - recent macOS) manually patched?\n"); - return FALSE; + return false; } else { DBG_RT( "Patched Lapic panic master (10.10 - recent macOS)\n"); // E8 XX XX FF FF 83 XX XX XX XX 00 00 @@ -1203,10 +1203,10 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_64() Stall(3000000); // } - return TRUE; + return true; } -BOOLEAN LOADER_ENTRY::KernelLapicPatch_32() +XBool LOADER_ENTRY::KernelLapicPatch_32() { // Credits to donovan6000 and Sherlocks for providing the lapic kernel patch source used to build this function @@ -1229,7 +1229,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_32() if (!patchLocation) { DBG_RT( "Can't find Lapic panic, kernel patch aborted.\n"); - return FALSE; + return false; } // Already patched? May be running a non-vanilla kernel already? @@ -1238,7 +1238,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_32() bytes[patchLocation + 2] == 0x90 && bytes[patchLocation + 3] == 0x90 && bytes[patchLocation + 4] == 0x90) { DBG_RT( "Lapic panic already patched, kernel file manually patched?\n"); - return FALSE; + return false; } else { DBG_RT( "Patched Lapic panic (32-bit)\n"); for (i = 0; i < 5; i++) { @@ -1250,7 +1250,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_32() Stall(3000000); // } - return TRUE; + return true; } // @@ -1259,7 +1259,7 @@ BOOLEAN LOADER_ENTRY::KernelLapicPatch_32() // SandyBridge-E, Ivy Bridge, Ivy Bridge-E, Haswell Celeron/Pentium, Haswell-E, Broadwell-E, ... // credit Pike R.Alpha, stinga11, syscl // -//BOOLEAN (*EnableExtCpuXCPM)(void *kernelData); +//XBool (*EnableExtCpuXCPM)(void *kernelData); // // syscl - applyKernPatch a wrapper for SearchAndReplace() to make the CpuPM patch tidy and clean @@ -1278,7 +1278,7 @@ void LOADER_ENTRY::applyKernPatch(const UINT8 *find, UINTN size, const UINT8 *re // Global XCPM patches compatibility // Currently 10.8.5 - 10.15 // -static inline BOOLEAN IsXCPMOSVersionCompat(const MacOsVersion& macOSVersion) +static inline XBool IsXCPMOSVersionCompat(const MacOsVersion& macOSVersion) { return macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("11.1.0"_XS8); } @@ -1288,17 +1288,17 @@ static inline BOOLEAN IsXCPMOSVersionCompat(const MacOsVersion& macOSVersion) // // syscl - SandyBridgeEPM(): enable PowerManagement on SandyBridge-E // -BOOLEAN LOADER_ENTRY::SandyBridgeEPM() +XBool LOADER_ENTRY::SandyBridgeEPM() { // note: a dummy function that made patches consistency - return TRUE; + return true; } // // syscl - Enable Haswell-E XCPM // Hex data provided and polished (c) PMheart, idea (c) Pike R.Alpha // -BOOLEAN LOADER_ENTRY::HaswellEXCPM() +XBool LOADER_ENTRY::HaswellEXCPM() { DBG("HaswellEXCPM() ===>\n"); UINT8 *kern = KernelData; @@ -1310,8 +1310,8 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM() // check OS version suit for patches if (!IsXCPMOSVersionCompat(macOSVersion)) { DBG("HaswellEXCPM(): Unsupported macOS.\n"); - DBG("HaswellEXCPM() <===FALSE\n"); - return FALSE; + DBG("HaswellEXCPM() <===false\n"); + return false; } // _cpuid_set_info @@ -1453,19 +1453,19 @@ BOOLEAN LOADER_ENTRY::HaswellEXCPM() DBG("Applied _xcpm_pkg_scope_msr patch\n"); } else { DBG("_xcpm_pkg_scope_msr not found, patch aborted\n"); - DBG("HaswellEXCPM() <===FALSE\n"); - return FALSE; + DBG("HaswellEXCPM() <===false\n"); + return false; } } DBG("HaswellEXCPM() <===\n"); - return TRUE; + return true; } // // Enable Broadwell-E/EP PowerManagement on 10.12+ by syscl // -BOOLEAN LOADER_ENTRY::BroadwellEPM() +XBool LOADER_ENTRY::BroadwellEPM() { DBG("BroadwellEPM() ===>\n"); @@ -1476,8 +1476,8 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM() // check OS version suit for patches if (!IsXCPMOSVersionCompat(macOSVersion)) { DBG("BroadwellEPM(): Unsupported macOS.\n"); - DBG("BroadwellEPM() <===FALSE\n"); - return FALSE; + DBG("BroadwellEPM() <===false\n"); + return false; } KernelAndKextPatches.FakeCPUID = (UINT32)(macOSVersion.notEmpty() && macOSVersion < MacOsVersion("10.10.3"_XS8) ? 0x0306C0 : 0x040674); @@ -1511,20 +1511,20 @@ BOOLEAN LOADER_ENTRY::BroadwellEPM() DBG("Applied _xcpm_pkg_scope_msr patch\n"); } else { DBG("_xcpm_pkg_scope_msr not found, patch aborted\n"); - DBG("BroadwellEPM() <===FALSE\n"); - return FALSE; + DBG("BroadwellEPM() <===false\n"); + return false; } } DBG("BroadwellEPM() <===\n"); - return TRUE; + return true; } // // syscl - this patch provides XCPM support for Haswell low-end(HSWLowEnd) and platforms later than Haswell // implemented by syscl // credit also Pike R.Alpha, stinga11, Sherlocks, vit9696 // -BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM() +XBool LOADER_ENTRY::HaswellLowEndXCPM() { DBG("HaswellLowEndXCPM() ===>\n"); // UINT64 os_version = AsciiOSVersionToUint64(macOSVersion); @@ -1533,8 +1533,8 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM() // check OS version suit for patches if (!IsXCPMOSVersionCompat(macOSVersion)) { DBG("HaswellLowEndXCPM(): Unsupported macOS.\n"); - DBG("HaswellLowEndXCPM() <===FALSE\n"); - return FALSE; + DBG("HaswellLowEndXCPM() <===false\n"); + return false; } KernelAndKextPatches.FakeCPUID = (UINT32)(0x0306A0); // correct FakeCPUID @@ -1543,7 +1543,7 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM() // 10.8.5 - 10.11.x no need the following kernel patches on Haswell Celeron/Pentium if (macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8)) { DBG("HaswellLowEndXCPM() <===\n"); - return TRUE; + return true; } // _xcpm_idle //this is a part of KernelPM @@ -1611,13 +1611,13 @@ BOOLEAN LOADER_ENTRY::HaswellLowEndXCPM() } DBG("HaswellLowEndXCPM() <===\n"); - return TRUE; + return true; } // // this patch provides XCPM support for Ivy Bridge. by PMheart // -BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM() +XBool LOADER_ENTRY::KernelIvyBridgeXCPM() { XString8 comment; // UINT32 i; @@ -1627,20 +1627,20 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM() // check whether Ivy Bridge if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE) { DBG("KernelIvyBridgeXCPM(): Unsupported platform.\nRequires Ivy Bridge, aborted\n"); - DBG("KernelIvyBridgeXCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyBridgeXCPM() <===false\n"); + return false; } // check OS version suit for patches // PMheart: attempt to add 10.14 compatibility if (!IsXCPMOSVersionCompat(macOSVersion)) { DBG("KernelIvyBridgeXCPM():Unsupported macOS.\n"); - DBG("KernelIvyBridgeXCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyBridgeXCPM() <===false\n"); + return false; } else if (macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8)) { // 10.8.5 - 10.11.x no need the following kernel patches on Ivy Bridge - we just use -xcpm boot-args DBG("KernelIvyBridgeXCPM() <===\n"); - return TRUE; + return true; } DBG("Searching _xcpm_pkg_scope_msr ...\n"); @@ -1667,8 +1667,8 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM() DBG("Applied _xcpm_pkg_scope_msr patch\n"); } else { DBG("_xcpm_pkg_scope_msr not found, patch aborted\n"); - DBG("KernelIvyBridgeXCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyBridgeXCPM() <===false\n"); + return false; } } @@ -1715,14 +1715,14 @@ BOOLEAN LOADER_ENTRY::KernelIvyBridgeXCPM() } */ DBG("KernelIvyBridgeXCPM() <===\n"); - return TRUE; + return true; } // // this patch provides XCPM support for Ivy Bridge-E. by PMheart // attempt to enable XCPM for Ivy-E, still need to test further // -BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM() +XBool LOADER_ENTRY::KernelIvyE5XCPM() { UINT8 *kern = (UINT8*)KernelData; XString8 comment; @@ -1733,16 +1733,16 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM() // check whether Ivy Bridge-E5 if (gCPUStructure.Model != CPU_MODEL_IVY_BRIDGE_E5) { DBG("KernelIvyE5XCPM(): Unsupported platform.\nRequires Ivy Bridge-E, aborted\n"); - DBG("KernelIvyE5XCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyE5XCPM() <===false\n"); + return false; } // check OS version suit for patches // PMheart: attempt to add 10.15 compatibility if (!IsXCPMOSVersionCompat(macOSVersion)) { DBG("KernelIvyE5XCPM(): Unsupported macOS.\n"); - DBG("KernelIvyE5XCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyE5XCPM() <===false\n"); + return false; } // _cpuid_set_info @@ -1806,8 +1806,8 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM() DBG("Applied _xcpm_pkg_scope_msr patch\n"); } else { // DBG("_xcpm_pkg_scope_msr not found, patch aborted\n"); - DBG("KernelIvyE5XCPM() <===FALSE\n"); - return FALSE; + DBG("KernelIvyE5XCPM() <===false\n"); + return false; } } @@ -1888,7 +1888,7 @@ BOOLEAN LOADER_ENTRY::KernelIvyE5XCPM() } DBG("KernelIvyE5XCPM() <===\n"); - return TRUE; + return true; } #if 0 void Patcher_SSE3_6(void* kernelData) @@ -1903,7 +1903,7 @@ void Patcher_SSE3_6(void* kernelData) // DBG("Start find SSE3 address\n"); i=0; //for (i=0;i 0 @@ -2523,7 +2523,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // // check that it is Mach-O header and detect architecture // if(MACH_GET_MAGIC(KernelData) == MH_MAGIC || MACH_GET_MAGIC(KernelData) == MH_CIGAM) { // DBG("Found 32 bit kernel at 0x%llx\n", (UINTN)KernelData); -// is64BitKernel = FALSE; +// is64BitKernel = false; // } else if (MACH_GET_MAGIC(KernelData) == MH_MAGIC_64 || MACH_GET_MAGIC(KernelData) == MH_CIGAM_64) { // DBG( "Found 64 bit kernel at 0x%llx\n", (UINTN)KernelData); //// DBG_RT("text section is: %s\n", (const char*)&KernelData[0x28]); @@ -2549,7 +2549,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // KernelOffset = GetTextExec(); //// DBG("BigSur: KernelOffset =0x%X\n", KernelOffset); // } -// is64BitKernel = TRUE; +// is64BitKernel = true; // } else { // // not valid Mach-O header - exiting // DBG( "Kernel not found at 0x%llx - skipping patches!\n", (UINTN)KernelData); @@ -2596,7 +2596,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) //void //LOADER_ENTRY::KernelAndKextsPatcherStart() //{ -// BOOLEAN KextPatchesNeeded, patchedOk; +// XBool KextPatchesNeeded, patchedOk; // /* // * it was intended for custom entries but not work if no custom entries used // * so set common until better solution invented @@ -2673,7 +2673,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // DBG( "KernelPm patch: Enabled\n"); //// KernelAndKextPatcherInit(); //// if (KernelData == NULL) goto NoKernelData; -// patchedOk = FALSE; +// patchedOk = false; // if (is64BitKernel) { // patchedOk = KernelPatchPm(); // } @@ -2718,8 +2718,8 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // // syscl - EnableExtCpuXCPM: Enable unsupported CPU's PowerManagement // // //// EnableExtCpuXCPM = NULL; -// patchedOk = FALSE; -//// BOOLEAN apply_idle_patch = (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U) && gSettings.HWP; +// patchedOk = false; +//// XBool apply_idle_patch = (gCPUStructure.Model >= CPU_MODEL_SKYLAKE_U) && gSettings.HWP; //// KernelAndKextPatcherInit(); //// if (KernelData == NULL) goto NoKernelData; // @@ -2733,7 +2733,7 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // case CPU_MODEL_JAKETOWN: // // SandyBridge-E LGA2011 // patchedOk = SandyBridgeEPM(); -// gSNBEAICPUFixRequire = TRUE; // turn on SandyBridge-E AppleIntelCPUPowerManagement Fix +// gSNBEAICPUFixRequire = true; // turn on SandyBridge-E AppleIntelCPUPowerManagement Fix // break; // // case CPU_MODEL_IVY_BRIDGE: @@ -2755,13 +2755,13 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // case CPU_MODEL_BROADWELL_DE: // // Broadwell-E/EP // patchedOk = BroadwellEPM(); -// gBDWEIOPCIFixRequire = TRUE; +// gBDWEIOPCIFixRequire = true; // break; // // default: // if (gCPUStructure.Model >= CPU_MODEL_HASWELL && -// (AsciiStrStr(gCPUStructure.BrandString, "Celeron") || -// AsciiStrStr(gCPUStructure.BrandString, "Pentium"))) { +// ( gCPUStructure.BrandString.contains("Celeron") || +// gCPUStructure.BrandString.contains("Pentium"))) { // // Haswell+ low-end CPU // patchedOk = HaswellLowEndXCPM(); // } @@ -2780,8 +2780,8 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize) // if (/*OSFLAG_ISSET(Flags, OSFLAG_WITHKEXTS) || */ // OSFLAG_ISSET(Flags, OSFLAG_CHECKFAKESMC)) { // DBG_RT( "\nAllowing kext patching to check if FakeSMC is present\n"); -// GlobalConfig.KextPatchesAllowed = TRUE; -// KextPatchesNeeded = TRUE; +// GlobalConfig.KextPatchesAllowed = true; +// KextPatchesNeeded = true; // } // // DBG_RT( "\nKextPatches Needed: %c, Allowed: %c ... ", diff --git a/rEFIt_UEFI/Platform/kernel_patcher.h b/rEFIt_UEFI/Platform/kernel_patcher.h index 2d2e0ee79..95fe274ea 100644 --- a/rEFIt_UEFI/Platform/kernel_patcher.h +++ b/rEFIt_UEFI/Platform/kernel_patcher.h @@ -138,16 +138,16 @@ typedef struct SEGMENT { //extern UINT32 *dtLength; //extern UINT8 *KernelData; //extern UINT32 KernelSlide; -//extern BOOLEAN isKernelcache; -//extern BOOLEAN is64BitKernel; -//extern BOOLEAN gSNBEAICPUFixRequire; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not -//extern BOOLEAN gBDWEIOPCIFixRequire; // Broadwell-E IOPCIFamily fix require or not +//extern XBool isKernelcache; +//extern XBool is64BitKernel; +//extern XBool gSNBEAICPUFixRequire; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not +//extern XBool gBDWEIOPCIFixRequire; // Broadwell-E IOPCIFamily fix require or not //extern UINT32 DisplayVendor[]; //void findCPUfamily(); -//extern BOOLEAN SSSE3; +//extern XBool SSSE3; //UINT64 kernelsize; diff --git a/rEFIt_UEFI/Platform/kext_inject.cpp b/rEFIt_UEFI/Platform/kext_inject.cpp index d7279ce69..3ec79e6cd 100644 --- a/rEFIt_UEFI/Platform/kext_inject.cpp +++ b/rEFIt_UEFI/Platform/kext_inject.cpp @@ -107,9 +107,9 @@ void toLowerStr(CHAR8 *tstr, IN CONST CHAR8 *str) { *tstr = '\0'; } -BOOLEAN LOADER_ENTRY::checkOSBundleRequired(const TagDict* dict) +XBool LOADER_ENTRY::checkOSBundleRequired(const TagDict* dict) { - BOOLEAN inject = TRUE; + XBool inject = true; const TagStruct* osBundleRequiredTag; XString8 osbundlerequired; @@ -125,7 +125,7 @@ BOOLEAN LOADER_ENTRY::checkOSBundleRequired(const TagDict* dict) osbundlerequired != "local"_XS8 && osbundlerequired != "console"_XS8 && osbundlerequired != "network-root"_XS8 ) { - inject = FALSE; + inject = false; } } @@ -136,7 +136,7 @@ BOOLEAN LOADER_ENTRY::checkOSBundleRequired(const TagDict* dict) //extern void AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize, INT32 N, LOADER_ENTRY *Entry); //XStringW infoPlistPath = getKextPlist(dir, KextEntry, &NoContents); -XStringW LOADER_ENTRY::getKextPlist(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, BOOLEAN* NoContents) +XStringW LOADER_ENTRY::getKextPlist(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, XBool* NoContents) { XStringW TempName; @@ -151,9 +151,9 @@ XStringW LOADER_ENTRY::getKextPlist(const XStringW& dirPath, const SIDELOAD_KEXT MsgLog("Failed to load extra kext : %ls \n", TempName.wc_str()); return L""_XSW; } - *NoContents = TRUE; + *NoContents = true; } else { - *NoContents = FALSE; + *NoContents = false; } return TempName; } @@ -179,7 +179,7 @@ TagDict* LOADER_ENTRY::getInfoPlist(const XStringW& infoPlistPath) } //XString8 execpath = getKextExecPath(dir, KextEntry, dict, NoContents); -XString8 LOADER_ENTRY::getKextExecPath(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, TagDict* dict, BOOLEAN NoContents) +XString8 LOADER_ENTRY::getKextExecPath(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, TagDict* dict, XBool NoContents) { const TagStruct* prop = NULL; XString8 TempName; @@ -213,11 +213,11 @@ EFI_STATUS LOADER_ENTRY::LoadKext(const EFI_FILE *RootDir, const XString8& FileN UINTN executableBufferLength = 0; // CHAR8* bundlePathBuffer = NULL; // UINTN bundlePathBufferLength = 0; - XStringW TempName; - TagDict* dict = NULL; + XStringW TempName; + TagDict* dict = NULL; const TagStruct* prop = NULL; - BOOLEAN NoContents = FALSE; - BOOLEAN inject = FALSE; + XBool NoContents = false; + XBool inject = false; _BooterKextFileInfo *infoAddr = NULL; _DeviceTreeBuffer *kext = (_DeviceTreeBuffer *)kext_v; @@ -232,7 +232,7 @@ EFI_STATUS LOADER_ENTRY::LoadKext(const EFI_FILE *RootDir, const XString8& FileN MsgLog("Failed to load extra kext : %ls status=%s\n", TempName.wc_str(), efiStrError(Status)); return EFI_NOT_FOUND; } - NoContents = TRUE; + NoContents = true; } if( ParseXML((CHAR8*)infoDictBuffer, &dict,infoDictBufferLength)!=0 ) { FreePool(infoDictBuffer); @@ -338,7 +338,7 @@ UINT32 GetListCount(LIST_ENTRY const* List) // return kextsSize; //} -void LOADER_ENTRY::LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force) +void LOADER_ENTRY::LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN XBool Force) { REFIT_DIR_ITER PlugInIter; EFI_FILE_INFO *PlugInFile; @@ -504,14 +504,14 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray* kextArray) MsgLog(" Force kext: %s\n", FileName.c_str()); AddKext( Volume->RootDir, FileName, archCpuType); XString8 PlugIns = S8Printf("%s\\Contents\\PlugIns", FileName.c_str()); - LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE); + LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, true); } DirIterClose(&PlugInIter); } else { XString8 Path = S8Printf("%ls", p); AddKext( Volume->RootDir, Path, archCpuType); XString8 PlugIns = S8Printf("%s\\Contents\\PlugIns", Path.c_str()); - LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE); + LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, true); } } } @@ -536,18 +536,18 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray* kextArray) // syscl - allow specific load inject kext // Clover/Kexts/Other is for general injection thus we need to scan both Other and macOSVersion folder - SrcDir = GetOtherKextsDir(TRUE); + SrcDir = GetOtherKextsDir(true); if ( SrcDir.notEmpty() ) { AddKextsFromDirInArray(SrcDir, archCpuType, kextArray); } else { - DBG("GetOtherKextsDir(TRUE) return NULL\n"); + DBG("GetOtherKextsDir(true) return NULL\n"); } // slice: CLOVER/kexts/Off keep disabled kext which can be allowed - SrcDir = GetOtherKextsDir(FALSE); + SrcDir = GetOtherKextsDir(false); if ( SrcDir.notEmpty() ) { AddKextsFromDirInArray(SrcDir, archCpuType, kextArray); } else { - DBG("GetOtherKextsDir(FALSE) return NULL\n"); + DBG("GetOtherKextsDir(false) return NULL\n"); } if ( macOSVersion.notEmpty() ) diff --git a/rEFIt_UEFI/Platform/kext_patcher.cpp b/rEFIt_UEFI/Platform/kext_patcher.cpp index 79f4688f2..845603df0 100644 --- a/rEFIt_UEFI/Platform/kext_patcher.cpp +++ b/rEFIt_UEFI/Platform/kext_patcher.cpp @@ -60,20 +60,20 @@ UINTN FindRelative32(const UINT8 *Source, UINTN Start, UINTN SourceSize, UINTN t /* UINTN FindSection(const UINT8 *Source, UINTN len, const UINT8* seg, const UINT8* sec) { - BOOLEAN eq; + XBool eq; for (UINTN i = 0x20; i < len; i++) { - eq = TRUE; + eq = true; for (UINTN j = 0; j < 16 && (sec[j] != 0); j++) { if (Source[i + j] != sec[j]) { - eq = FALSE; + eq = false; break; } } if (eq) { for (UINTN j = 0; j < 16 && (seg[j] != 0); j++) { if (Source[i + 0x10 + j] != seg[j]) { - eq = FALSE; + eq = false; break; } } @@ -143,10 +143,10 @@ void ExtractKextBundleIdentifier(CHAR8 *Plist) } } -BOOLEAN +XBool isPatchNameMatch (CHAR8 *BundleIdentifier, CHAR8 *Name) { - BOOLEAN isBundle = (AsciiStrStr(Name, ".") != NULL); + XBool isBundle = (AsciiStrStr(Name, ".") != NULL); return isBundle ? (AsciiStrCmp(BundleIdentifier, Name) == 0) @@ -163,7 +163,7 @@ isPatchNameMatch (CHAR8 *BundleIdentifier, CHAR8 *Name) // // inited or not? -BOOLEAN ATIConnectorsPatchInited = FALSE; +XBool ATIConnectorsPatchInited = false; // ATIConnectorsController's boundle IDs for // 0: ATI version - Lion, SnowLeo 10.6.7 2011 MBP @@ -193,7 +193,7 @@ void LOADER_ENTRY::ATIConnectorsPatchInit() KernelAndKextPatches.KPATIConnectorsController.c_str() ); - ATIConnectorsPatchInited = TRUE; + ATIConnectorsPatchInited = true; //DBG(L"Bundle1: %s\n", ATIKextBundleId[0]); //DBG(L"Bundle2: %s\n", ATIKextBundleId[1]); @@ -574,7 +574,7 @@ void LOADER_ENTRY::SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *Info // now let's patch it if (macOSVersion < MacOsVersion("10.9"_XS8) || macOSVersion >= MacOsVersion("10.14"_XS8)) { DBG("Unsupported macOS.\nSandyBridge-E requires macOS 10.9 - 10.13.x, aborted\n"); - DBG("SNBE_AICPUPatch() <===FALSE\n"); + DBG("SNBE_AICPUPatch() <===false\n"); return; } @@ -957,7 +957,7 @@ void LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPli if (!kextpatch.IsPlistPatch) { // kext binary patch DBG_RT("Binary patch\n"); - bool once = false; + XBool once = false; UINTN procLen = 0; UINTN procAddr = searchProcInDriver(Driver, DriverSize, kextpatch.ProcedureName); @@ -1122,7 +1122,7 @@ void LOADER_ENTRY::PatchKext(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, for (size_t i = 0; i < KernelAndKextPatches.KextPatches.size(); i++) { XString8& Name = KernelAndKextPatches.KextPatches[i].Name; - BOOLEAN isBundle = Name.contains("."); + XBool isBundle = Name.contains("."); if ((KernelAndKextPatches.KextPatches[i].Find.size() > 0) && isBundle?(AsciiStrCmp(gKextBundleIdentifier, Name.c_str()) == 0):(AsciiStrStr(gKextBundleIdentifier, Name.c_str()) != NULL)) { // (AsciiStrStr(InfoPlist, KernelAndKextPatches.KextPatches[i].Name) != NULL)) { diff --git a/rEFIt_UEFI/Platform/nvidia.cpp b/rEFIt_UEFI/Platform/nvidia.cpp index 23300bb50..c47b63afa 100644 --- a/rEFIt_UEFI/Platform/nvidia.cpp +++ b/rEFIt_UEFI/Platform/nvidia.cpp @@ -1823,7 +1823,7 @@ static INT32 patch_nvidia_rom(UINT8 *rom) UINT16 dcbptr; UINT8 *dcbtable; UINT8 *togroup; - INT32 has_lvds = FALSE; + INT32 has_lvds = false; struct dcbentry { UINT8 type; UINT8 index; @@ -1832,7 +1832,7 @@ static INT32 patch_nvidia_rom(UINT8 *rom) // DBG("patch_nvidia_rom\n"); if (!rom || (rom[0] != 0x55 && rom[1] != 0xaa)) { - DBG("FALSE ROM signature: 0x%02hhX%02hhX\n", rom[0], rom[1]); + DBG("false ROM signature: 0x%02hhX%02hhX\n", rom[0], rom[1]); return PATCH_ROM_FAILED; } @@ -1907,7 +1907,7 @@ static INT32 patch_nvidia_rom(UINT8 *rom) for (i = 0; i < num_outputs; i++) { if (entries[i].type == 3) { - has_lvds =TRUE; + has_lvds =true; //DBG("found LVDS\n"); channel1 |= (0x1 << entries[i].index); entries[i].type = TYPE_GROUPED; @@ -2019,7 +2019,7 @@ CONST CHAR8 *get_nvidia_model(UINT32 device_id, UINT32 subsys_id) //ErmaC added selector for nVidia "old" style in System Profiler //DBG("NvidiaGeneric = %ls\n", gSettings.Graphics.NvidiaGeneric?L"YES":L"NO"); - if (gSettings.Graphics.NvidiaGeneric == FALSE) + if (gSettings.Graphics.NvidiaGeneric == false) { // Then check the exceptions table if (subsys_id) { @@ -2148,7 +2148,7 @@ UINT64 mem_detect(UINT16 nvCardType, pci_dt_t *nvda_dev) break; case 0x0649: // 9600M GT 0649 // 10DE06491043202D 1GB VRAM - if (((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id) == 0x1043202D) { + if (((nvda_dev->subsys_id_union.subsys.vendor_id << 16) | nvda_dev->subsys_id_union.subsys.device_id) == 0x1043202D) { vram_size = 1024*1024*1024; } break; @@ -2171,14 +2171,14 @@ UINT64 mem_detect(UINT16 nvCardType, pci_dt_t *nvda_dev) return vram_size; } -BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) +XBool setup_nvidia_devprop(pci_dt_t *nvda_dev) { const INT32 MAX_BIOS_VERSION_LENGTH = 32; EFI_STATUS Status = EFI_NOT_FOUND; DevPropDevice *device = NULL; XString8 devicepath; - BOOLEAN load_vbios = gSettings.Graphics.LoadVBios; - BOOLEAN Injected = FALSE; + XBool load_vbios = gSettings.Graphics.LoadVBios; + XBool Injected = false; UINT8 *rom = NULL; UINT16 nvCardType = 0; UINT64 videoRam = 0; @@ -2194,7 +2194,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) INT32 crlf_count = 0; option_rom_pci_header_t *rom_pci_header; XString8 version_str; - BOOLEAN RomAssigned = FALSE; + XBool RomAssigned = false; UINT32 device_id, subsys_id; const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD *nvcard; @@ -2204,7 +2204,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) // subsystem = (nvda_dev->subsys_id.subsys.vendor_id << 16) + // nvda_dev->subsys_id.subsys.device_id; device_id = ((nvda_dev->vendor_id << 16) | nvda_dev->device_id); - subsys_id = ((nvda_dev->subsys_id.subsys.vendor_id << 16) | nvda_dev->subsys_id.subsys.device_id); + subsys_id = ((nvda_dev->subsys_id_union.subsys.vendor_id << 16) | nvda_dev->subsys_id_union.subsys.device_id); // get card type nvCardType = (REG32(nvda_dev->regs, 0) >> 20) & 0x1ff; @@ -2245,7 +2245,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) if (n_ports == 0) { // !nvcard->VideoPorts n_ports = gConf.GfxPropertiesArray[j].Ports; } - if (load_vbios == FALSE) { // !nvcard->LoadVBios + if (load_vbios == false) { // !nvcard->LoadVBios load_vbios = gConf.GfxPropertiesArray[j].LoadVBios; } break; @@ -2255,12 +2255,12 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) if (load_vbios) { - XStringW FileName = SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + XStringW FileName = SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id_union.subsys.vendor_id, nvda_dev->subsys_id_union.subsys.device_id); Status = EFI_NOT_FOUND; if ( selfOem.oemDirExists() ) { if (FileExists(&selfOem.getOemDir(), FileName)) { - DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id_union.subsys.vendor_id, nvda_dev->subsys_id_union.subsys.device_id); Status = egLoadFile(&selfOem.getOemDir(), FileName.wc_str(), &buffer, &bufferLen); } else { FileName.SWPrintf("ROM\\10de_%04hX.rom", nvda_dev->device_id); @@ -2272,9 +2272,9 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) } if ( Status == EFI_NOT_FOUND ) { - FileName.SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + FileName.SWPrintf("ROM\\10de_%04hX_%04hX_%04hX.rom", nvda_dev->device_id, nvda_dev->subsys_id_union.subsys.vendor_id, nvda_dev->subsys_id_union.subsys.device_id); if (FileExists(&self.getCloverDir(), FileName)) { - DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + DBG("Found specific VBIOS ROM file (10de_%04hX_%04hX_%04hX.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id_union.subsys.vendor_id, nvda_dev->subsys_id_union.subsys.device_id); Status = egLoadFile(&self.getCloverDir(), FileName.wc_str(), &buffer, &bufferLen); } else { FileName.SWPrintf("ROM\\10de_%04hX.rom", nvda_dev->device_id); @@ -2324,11 +2324,11 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) } } if (!rom) rom = buffer; - RomAssigned = TRUE; + RomAssigned = true; DBG(" using loaded ROM image\n"); } else { DBG(" there are no ROM loaded and no VBIOS read from hardware\n"); - // return FALSE; + // return false; } } @@ -2405,7 +2405,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) if (nvda_dev && !nvda_dev->used) { device = devprop_add_device_pci(device_inject_string, nvda_dev, NULL); - nvda_dev->used = TRUE; + nvda_dev->used = true; } DBG("Nvidia: VideoPorts:"); @@ -2434,7 +2434,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) if (gSettings.Devices.AddPropertyArray[i].Device != DEV_NVIDIA) { continue; } - Injected = TRUE; + Injected = true; if (!gSettings.Devices.AddPropertyArray[i].MenuItem.BValue) { //DBG(" disabled property Key: %s, len: %d\n", gSettings.Devices.AddPropertyArray[i].Key, gSettings.Devices.AddPropertyArray[i].ValueLen); @@ -2445,7 +2445,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) } if (Injected) { DBG("custom NVIDIA properties injected, continue\n"); - //return TRUE; + //return true; } } @@ -2544,6 +2544,6 @@ done: if (!RomAssigned) { FreePool(rom); } - return TRUE; + return true; } diff --git a/rEFIt_UEFI/Platform/nvidia.h b/rEFIt_UEFI/Platform/nvidia.h index f8e4ea5fd..d903cc2a0 100644 --- a/rEFIt_UEFI/Platform/nvidia.h +++ b/rEFIt_UEFI/Platform/nvidia.h @@ -56,7 +56,7 @@ extern CHAR8* gDeviceProperties; -//BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev); +//XBool setup_nvidia_devprop(pci_dt_t *nvda_dev); typedef struct nvidia_pci_info_t { @@ -180,7 +180,7 @@ extern const UINT8 default_NVPM[]; extern const UINT8 default_dcfg_0[]; extern const UINT8 default_dcfg_1[]; -BOOLEAN +XBool setup_nvidia_devprop ( pci_dt_t *nvda_dev ); diff --git a/rEFIt_UEFI/Platform/platformdata.cpp b/rEFIt_UEFI/Platform/platformdata.cpp index 98af7d665..8bf9fcc57 100644 --- a/rEFIt_UEFI/Platform/platformdata.cpp +++ b/rEFIt_UEFI/Platform/platformdata.cpp @@ -757,7 +757,7 @@ uint64_t GetExtFwFeaturesMask(MACHINE_TYPES Model) return (uint64_t)GetFwFeaturesMaskFromModel(Model) + 0xFF00000000ull; } -bool GetMobile(MACHINE_TYPES Model) +XBool GetMobile(MACHINE_TYPES Model) { // Mobile: the battery tab in Energy Saver switch ( Model ) @@ -829,7 +829,7 @@ bool GetMobile(MACHINE_TYPES Model) case MacBookAir81: case MacBookAir82: case MacBookAir91: - return TRUE; + return true; case MacMini11: case MacMini21: case MacMini31: @@ -841,7 +841,7 @@ bool GetMobile(MACHINE_TYPES Model) case MacMini62: case MacMini71: case MacMini81: - return FALSE; + return false; case iMac41: case iMac42: case iMac51: @@ -875,7 +875,7 @@ bool GetMobile(MACHINE_TYPES Model) case iMac201: case iMac202: case iMacPro11: - return FALSE; + return false; case MacPro11: case MacPro21: case MacPro31: @@ -883,13 +883,13 @@ bool GetMobile(MACHINE_TYPES Model) case MacPro51: case MacPro61: case MacPro71: - return FALSE; + return false; case Xserve11: case Xserve21: case Xserve31: - return FALSE; + return false; case MaxMachineType: // currently a copy of iMac132 - return FALSE; + return false; default: // bug, unknown Apple model log_technical_bug("%s : cannot find model %d\n", __PRETTY_FUNCTION__, Model); return false; @@ -988,7 +988,7 @@ UINT64 GetPlatformFeature(MACHINE_TYPES Model) } } -void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RBr[8]) +void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, XBool isMobile, char RBr[8]) { memset(RBr, 0, 8); if (ApplePlatformData[Model].smcBranch[0] != 'N') { @@ -1066,7 +1066,7 @@ void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RBr[8]) } } -void getRPlt(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RPlt[8]) +void getRPlt(MACHINE_TYPES Model, UINT32 CPUModel, XBool isMobile, char RPlt[8]) { memset(RPlt, 0, 8); if (ApplePlatformData[Model].smcPlatform[0] != 'N') { @@ -1142,7 +1142,7 @@ void getRPlt(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RPlt[8]) } } -bool isReleaseDateWithYear20(MACHINE_TYPES Model) +XBool isReleaseDateWithYear20(MACHINE_TYPES Model) { switch ( Model ) { @@ -1598,11 +1598,11 @@ int compareBiosVersion(const XString8& version1, const XString8& version2) } } -bool is2ndBiosVersionGreaterThan1st(const XString8& version1, const XString8& version2) +XBool is2ndBiosVersionGreaterThan1st(const XString8& version1, const XString8& version2) { return compareBiosVersion(version1, version2) <= 0; } -bool isBiosVersionEquel(const XString8& version1, const XString8& version2) +XBool isBiosVersionEquel(const XString8& version1, const XString8& version2) { return compareBiosVersion(version1, version2) == 0; } diff --git a/rEFIt_UEFI/Platform/platformdata.h b/rEFIt_UEFI/Platform/platformdata.h index e40aff758..e706676e2 100644 --- a/rEFIt_UEFI/Platform/platformdata.h +++ b/rEFIt_UEFI/Platform/platformdata.h @@ -196,21 +196,21 @@ extern PLATFORMDATA ApplePlatformData[]; void SetDMISettingsForModel(MACHINE_TYPES Model, SETTINGS_DATA* settingsData, REFIT_CONFIG* liveConfig); MACHINE_TYPES GetModelFromString (const XString8& ProductName); -bool isReleaseDateWithYear20(MACHINE_TYPES Model); +XBool isReleaseDateWithYear20(MACHINE_TYPES Model); XString8 GetReleaseDate (MACHINE_TYPES Model); uint8_t GetChassisTypeFromModel(MACHINE_TYPES Model); uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model); uint32_t GetFwFeatures(MACHINE_TYPES Model); uint64_t GetExtFwFeatures(MACHINE_TYPES Model); uint64_t GetExtFwFeaturesMask(MACHINE_TYPES Model); -bool GetMobile(MACHINE_TYPES Model); +XBool GetMobile(MACHINE_TYPES Model); UINT64 GetPlatformFeature(MACHINE_TYPES Model); -void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RBr[8]); -void getRPlt(MACHINE_TYPES Model, UINT32 CPUModel, bool isMobile, char RPlt[8]); +void getRBr(MACHINE_TYPES Model, UINT32 CPUModel, XBool isMobile, char RBr[8]); +void getRPlt(MACHINE_TYPES Model, UINT32 CPUModel, XBool isMobile, char RPlt[8]); int compareBiosVersion(const XString8& version1, const XString8& version2); -bool is2ndBiosVersionGreaterThan1st(const XString8& version1, const XString8& version2); -bool isBiosVersionEquel(const XString8& version1, const XString8& version2); +XBool is2ndBiosVersionGreaterThan1st(const XString8& version1, const XString8& version2); +XBool isBiosVersionEquel(const XString8& version1, const XString8& version2); int compareReleaseDate(const XString8& date1, const XString8& date2); diff --git a/rEFIt_UEFI/Platform/plist/TagArray.cpp b/rEFIt_UEFI/Platform/plist/TagArray.cpp index 0669774c6..1cee53354 100755 --- a/rEFIt_UEFI/Platform/plist/TagArray.cpp +++ b/rEFIt_UEFI/Platform/plist/TagArray.cpp @@ -46,7 +46,7 @@ XObjArray TagArray::tagsFree; -bool TagArray::operator == (const TagStruct& other) const +XBool TagArray::operator == (const TagStruct& other) const { if ( !other.isArray() ) return false; if ( _arrayContent.size() != other.getArray()->arrayContent().size() ) { @@ -60,7 +60,7 @@ bool TagArray::operator == (const TagStruct& other) const return true; } -bool TagArray::debugIsEqual(const TagStruct& other, const XString8& label) const +XBool TagArray::debugIsEqual(const TagStruct& other, const XString8& label) const { if ( !other.isArray() ) { MsgLog("counterpart of '%s' is not an array\n", label.c_str()); diff --git a/rEFIt_UEFI/Platform/plist/TagArray.h b/rEFIt_UEFI/Platform/plist/TagArray.h index 4045648de..d350eba9a 100644 --- a/rEFIt_UEFI/Platform/plist/TagArray.h +++ b/rEFIt_UEFI/Platform/plist/TagArray.h @@ -22,13 +22,13 @@ public: const TagArray& operator = (const TagArray&); // Can be defined if needed virtual ~TagArray() { } - virtual bool operator == (const TagStruct& other) const; - virtual bool debugIsEqual(const TagStruct& other, const XString8& label) const; + virtual XBool operator == (const TagStruct& other) const; + virtual XBool debugIsEqual(const TagStruct& other, const XString8& label) const; virtual TagArray* getArray() { return this; } virtual const TagArray* getArray() const { return this; } - virtual bool isArray() const { return true; } + virtual XBool isArray() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Array"_XS8; } static TagArray* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagBool.cpp b/rEFIt_UEFI/Platform/plist/TagBool.cpp index 4aa558af5..a00ba2304 100755 --- a/rEFIt_UEFI/Platform/plist/TagBool.cpp +++ b/rEFIt_UEFI/Platform/plist/TagBool.cpp @@ -71,7 +71,7 @@ void TagBool::FreeTag() tagsFree.AddReference(this, true); } -bool TagBool::operator == (const TagStruct& other) const +XBool TagBool::operator == (const TagStruct& other) const { if ( !other.isBool() ) return false; return value == other.getBool()->value; diff --git a/rEFIt_UEFI/Platform/plist/TagBool.h b/rEFIt_UEFI/Platform/plist/TagBool.h index 6d0af3157..412001fc7 100644 --- a/rEFIt_UEFI/Platform/plist/TagBool.h +++ b/rEFIt_UEFI/Platform/plist/TagBool.h @@ -13,7 +13,7 @@ class TagBool : public TagStruct { static XObjArray tagsFree; - bool value; + XBool value; public: @@ -22,12 +22,12 @@ public: const TagBool& operator = (const TagBool&); // Can be defined if needed virtual ~TagBool() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagBool* getBool() { return this; } virtual const TagBool* getBool() const { return this; } - virtual bool isBool() const { return true; } + virtual XBool isBool() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Bool"_XS8; } static TagBool* getEmptyTag(); virtual void FreeTag(); @@ -37,14 +37,14 @@ public: /* * getters and setters */ - bool boolValue() const + XBool boolValue() const { // if ( !isBool() ) panic("TagBool::boolValue() : !isBool() "); return value; } - void setBoolValue(bool b) + void setBoolValue(XBool b) { -// if ( !isBool() ) panic("TagBool::setIntValue(bool) : !isBool() "); +// if ( !isBool() ) panic("TagBool::setIntValue(XBool) : !isBool() "); value = b; } diff --git a/rEFIt_UEFI/Platform/plist/TagData.cpp b/rEFIt_UEFI/Platform/plist/TagData.cpp index 18a3e6eb8..9eb3ecc4e 100755 --- a/rEFIt_UEFI/Platform/plist/TagData.cpp +++ b/rEFIt_UEFI/Platform/plist/TagData.cpp @@ -73,7 +73,7 @@ void TagData::FreeTag() tagsFree.AddReference(this, true); } -bool TagData::operator == (const TagStruct& other) const +XBool TagData::operator == (const TagStruct& other) const { if ( !other.isData() ) return false; if ( dataBuffer != other.getData()->dataBuffer ) return false; diff --git a/rEFIt_UEFI/Platform/plist/TagData.h b/rEFIt_UEFI/Platform/plist/TagData.h index 269568d48..c38c2bf3a 100644 --- a/rEFIt_UEFI/Platform/plist/TagData.h +++ b/rEFIt_UEFI/Platform/plist/TagData.h @@ -23,12 +23,12 @@ public: const TagData& operator = (const TagData&); // Can be defined if needed virtual ~TagData() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagData* getData() { return this; } virtual const TagData* getData() const { return this; } - virtual bool isData() const { return true; } + virtual XBool isData() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Data"_XS8; } static TagData* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagDate.cpp b/rEFIt_UEFI/Platform/plist/TagDate.cpp index 35c632b94..da5690c9a 100755 --- a/rEFIt_UEFI/Platform/plist/TagDate.cpp +++ b/rEFIt_UEFI/Platform/plist/TagDate.cpp @@ -72,7 +72,7 @@ void TagDate::FreeTag() tagsFree.AddReference(this, true); } -bool TagDate::operator == (const TagStruct& other) const +XBool TagDate::operator == (const TagStruct& other) const { if ( !other.isDate() ) return false; return string == other.getDate()->string; diff --git a/rEFIt_UEFI/Platform/plist/TagDate.h b/rEFIt_UEFI/Platform/plist/TagDate.h index c35f84e51..0637804c2 100644 --- a/rEFIt_UEFI/Platform/plist/TagDate.h +++ b/rEFIt_UEFI/Platform/plist/TagDate.h @@ -22,12 +22,12 @@ public: const TagDate& operator = (const TagDate&); // Can be defined if needed virtual ~TagDate() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagDate* getDate() { return this; } virtual const TagDate* getDate() const { return this; } - virtual bool isDict() const { return true; } + virtual XBool isDict() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Dict"_XS8; } static TagDate* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagDict.cpp b/rEFIt_UEFI/Platform/plist/TagDict.cpp index 72fad6c32..d2184caa3 100755 --- a/rEFIt_UEFI/Platform/plist/TagDict.cpp +++ b/rEFIt_UEFI/Platform/plist/TagDict.cpp @@ -75,7 +75,7 @@ void TagDict::FreeTag() tagsFree.AddReference(this, true); } -bool TagDict::operator == (const TagStruct& other) const +XBool TagDict::operator == (const TagStruct& other) const { if ( !other.isDict() ) return false; if ( _dictContent.size() != other.getDict()->_dictContent.size() ) { @@ -89,7 +89,7 @@ bool TagDict::operator == (const TagStruct& other) const return true; } -bool TagDict::debugIsEqual(const TagStruct& other, const XString8& label) const +XBool TagDict::debugIsEqual(const TagStruct& other, const XString8& label) const { if ( !other.isDict()) { MsgLog("counterpart of '%s' is not a dict\n", label.c_str()); diff --git a/rEFIt_UEFI/Platform/plist/TagDict.h b/rEFIt_UEFI/Platform/plist/TagDict.h index 833c9302a..e3641441c 100644 --- a/rEFIt_UEFI/Platform/plist/TagDict.h +++ b/rEFIt_UEFI/Platform/plist/TagDict.h @@ -22,13 +22,13 @@ public: const TagDict& operator = (const TagDict&); // Can be defined if needed virtual ~TagDict() { } - virtual bool operator == (const TagStruct& other) const; - virtual bool debugIsEqual(const TagStruct& other, const XString8& label) const; + virtual XBool operator == (const TagStruct& other) const; + virtual XBool debugIsEqual(const TagStruct& other, const XString8& label) const; virtual TagDict* getDict() { return this; } virtual const TagDict* getDict() const { return this; } - virtual bool isDict() const { return true; } + virtual XBool isDict() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Dict"_XS8; } static TagDict* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagFloat.cpp b/rEFIt_UEFI/Platform/plist/TagFloat.cpp index 10b9727ed..e3a9ec639 100755 --- a/rEFIt_UEFI/Platform/plist/TagFloat.cpp +++ b/rEFIt_UEFI/Platform/plist/TagFloat.cpp @@ -73,7 +73,7 @@ void TagFloat::FreeTag() tagsFree.AddReference(this, true); } -bool TagFloat::operator == (const TagStruct& other) const +XBool TagFloat::operator == (const TagStruct& other) const { if ( !other.isFloat() ) return false; return value == other.getFloat()->value; diff --git a/rEFIt_UEFI/Platform/plist/TagFloat.h b/rEFIt_UEFI/Platform/plist/TagFloat.h index 381e39588..231221618 100644 --- a/rEFIt_UEFI/Platform/plist/TagFloat.h +++ b/rEFIt_UEFI/Platform/plist/TagFloat.h @@ -22,12 +22,12 @@ public: const TagFloat& operator = (const TagFloat&); // Can be defined if needed virtual ~TagFloat() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagFloat* getFloat() { return this; } virtual const TagFloat* getFloat() const { return this; } - virtual bool isFloat() const { return true; } + virtual XBool isFloat() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Float"_XS8; } static TagFloat* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagInt64.cpp b/rEFIt_UEFI/Platform/plist/TagInt64.cpp index d2907e14b..a42b59861 100755 --- a/rEFIt_UEFI/Platform/plist/TagInt64.cpp +++ b/rEFIt_UEFI/Platform/plist/TagInt64.cpp @@ -73,7 +73,7 @@ void TagInt64::FreeTag() tagsFree.AddReference(this, true); } -bool TagInt64::operator == (const TagStruct& other) const +XBool TagInt64::operator == (const TagStruct& other) const { if ( !other.isInt64() ) return false; return value == other.getInt64()->value; diff --git a/rEFIt_UEFI/Platform/plist/TagInt64.h b/rEFIt_UEFI/Platform/plist/TagInt64.h index c77f9706c..de6c1625d 100644 --- a/rEFIt_UEFI/Platform/plist/TagInt64.h +++ b/rEFIt_UEFI/Platform/plist/TagInt64.h @@ -22,12 +22,12 @@ public: const TagInt64& operator = (const TagInt64&); // Can be defined if needed virtual ~TagInt64() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagInt64* getInt64() { return this; } virtual const TagInt64* getInt64() const { return this; } - virtual bool isInt64() const { return true; } + virtual XBool isInt64() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Int64"_XS8; } static TagInt64* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagKey.cpp b/rEFIt_UEFI/Platform/plist/TagKey.cpp index 563b62db1..7de4872af 100755 --- a/rEFIt_UEFI/Platform/plist/TagKey.cpp +++ b/rEFIt_UEFI/Platform/plist/TagKey.cpp @@ -73,7 +73,7 @@ void TagKey::FreeTag() tagsFree.AddReference(this, true); } -bool TagKey::operator == (const TagStruct& other) const +XBool TagKey::operator == (const TagStruct& other) const { if ( !other.isKey() ) return false; return _string == other.getKey()->_string; diff --git a/rEFIt_UEFI/Platform/plist/TagKey.h b/rEFIt_UEFI/Platform/plist/TagKey.h index c10e29e6d..844fcb7bd 100644 --- a/rEFIt_UEFI/Platform/plist/TagKey.h +++ b/rEFIt_UEFI/Platform/plist/TagKey.h @@ -22,12 +22,12 @@ public: const TagKey& operator = (const TagKey&); // Can be defined if needed virtual ~TagKey() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagKey* getKey() { return this; } virtual const TagKey* getKey() const { return this; } - virtual bool isKey() const { return true; } + virtual XBool isKey() const { return true; } virtual const XString8 getTypeAsXString8() const { return "Key"_XS8; } static TagKey* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/TagString8.cpp b/rEFIt_UEFI/Platform/plist/TagString8.cpp index eeb72bbeb..69dcad8e9 100755 --- a/rEFIt_UEFI/Platform/plist/TagString8.cpp +++ b/rEFIt_UEFI/Platform/plist/TagString8.cpp @@ -72,7 +72,7 @@ void TagString::FreeTag() tagsFree.AddReference(this, true); } -bool TagString::operator == (const TagStruct& other) const +XBool TagString::operator == (const TagStruct& other) const { if ( !other.isString() ) return false; return _string == other.getString()->_string; diff --git a/rEFIt_UEFI/Platform/plist/TagString8.h b/rEFIt_UEFI/Platform/plist/TagString8.h index edbcd0d05..3341e5657 100644 --- a/rEFIt_UEFI/Platform/plist/TagString8.h +++ b/rEFIt_UEFI/Platform/plist/TagString8.h @@ -22,12 +22,12 @@ public: const TagString& operator = (const TagString&); // Can be defined if needed virtual ~TagString() { } - virtual bool operator == (const TagStruct& other) const; + virtual XBool operator == (const TagStruct& other) const; virtual TagString* getString() { return this; } virtual const TagString* getString() const { return this; } - virtual bool isString() const { return true; } + virtual XBool isString() const { return true; } virtual const XString8 getTypeAsXString8() const { return "String8"_XS8; } static TagString* getEmptyTag(); virtual void FreeTag(); diff --git a/rEFIt_UEFI/Platform/plist/plist.cpp b/rEFIt_UEFI/Platform/plist/plist.cpp index b9b0bce9f..507961e3a 100755 --- a/rEFIt_UEFI/Platform/plist/plist.cpp +++ b/rEFIt_UEFI/Platform/plist/plist.cpp @@ -57,7 +57,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr); EFI_STATUS ParseTagFloat(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr); EFI_STATUS ParseTagData(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr); EFI_STATUS ParseTagDate(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr); -EFI_STATUS ParseTagBoolean(TagStruct* * tag, bool value, UINT32* lenPtr); +EFI_STATUS ParseTagBoolean(TagStruct* * tag, XBool value, UINT32* lenPtr); EFI_STATUS XMLParseNextTag (CHAR8 *buffer, TagStruct**tag, UINT32 *lenPtr); @@ -165,7 +165,7 @@ EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag,UINT32* lenPtr); //} // -bool TagStruct::debugIsEqual(const TagStruct& other, const XString8& label) const +XBool TagStruct::debugIsEqual(const TagStruct& other, const XString8& label) const { if ( *this != other ) { MsgLog("Difference at %s\n", label.c_str()); @@ -184,29 +184,29 @@ void TagStruct::printf(unsigned int ident) const } // Convenience method -bool TagStruct::isTrue() const +XBool TagStruct::isTrue() const { if ( isBool() ) return getBool()->boolValue(); return false; } -bool TagStruct::isFalse() const +XBool TagStruct::isFalse() const { if ( isBool() ) return !getBool()->boolValue(); return false; } -bool TagStruct::isTrueOrYy() const +XBool TagStruct::isTrueOrYy() const { if ( isBool() ) return getBool()->boolValue(); if ( isString() && getString()->stringValue().notEmpty() && (getString()->stringValue()[0] == 'y' || getString()->stringValue()[0] == 'Y') ) return true; return false; } -bool TagStruct::isTrueOrYes() const +XBool TagStruct::isTrueOrYes() const { if ( isBool() ) return getBool()->boolValue(); if ( isString() && getString()->stringValue().isEqual("Yes"_XS8) ) return true; return false; } -bool TagStruct::isFalseOrNn() const +XBool TagStruct::isFalseOrNn() const { if ( isBool() ) return !getBool()->boolValue(); if ( isString() && getString()->stringValue().notEmpty() && (getString()->stringValue()[0] == 'n' || getString()->stringValue()[0] == 'N') ) return true; @@ -255,7 +255,7 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagDict** dict, size_t bufSize) } } buffer_start = configBuffer; - while (TRUE) + while (true) { Status = XMLParseNextTag(configBuffer + pos, &tag, &length); DBG("pos=%u\n", pos); @@ -382,12 +382,12 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr) { Status = ParseTagDate(buffer + pos, tag, &length); } - /***** FALSE ****/ + /***** false ****/ else if (!strcmp(tagName, kXMLTagFalse)) { Status = ParseTagBoolean(tag, false, &length); } - /***** TRUE ****/ + /***** true ****/ else if (!strcmp(tagName, kXMLTagTrue)) { Status = ParseTagBoolean(tag, true, &length); @@ -426,7 +426,7 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr) //========================================================================== // ParseTagList -EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagStruct** tag, UINT32 empty, UINT32* lenPtr) +EFI_STATUS __ParseTagList(XBool isArray, CHAR8* buffer, TagStruct** tag, UINT32 empty, UINT32* lenPtr) { EFI_STATUS Status = EFI_SUCCESS; UINT32 pos; @@ -453,7 +453,7 @@ EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagStruct** tag, UINT32 e XObjArray& tagList = *tagListPtr; if (!empty) { - while (TRUE) { + while (true) { TagStruct* newDictOrArrayTag = NULL; Status = XMLParseNextTag(buffer + pos, &newDictOrArrayTag, &length); if (EFI_ERROR(Status)) { @@ -558,7 +558,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr) UINT32 length = 0; INTN integer; UINT32 size; - BOOLEAN negative = FALSE; + XBool negative = false; CHAR8* val = buffer; TagInt64* tmpTag; @@ -601,7 +601,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr) } else if ( size ) { // Decimal value if (*val == '-') { - negative = TRUE; + negative = true; val++; size--; } @@ -711,7 +711,7 @@ EFI_STATUS ParseTagDate(CHAR8* buffer, TagStruct* * tag,UINT32* lenPtr) //========================================================================== // ParseTagBoolean -EFI_STATUS ParseTagBoolean(TagStruct** tag, bool value, UINT32* lenPtr) +EFI_STATUS ParseTagBoolean(TagStruct** tag, XBool value, UINT32* lenPtr) { TagBool* tmpTag; @@ -805,20 +805,20 @@ EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag, UINT32* lenPtr) /* - return TRUE if the property present && value = TRUE - else return FALSE + return true if the property present && value = true + else return false */ -BOOLEAN +XBool IsPropertyNotNullAndTrue(const TagStruct* Prop) { return Prop != NULL && Prop->isTrueOrYy(); } /* - return TRUE if the property present && value = FALSE - else return FALSE + return true if the property present && value = false + else return false */ -BOOLEAN +XBool IsPropertyNotNullAndFalse(const TagStruct* Prop) { return Prop != NULL && Prop->isFalseOrNn(); diff --git a/rEFIt_UEFI/Platform/plist/plist.h b/rEFIt_UEFI/Platform/plist/plist.h index 3bf857ed3..847661ae4 100644 --- a/rEFIt_UEFI/Platform/plist/plist.h +++ b/rEFIt_UEFI/Platform/plist/plist.h @@ -50,9 +50,9 @@ public: // static TagStruct* getEmptyArrayTag(); virtual void FreeTag() = 0; - virtual bool operator == (const TagStruct& other) const = 0; - virtual bool operator != (const TagStruct& other) const { return !(*this == other); }; - virtual bool debugIsEqual(const TagStruct& other, const XString8& label) const; + virtual XBool operator == (const TagStruct& other) const = 0; + virtual XBool operator != (const TagStruct& other) const { return !(*this == other); }; + virtual XBool debugIsEqual(const TagStruct& other, const XString8& label) const; virtual void sprintf(unsigned int ident, XString8* s) const = 0; void printf(unsigned int ident) const; @@ -100,25 +100,25 @@ public: #endif - virtual bool isDict() const { return false; } - virtual bool isKey() const { return false; } - virtual bool isString() const { return false; } - virtual bool isInt64() const { return false; } - virtual bool isFloat() const { return false; } - virtual bool isBool() const { return false; } - virtual bool isData() const { return false; } - virtual bool isDate() const { return false; } - virtual bool isArray() const { return false; } + virtual XBool isDict() const { return false; } + virtual XBool isKey() const { return false; } + virtual XBool isString() const { return false; } + virtual XBool isInt64() const { return false; } + virtual XBool isFloat() const { return false; } + virtual XBool isBool() const { return false; } + virtual XBool isData() const { return false; } + virtual XBool isDate() const { return false; } + virtual XBool isArray() const { return false; } virtual const XString8 getTypeAsXString8() const = 0; // Convenience method - bool isTrue() const; - bool isFalse() const; - bool isTrueOrYy() const; - bool isTrueOrYes() const; - bool isFalseOrNn() const; + XBool isTrue() const; + XBool isFalse() const; + XBool isTrueOrYy() const; + XBool isTrueOrYes() const; + XBool isFalseOrNn() const; }; #include "TagDict.h" @@ -139,12 +139,12 @@ GetNextTag ( UINT32 *length ); -BOOLEAN +XBool IsPropertyNotNullAndTrue( const TagStruct* Prop ); -BOOLEAN +XBool IsPropertyNotNullAndFalse( const TagStruct* Prop ); diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index 7d6d08e2b..4ba1d7a57 100755 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -94,9 +94,9 @@ UINT16 mHandle19; UINT16 mMemory17[MAX_RAM_SLOTS]; UINT64 mInstalled[MAX_RAM_SLOTS]; UINT64 mEnabled[MAX_RAM_SLOTS]; -BOOLEAN gMobile; +XBool gMobile; UINT8 gBootStatus; -BOOLEAN Once; +XBool Once; MEM_STRUCTURE gRAM; @@ -155,7 +155,7 @@ SMBIOS_TABLE_STRING SMBIOS_TABLE_TYPE4_STR_IDX[] = { /* Functions */ // validate the SMBIOS entry point structure -BOOLEAN IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure) +XBool IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure) { UINTN I; UINT8 Length; @@ -163,7 +163,7 @@ BOOLEAN IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStruc UINT8 *BytePtr; if (!EntryPointStructure) - return FALSE; + return false; BytePtr = (UINT8*) EntryPointStructure; Length = EntryPointStructure->EntryPointLength; @@ -462,7 +462,7 @@ void PatchTableType0(const SmbiosInjectedSettings& smbiosSettings) //dunno about latest version but there is a way to set good characteristics //if use patched AppleSMBIOS //---------------- - Once = TRUE; + Once = true; UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE0_STR_IDX); @@ -542,7 +542,7 @@ void PatchTableType1(const SmbiosInjectedSettings& smbiosSettings) UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE1_STR_IDX); newSmbiosTable.Type1->WakeUpType = SystemWakeupTypePowerSwitch; - Once = TRUE; + Once = true; EFI_GUID SmUUID; // macOs take all guid as BE guid, irrespective to the variant. @@ -628,7 +628,7 @@ void PatchTableType2(const SmbiosInjectedSettings& smbiosSettings) if (smbiosSettings.BoardType == 11) { newSmbiosTable.Type2->FeatureFlag.Removable = 1; } - Once = TRUE; + Once = true; UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE2_STR_IDX); @@ -664,7 +664,7 @@ DBG("%s : UpdateSmbiosString Version=BoardVersion=%s\n", __PRETTY_FUNCTION__, sm return; } -bool getMobileFromSmbios() +XBool getMobileFromSmbios() { // System Chassis Information // @@ -684,7 +684,7 @@ void GetTableType3(SmbiosDiscoveredSettings* smbiosSettings) SmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, 0); if (SmbiosTable.Raw == NULL) { DBG("SmbiosTable: Type 3 (System Chassis Information) not found!\n"); - gMobile = FALSE; //default value + gMobile = false; //default value return; } mHandle3 = SmbiosTable.Type3->Hdr.Handle; @@ -722,7 +722,7 @@ void PatchTableType3(const SmbiosInjectedSettings& smbiosSettings) newSmbiosTable.Type3->NumberofPowerCords = 1; newSmbiosTable.Type3->ContainedElementCount = 0; newSmbiosTable.Type3->ContainedElementRecordLength = 0; - Once = TRUE; + Once = true; UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE3_STR_IDX); @@ -847,7 +847,7 @@ void PatchTableType4(const SmbiosInjectedSettings& smbiosSettings) UniquifySmbiosTableStr(newSmbiosTable, SMBIOS_TABLE_TYPE4_STR_IDX); // TODO: Set SmbiosTable.Type4->ProcessorFamily for all implemented CPU models - Once = TRUE; + Once = true; if (smbiosSettings.Model == CPU_MODEL_ATOM) { newSmbiosTable.Type4->ProcessorFamily = ProcessorFamilyIntelAtom; } @@ -1043,7 +1043,7 @@ void PatchTableType7(const SmbiosInjectedSettings& smbiosSettings) // Handle = 0x0700 + CoreN<<2 + CacheN (4-level cache is supported // L1[CoreN] = Handle - BOOLEAN correctSD = FALSE; + XBool correctSD = false; //according to spec for Smbios v2.0 max handle is 0xFFFE, for v>2.0 (we made 2.6) max handle=0xFEFF. // Value 0xFFFF means no cache @@ -1062,7 +1062,7 @@ void PatchTableType7(const SmbiosInjectedSettings& smbiosSettings) CopyMem((void*)newSmbiosTable.Type7, (void*)SmbiosTable.Type7, TableSize); correctSD = (newSmbiosTable.Type7->SocketDesignation == 0); CoreCache = newSmbiosTable.Type7->CacheConfiguration & 3; - Once = TRUE; + Once = true; //SSocketD = "L1-Cache"; if(correctSD) { @@ -1123,7 +1123,7 @@ void PatchTableType9(const SmbiosInjectedSettings& smbiosSettings) DBG("SlotDevice[%hhu].SlotID = %hhd\n", Index, smbiosSettings.SlotDevices.getSlotForIndex(Index).SlotID); DBG("SlotDevice[%hhu].SlotType = %d\n", Index, smbiosSettings.SlotDevices.getSlotForIndex(Index).SlotType); DBG("SlotDevice[%hhu].SlotName = %s\n", Index, smbiosSettings.SlotDevices.getSlotForIndex(Index).SlotName.c_str()); - DBG("SlotDevice[%hhu].Valid = %d\n", Index, smbiosSettings.SlotDevices.isSlotForIndexValid(Index)); + DBG("SlotDevice[%hhu].Valid = %d\n", Index, (bool)smbiosSettings.SlotDevices.isSlotForIndexValid(Index)); } #endif @@ -1275,7 +1275,7 @@ void GetTableType17(SmbiosDiscoveredSettings* smbiosSettings) { // Memory Device // - BOOLEAN Found; + XBool Found; // Get Table Type17 and count Size for (size_t Index = 0; Index < smbiosSettings->RamSlotCount; Index++) { //how many tables there may be? @@ -1295,14 +1295,14 @@ void GetTableType17(SmbiosDiscoveredSettings* smbiosSettings) // be skipped where others may not but it seems easier // to just skip all entries that have an error - apianti // will try - Found = FALSE; + Found = false; for (INTN Index2 = 0; Index2 < 24; Index2++) { newSmbiosTable = GetSmbiosTableFromType (EntryPoint, EFI_SMBIOS_TYPE_32BIT_MEMORY_ERROR_INFORMATION, Index2); if (newSmbiosTable.Raw == NULL) { continue; } if (newSmbiosTable.Type18->Hdr.Handle == SmbiosTable.Type17->MemoryErrorInformationHandle) { - Found = TRUE; + Found = true; DBG("Found memory information in table 18/%lld, type=0x%X, operation=0x%X syndrome=0x%X\n", Index2, newSmbiosTable.Type18->ErrorType, newSmbiosTable.Type18->ErrorOperation, @@ -1334,7 +1334,7 @@ void GetTableType17(SmbiosDiscoveredSettings* smbiosSettings) } // Determine if slot has size if (SmbiosTable.Type17->Size > 0) { - gRAM.SMBIOS[Index].InUse = TRUE; + gRAM.SMBIOS[Index].InUse = true; gRAM.SMBIOS[Index].ModuleSize = SmbiosTable.Type17->Size; if (SmbiosTable.Type17->Size == 0x7FFF) { gRAM.SMBIOS[Index].ModuleSize = SmbiosTable.Type17->ExtendedSize; @@ -1342,7 +1342,7 @@ void GetTableType17(SmbiosDiscoveredSettings* smbiosSettings) } // Determine if module frequency is sane value if ((SmbiosTable.Type17->Speed > 0) && (SmbiosTable.Type17->Speed <= MAX_RAM_FREQUENCY)) { - gRAM.SMBIOS[Index].InUse = TRUE; + gRAM.SMBIOS[Index].InUse = true; gRAM.SMBIOS[Index].Frequency = SmbiosTable.Type17->Speed; if (SmbiosTable.Type17->Speed > gRAM.Frequency) { gRAM.Frequency = SmbiosTable.Type17->Speed; @@ -1390,13 +1390,13 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings) UINT8 channelMap[MAX_RAM_SLOTS]; UINT8 expectedCount = 0; UINT8 channels = 2; - BOOLEAN insertingEmpty = TRUE; - BOOLEAN trustSMBIOS = ((gRAM.SPDInUse == 0) || smbiosSettings.TrustSMBIOS); - BOOLEAN wrongSMBIOSBanks = FALSE; - BOOLEAN isMacPro = FALSE; + XBool insertingEmpty = true; + XBool trustSMBIOS = ((gRAM.SPDInUse == 0) || smbiosSettings.TrustSMBIOS); + XBool wrongSMBIOSBanks = false; + XBool isMacPro = false; MACHINE_TYPES Model = GetModelFromString(smbiosSettings.ProductName); if ((Model == MacPro31) || (Model == MacPro41) || (Model == MacPro51) || (Model == MacPro61)) { - isMacPro = TRUE; + isMacPro = true; } // Inject user memory tables if (smbiosSettings.InjectMemoryTables) @@ -1441,7 +1441,7 @@ DBG("gSettings.Smbios.Memory.SlotCounts=%d\n", smbiosSettings.Memory.SlotCounts) DBG("gSettings.Smbios.Memory.UserChannels=%d\n", smbiosSettings.Memory.UserChannels); for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { DBG("gSettings.Smbios.Memory.User[%lld].Frequency=%d\n", Index, smbiosSettings.Memory.getSlotInfoForSlotID(Index).Frequency); - DBG("gSettings.Smbios.Memory.User[%lld].InUse=%d\n", Index, smbiosSettings.Memory.getSlotInfoForSlotID(Index).InUse); + DBG("gSettings.Smbios.Memory.User[%lld].InUse=%d\n", Index, (bool)smbiosSettings.Memory.getSlotInfoForSlotID(Index).InUse); DBG("gSettings.Smbios.Memory.User[%lld].ModuleSize=%d\n", Index, smbiosSettings.Memory.getSlotInfoForSlotID(Index).ModuleSize); DBG("gSettings.Smbios.Memory.User[%lld].PartNo=%s\n", Index, smbiosSettings.Memory.getSlotInfoForSlotID(Index).PartNo.c_str()); DBG("gSettings.Smbios.Memory.User[%lld].SerialNo=%s\n", Index, smbiosSettings.Memory.getSlotInfoForSlotID(Index).SerialNo.c_str()); @@ -1460,7 +1460,7 @@ for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { newSmbiosTable.Type17->DataWidth = 0xFFFF; newSmbiosTable.Type17->Hdr.Handle = (UINT16)(0x1100 + UserIndex); newSmbiosTable.Type17->FormFactor = (UINT8)(gMobile ? MemoryFormFactorSodimm : MemoryFormFactorDimm); - newSmbiosTable.Type17->TypeDetail.Synchronous = TRUE; + newSmbiosTable.Type17->TypeDetail.Synchronous = true; newSmbiosTable.Type17->DeviceSet = bank + 1; newSmbiosTable.Type17->MemoryArrayHandle = mHandle16; if (isMacPro) { @@ -1536,11 +1536,11 @@ for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { // Prefer the SPD information if (gRAM.SPDInUse > gRAM.SMBIOSInUse) { DBG("Not trusting SMBIOS because SPD reports more modules...\n"); - trustSMBIOS = FALSE; + trustSMBIOS = false; } else if (gRAM.SPD[0].InUse || !gRAM.SMBIOS[0].InUse) { if (gRAM.SPDInUse > 1) { DBG("Not trusting SMBIOS because SPD reports different modules...\n"); - trustSMBIOS = FALSE; + trustSMBIOS = false; } else if (gRAM.SMBIOSInUse == 1) { channels = 1; } @@ -1554,16 +1554,16 @@ for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { } } else { DBG("Not trusting SMBIOS because SPD reports only one module...\n"); - trustSMBIOS = FALSE; + trustSMBIOS = false; } } else { DBG("Not trusting SMBIOS because SPD reports less modules...\n"); - trustSMBIOS = FALSE; + trustSMBIOS = false; } } else if (gRAM.SPD[0].InUse != gRAM.SMBIOS[0].InUse) { // Never trust a sneaky SMBIOS! DBG("Not trusting SMBIOS because it's being sneaky...\n"); - trustSMBIOS = FALSE; + trustSMBIOS = false; } } else if (gRAM.SMBIOSInUse == 1) { channels = 1; @@ -1743,10 +1743,10 @@ for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { newSmbiosTable.Type17->TotalWidth = 0xFFFF; newSmbiosTable.Type17->DataWidth = 0xFFFF; } - Once = TRUE; + Once = true; newSmbiosTable.Type17->Hdr.Handle = (UINT16)(0x1100 + Index); newSmbiosTable.Type17->FormFactor = (UINT8)(gMobile ? MemoryFormFactorSodimm : MemoryFormFactorDimm); - newSmbiosTable.Type17->TypeDetail.Synchronous = TRUE; + newSmbiosTable.Type17->TypeDetail.Synchronous = true; newSmbiosTable.Type17->DeviceSet = bank + 1; newSmbiosTable.Type17->MemoryArrayHandle = mHandle16; @@ -1828,7 +1828,7 @@ for (uint64_t Index = 0; Index < smbiosSettings.Memory.SlotCounts; Index++) { DBG("%s %s EMPTY\n", bankLocator.c_str(), deviceLocator.c_str()); newSmbiosTable.Type17->MemoryType = 0; //MemoryTypeUnknown; } else { - insertingEmpty = FALSE; + insertingEmpty = false; DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator.c_str(), deviceLocator.c_str(), newSmbiosTable.Type17->Speed, newSmbiosTable.Type17->Size, newSmbiosTable.Type17->ExtendedSize); if (newSmbiosTable.Type17->Size == 0x7FFF) { @@ -2226,7 +2226,7 @@ void FinalizeSmbios(const SmbiosInjectedSettings& smbiosSettings) //continue EFI_PEI_HOB_POINTERS HobStart; EFI_PHYSICAL_ADDRESS *Table = NULL; //UINTN TableLength = 0; -// BOOLEAN FoundTable3 = FALSE; +// XBool FoundTable3 = false; // Get Hob List HobStart.Raw = (__typeof_am__(HobStart.Raw))GetHobList(); @@ -2240,7 +2240,7 @@ void FinalizeSmbios(const SmbiosInjectedSettings& smbiosSettings) //continue //TableLength = GET_GUID_HOB_DATA_SIZE (GuidHob); if (Table != NULL) { if (Index != 0) { -// FoundTable3 = TRUE; //don't know how to use it. Real Mac have table3 in the format of table2 +// FoundTable3 = true; //don't know how to use it. Real Mac have table3 in the format of table2 DBG("Found SMBIOS3 Table\n"); } break; diff --git a/rEFIt_UEFI/Platform/smbios.h b/rEFIt_UEFI/Platform/smbios.h index 7f3ecb852..b3288bfa3 100644 --- a/rEFIt_UEFI/Platform/smbios.h +++ b/rEFIt_UEFI/Platform/smbios.h @@ -25,14 +25,14 @@ static_assert(MAX_RAM_SLOTS < UINT8_MAX, "MAX_RAM_SLOTS < UINT8_MAX"); // Import class RAM_SLOT_INFO { public: - UINT64 Slot = UINT64(); - UINT32 ModuleSize = UINT32(); - UINT32 Frequency = UINT32(); + UINT64 Slot = UINT64(); + UINT32 ModuleSize = UINT32(); + UINT32 Frequency = UINT32(); XString8 Vendor = XString8(); XString8 PartNo = XString8(); XString8 SerialNo = XString8(); - UINT8 Type = UINT8(); - bool InUse = bool(); + UINT8 Type = UINT8(); + XBool InUse = false; RAM_SLOT_INFO() {} }; @@ -151,19 +151,19 @@ class SmbiosInjectedSettings XString8 ChassisAssetTag = XString8(); XString8 FamilyName = XString8(); XString8 SmUUID = XString8(); - bool NoRomInfo = 0; - uint8_t EnabledCores = 0; - bool TrustSMBIOS = 0; - bool InjectMemoryTables = 0; - uint8_t BoardType = 0; - uint8_t ChassisType = 0; + XBool NoRomInfo = false; + uint8_t EnabledCores = 0; + XBool TrustSMBIOS = false; + XBool InjectMemoryTables = false; + uint8_t BoardType = 0; + uint8_t ChassisType = 0; class SlotDevicesArrayClass : protected XObjArray { using super = XObjArray; public: void setEmpty() { super::setEmpty(); } - void AddReference(SLOT_DEVICE* newElement, bool FreeIt) { super::AddReference(newElement, FreeIt); } + void AddReference(SLOT_DEVICE* newElement, XBool FreeIt) { super::AddReference(newElement, FreeIt); } const SLOT_DEVICE& getSlotForIndex(size_t Index) const { if ( Index >= MAX_RAM_SLOTS) { @@ -185,7 +185,7 @@ class SmbiosInjectedSettings AddReference(slotDevice, true); return *slotDevice; } - bool isSlotForIndexValid(uint8_t Index) const { + XBool isSlotForIndexValid(uint8_t Index) const { if ( Index >= MAX_RAM_SLOTS) { log_technical_bug("%s : Index >= MAX_RAM_SLOTS", __PRETTY_FUNCTION__); } @@ -205,11 +205,11 @@ class SmbiosInjectedSettings uint64_t ExtendedFirmwareFeaturesMask = 0; int8_t Attribute = 0; - bool KPDELLSMBIOS = 0; + XBool KPDELLSMBIOS = false; // CPU uint16_t CpuType = 0; - bool SetTable132 = 0; + XBool SetTable132 = false; uint16_t QPI = 0; // from SmBios @@ -242,7 +242,7 @@ extern APPLE_SMBIOS_STRUCTURE_POINTER SmbiosTable; // TODO stop using globals. extern MEM_STRUCTURE gRAM; -extern BOOLEAN gMobile; +extern XBool gMobile; @@ -256,7 +256,7 @@ EFI_STATUS PrepatchSmbios(SmbiosDiscoveredSettings* smbiosSettings); void PatchSmbios(const SmbiosInjectedSettings& smbiosSettings); void FinalizeSmbios(const SmbiosInjectedSettings& smbiosSettings); -bool getMobileFromSmbios(); +XBool getMobileFromSmbios(); XString8 getSmUUIDFromSmbios(); diff --git a/rEFIt_UEFI/Platform/spd.cpp b/rEFIt_UEFI/Platform/spd.cpp index c187a8065..628c249fe 100644 --- a/rEFIt_UEFI/Platform/spd.cpp +++ b/rEFIt_UEFI/Platform/spd.cpp @@ -37,7 +37,7 @@ #endif -BOOLEAN smbIntel; +XBool smbIntel; UINT8 smbPage; CONST CHAR8 *spd_memory_types[] = @@ -599,7 +599,7 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did) UINT32 base, mmio, hostc; UINT16 Command; //RAM_SLOT_INFO* slot; - //BOOLEAN fullBanks; + //XBool fullBanks; UINT8* spdbuf; // UINT16 vid, did; @@ -645,7 +645,7 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did) ); base &= 0xFFFE; - smbIntel = TRUE; + smbIntel = true; } else { /*Status = */PciIo->Pci.Read ( @@ -656,7 +656,7 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did) &base ); base &= 0xFFFC; - smbIntel = FALSE; + smbIntel = false; } /*Status = */PciIo->Pci.Read ( PciIo, @@ -843,12 +843,12 @@ STATIC void read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did) gRAM.SPD[i].PartNo.c_str(), gRAM.SPD[i].SerialNo.c_str()); - gRAM.SPD[i].InUse = TRUE; + gRAM.SPD[i].InUse = true; ++(gRAM.SPDInUse); //} // laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so: - //gDMI->DIMM[i]= (UINT32)((i>0 && gRAM->DIMM[1].InUse==FALSE && !fullBanks && TotalCount == 2)?mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this + //gDMI->DIMM[i]= (UINT32)((i>0 && gRAM->DIMM[1].InUse==false && !fullBanks && TotalCount == 2)?mapping[i] : i); // for laptops case, mapping setup would need to be more generic than this //slot->spd = NULL; diff --git a/rEFIt_UEFI/Platform/usbfix.cpp b/rEFIt_UEFI/Platform/usbfix.cpp index 56a7969de..038554744 100644 --- a/rEFIt_UEFI/Platform/usbfix.cpp +++ b/rEFIt_UEFI/Platform/usbfix.cpp @@ -65,7 +65,7 @@ DBG("FixOwnership() -> begin\n"); UINTN isOSowned; UINTN isBIOSowned; - BOOLEAN isOwnershipConflict; + XBool isOwnershipConflict; // // Find the usb host controller diff --git a/rEFIt_UEFI/PlatformEFI/BasicIO.cpp b/rEFIt_UEFI/PlatformEFI/BasicIO.cpp index 4284484e3..5f9487b1c 100644 --- a/rEFIt_UEFI/PlatformEFI/BasicIO.cpp +++ b/rEFIt_UEFI/PlatformEFI/BasicIO.cpp @@ -21,17 +21,17 @@ extern "C" { // Keyboard input // -BOOLEAN ReadAllKeyStrokes(void) +XBool ReadAllKeyStrokes(void) { - BOOLEAN GotKeyStrokes; + XBool GotKeyStrokes; EFI_STATUS Status; EFI_INPUT_KEY key; - GotKeyStrokes = FALSE; + GotKeyStrokes = false; for (;;) { Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &key); if (Status == EFI_SUCCESS) { - GotKeyStrokes = TRUE; + GotKeyStrokes = true; continue; } break; @@ -84,11 +84,11 @@ WaitForKeyPress( //void DebugPause(void) //{ // // show console and wait for key -// SwitchToText(FALSE); +// SwitchToText(false); // PauseForKey(L""); // // // reset error flag -// haveError = FALSE; +// haveError = false; //} //#endif @@ -103,12 +103,12 @@ void EndlessIdleLoop(void) } -BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where) +XBool CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where) { // CHAR16 ErrorName[64]; if (!EFI_ERROR(Status)) - return FALSE; + return false; MsgLog("Fatal Error: %s %ls\n", efiStrError(Status), where); @@ -116,19 +116,19 @@ BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where) gST->ConOut->SetAttribute (gST->ConOut, EFI_RED | EFI_BACKGROUND_BLACK); printf("Fatal Error: %s %ls\n", efiStrError(Status), where); gST->ConOut->SetAttribute (gST->ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK); - haveError = TRUE; + haveError = true; //gBS->Exit(ImageHandle, ExitStatus, ExitDataSize, ExitData); - return TRUE; + return true; } -BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where) +XBool CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where) { // CHAR16 ErrorName[64]; if (!EFI_ERROR(Status)) - return FALSE; + return false; MsgLog("Fatal Error: %s %ls\n", efiStrError(Status), where); @@ -136,9 +136,9 @@ BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where) gST->ConOut->SetAttribute (gST->ConOut, EFI_RED | EFI_BACKGROUND_BLACK); printf("Error: %s %ls\n", efiStrError(Status), where); gST->ConOut->SetAttribute (gST->ConOut, EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK); - haveError = TRUE; + haveError = true; - return TRUE; + return true; } diff --git a/rEFIt_UEFI/PlatformEFI/BootLog.cpp b/rEFIt_UEFI/PlatformEFI/BootLog.cpp index a57279171..e2a5ea434 100644 --- a/rEFIt_UEFI/PlatformEFI/BootLog.cpp +++ b/rEFIt_UEFI/PlatformEFI/BootLog.cpp @@ -271,7 +271,7 @@ void EFIAPI DebugLog(IN INTN DebugMode, IN CONST CHAR8 *FormatString, ...) // Print message to log buffer VA_START(Marker, FormatString); - MemLogfVA(TRUE, DebugMode, FormatString, Marker); + MemLogfVA(true, DebugMode, FormatString, Marker); VA_END(Marker); } @@ -281,7 +281,7 @@ void InitBooterLog(void) } -EFI_STATUS SetupBooterLog(BOOLEAN AllowGrownSize) +EFI_STATUS SetupBooterLog(XBool AllowGrownSize) { EFI_STATUS Status = EFI_SUCCESS; CHAR8 *MemLogBuffer; @@ -353,6 +353,6 @@ void EFIAPI DebugLogForOC(IN INTN DebugLevel, IN CONST CHAR8 *FormatString, ...) // Print message to log buffer VA_START(Marker, FormatString); - MemLogVA(TRUE, 1, FormatString, Marker); + MemLogVA(true, 1, FormatString, Marker); VA_END(Marker); } diff --git a/rEFIt_UEFI/PlatformEFI/include/Platform.h b/rEFIt_UEFI/PlatformEFI/include/Platform.h index 87210e7ff..4bd397cca 100755 --- a/rEFIt_UEFI/PlatformEFI/include/Platform.h +++ b/rEFIt_UEFI/PlatformEFI/include/Platform.h @@ -15,6 +15,7 @@ Headers collection for procedures #ifdef __cplusplus #include +#include "../cpp_foundation/XBool.h" #include "../cpp_foundation/XString.h" #include "../cpp_foundation/XArray.h" #include "../cpp_foundation/XObjArray.h" diff --git a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp index 0f9a6710f..d72f053b2 100644 --- a/rEFIt_UEFI/PlatformEFI/posix/abort.cpp +++ b/rEFIt_UEFI/PlatformEFI/posix/abort.cpp @@ -34,7 +34,7 @@ static void panic_(const char* format, VA_LIST va) ; #ifdef CLOVER_BUILD -extern void egSetGraphicsModeEnabled(BOOLEAN); +extern void egSetGraphicsModeEnabled(XBool); extern const LString8 gBuildId; #endif diff --git a/rEFIt_UEFI/PlatformPOSIX+EFI/BootLog.cpp b/rEFIt_UEFI/PlatformPOSIX+EFI/BootLog.cpp index f1de9a472..bdfdb9972 100644 --- a/rEFIt_UEFI/PlatformPOSIX+EFI/BootLog.cpp +++ b/rEFIt_UEFI/PlatformPOSIX+EFI/BootLog.cpp @@ -52,7 +52,7 @@ PrintBytes(IN void *Bytes, IN UINTN Number) } } -bool gEnableCloverLog = false; +XBool gEnableCloverLog = false; // Changed MsgLog(...) it now calls this function // with DebugMode == 0. - apianti diff --git a/rEFIt_UEFI/PlatformPOSIX/BasicIO.cpp b/rEFIt_UEFI/PlatformPOSIX/BasicIO.cpp index 274e85f73..b44a0afd0 100644 --- a/rEFIt_UEFI/PlatformPOSIX/BasicIO.cpp +++ b/rEFIt_UEFI/PlatformPOSIX/BasicIO.cpp @@ -21,7 +21,7 @@ // Keyboard input // -BOOLEAN ReadAllKeyStrokes(void) +XBool ReadAllKeyStrokes(void) { panic("not yet"); } @@ -52,12 +52,12 @@ void EndlessIdleLoop(void) } -BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where) +XBool CheckFatalError(IN EFI_STATUS Status, IN CONST CHAR16 *where) { panic("not yet"); } -BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where) +XBool CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where) { panic("not yet"); } diff --git a/rEFIt_UEFI/PlatformPOSIX/BootLog.cpp b/rEFIt_UEFI/PlatformPOSIX/BootLog.cpp index f1de9a472..bdfdb9972 100644 --- a/rEFIt_UEFI/PlatformPOSIX/BootLog.cpp +++ b/rEFIt_UEFI/PlatformPOSIX/BootLog.cpp @@ -52,7 +52,7 @@ PrintBytes(IN void *Bytes, IN UINTN Number) } } -bool gEnableCloverLog = false; +XBool gEnableCloverLog = false; // Changed MsgLog(...) it now calls this function // with DebugMode == 0. - apianti diff --git a/rEFIt_UEFI/PlatformPOSIX/include/Platform.h b/rEFIt_UEFI/PlatformPOSIX/include/Platform.h index 7e4d83da3..a3415e648 100644 --- a/rEFIt_UEFI/PlatformPOSIX/include/Platform.h +++ b/rEFIt_UEFI/PlatformPOSIX/include/Platform.h @@ -31,6 +31,10 @@ //#pragma clang diagnostic ignored "-Wc99-extensions" +#ifdef __cplusplus +#include "../../cpp_foundation/XBool.h" +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/rEFIt_UEFI/Settings/ConfigManager.cpp b/rEFIt_UEFI/Settings/ConfigManager.cpp index 5a60ab95d..ddf0cd06a 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.cpp +++ b/rEFIt_UEFI/Settings/ConfigManager.cpp @@ -153,7 +153,7 @@ void ConfigManager::DiscoverDevices() } gfx->Connectors = *(UINT32*)(gfx->Mmio + RADEON_BIOS_0_SCRATCH); // DBG(" - RADEON_BIOS_0_SCRATCH = 0x%08X\n", gfx->Connectors); - gfx->ConnChanged = FALSE; + gfx->ConnChanged = false; DiscoveredSlotDeviceClass* SlotDevice = new DiscoveredSlotDeviceClass; SlotDeviceArrayNonConst.AddReference(SlotDevice, true); @@ -161,7 +161,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "PCI Slot 0"_XS8; SlotDevice->SlotID = 1; SlotDevice->SlotType = SlotTypePciExpressX16; @@ -173,7 +173,7 @@ void ConfigManager::DiscoverDevices() DBG(" - GFX: Model=%s (Intel)\n", gfx->Model.c_str()); gfx->Ports = 1; gfx->Connectors = (1 << GfxPropertiesArrayNonConst.size()); - gfx->ConnChanged = FALSE; + gfx->ConnChanged = false; break; } case 0x10de: { @@ -227,7 +227,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "PCI Slot 0"_XS8; SlotDevice->SlotID = 1; SlotDevice->SlotType = SlotTypePciExpressX16; @@ -238,7 +238,7 @@ void ConfigManager::DiscoverDevices() gfx->Model.S8Printf("pci%hx,%hx", Pci.Hdr.VendorId, Pci.Hdr.DeviceId); gfx->Ports = 1; gfx->Connectors = (1 << GfxPropertiesArrayNonConst.size()); - gfx->ConnChanged = FALSE; + gfx->ConnChanged = false; break; } @@ -265,7 +265,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "AirPort"_XS8; SlotDevice->SlotID = 0; SlotDevice->SlotType = SlotTypePciExpressX1; @@ -305,7 +305,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "Ethernet"_XS8; SlotDevice->SlotID = 2; SlotDevice->SlotType = SlotTypePciExpressX1; @@ -346,7 +346,7 @@ void ConfigManager::DiscoverDevices() // if ( Mmio != NULL ) { UINTN Offset = 0; - BOOLEAN Swab = FALSE; + XBool Swab = false; UINT32 Mac0, Mac4; switch ( Vendor ) { case 0x11ab: //Marvell Yukon @@ -372,7 +372,7 @@ void ConfigManager::DiscoverDevices() break; case 0x1969: //Atheros Offset = L1C_STAD0; - Swab = TRUE; + Swab = true; break; case 0x8086: //Intel if (PreviousVendor == Vendor) { @@ -420,7 +420,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "FireWire"_XS8; SlotDevice->SlotID = 3; SlotDevice->SlotType = SlotTypePciExpressX4; @@ -448,7 +448,7 @@ void ConfigManager::DiscoverDevices() SlotDevice->SegmentGroupNum = (UINT16)Segment; SlotDevice->BusNum = (UINT8)Bus; SlotDevice->DevFuncNum = (UINT8)((Device << 3) | (Function & 0x07)); - //SlotDevice->Valid = TRUE; + //SlotDevice->Valid = true; SlotDevice->SlotName = "HDMI port"_XS8; SlotDevice->SlotID = 5; SlotDevice->SlotType = SlotTypePciExpressX4; @@ -524,7 +524,7 @@ EFI_STATUS LoadPlist(const XStringW& ConfName, C* plist) } XmlLiteParser xmlLiteParser; - bool parsingOk = plist->parse((const CHAR8*)ConfigPtr, Size, ""_XS8, &xmlLiteParser); + XBool parsingOk = plist->parse((const CHAR8*)ConfigPtr, Size, ""_XS8, &xmlLiteParser); if ( xmlLiteParser.getErrorsAndWarnings().size() ) { if ( xmlLiteParser.getErrorsAndWarnings().size() > 1 ) { DebugLog(2, "There are problems in plist '%ls'\n", configPlistPath.wc_str()); @@ -713,10 +713,10 @@ void ConfigManager::applySettings() const if ( gCPUStructure.Model >= CPU_MODEL_IVY_BRIDGE ) { if ( !configPlist.ACPI.SSDT.Generate.getGeneratePStates().isDefined() ) - gSettings.ACPI.SSDT.Generate.GeneratePStates = TRUE; + gSettings.ACPI.SSDT.Generate.GeneratePStates = true; if ( !configPlist.ACPI.SSDT.Generate.getGenerateCStates().isDefined() ) - gSettings.ACPI.SSDT.Generate.GenerateCStates = TRUE; + gSettings.ACPI.SSDT.Generate.GenerateCStates = true; // backward compatibility, APFS, APLF, PluginType follow PStates if ( !configPlist.ACPI.SSDT.Generate.getGenerateAPSN().isDefined() ) @@ -729,7 +729,7 @@ void ConfigManager::applySettings() const gSettings.ACPI.SSDT.Generate.GeneratePluginType = gSettings.ACPI.SSDT.Generate.GeneratePStates; if ( !configPlist.ACPI.SSDT.getEnableC6().isDefined() ) - gSettings.ACPI.SSDT._EnableC6 = TRUE; + gSettings.ACPI.SSDT._EnableC6 = true; if ( !configPlist.ACPI.SSDT.getPluginType().isDefined() ) gSettings.ACPI.SSDT.PluginType = 1; @@ -855,7 +855,7 @@ void ConfigManager::applySettings() const // to determine the use of Table 132 if ( gSettings.CPU.QPI ) { - GlobalConfig.SetTable132 = TRUE; + GlobalConfig.SetTable132 = true; //DBG("QPI: use Table 132\n"); } else { @@ -865,7 +865,7 @@ void ConfigManager::applySettings() const case CPU_MODEL_WESTMERE: // Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm case CPU_MODEL_NEHALEM_EX: // Core i7, Nehalem-Ex Xeon, "Beckton" case CPU_MODEL_WESTMERE_EX: // Core i7, Nehalem-Ex Xeon, "Eagleton" - GlobalConfig.SetTable132 = TRUE; + GlobalConfig.SetTable132 = true; DBG("QPI: use Table 132\n"); break; default: diff --git a/rEFIt_UEFI/Settings/ConfigManager.h b/rEFIt_UEFI/Settings/ConfigManager.h index f091ebdfd..7bd9396ef 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.h +++ b/rEFIt_UEFI/Settings/ConfigManager.h @@ -52,10 +52,10 @@ public: EFI_HANDLE Handle = 0; UINT8 *Mmio = 0; UINT32 Connectors = 0; - BOOLEAN ConnChanged = 0; + XBool ConnChanged = false; // ATTENTION : this is not discovered. This will be assigned once config plist is read. - bool LoadVBios = 0; + XBool LoadVBios = false; DiscoveredGfx() {} DiscoveredGfx(const DiscoveredGfx&) = default; // default copy is ok because we can copy Mmio, because it's not allocated and still make sense once copied. @@ -67,7 +67,7 @@ class GfxPropertiesArrayClass : public XObjArray public: - bool hasBrand(HRDW_MANUFACTERER brand) const { + XBool hasBrand(HRDW_MANUFACTERER brand) const { for ( size_t idx = 0 ; idx < size() ; ++idx ) { if ( ElementAt(idx).Vendor == brand ) return true; } @@ -75,11 +75,11 @@ public: } - bool hasNvidia() const { return hasBrand(Nvidia); } - bool hasIntel() const { return hasBrand(Intel); } + XBool hasNvidia() const { return hasBrand(Nvidia); } + XBool hasIntel() const { return hasBrand(Intel); } - bool isCardAtPosIntel(size_t pos) const { return size() > pos && ElementAt(pos).Vendor == Intel; } - bool isCardAtPosNvidia(size_t pos) const { return size() > pos && ElementAt(pos).Vendor == Nvidia; } + XBool isCardAtPosIntel(size_t pos) const { return size() > pos && ElementAt(pos).Vendor == Intel; } + XBool isCardAtPosNvidia(size_t pos) const { return size() > pos && ElementAt(pos).Vendor == Nvidia; } }; @@ -113,7 +113,7 @@ class LanCardArrayClass : public XObjArray { public: /* Requirment : MacAddressToLookFor is 6 chars long */ - bool containsMacAddress(const UINT8* MacAddressToLookFor) const { + XBool containsMacAddress(const UINT8* MacAddressToLookFor) const { for ( size_t idx = 0 ; idx < size() ; ++idx ) { if ( memcmp(MacAddressToLookFor, ElementAt(idx).MacAddress, 6) == 0 ) return true; } diff --git a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.cpp b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.cpp index d77c34769..e880818c1 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.cpp +++ b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.cpp @@ -11,32 +11,32 @@ -bool ConfigPlistAbstractClass::parse(XmlLiteParser* xmlLiteParser, const XString8& xmlPath) +XBool ConfigPlistAbstractClass::parse(XmlLiteParser* xmlLiteParser, const XString8& xmlPath) { xmlLiteParser->moveForwardUntilSignificant(); xmlLiteParser->skipHeader(); auto pos = xmlLiteParser->getPosition(); - bool b = parseFromXmlLite(xmlLiteParser, xmlPath, true); + XBool b = parseFromXmlLite(xmlLiteParser, xmlPath, true); if ( !b ) return false; b = validate(xmlLiteParser, xmlPath, pos, true); return b; } -bool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size, const XString8& xmlPath, XmlLiteParser* xmlLiteParser) +XBool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size, const XString8& xmlPath, XmlLiteParser* xmlLiteParser) { xmlLiteParser->init(buf.c_str(), size); return parse(xmlLiteParser, xmlPath); } -bool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size, const XString8& xmlPath) +XBool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size, const XString8& xmlPath) { XmlLiteParser xmlLiteParser; xmlLiteParser.init(buf.c_str(), size); return parse(&xmlLiteParser, xmlPath); } -bool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size) +XBool ConfigPlistAbstractClass::parse(const LString8& buf, size_t size) { return parse(buf, size, ""_XS8); } diff --git a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.h b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.h index de55667bb..b296e4bd1 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistAbstract.h @@ -18,10 +18,10 @@ public: ConfigPlistAbstractClass() {}; - bool parse(XmlLiteParser* xmlLiteParser, const XString8& xmlPath); - bool parse(const LString8& buf, size_t size, const XString8& xmlPath, XmlLiteParser* xmlLiteParser); - bool parse(const LString8& buf, size_t size, const XString8& xmlPath); - bool parse(const LString8& buf, size_t size); + XBool parse(XmlLiteParser* xmlLiteParser, const XString8& xmlPath); + XBool parse(const LString8& buf, size_t size, const XString8& xmlPath, XmlLiteParser* xmlLiteParser); + XBool parse(const LString8& buf, size_t size, const XString8& xmlPath); + XBool parse(const LString8& buf, size_t size); }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h index 20d95bae7..11d2b7037 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/ConfigPlistClass.h @@ -101,7 +101,7 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; if ( LString8(ACPI.DSDT.Fixes.ACPI_DSDT_Fixe_Array[29].getNewName()) != "FixHeaders_20000000"_XS8 ) { diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI.h index 0f3234bf6..1ec33752e 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI.h @@ -76,7 +76,7 @@ public: class Signature_Class : public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; if ( xstring8.length() == 4 ) return true; @@ -111,7 +111,7 @@ public: return *(UINT64*)&Id; }; UINT32 dgetTabLength() const { return Length.isDefined() ? Length.value() : 0; }; - bool dgetOtherOS() const { return DropForAllOS.isDefined() ? DropForAllOS.value() : false; }; + XBool dgetOtherOS() const { return DropForAllOS.isDefined() ? DropForAllOS.value() : XBool(false); }; }; @@ -173,13 +173,13 @@ public: const decltype(FixHeaders)& getFixHeaders() const { return FixHeaders; }; - bool dgetSlpSmiEnable() const { return HaltEnabler.isDefined() ? HaltEnabler.value() : false; }; - bool dgetFixHeaders() const { return FixHeaders.isDefined() ? FixHeaders.value() : false; }; - bool dgetFixMCFG() const { return FixMCFG.isDefined() ? FixMCFG.value() : false; }; - bool dgetNoASPM() const { return DisableASPM.isDefined() ? DisableASPM.value() : false; }; - bool dgetsmartUPS() const { return smartUPS.isDefined() ? smartUPS.value() : false; }; - bool dgetPatchNMI() const { return PatchAPIC.isDefined() ? PatchAPIC.value() : false; }; - bool dgetAutoMerge() const { return AutoMerge.isDefined() ? AutoMerge.value() : false; }; + XBool dgetSlpSmiEnable() const { return HaltEnabler.isDefined() ? HaltEnabler.value() : XBool(false); }; + XBool dgetFixHeaders() const { return FixHeaders.isDefined() ? FixHeaders.value() : XBool(false); }; + XBool dgetFixMCFG() const { return FixMCFG.isDefined() ? FixMCFG.value() : XBool(false); }; + XBool dgetNoASPM() const { return DisableASPM.isDefined() ? DisableASPM.value() : XBool(false); }; + XBool dgetsmartUPS() const { return smartUPS.isDefined() ? smartUPS.value() : XBool(false); }; + XBool dgetPatchNMI() const { return PatchAPIC.isDefined() ? PatchAPIC.value() : XBool(false); }; + XBool dgetAutoMerge() const { return AutoMerge.isDefined() ? AutoMerge.value() : XBool(false); }; const decltype(DisabledAML)::ValueType& dgetDisabledAML() const { return DisabledAML.isDefined() ? DisabledAML.value() : DisabledAML.nullValue; }; const decltype(SortedOrder)::ValueType& dgetSortedACPI() const { return SortedOrder.isDefined() ? SortedOrder.value() : SortedOrder.nullValue; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.cpp b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.cpp index 989f8299e..afe6c3738 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.cpp +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.cpp @@ -12,7 +12,7 @@ -XmlAbstractType& ConfigPlistClass::ACPI_Class::DSDT_Class::ACPI_DSDT_Fixes_Class::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, bool* keyFound) +XmlAbstractType& ConfigPlistClass::ACPI_Class::DSDT_Class::ACPI_DSDT_Fixes_Class::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, XBool* keyFound) { #ifdef JIEF_DEBUG if ( strncmp(keyValue, "FixHeaders", strlen("FixHeaders")) == 0 ) { diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.h index 9e3beada4..736e88c72 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_DSDT.h @@ -35,8 +35,8 @@ public: ACPI_DSDT_Fix& operator = (const ACPI_DSDT_Fix&) = delete; // { panic("copy ctor"); }; // = delete; virtual const char* getDescription() override { panic("not defined"); }; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { panic("not defined"); }; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override { panic("not defined"); }; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { panic("not defined"); }; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override { panic("not defined"); }; virtual void reset() override { super::reset(); @@ -48,10 +48,10 @@ public: const CHAR8* getOldName() const { return m_oldName; } uint32_t getBitData() const { return m_bitData; } - bool dgetOldEnabled() const { return oldEnabled.isDefined() ? oldEnabled.value() : false; }; - bool dgetNewEnabled() const { return newEnabled.isDefined() ? newEnabled.value() : false; }; + XBool dgetOldEnabled() const { return oldEnabled.isDefined() ? oldEnabled.value() : XBool(false); }; + XBool dgetNewEnabled() const { return newEnabled.isDefined() ? newEnabled.value() : XBool(false); }; - bool dgetEnabled() const { + XBool dgetEnabled() const { if ( oldEnabled.isDefined() && oldEnabled.value() ) return true; if ( newEnabled.isDefined() && newEnabled.value() ) return true; return false; @@ -104,9 +104,9 @@ public: } }; - virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, bool* keyFound) override; + virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, XBool* keyFound) override; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; // if ( LString8(ACPI_DSDT_Fixe_Array[29].getNewName()) != "FixHeaders_20000000"_XS8 ) { @@ -135,7 +135,7 @@ public: } return FixDsdt; } - bool dgetFixHeaders() const { + XBool dgetFixHeaders() const { return getFixHeaders().dgetEnabled(); } }; @@ -147,7 +147,7 @@ public: class TgtBridgeClass : public XmlData { using super = XmlData; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { #ifdef JIEF_DEBUG if ( xmlPath.contains("ACPI/DSDT/Patches[15]"_XS8) ) { NOP; @@ -175,8 +175,8 @@ if ( xmlPath.contains("ACPI/DSDT/Patches[15]"_XS8) ) { virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; public: - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; - uint8_t dgetBValue() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; + uint8_t dgetBValue() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; XString8 dgetPatchDsdtLabel() const { return Comment.isDefined() ? Comment.value() : "(NoLabel)"_XS8; }; const XBuffer& dgetPatchDsdtFind() const { return Find.isDefined() ? Find.value() : XBuffer::NullXBuffer; }; const XBuffer& dgetPatchDsdtReplace() const { return Replace.isDefined() ? Replace.value() : XBuffer::NullXBuffer; }; @@ -211,8 +211,8 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; XString8 dgetDsdtName() const { return Name.isDefined() && Name.value().notEmpty() ? Name.value() : "DSDT.aml"_XS8; }; - bool dgetDebugDSDT() const { return Debug.isDefined() ? Debug.value() : false; }; - bool dgetRtc8Allowed() const { return Rtc8Allowed.isDefined() ? Rtc8Allowed.value() : false; }; + XBool dgetDebugDSDT() const { return Debug.isDefined() ? Debug.value() : XBool(false); }; + XBool dgetRtc8Allowed() const { return Rtc8Allowed.isDefined() ? Rtc8Allowed.value() : XBool(false); }; uint8_t dgetPNLF_UID() const { return isDefined() ? PNLF_UID.isDefined() ? PNLF_UID.value() : 0x0a : 0; }; // TODO: different default value if section is not defined uint32_t dgetFixDsdt() const { // priority is given to Fixes @@ -221,8 +221,8 @@ public: }; // const ACPI_DSDT_Fixes_Class& getFixes() const { return Fixes; }; // const XmlArray& getPatches() const { return Patches; }; - bool dgetReuseFFFF() const { return ReuseFFFF.isDefined() ? ReuseFFFF.value() : false; }; - bool dgetSuspendOverride() const { return SuspendOverride.isDefined() ? SuspendOverride.value() : false; }; + XBool dgetReuseFFFF() const { return ReuseFFFF.isDefined() ? ReuseFFFF.value() : XBool(false); }; + XBool dgetSuspendOverride() const { return SuspendOverride.isDefined() ? SuspendOverride.value() : XBool(false); }; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_SSDT.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_SSDT.h index e38b627ed..2d6dda3e7 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_SSDT.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_ACPI_SSDT.h @@ -37,11 +37,11 @@ protected: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetPStates() const { return PStates.isDefined() ? PStates.value() : false; }; - bool dgetCStates() const { return CStates.isDefined() ? CStates.value() : false; }; - bool dgetAPSN() const { return APSN.isDefined() ? APSN.value() : false; }; - bool dgetAPLF() const { return APLF.isDefined() ? APLF.value() : false; }; - bool dgetPluginType() const { return PluginType.isDefined() ? PluginType.value() : false; }; + XBool dgetPStates() const { return PStates.isDefined() ? PStates.value() : XBool(false); }; + XBool dgetCStates() const { return CStates.isDefined() ? CStates.value() : XBool(false); }; + XBool dgetAPSN() const { return APSN.isDefined() ? APSN.value() : XBool(false); }; + XBool dgetAPLF() const { return APLF.isDefined() ? APLF.value() : XBool(false); }; + XBool dgetPluginType() const { return PluginType.isDefined() ? PluginType.value() : XBool(false); }; undefinable_bool getPStates() const { return PStates.isDefined() ? undefinable_bool(PStates.value()) : undefinable_bool(); }; undefinable_bool getCStates() const { return CStates.isDefined() ? undefinable_bool(CStates.value()) : undefinable_bool(); }; @@ -65,23 +65,23 @@ public: public: virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetGeneratePStates() const { + XBool dgetGeneratePStates() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return xmlDict.dgetPStates(); } - bool dgetGenerateCStates() const { + XBool dgetGenerateCStates() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return xmlDict.dgetCStates(); } - bool dgetGenerateAPSN() const { + XBool dgetGenerateAPSN() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return xmlDict.dgetAPSN(); } - bool dgetGenerateAPLF() const { + XBool dgetGenerateAPLF() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return xmlDict.dgetAPLF(); } - bool dgetGeneratePluginType() const { + XBool dgetGeneratePluginType() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return xmlDict.dgetPluginType(); } @@ -152,18 +152,18 @@ protected: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetDropSSDTSetting() const { return DropOem.isDefined() ? DropOem.value() : false; }; - bool dgetNoOemTableId() const { return NoOemTableId.isDefined() ? NoOemTableId.value() : false; }; - bool dgetNoDynamicExtract() const { return NoDynamicExtract.isDefined() ? NoDynamicExtract.value() : false; }; - bool dgetEnableISS() const { return UseSystemIO.isDefined() ? UseSystemIO.value() : false; }; - bool dgetEnableC7() const { return EnableC7.isDefined() ? EnableC7.value() : false; }; - bool dget_EnableC6() const { return EnableC6.isDefined() ? EnableC6.value() : false; }; - bool dget_EnableC4() const { return EnableC4.isDefined() ? EnableC4.value() : false; }; - bool dget_EnableC2() const { return EnableC2.isDefined() ? EnableC2.value() : false; }; + XBool dgetDropSSDTSetting() const { return DropOem.isDefined() ? DropOem.value() : XBool(false); }; + XBool dgetNoOemTableId() const { return NoOemTableId.isDefined() ? NoOemTableId.value() : XBool(false); }; + XBool dgetNoDynamicExtract() const { return NoDynamicExtract.isDefined() ? NoDynamicExtract.value() : XBool(false); }; + XBool dgetEnableISS() const { return UseSystemIO.isDefined() ? UseSystemIO.value() : XBool(false); }; + XBool dgetEnableC7() const { return EnableC7.isDefined() ? EnableC7.value() : XBool(false); }; + XBool dget_EnableC6() const { return EnableC6.isDefined() ? EnableC6.value() : XBool(false); }; + XBool dget_EnableC4() const { return EnableC4.isDefined() ? EnableC4.value() : XBool(false); }; + XBool dget_EnableC2() const { return EnableC2.isDefined() ? EnableC2.value() : XBool(false); }; uint16_t dget_C3Latency() const { return C3Latency.isDefined() ? C3Latency.value() : 0; }; uint8_t dgetPLimitDict() const { return PLimitDict.isDefined() ? PLimitDict.value() : 0; }; uint8_t dgetUnderVoltStep() const { return UnderVoltStep.isDefined() ? UnderVoltStep.value() : 0; }; - bool dgetDoubleFirstState() const { return DoubleFirstState.isDefined() ? DoubleFirstState.value() : false; }; + XBool dgetDoubleFirstState() const { return DoubleFirstState.isDefined() ? DoubleFirstState.value() : XBool(false); }; uint8_t dgetMinMultiplier() const { return MinMultiplier.isDefined() ? MinMultiplier.value() : 0; }; uint8_t dgetMaxMultiplier() const { return MaxMultiplier.isDefined() ? MaxMultiplier.value() : 0; }; uint8_t dgetPluginType() const { return PluginType.isDefined() ? PluginType.value() : 0; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h index 4d9adc4ee..1c1c942c7 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h @@ -31,9 +31,9 @@ class Boot_Class : public XmlDict XmlUnionField m_fields[3] = { xmlBool, xmlInt8, xmlString8 }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); - if ( xmlBool.isDefined() ) return true; // ok, whatever bool value is + if ( xmlBool.isDefined() ) return true; // ok, whatever XBool value is if ( xmlInt8.isDefined() ) { if ( xmlInt8.value() < -1 || xmlInt8.value() > 2 ) { xmlLiteParser->addWarning(generateErrors, S8Printf("XMPDetection can -1, 0, 1 or 2 for tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); @@ -92,7 +92,7 @@ public: XmlData xmlData = XmlData(); XmlUnionField m_fields[3] = { xmlBool, xmlString8, xmlData}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( !xmlString8.isDefined() ) return true; if ( xmlString8.value().isEqualIC("Apple") ) return true; @@ -134,25 +134,25 @@ public: /* dget method means get value and returns default if undefined. dget = short for defaultget */ int64_t dgetTimeout() const { return Timeout.isDefined() ? Timeout.value() : -1; }; - bool dgetSkipHibernateTimeout() const { return SkipHibernateTimeout.isDefined() ? SkipHibernateTimeout.value() : false; }; - bool dgetDisableCloverHotkeys() const { return DisableCloverHotkeys.isDefined() ? DisableCloverHotkeys.value() : false; }; + XBool dgetSkipHibernateTimeout() const { return SkipHibernateTimeout.isDefined() ? SkipHibernateTimeout.value() : XBool(false); }; + XBool dgetDisableCloverHotkeys() const { return DisableCloverHotkeys.isDefined() ? DisableCloverHotkeys.value() : XBool(false); }; const XString8& dgetBootArgs() const { return BootArgs.isDefined() ? BootArgs.value() : NullXString8; }; - bool dgetNeverDoRecovery() const { return NeverDoRecovery.isDefined() ? NeverDoRecovery.value() : false; }; + XBool dgetNeverDoRecovery() const { return NeverDoRecovery.isDefined() ? NeverDoRecovery.value() : XBool(false); }; const decltype(DefaultVolume)::ValueType& dgetDefaultVolume() const { if ( !DefaultVolume.isDefined() ) return DefaultVolume.nullValue; if ( DefaultVolume.value().isEqualIC("LastBootedVolume") ) return DefaultVolume.nullValue; return DefaultVolume.isDefined() ? DefaultVolume.value() : DefaultVolume.nullValue; }; const XString8& dgetDefaultLoader() const { return DefaultLoader.isDefined() ? DefaultLoader.value() : NullXString8; }; - bool dgetDebugLog() const { return Debug.isDefined() ? Debug.value() : false; }; - bool dgetFastBoot() const { return FastBoot.isDefined() ? FastBoot.value() : false; }; - bool dgetNoEarlyProgress() const { return NoEarlyProgress.isDefined() ? NoEarlyProgress.value() : false; }; - bool dgetNeverHibernate() const { return NeverHibernate.isDefined() ? NeverHibernate.value() : false; }; - bool dgetStrictHibernate() const { return StrictHibernate.isDefined() ? StrictHibernate.value() : false; }; - bool dgetRtcHibernateAware() const { return RtcHibernateAware.isDefined() ? RtcHibernateAware.value() : false; }; - bool dgetHibernationFixup() const { return HibernationFixup.isDefined() ? HibernationFixup.value() : false; }; - bool dgetSignatureFixup() const { return SignatureFixup.isDefined() ? SignatureFixup.value() : false; }; - INT8 dgetSecureSetting() const { return isDefined() ? SecureBootSetupMode.isDefined() ? SecureBootSetupMode.value() : -1 : 0; }; // to Rename to SecureBootSetupMode // TODO: different default value if section is not defined + XBool dgetDebugLog() const { return Debug.isDefined() ? Debug.value() : XBool(false); }; + XBool dgetFastBoot() const { return FastBoot.isDefined() ? FastBoot.value() : XBool(false); }; + XBool dgetNoEarlyProgress() const { return NoEarlyProgress.isDefined() ? NoEarlyProgress.value() : XBool(false); }; + XBool dgetNeverHibernate() const { return NeverHibernate.isDefined() ? NeverHibernate.value() : XBool(false); }; + XBool dgetStrictHibernate() const { return StrictHibernate.isDefined() ? StrictHibernate.value() : XBool(false); }; + XBool dgetRtcHibernateAware() const { return RtcHibernateAware.isDefined() ? RtcHibernateAware.value() : XBool(false); }; + XBool dgetHibernationFixup() const { return HibernationFixup.isDefined() ? HibernationFixup.value() : XBool(false); }; + XBool dgetSignatureFixup() const { return SignatureFixup.isDefined() ? SignatureFixup.value() : XBool(false); }; + INT8 dgetSecureSetting() const { return isDefined() ? SecureBootSetupMode.isDefined() ? (int)SecureBootSetupMode.value() : -1 : 0; }; // to Rename to SecureBootSetupMode // TODO: different default value if section is not defined UINT8 dgetSecureBootPolicy() const { if ( !SecureBootPolicy.isDefined() ) return 0; if ( SecureBootPolicy.value().length() < 1 ) return 0; @@ -190,14 +190,14 @@ public: // return 0; // }; int8_t dgetXMPDetection() const { return XMPDetection.dgetValue(); } - XString8 dgetLegacyBoot(bool isFirmwareClover) const { return isDefined() ? Legacy.isDefined() ? Legacy.value() : isFirmwareClover ? "PBR"_XS8 : "LegacyBiosDefault"_XS8 : NullXString8; }; // TODO: different default value if section is not defined + XString8 dgetLegacyBoot(XBool isFirmwareClover) const { return isDefined() ? Legacy.isDefined() ? Legacy.value() : isFirmwareClover ? "PBR"_XS8 : "LegacyBiosDefault"_XS8 : NullXString8; }; // TODO: different default value if section is not defined UINT16 dgetLegacyBiosDefaultEntry() const { return LegacyBiosDefaultEntry.isDefined() ? LegacyBiosDefaultEntry.value() : 0; }; const XString8& dgetCustomLogoAsXString8() const { return CustomLogo.xmlString8.isDefined() ? CustomLogo.xmlString8.value() : NullXString8; }; const XBuffer& dgetCustomLogoAsData() const { return CustomLogo.xmlData.isDefined() ? CustomLogo.xmlData.value() : XBuffer::NullXBuffer; }; /* calculated values */ - bool dgetLastBootedVolume() const { return DefaultVolume.isDefined() ? DefaultVolume.value() == "LastBootedVolume"_XS8 : false; } + XBool dgetLastBootedVolume() const { return DefaultVolume.isDefined() ? DefaultVolume.value() == "LastBootedVolume"_XS8 : false; } UINT8 dgetCustomLogoType() const { if ( CustomLogo.xmlBool.isDefined() ) return CustomLogo.xmlBool.value() ? CUSTOM_BOOT_APPLE : CUSTOM_BOOT_USER_DISABLED; if ( CustomLogo.xmlString8.isDefined() ) { diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_CPU.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_CPU.h index 5b8349ba1..1e6813749 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_CPU.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_CPU.h @@ -18,7 +18,7 @@ protected: { using super = XmlUInt32; public: - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( isDefined() && (value() <= 100 || value() >= 20000) ) { return xmlLiteParser->addError(generateErrors, S8Printf("FrequencyMHz must be >200 and <20000 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); @@ -30,7 +30,7 @@ protected: { using super = XmlUInt16; public: - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); return xmlLiteParser->addWarning(generateErrors, S8Printf("Latency is replaced by ACPI/SSDT/C3Latency, value ignored. tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); } @@ -75,23 +75,23 @@ public: CPU_Class() {} - uint16_t dgetQPI() const { return QPI.isDefined() ? QPI.value() : false; }; - uint32_t dgetCpuFreqMHz() const { return FrequencyMHz.isDefined() ? FrequencyMHz.value() : false; }; + uint16_t dgetQPI() const { return QPI.isDefined() ? QPI.value() : 0; }; + uint32_t dgetCpuFreqMHz() const { return FrequencyMHz.isDefined() ? FrequencyMHz.value() : 0; }; uint16_t dgetCpuType() const { return Type.isDefined() ? Type.value() : GetAdvancedCpuType(); }; - bool dgetQEMU() const { return QEMU.isDefined() ? QEMU.value() : false; }; - bool dgetUseARTFreq() const { return UseARTFrequency.isDefined() ? UseARTFrequency.value() : false; }; - uint32_t dgetBusSpeed() const { return BusSpeedkHz.isDefined() ? BusSpeedkHz.value() : false; }; + XBool dgetQEMU() const { return QEMU.isDefined() ? QEMU.value() : XBool(false); }; + XBool dgetUseARTFreq() const { return UseARTFrequency.isDefined() ? UseARTFrequency.value() : XBool(false); }; + uint32_t dgetBusSpeed() const { return BusSpeedkHz.isDefined() ? BusSpeedkHz.value() : 0; }; undefinable_bool dget_EnableC6() const { return C6.isDefined() ? undefinable_bool(C6.value()) : undefinable_bool(); }; undefinable_bool dget_EnableC4() const { return C4.isDefined() ? undefinable_bool(C4.value()) : undefinable_bool(); }; undefinable_bool dget_EnableC2() const { return C2.isDefined() ? undefinable_bool(C2.value()) : undefinable_bool(); }; undefinable_uint16 dget_C3Latency() const { return Latency.isDefined() ? undefinable_uint16(Latency.value()) : undefinable_uint16(); }; uint8_t dgetSavingMode() const { return SavingMode.isDefined() ? SavingMode.value() : 0xFF; }; - bool dgetHWPEnable() const { return HWPEnable.isDefined() ? HWPEnable.value() : false; }; + XBool dgetHWPEnable() const { return HWPEnable.isDefined() ? HWPEnable.value() : XBool(false); }; undefinable_uint32 dgetHWPValue() const { return HWPValue.isDefined() ? undefinable_uint32(HWPValue.value()) : undefinable_uint32(); }; uint8_t dgetTDP() const { return TDP.isDefined() ? TDP.value() : false; }; - bool dgetTurboDisabled() const { return TurboDisable.isDefined() ? TurboDisable.value() : false; }; + XBool dgetTurboDisabled() const { return TurboDisable.isDefined() ? TurboDisable.value() : XBool(false); }; - bool dgetUserChange() const { return BusSpeedkHz.isDefined(); }; + XBool dgetUserChange() const { return BusSpeedkHz.isDefined(); }; undefinable_bool getUseARTFreq() const { return UseARTFrequency.isDefined() ? undefinable_bool(UseARTFrequency.value()) : undefinable_bool(); }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices.h index f7567978b..5d36494d6 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices.h @@ -122,9 +122,9 @@ protected: const decltype(SetIntelBacklight)::ValueType& dgetIntelBacklight() const { return SetIntelBacklight.isDefined() ? SetIntelBacklight.value() : SetIntelBacklight.nullValue; }; const decltype(SetIntelMaxBacklight)::ValueType& dgetIntelMaxBacklight() const { return SetIntelMaxBacklight.isDefined() ? SetIntelMaxBacklight.value() : SetIntelMaxBacklight.nullValue; }; const decltype(IntelMaxValue)::ValueType& dgetIntelMaxValue() const { return IntelMaxValue.isDefined() ? IntelMaxValue.value() : IntelMaxValue.nullValue; }; - bool dgetLANInjection() const { return isDefined() ? LANInjection.isDefined() ? LANInjection.value() : true : false; }; // TODO: different default value if section is not defined + XBool dgetLANInjection() const { return isDefined() ? LANInjection.isDefined() ? LANInjection.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined const decltype(HDMIInjection)::ValueType& dgetHDMIInjection() const { return HDMIInjection.isDefined() ? HDMIInjection.value() : HDMIInjection.nullValue; }; - bool dgetNoDefaultProperties() const { return isDefined() ? NoDefaultProperties.isDefined() ? NoDefaultProperties.value() : true : false; }; // TODO: different default value if section is not defined + XBool dgetNoDefaultProperties() const { return isDefined() ? NoDefaultProperties.isDefined() ? NoDefaultProperties.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined const decltype(UseIntelHDMI)::ValueType& dgetUseIntelHDMI() const { return UseIntelHDMI.isDefined() ? UseIntelHDMI.value() : UseIntelHDMI.nullValue; }; const decltype(ForceHPET)::ValueType& dgetForceHPET() const { return ForceHPET.isDefined() ? ForceHPET.value() : ForceHPET.nullValue; }; const decltype(DisableFunctions)::ValueType& dgetDisableFunctions() const { return DisableFunctions.isDefined() ? DisableFunctions.value() : DisableFunctions.nullValue; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Arbitrary.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Arbitrary.h index e16e98d41..4adde734e 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Arbitrary.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Arbitrary.h @@ -14,7 +14,7 @@ class Devices_Arbitrary_Class : public XmlDict public: // class PciAddrClass : public XmlString8AllowEmpty { -// virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { // RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); // if ( isDefined() && value().length() != 8 ) return xmlLiteParser->addError(generateErrors, S8Printf("PciAddr must be 8 chars long (ex 00:00.01) at line %d.", keyPos.getLine())); // return true; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Audio.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Audio.h index c69a6882a..1ececd6de 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Audio.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Audio.h @@ -21,7 +21,7 @@ class Devices_Audio_Class : public XmlDict XmlString8AllowEmpty xmlString8 = XmlString8AllowEmpty(); // TODO: change XmlString8AllowEmpty for XmlString8AllowEmpty XmlUnionField m_fields[2] = { xmlInt32, xmlString8}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( !xmlString8.isDefined() ) return true; // if ( xmlString8.value().isEqualIC("Detect") ) return true; @@ -45,14 +45,14 @@ class Devices_Audio_Class : public XmlDict }; public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; -// virtual bool validate(XmlLiteParser* xmlLiteParser, const char* name, XmlAbstractType* xmlTyp, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) override; +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const char* name, XmlAbstractType* xmlTyp, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) override; const decltype(ResetHDA)::ValueType& dgetResetHDA() const { return ResetHDA.isDefined() ? ResetHDA.value() : ResetHDA.nullValue; }; const decltype(AFGLowPowerState)::ValueType& dgetAFGLowPowerState() const { return AFGLowPowerState.isDefined() ? AFGLowPowerState.value() : AFGLowPowerState.nullValue; }; - bool dgetHDAInjection() const { + XBool dgetHDAInjection() const { if ( !Inject.isDefined() ) return false; - if ( Inject.xmlInt32.isDefined() ) return Inject.xmlInt32.value(); + if ( Inject.xmlInt32.isDefined() ) return Inject.xmlInt32.value() != 0; if ( Inject.xmlString8.isDefined() ) { if ( Inject.xmlString8.value().startWithOrEqualToIC("n") ) return false; if ( Inject.xmlString8.value().startWithOrEqualToIC("0x") ) return true; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Properties.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Properties.h index b1e723a9f..d622e227d 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Properties.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_Properties.h @@ -33,7 +33,7 @@ class PropertiesUnion: public XmlUnion uint8_t dgetBValue() const { if ( !parent.dgetEnabled() ) return false; - return xmlKey().isDefined() ? xmlKey().isEnabled() : false; + return xmlKey().isDefined() ? xmlKey().isEnabled() : XBool(false); } const keyType::ValueType& dgetKey() const { return xmlKey().isDefined() ? xmlKey().value() : xmlKey().nullValue; }; XBuffer dgetValue() const { return isDefined() ? value() : XBuffer::NullXBuffer; }; @@ -55,7 +55,7 @@ class PropertiesUnion: public XmlUnion public: const keyType::ValueType& dgetLabel() const { return super::xmlKey().isDefined() ? xmlKey().value() : xmlKey().nullValue; }; const keyType::ValueType& dgetDevicePathAsString() const { return xmlKey().isDefined() ? xmlKey().value() : xmlKey().nullValue; }; - bool dgetEnabled() const { return xmlKey().isDefined() ? xmlKey().isEnabled() : false; }; + XBool dgetEnabled() const { return xmlKey().isDefined() ? xmlKey().isEnabled() : XBool(false); }; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_USB.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_USB.h index 06494e449..eb10ea02d 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_USB.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Devices_USB.h @@ -34,7 +34,7 @@ protected: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; public: - decltype(Inject)::ValueType dgetUSBInjection() const { return Inject.isDefined() ? Inject.value() : true; }; + decltype(Inject)::ValueType dgetUSBInjection() const { return Inject.isDefined() ? Inject.value() : XBool(true); }; const decltype(AddClockID)::ValueType& dgetInjectClockID() const { return AddClockID.isDefined() ? AddClockID.value() : AddClockID.nullValue; }; const decltype(FixOwnership)::ValueType& dgetUSBFixOwnership() const { return FixOwnership.isDefined() ? FixOwnership.value() : FixOwnership.nullValue; }; const decltype(HighCurrent)::ValueType& dgetHighCurrent() const { return HighCurrent.isDefined() ? HighCurrent.value() : HighCurrent.nullValue; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.cpp b/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.cpp index 58ff21be6..4e029ab84 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.cpp +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.cpp @@ -14,7 +14,7 @@ #include "ConfigPlistClass.h" -bool ConfigPlistClass::GUI_Class::GUI_Custom_Class::GUI_Custom_Entry_Class::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) { +XBool ConfigPlistClass::GUI_Class::GUI_Custom_Class::GUI_Custom_Entry_Class::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; for ( size_t idx=0 ; idx < SubEntries.size() ; ++idx ) SubEntries.ElementAt(idx).Parent = this; if ( Arguments.isDefined() && AddArguments.isDefined() ) { diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.h index bb9f94453..6fca4b125 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_GUI.h @@ -36,12 +36,12 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; int64_t dgetPointerSpeed() const { return Speed.isDefined() ? Speed.value() : 2; }; - bool dgetPointerEnabled() const { + XBool dgetPointerEnabled() const { if ( dgetPointerSpeed() <= 0 ) return false; // return false, whatever value Enabled has. if ( Enabled.isDefined() ) return Enabled.value(); return true; // if !Enabled.isDefined(), return true because dgetPointerSpeed() > 0 } - bool dgetPointerMirror() const { return Mirror.isDefined() ? Mirror.value() : false; }; + XBool dgetPointerMirror() const { return Mirror.isDefined() ? Mirror.value() : XBool(false); }; uint64_t dgetDoubleClickTime() const { return DoubleClickTime.isDefined() ? DoubleClickTime.value() : 500; }; }; @@ -49,7 +49,7 @@ public: // -------------------------------------------------- Scan class - // bool or dict + // XBool or dict class GUI_Scan_Class : public XmlUnion { public: @@ -75,15 +75,15 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetDisableEntryScan() const { return Entries.isDefined() && Entries.value() == false; }; - bool dgetDisableToolScan() const { return Tool.isDefined() && Tool.value() == false; }; - bool dgetLinux() const { return !(Linux.isDefined() && Linux.value() == false); }; - bool dgetNoLegacy() const { + XBool dgetDisableEntryScan() const { return Entries.isDefined() && Entries.value() == false; }; + XBool dgetDisableToolScan() const { return Tool.isDefined() && Tool.value() == false; }; + XBool dgetLinux() const { return !(Linux.isDefined() && Linux.value() == false); }; + XBool dgetNoLegacy() const { if ( !Legacy.isDefined() ) return false; if ( Legacy.xmlBool.isDefined() && Legacy.xmlBool.value() == false ) return true; return false; } - bool dgetLegacyFirst() const { return Legacy.isDefined() && Legacy.xmlString8.isDefined() && Legacy.xmlString8.value().startWithIC("F"); }; + XBool dgetLegacyFirst() const { return Legacy.isDefined() && Legacy.xmlString8.isDefined() && Legacy.xmlString8.value().startWithIC("F"); }; UINT8 dgetKernel() const { if ( !Kernel.isDefined() ) return 0; if ( Kernel.xmlBool.isDefined() ) { @@ -114,23 +114,23 @@ public: XmlUnionField m_fields[2] = { ScanAsBool, ScanAsAsDict}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetDisableEntryScan() const { + XBool dgetDisableEntryScan() const { if ( ScanAsBool.isDefined() && ScanAsBool.value() == false ) return true; return ScanAsAsDict.dgetDisableEntryScan(); } - bool dgetDisableToolScan() const { + XBool dgetDisableToolScan() const { if ( ScanAsBool.isDefined() && ScanAsBool.value() == false ) return true; return ScanAsAsDict.dgetDisableToolScan(); } - bool dgetLinuxScan() const { + XBool dgetLinuxScan() const { if ( !ScanAsAsDict.isDefined() ) return parent.isDefined(); // TODO: different default value if section is not defined return ScanAsAsDict.dgetLinux(); } - bool dgetNoLegacy() const { + XBool dgetNoLegacy() const { if ( ScanAsBool.isDefined() && ScanAsBool.value() == false ) return true; return ScanAsAsDict.dgetNoLegacy(); } - bool dgetLegacyFirst() const { + XBool dgetLegacyFirst() const { if ( !ScanAsAsDict.isDefined() ) return false; return ScanAsAsDict.dgetLegacyFirst(); } @@ -212,7 +212,7 @@ public: XmlString8AllowEmpty xmlString8 = XmlString8AllowEmpty(); XmlUnionField m_fields[2] = { xmlBool, xmlString8}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( !xmlString8.isDefined() ) return true; if ( xmlString8.value().isEqualIC("Always") ) return true; @@ -281,13 +281,13 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; const XStringW& dgetVolume() const { return Volume.isDefined() ? Volume.value() : NullXStringW; }; const XStringW& dgetPath() const { return Path.isDefined() ? Path.value() : NullXStringW; }; const XStringW& dgetSettings() const { return Settings.isDefined() ? Settings.value() : NullXStringW; }; - BOOLEAN dgetCommonSettings() const { return CommonSettings.isDefined() ? CommonSettings.value() : false; }; + XBool dgetCommonSettings() const { return CommonSettings.isDefined() ? CommonSettings.value() : XBool(false); }; const XString8& dgetAddArguments() const { return AddArguments.isDefined() ? AddArguments.value() : NullXString8; }; const undefinable_XString8 dgetArguments() const { return Arguments.isDefined() ? undefinable_XString8(Arguments.value()) : undefinable_XString8(); }; const XString8& dgetm_Title() const { return Title.isDefined() ? Title.value() : NullXString8; }; @@ -319,8 +319,8 @@ public: UINTN Color = AsciiStrHexToUintn(BootBgColor.value()); return EFI_GRAPHICS_OUTPUT_BLT_PIXEL({uint8_t((Color >> 8) & 0xFF),uint8_t((Color >> 16) & 0xFF),uint8_t((Color >> 24) & 0xFF),uint8_t((Color >> 0) & 0xFF)}); } - bool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : false; }; - bool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; + XBool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : XBool(false); }; + XBool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; UINT8 dgetType() const { if ( Type.isDefined() ) { if ((Type.value().isEqualIC("OSX")) || @@ -377,10 +377,10 @@ public: } // 2021-04-22 - decltype(ForceTextMode)::ValueType dgetForceTextMode() const { return ForceTextMode.isDefined() ? ForceTextMode.value() : false; }; + decltype(ForceTextMode)::ValueType dgetForceTextMode() const { return ForceTextMode.isDefined() ? ForceTextMode.value() : XBool(false); }; // /* calculated values */ -// UINT8 getFlags(bool NoCachesDefault) const { +// UINT8 getFlags(XBool NoCachesDefault) const { // UINT8 Flags = 0; // if ( Arguments.isDefined() ) Flags = OSFLAG_SET(Flags, OSFLAG_NODEFAULTARGS); // if ( dgetAlwaysHidden() ) Flags = OSFLAG_SET(Flags, OSFLAG_DISABLED); @@ -432,12 +432,12 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; return true; } - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; const XString8& dget_AddArguments() const { return AddArguments.isDefined() ? AddArguments.value() : NullXString8; }; const undefinable_XString8 dget_Arguments() const { return Arguments.isDefined() ? undefinable_XString8(Arguments.value()) : undefinable_XString8(); }; undefinable_XString8 dget_Title() const { return Title.isDefined() ? undefinable_XString8(Title.value()) : undefinable_XString8(); }; @@ -484,7 +484,7 @@ public: XmlData DriveImageData = XmlData(); class HotKeyClass : public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( !isDefined() ) return true; if ( xstring8.length() != 1 ) { @@ -520,7 +520,7 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; const XString8& dgetVolume() const { return Volume.isDefined() ? Volume.value() : NullXString8; }; const XString8& dgetTitle() const { return Title.isDefined() ? Title.value() : NullXString8; }; const XString8& dgetFullTitle() const { return FullTitle.isDefined() ? FullTitle.value() : NullXString8; }; @@ -529,8 +529,8 @@ public: const XString8& dgetDriveImagePath() const { return DriveImagePath.isDefined() ? DriveImagePath.value() : NullXString8; }; const XBuffer& dgetDriveImageData() const { return DriveImageData.isDefined() ? DriveImageData.value() : XBuffer::NullXBuffer; }; char32_t dgetHotkey() const { return Hotkey.isDefined() && Hotkey.value().notEmpty() ? Hotkey.value()[0] : 0; }; - bool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : false; }; - bool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; + XBool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : XBool(false); }; + XBool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; UINT8 dgetType() const { if ( Type.isDefined() ) { if (Type.value().isEqualIC("Windows")) { @@ -581,7 +581,7 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; const XString8& dgetVolume() const { return Volume.isDefined() ? Volume.value() : NullXString8; }; const XString8& dgetPath() const { return Path.isDefined() ? Path.value() : NullXString8; }; const XString8& dgetArguments() const { return Arguments.isDefined() ? Arguments.value() : NullXString8; }; @@ -590,8 +590,8 @@ public: const XString8& dgetImagePath() const { return ImagePath.isDefined() ? ImagePath.value() : NullXString8; }; const XBuffer& dgetImageData() const { return ImageData.isDefined() ? ImageData.value() : XBuffer::NullXBuffer; }; char32_t dgetHotkey() const { return Hotkey.isDefined() && Hotkey.value().notEmpty() ? Hotkey.value()[0] : 0; }; - bool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : false; }; - bool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; + XBool dgetHidden() const { return Hidden.isDefined() && Hidden.xmlBool.isDefined() ? Hidden.xmlBool.value() : XBool(false); }; + XBool dgetAlwaysHidden() const { return Hidden.isDefined() && Hidden.xmlString8.isDefined() ? Hidden.xmlString8.value().isEqualIC("Always") : false; }; UINT8 dgetVolumeType() const { return VolumeType.isDefined() ? VolumeType.dgetVolumeType() : /*Parent ? Parent->dgetVolumeType() :*/ 0; } // VolumeType is duplicated in DuplicateCustomEntry(), but unconditionnally assigned in FillinCustomEntry(). So no "inheritance" from parent. }; @@ -623,7 +623,7 @@ protected: // EmbeddedThemeType class EmbeddedThemeTypeClass: public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( xstring8.isEqualIC("Dark") ) return true; if ( xstring8.isEqualIC("Light") ) return true; @@ -643,7 +643,7 @@ protected: // ScreenResolution class ScreenResolutionClass: public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); // TODO Check that resolution is Integer x Integer return true; @@ -658,7 +658,7 @@ protected: using super = XmlInt64OrString; public: // ConsoleMode_Class() : XmlInt64OrString(false) {}; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( !xmlString8.isDefined() ) return true; if ( xmlString8.value().isEqualIC("Max") ) return true; @@ -670,7 +670,7 @@ protected: // Language class LanguageClass: public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( xstring8.containsIC("en") ) return true; if ( xstring8.containsIC("ru") ) return true; @@ -733,17 +733,17 @@ public: GUI_Class() : Scan(*this) {} virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; -// virtual bool validate(XmlLiteParser* xmlLiteParser, const char* name, XmlAbstractType* xmlTyp, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) override; +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const char* name, XmlAbstractType* xmlTyp, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) override; int32_t dgetTimezone() const { return Timezone.isDefined() ? Timezone.value() : 0xFF; }; const XString8& dgetTheme() const { return Theme.isDefined() ? Theme.value() : NullXString8; }; const XString8& dgetEmbeddedThemeType() const { return EmbeddedThemeType.isDefined() ? EmbeddedThemeType.value() : NullXString8; }; - bool dgetPlayAsync() const { return PlayAsync.isDefined() ? PlayAsync.value() : false; }; - bool dgetCustomIcons() const { return CustomIcons.isDefined() ? CustomIcons.value() : false; }; - bool dgetTextOnly() const { return TextOnly.isDefined() ? TextOnly.value() : false; }; - bool dgetShowOptimus() const { return ShowOptimus.isDefined() ? ShowOptimus.value() : false; }; + XBool dgetPlayAsync() const { return PlayAsync.isDefined() ? PlayAsync.value() : XBool(false); }; + XBool dgetCustomIcons() const { return CustomIcons.isDefined() ? CustomIcons.value() : XBool(false); }; + XBool dgetTextOnly() const { return TextOnly.isDefined() ? TextOnly.value() : XBool(false); }; + XBool dgetShowOptimus() const { return ShowOptimus.isDefined() ? ShowOptimus.value() : XBool(false); }; const XString8& dgetScreenResolution() const { return ScreenResolution.isDefined() ? ScreenResolution.value() : NullXString8; }; - bool dgetProvideConsoleGop() const { return isDefined() ? ProvideConsoleGop.isDefined() ? ProvideConsoleGop.value() : true : false; }; // TODO: different default value if section is not defined + XBool dgetProvideConsoleGop() const { return isDefined() ? ProvideConsoleGop.isDefined() ? ProvideConsoleGop.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined int64_t dgetConsoleMode() const { if ( ConsoleMode.xmlInt64.isDefined() ) { return ConsoleMode.xmlInt64.value(); @@ -801,11 +801,11 @@ public: - bool dgetKbdPrevLang() const { return KbdPrevLang.isDefined() ? KbdPrevLang.value() : false; }; + XBool dgetKbdPrevLang() const { return KbdPrevLang.isDefined() ? KbdPrevLang.value() : XBool(false); }; /* calculated value */ - bool getDarkEmbedded(bool isDaylight) const { + XBool getDarkEmbedded(XBool isDaylight) const { if ( !EmbeddedThemeType.isDefined() ) return false; if ( EmbeddedThemeType.value().isEqualIC("Dark") ) return true; if ( EmbeddedThemeType.value().isEqualIC("Daytime") ) return !isDaylight; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Graphics.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Graphics.h index 39d347aa3..977067750 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Graphics.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Graphics.h @@ -88,7 +88,7 @@ public: }; virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); if ( Inject.isDefined() ) { if ( Inject.value() ) { @@ -147,9 +147,9 @@ public: const decltype(ATI)::ValueType& dgetATI() const { return ATI.isDefined() ? ATI.value() : ATI.nullValue; }; const decltype(NVidia)::ValueType& dgetNVidia() const { return NVidia.isDefined() ? NVidia.value() : NVidia.nullValue; }; friend class XmlInjectUnion; - bool isInjectIntelDefined() const { return Intel.isDefined(); }; - bool isInjectATIDefined() const { return ATI.isDefined(); }; - bool isInjectNVidiaDefined() const { return NVidia.isDefined(); }; + XBool isInjectIntelDefined() const { return Intel.isDefined(); }; + XBool isInjectATIDefined() const { return ATI.isDefined(); }; + XBool isInjectNVidiaDefined() const { return NVidia.isDefined(); }; }; class XmlInjectUnion: public XmlUnion @@ -160,7 +160,7 @@ public: XmlUnionField m_fields[2] = { xmlBool, xmlDict}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; public: - bool dgetGraphicsInjector() const { + XBool dgetGraphicsInjector() const { if ( xmlBool.isDefined() ) return xmlBool.value(); return false; } @@ -168,9 +168,9 @@ public: const decltype(Graphics_Inject_Class::ATI)::ValueType& dgetInjectATI() const { return xmlBool.isDefined() ? xmlBool.value() : xmlDict.isDefined() ? xmlDict.dgetATI() : decltype(Graphics_Inject_Class::ATI)::nullValue; }; const decltype(Graphics_Inject_Class::NVidia)::ValueType& dgetInjectNVidia() const { return xmlBool.isDefined() ? xmlBool.value() : xmlDict.isDefined() ? xmlDict.dgetNVidia() : decltype(Graphics_Inject_Class::NVidia)::nullValue; }; - bool isInjectIntelDefined() const { return xmlBool.isDefined() || xmlDict.isInjectIntelDefined(); }; - bool isInjectATIDefined() const { return xmlBool.isDefined() || xmlDict.isInjectATIDefined(); }; - bool isInjectNVidiaDefined() const { return xmlBool.isDefined() || xmlDict.isInjectNVidiaDefined(); }; + XBool isInjectIntelDefined() const { return xmlBool.isDefined() || xmlDict.isInjectIntelDefined(); }; + XBool isInjectATIDefined() const { return xmlBool.isDefined() || xmlDict.isInjectATIDefined(); }; + XBool isInjectNVidiaDefined() const { return xmlBool.isDefined() || xmlDict.isInjectNVidiaDefined(); }; }; protected: diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_KernelAndKextPatches.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_KernelAndKextPatches.h index 017e2c555..9218bd501 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_KernelAndKextPatches.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_KernelAndKextPatches.h @@ -54,20 +54,20 @@ public: // virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; virtual void getFields(XmlDictField** fields, size_t* nb) override { panic("BUG: This cannot be called"); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; // TODO after switch to new parser : name.isEmpty() if ( !Find.isDefined() || Find.value().size() == 0 ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Find has to be defined in dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); if ( !Replace.isDefined() || Replace.value().size() == 0 ) return xmlLiteParser->addWarning(generateErrors, S8Printf("One of Find or Replace has to be defined in dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); if ( Replace.value().size() > Find.value().size() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Replace is longer (%zu) than Find (%zu) and will be truncated in dict '%s:%d'.", Replace.value().size(), Find.value().size(), xmlPath.c_str(), keyPos.getLine())); - Replace.modifiableValue().setSize(Find.value().size(), 0); + Replace.setSize(Find.value().size(), 0); // 0 is ignored because we know that this call will truncate } return b; } - bool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : false; }; + XBool dgetDisabled() const { return Disabled.isDefined() ? Disabled.value() : XBool(false); }; const XBuffer& dgetFind() const { return Find.isDefined() ? Find.value() : XBuffer::NullXBuffer; }; const XBuffer& dgetReplace() const { return Replace.isDefined() ? Replace.value() : XBuffer::NullXBuffer; }; XBuffer dgetMaskFind() const @@ -152,9 +152,9 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); if ( !Name.isDefined() ) { b = xmlLiteParser->addWarning(generateErrors, S8Printf("Kernel patch is ignored because 'Name' is not defined in dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); @@ -165,7 +165,7 @@ public: const XString8& dgetName() const { return Name.isDefined() ? Name.value() : NullXString8; }; XString8 dgetLabel() const override { return Comment.isDefined() ? S8Printf("%s (%s)", Name.value().c_str(), Comment.value().c_str()) : S8Printf("%s (NoLabel)", Name.value().c_str()); }; - bool dgetIsPlistPatch() const { return InfoPlistPatch.isDefined() ? InfoPlistPatch.value() : false; }; + XBool dgetIsPlistPatch() const { return InfoPlistPatch.isDefined() ? InfoPlistPatch.value() : XBool(false); }; // override because of different defaultvalue virtual INTN dgetCount() const override { return Count.isDefined() ? Count.value() : 1; }; @@ -197,8 +197,8 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { - bool b = true; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { + XBool b = true; b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); return b; } @@ -231,8 +231,8 @@ public: public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { - bool b = true; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { + XBool b = true; b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); return b; } @@ -245,15 +245,10 @@ public: class ForceKextsToLoadClass : public XmlStringWArray { using super = XmlStringWArray; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - for ( size_t idx = 0 ; idx < value().size() ; ) { - if ( value()[idx] == "\\"_XS8 ) { - xmlLiteParser->addWarning(generateErrors, S8Printf("String cannot be '\\' for tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); - value().removeAtPos(idx); - }else{ - ++idx; - } + if ( value().contains("\\") ) { + return xmlLiteParser->addWarning(generateErrors, S8Printf("String cannot contains '\\' for tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); } return true; } @@ -299,9 +294,9 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; if ( !ATIConnectorsController.isDefined() ) { if ( ATIConnectorsData.isDefined() ) { b = xmlLiteParser->addWarning(generateErrors, S8Printf("ATIConnectorsData is ignored because ATIConnectorsController is not defined in dict '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); @@ -329,16 +324,16 @@ public: return true; } - bool dgetKPDebug() const { return Debug.isDefined() ? Debug.value() : false; }; - bool dgetKPKernelLapic() const { return KernelLapic.isDefined() ? KernelLapic.value() : false; }; - bool dgetKPKernelXCPM() const { return KernelXCPM.isDefined() ? KernelXCPM.value() : false; }; - bool dget_KPKernelPm() const { return KernelPm.isDefined() ? KernelPm.value() : false; }; - bool dgetKPPanicNoKextDump() const { return PanicNoKextDump.isDefined() ? PanicNoKextDump.value() : false; }; - bool dget_KPAppleIntelCPUPM() const { return AppleIntelCPUPM.isDefined() ? AppleIntelCPUPM.value() : false; }; - bool dgetKPAppleRTC() const { return AppleRTC.isDefined() ? AppleRTC.value() : true; }; - bool dgetEightApple() const { return EightApple.isDefined() ? EightApple.value() : false; }; - bool dgetKPDELLSMBIOS() const { return DellSMBIOSPatch.isDefined() ? DellSMBIOSPatch.value() : false; }; - uint32_t dgetFakeCPUID() const { return FakeCPUID.isDefined() ? FakeCPUID.value() : false; }; + XBool dgetKPDebug() const { return Debug.isDefined() ? Debug.value() : XBool(false); }; + XBool dgetKPKernelLapic() const { return KernelLapic.isDefined() ? KernelLapic.value() : XBool(false); }; + XBool dgetKPKernelXCPM() const { return KernelXCPM.isDefined() ? KernelXCPM.value() : XBool(false); }; + XBool dget_KPKernelPm() const { return KernelPm.isDefined() ? KernelPm.value() : XBool(false); }; + XBool dgetKPPanicNoKextDump() const { return PanicNoKextDump.isDefined() ? PanicNoKextDump.value() : XBool(false); }; + XBool dget_KPAppleIntelCPUPM() const { return AppleIntelCPUPM.isDefined() ? AppleIntelCPUPM.value() : XBool(false); }; + XBool dgetKPAppleRTC() const { return AppleRTC.isDefined() ? AppleRTC.value() : XBool(true); }; + XBool dgetEightApple() const { return EightApple.isDefined() ? EightApple.value() : XBool(false); }; + XBool dgetKPDELLSMBIOS() const { return DellSMBIOSPatch.isDefined() ? DellSMBIOSPatch.value() : XBool(false); }; + uint32_t dgetFakeCPUID() const { return FakeCPUID.isDefined() ? FakeCPUID.value() : 0; }; const XString8& dgetKPATIConnectorsController() const { return ATIConnectorsController.isDefined() ? ATIConnectorsController.value() : NullXString8; }; const XBuffer& dgetKPATIConnectorsData() const { return ATIConnectorsData.isDefined() ? ATIConnectorsData.value() : XBuffer::NullXBuffer; }; const XBuffer& dgetKPATIConnectorsPatch() const { return ATIConnectorsPatch.isDefined() ? ATIConnectorsPatch.value() : XBuffer::NullXBuffer; }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Quirks.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Quirks.h index 99abc8631..0e605e3e5 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Quirks.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Quirks.h @@ -31,9 +31,9 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; if ( !Address.isDefined() || Address.value() == 0) { if ( Enabled.isDefined() && Enabled.value() ) b = xmlLiteParser->addWarning(generateErrors, S8Printf("Enabled is ignored because Address is not defined or 0 in dict '%s:%d'", xmlPath.c_str(), keyPos.getLine())); } @@ -66,17 +66,17 @@ public: XmlBool ThirdPartyDrives = XmlBool(); XmlBool XhciPortLimit = XmlBool(); - bool dgetAppleXcpmExtraMsrs() const { return AppleXcpmExtraMsrs.isDefined() ? AppleXcpmExtraMsrs.value() : AppleXcpmExtraMsrs.nullValue; }; - bool dgetAppleXcpmForceBoost() const { return AppleXcpmForceBoost.isDefined() ? AppleXcpmForceBoost.value() : AppleXcpmForceBoost.nullValue; }; - bool dgetDisableIoMapper() const { return DisableIoMapper.isDefined() ? DisableIoMapper.value() : DisableIoMapper.nullValue; }; - bool dgetDisableLinkeditJettison() const { return DisableLinkeditJettison.isDefined() ? DisableLinkeditJettison.value() : DisableLinkeditJettison.nullValue; }; - bool dgetDummyPowerManagement() const { return DummyPowerManagement.isDefined() ? DummyPowerManagement.value() : DummyPowerManagement.nullValue; }; - bool dgetExtendBTFeatureFlags() const { return ExtendBTFeatureFlags.isDefined() ? ExtendBTFeatureFlags.value() : ExtendBTFeatureFlags.nullValue; }; - bool dgetExternalDiskIcons() const { return ExternalDiskIcons.isDefined() ? ExternalDiskIcons.value() : ExternalDiskIcons.nullValue; }; - bool dgetIncreasePciBarSize() const { return IncreasePciBarSize.isDefined() ? IncreasePciBarSize.value() : IncreasePciBarSize.nullValue; }; - bool dgetPowerTimeoutKernelPanic() const { return PowerTimeoutKernelPanic.isDefined() ? PowerTimeoutKernelPanic.value() : PowerTimeoutKernelPanic.nullValue; }; - bool dgetThirdPartyDrives() const { return ThirdPartyDrives.isDefined() ? ThirdPartyDrives.value() : ThirdPartyDrives.nullValue; }; - bool dgetXhciPortLimit() const { return XhciPortLimit.isDefined() ? XhciPortLimit.value() : XhciPortLimit.nullValue; }; + XBool dgetAppleXcpmExtraMsrs() const { return AppleXcpmExtraMsrs.isDefined() ? AppleXcpmExtraMsrs.value() : AppleXcpmExtraMsrs.nullValue; }; + XBool dgetAppleXcpmForceBoost() const { return AppleXcpmForceBoost.isDefined() ? AppleXcpmForceBoost.value() : AppleXcpmForceBoost.nullValue; }; + XBool dgetDisableIoMapper() const { return DisableIoMapper.isDefined() ? DisableIoMapper.value() : DisableIoMapper.nullValue; }; + XBool dgetDisableLinkeditJettison() const { return DisableLinkeditJettison.isDefined() ? DisableLinkeditJettison.value() : DisableLinkeditJettison.nullValue; }; + XBool dgetDummyPowerManagement() const { return DummyPowerManagement.isDefined() ? DummyPowerManagement.value() : DummyPowerManagement.nullValue; }; + XBool dgetExtendBTFeatureFlags() const { return ExtendBTFeatureFlags.isDefined() ? ExtendBTFeatureFlags.value() : ExtendBTFeatureFlags.nullValue; }; + XBool dgetExternalDiskIcons() const { return ExternalDiskIcons.isDefined() ? ExternalDiskIcons.value() : ExternalDiskIcons.nullValue; }; + XBool dgetIncreasePciBarSize() const { return IncreasePciBarSize.isDefined() ? IncreasePciBarSize.value() : IncreasePciBarSize.nullValue; }; + XBool dgetPowerTimeoutKernelPanic() const { return PowerTimeoutKernelPanic.isDefined() ? PowerTimeoutKernelPanic.value() : PowerTimeoutKernelPanic.nullValue; }; + XBool dgetThirdPartyDrives() const { return ThirdPartyDrives.isDefined() ? ThirdPartyDrives.value() : ThirdPartyDrives.nullValue; }; + XBool dgetXhciPortLimit() const { return XhciPortLimit.isDefined() ? XhciPortLimit.value() : XhciPortLimit.nullValue; }; OcKernelQuirks_Class(const Quirks_Class& _parent) /*: parent(_parent)*/ {} }; @@ -103,23 +103,23 @@ public: XmlBool SignalAppleOS = XmlBool(); XmlBool SyncRuntimePermissions = XmlBool(); - bool dgetAvoidRuntimeDefrag() const { return parent.isDefined() ? AvoidRuntimeDefrag.isDefined() ? AvoidRuntimeDefrag.value() : true : false; }; // TODO: different default value if section is not defined - bool dgetDevirtualiseMmio() const { return DevirtualiseMmio.isDefined() ? DevirtualiseMmio.value() : DevirtualiseMmio.nullValue; }; - bool dgetDisableSingleUser() const { return DisableSingleUser.isDefined() ? DisableSingleUser.value() : DisableSingleUser.nullValue; }; - bool dgetDisableVariableWrite() const { return DisableVariableWrite.isDefined() ? DisableVariableWrite.value() : DisableVariableWrite.nullValue; }; - bool dgetDiscardHibernateMap() const { return DiscardHibernateMap.isDefined() ? DiscardHibernateMap.value() : DiscardHibernateMap.nullValue; }; - bool dgetEnableSafeModeSlide() const { return parent.isDefined() ? EnableSafeModeSlide.isDefined() ? EnableSafeModeSlide.value() : true : false; }; // TODO: different default value if section is not defined - bool dgetEnableWriteUnprotector() const { return parent.isDefined() ? EnableWriteUnprotector.isDefined() ? EnableWriteUnprotector.value() : true : EnableWriteUnprotector.nullValue; }; // TODO: different default value if section is not defined - bool dgetForceExitBootServices() const { return ForceExitBootServices.isDefined() ? ForceExitBootServices.value() : ForceExitBootServices.nullValue; }; - bool dgetProtectMemoryRegions() const { return ProtectMemoryRegions.isDefined() ? ProtectMemoryRegions.value() : ProtectMemoryRegions.nullValue; }; - bool dgetProtectSecureBoot() const { return ProtectSecureBoot.isDefined() ? ProtectSecureBoot.value() : ProtectSecureBoot.nullValue; }; - bool dgetProtectUefiServices() const { return ProtectUefiServices.isDefined() ? ProtectUefiServices.value() : ProtectUefiServices.nullValue; }; - bool dgetProvideCustomSlide() const { return ProvideCustomSlide.isDefined() ? ProvideCustomSlide.value() : ProvideCustomSlide.nullValue; }; + XBool dgetAvoidRuntimeDefrag() const { return parent.isDefined() ? AvoidRuntimeDefrag.isDefined() ? AvoidRuntimeDefrag.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined + XBool dgetDevirtualiseMmio() const { return DevirtualiseMmio.isDefined() ? DevirtualiseMmio.value() : DevirtualiseMmio.nullValue; }; + XBool dgetDisableSingleUser() const { return DisableSingleUser.isDefined() ? DisableSingleUser.value() : DisableSingleUser.nullValue; }; + XBool dgetDisableVariableWrite() const { return DisableVariableWrite.isDefined() ? DisableVariableWrite.value() : DisableVariableWrite.nullValue; }; + XBool dgetDiscardHibernateMap() const { return DiscardHibernateMap.isDefined() ? DiscardHibernateMap.value() : DiscardHibernateMap.nullValue; }; + XBool dgetEnableSafeModeSlide() const { return parent.isDefined() ? EnableSafeModeSlide.isDefined() ? EnableSafeModeSlide.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined + XBool dgetEnableWriteUnprotector() const { return parent.isDefined() ? EnableWriteUnprotector.isDefined() ? EnableWriteUnprotector.value() : XBool(true) : EnableWriteUnprotector.nullValue; }; // TODO: different default value if section is not defined + XBool dgetForceExitBootServices() const { return ForceExitBootServices.isDefined() ? ForceExitBootServices.value() : ForceExitBootServices.nullValue; }; + XBool dgetProtectMemoryRegions() const { return ProtectMemoryRegions.isDefined() ? ProtectMemoryRegions.value() : ProtectMemoryRegions.nullValue; }; + XBool dgetProtectSecureBoot() const { return ProtectSecureBoot.isDefined() ? ProtectSecureBoot.value() : ProtectSecureBoot.nullValue; }; + XBool dgetProtectUefiServices() const { return ProtectUefiServices.isDefined() ? ProtectUefiServices.value() : ProtectUefiServices.nullValue; }; + XBool dgetProvideCustomSlide() const { return ProvideCustomSlide.isDefined() ? ProvideCustomSlide.value() : ProvideCustomSlide.nullValue; }; uint8_t dgetProvideMaxSlide() const { return ProvideMaxSlide.isDefined() ? ProvideMaxSlide.value() : ProvideMaxSlide.nullValue; }; - bool dgetRebuildAppleMemoryMap() const { return RebuildAppleMemoryMap.isDefined() ? RebuildAppleMemoryMap.value() : RebuildAppleMemoryMap.nullValue; }; - bool dgetSetupVirtualMap() const { return parent.isDefined() ? SetupVirtualMap.isDefined() ? SetupVirtualMap.value() : true : SetupVirtualMap.nullValue; }; // TODO: different default value if section is not defined - bool dgetSignalAppleOS() const { return SignalAppleOS.isDefined() ? SignalAppleOS.value() : SignalAppleOS.nullValue; }; - bool dgetSyncRuntimePermissions() const { return parent.isDefined() ? SyncRuntimePermissions.isDefined() ? SyncRuntimePermissions.value() : true : false; }; // TODO: different default value if section is not defined + XBool dgetRebuildAppleMemoryMap() const { return RebuildAppleMemoryMap.isDefined() ? RebuildAppleMemoryMap.value() : RebuildAppleMemoryMap.nullValue; }; + XBool dgetSetupVirtualMap() const { return parent.isDefined() ? SetupVirtualMap.isDefined() ? SetupVirtualMap.value() : XBool(true) : SetupVirtualMap.nullValue; }; // TODO: different default value if section is not defined + XBool dgetSignalAppleOS() const { return SignalAppleOS.isDefined() ? SignalAppleOS.value() : SignalAppleOS.nullValue; }; + XBool dgetSyncRuntimePermissions() const { return parent.isDefined() ? SyncRuntimePermissions.isDefined() ? SyncRuntimePermissions.value() : XBool(true) : XBool(false); }; // TODO: different default value if section is not defined OcBooterQuirks_Class(const Quirks_Class& _parent) : parent(_parent) {} }; @@ -170,14 +170,14 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; return b; } const decltype(FuzzyMatch)::ValueType& dgetFuzzyMatch() const { return FuzzyMatch.isDefined() ? FuzzyMatch.value() : FuzzyMatch.nullValue; }; const decltype(KernelCache)::ValueType& dgetOcKernelCache() const { return KernelCache.isDefined() ? KernelCache.value() : KernelCache.nullValue; }; -// bool dgetProvideConsoleGop() const { return ProvideConsoleGopEnable.isDefined() ? ProvideConsoleGopEnable.value() : ProvideConsoleGopEnable.nullValue; }; +// XBool dgetProvideConsoleGop() const { return ProvideConsoleGopEnable.isDefined() ? ProvideConsoleGopEnable.value() : ProvideConsoleGopEnable.nullValue; }; UINT32 dgetQuirksMask() const { UINT32 mask = 0; mask |= OcBooterQuirks.dgetAvoidRuntimeDefrag() ? QUIRK_DEFRAG:0; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_RtVariables.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_RtVariables.h index 4961f11ed..a763fdd9a 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_RtVariables.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_RtVariables.h @@ -20,7 +20,7 @@ public: public: class GuidClass : public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; if ( !IsValidGuidString(xstring8) ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid GUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine())); @@ -67,7 +67,7 @@ public: XmlData xmlData = XmlData(); XmlUnionField m_fields[2] = { xmlString8, xmlData}; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; -// virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override +// virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override // { // WARNING_IF_DEFINED; // @@ -81,7 +81,7 @@ public: // xmlLiteParser->addError(generateErrors, S8Printf("Expecting \"UseMacAddr0\", \"UseMacAddr1\", a string or data for tag '%s:%d'.", xmlPath.c_str(), pos.getLine())); // return false; // } -// virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { //if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; // if ( !xmlString8.isDefined() ) return true; // if ( xmlString8.value().isEqualIC("UseMacAddr0") ) return true; @@ -118,7 +118,7 @@ public: }; // class ROMClass: public XmlData { -// virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { //if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; // if ( "UseMacAddr0"_XS8.isEqualIC(value().CData()) ) return true; // if ( "UseMacAddr1"_XS8.isEqualIC(value().CData()) ) return true; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_SystemParameters.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_SystemParameters.h index 500288b05..5ce84f4e0 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_SystemParameters.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_SystemParameters.h @@ -15,7 +15,7 @@ class SystemParameters_Class : public XmlDict public: class InjectKextsClass: public XmlBoolOrString { using super = XmlBoolOrString; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( isDefined() && xmlString8.isDefined() ) { if ( !xmlString8.value().isEqualIC("Detect") ) return xmlLiteParser->addWarning(generateErrors, S8Printf("InjectKexts must be a boolean or \"Detect\" in dict '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -25,7 +25,7 @@ public: }; class CustomUUIDClass : public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; if ( !IsValidGuidString(xstring8) ) return xmlLiteParser->addWarning(generateErrors, S8Printf(" invalid CustomUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine())); @@ -64,20 +64,20 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; return b; } - bool dgetWithKexts() const { return true; } // looks like it can never be false anymore... - bool dgetWithKextsIfNoFakeSMC() const { return InjectKexts.xmlString8.isDefined() ? InjectKexts.xmlString8.value().isEqualIC("Detect") : false; } - bool dgetNoCaches() const { return NoCaches.isDefined() ? NoCaches.value() : false; } - bool dgetBacklightLevelConfig() const { return BacklightLevel.isDefined(); } + XBool dgetWithKexts() const { return true; } // looks like it can never be false anymore... + XBool dgetWithKextsIfNoFakeSMC() const { return InjectKexts.xmlString8.isDefined() ? InjectKexts.xmlString8.value().isEqualIC("Detect") : false; } + XBool dgetNoCaches() const { return NoCaches.isDefined() ? NoCaches.value() : XBool(false); } + XBool dgetBacklightLevelConfig() const { return BacklightLevel.isDefined(); } uint16_t dgetBacklightLevel() const { return BacklightLevel.isDefined() && BacklightLevel.xmlInt16.isDefined() ? BacklightLevel.xmlInt16.value() : 0xFFFF; } const XString8& dgetCustomUuid() const { return CustomUUID.isDefined() ? CustomUUID.value() : NullXString8; } - UINT8 dget_InjectSystemID() const { return InjectSystemID.isDefined() ? InjectSystemID.value() : 2; } - bool dgetNvidiaWeb() const { return NvidiaWeb.isDefined() ? NvidiaWeb.value() : 0; } + UINT8 dget_InjectSystemID() const { return InjectSystemID.isDefined() ? (int)InjectSystemID.value() : 2; } + XBool dgetNvidiaWeb() const { return NvidiaWeb.isDefined() ? NvidiaWeb.value() : XBool(false); } }; diff --git a/rEFIt_UEFI/Settings/ConfigPlist/README.md b/rEFIt_UEFI/Settings/ConfigPlist/README.md index 525d23eab..459ba54a4 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/README.md +++ b/rEFIt_UEFI/Settings/ConfigPlist/README.md @@ -128,7 +128,7 @@ To validate and reject bad input, override the method validate. Imagine we have class CountClass : public XmlInt64 { using super = XmlInt64; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( value() < -2 ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Count cannot be negative. It must a number between -2 and 18 inclusive at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -168,7 +168,7 @@ class MyDictClass : public XmlDict }; virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !type.isDefined() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Type must befined at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -208,7 +208,7 @@ class MyDictClass : public XmlDict }; virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !type.isDefined() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Type must befined at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -326,7 +326,7 @@ int32_t valueOne = array[1].value(); // == 2 ### Union -Sometimes, a value can be, for example, a bool or a string. In that case it's easy to declare. Just subclass XmlUnion : +Sometimes, a value can be, for example, a XBool or a string. In that case it's easy to declare. Just subclass XmlUnion : ``` class XmlBoolOrString : public XmlUnion @@ -335,10 +335,10 @@ class XmlBoolOrString : public XmlUnion public: XmlBool xmlBool = XmlBool(); XmlString8 xmlString8 = XmlString8(); - virtual const char* getDescription() override { return "bool or string"; }; + virtual const char* getDescription() override { return "XBool or string"; }; XmlUnionField m_fields[2] = { xmlBool, xmlString8 }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; ``` -In this example, the value will be tried to be parsed as a bool. If it doesn't work, the next possibility is tried. Here it's xmlString8. You can create union with any kind of field you create, including dict and arrays. +In this example, the value will be tried to be parsed as a XBool. If it doesn't work, the next possibility is tried. Here it's xmlString8. You can create union with any kind of field you create, including dict and arrays. diff --git a/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h b/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h index 9ffee45ea..a6e43ed2c 100755 --- a/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/SMBIOSPlist.h @@ -67,7 +67,7 @@ public: class SlotClass : public XmlUInt64 { using super = XmlUInt64; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Slot must be defined as a number between 0 and 15 inclusive at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); if ( value() < 0 ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Slot cannot be negative. It must a number between 0 and 15 inclusive at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -84,7 +84,7 @@ public: XmlString8AllowEmpty Serial = XmlString8AllowEmpty(); class TypeClass: public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( isDefined() ) { if ( xstring8.isEqualIC("DDR") ) return true; @@ -109,7 +109,7 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !Slot.isDefined() ) return false; return true; @@ -136,7 +136,7 @@ public: // Cannot happen if validate has been done properly. panic("invalid value"); } - bool dgetInUse() const { return Size.isDefined() ? Size.value() > 0 : false; }; + XBool dgetInUse() const { return Size.isDefined() ? Size.value() > 0 : false; }; }; @@ -168,9 +168,9 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; return b; } @@ -204,7 +204,7 @@ public: class DeviceClass: public XmlString8AllowEmpty { using super = XmlString8AllowEmpty; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( isDefined() ) { if ( xstring8.isEqualIC("ATI") ) return true; @@ -233,9 +233,9 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; - bool b = true; + XBool b = true; return b; } const decltype(Device)::ValueType& dgetDevice() const { return Device.isDefined() ? Device.value() : Device.nullValue; }; @@ -307,7 +307,7 @@ public: { using super = XmlString8AllowEmpty; protected: - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) return true; if ( !IsValidGuidString(xstring8) ) return xmlLiteParser->addWarning(generateErrors, S8Printf("Invalid SmUUID '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX in dict '%s:%d'", xstring8.c_str(), xmlPath.c_str(), keyPos.getLine())); @@ -320,7 +320,7 @@ public: using super = XmlString8Trimed; public: ProductNameClass() : super(true) {}; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !isDefined() ) { xmlLiteParser->addError(generateErrors, S8Printf("You must define ProductName in SMBIOS dict, line %d", keyPos.getLine())); @@ -410,7 +410,7 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !ProductName.isDefined() ) { return xmlLiteParser->addWarning(generateErrors, S8Printf("ProductName is not defined, the whole SMBIOS dict is ignored at line %d.", keyPos.getLine())); @@ -486,7 +486,7 @@ public: } return GetModelFromString(ProductName.value()); // ProductName has been validated, so Model CANNOT be MaxMachineType } - bool hasModel() const { return ProductName.isDefined(); } + XBool hasModel() const { return ProductName.isDefined(); } MACHINE_TYPES dgetModel() const { @@ -619,8 +619,8 @@ public: decltype(SmbiosVersion)::ValueType dgetSmbiosVersion() const { return SmbiosVersion.isDefined() ? SmbiosVersion.value() : 0x204; }; decltype(MemoryRank)::ValueType dgetAttribute() const { return MemoryRank.isDefined() ? MemoryRank.value() : -1; }; - decltype(Trust)::ValueType dgetTrustSMBIOS() const { return Trust.isDefined() ? Trust.value() : true; }; - bool dgetInjectMemoryTables() const { return Memory.Modules.isDefined() && Memory.Modules.size() > 0 ? Memory.dgetSlotCounts() > 0 : false; }; + decltype(Trust)::ValueType dgetTrustSMBIOS() const { return Trust.isDefined() ? Trust.value() : XBool(true); }; + XBool dgetInjectMemoryTables() const { return Memory.Modules.isDefined() && Memory.Modules.size() > 0 ? Memory.dgetSlotCounts() > 0 : false; }; decltype(PlatformFeature)::ValueType dgetgPlatformFeature() const { if ( PlatformFeature.isDefined() ) return PlatformFeature.value(); return GetPlatformFeature(dgetModel()); diff --git a/rEFIt_UEFI/Settings/Self.cpp b/rEFIt_UEFI/Settings/Self.cpp index d7817815a..43355743f 100644 --- a/rEFIt_UEFI/Settings/Self.cpp +++ b/rEFIt_UEFI/Settings/Self.cpp @@ -5,8 +5,8 @@ * Author: jief */ -#include "../Settings/Self.h" #include +#include "../Settings/Self.h" #include "../refit/lib.h" #ifndef DEBUG_ALL @@ -21,7 +21,7 @@ #define DBG(...) DebugLog(DEBUG_SELF, __VA_ARGS__) #endif -EFI_STATUS Self::__initialize(bool debugMsg, EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** SelfLoadedImagePtr, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** SelfSimpleVolumePtr, EFI_FILE** SelfVolumeRootDirPtr, XStringW* CloverDirFullPathPtr, XStringW* efiFileNamePtr, EFI_FILE** CloverDirPtr) +EFI_STATUS Self::__initialize(XBool debugMsg, EFI_HANDLE SelfImageHandle, EFI_LOADED_IMAGE** SelfLoadedImagePtr, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** SelfSimpleVolumePtr, EFI_FILE** SelfVolumeRootDirPtr, XStringW* CloverDirFullPathPtr, XStringW* efiFileNamePtr, EFI_FILE** CloverDirPtr) { EFI_STATUS Status; @@ -131,7 +131,7 @@ Self self; constexpr const LStringW THEMES_DIRNAME = L"Themes"_XSW; -EFI_STATUS Self::_openDir(const XStringW& path, bool* b, EFI_FILE** efiDir) +EFI_STATUS Self::_openDir(const XStringW& path, XBool* b, EFI_FILE** efiDir) { EFI_STATUS Status; Status = m_CloverDir->Open(m_CloverDir, efiDir, path.wc_str(), EFI_FILE_MODE_READ, 0); @@ -206,7 +206,7 @@ EFI_STATUS Self::_initialize() // // // Do this before the next check. // if ( !m_CloverDirFullPath.startWith('\\') ) { -// //CHAR16* f = ConvertDevicePathToText(m_SelfLoadedImage->FilePath, TRUE, TRUE); +// //CHAR16* f = ConvertDevicePathToText(m_SelfLoadedImage->FilePath, true, true); // //panic("Bad format for m_CloverDirFullPath(%ls). It must start with a '\\'.\nConvertDevicePathToText=%ls", m_CloverDirFullPath.wc_str(), f); // // // // Some firmware seems to not put a '\' at the begining. Do not panic anymore, just add it. diff --git a/rEFIt_UEFI/Settings/Self.h b/rEFIt_UEFI/Settings/Self.h index e77c8843d..39d502450 100644 --- a/rEFIt_UEFI/Settings/Self.h +++ b/rEFIt_UEFI/Settings/Self.h @@ -20,7 +20,7 @@ class Self { // Class method, usable even without any instance of Self. protected: - static EFI_STATUS __initialize(bool debugMsg, EFI_HANDLE m_SelfImageHandle, EFI_LOADED_IMAGE** m_SelfLoadedImage, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** m_SelfSimpleVolumePtr, EFI_FILE** m_SelfVolumeRootDirPtr, XStringW* m_CloverDirFullPathPtr, XStringW* m_efiFileNamePtr, EFI_FILE** m_CloverDirPtr); + static EFI_STATUS __initialize(XBool debugMsg, EFI_HANDLE m_SelfImageHandle, EFI_LOADED_IMAGE** m_SelfLoadedImage, EFI_SIMPLE_FILE_SYSTEM_PROTOCOL** m_SelfSimpleVolumePtr, EFI_FILE** m_SelfVolumeRootDirPtr, XStringW* m_CloverDirFullPathPtr, XStringW* m_efiFileNamePtr, EFI_FILE** m_CloverDirPtr); public: static const EFI_FILE_PROTOCOL* getCloverDirAndEfiFileName(EFI_HANDLE ImageHandle, XStringW* efiFileName); @@ -39,10 +39,10 @@ protected: XStringW m_CloverDirFullPath {}; // full path of folder containing this efi. XStringW m_CloverDirFullPath4Display {}; // prettier for diplay - bool m_ThemesDirExists {}; + XBool m_ThemesDirExists {}; EFI_FILE *m_ThemesDir {}; - EFI_STATUS _openDir(const XStringW& path, bool* b, EFI_FILE** efiDir); + EFI_STATUS _openDir(const XStringW& path, XBool* b, EFI_FILE** efiDir); EFI_STATUS _initialize(); public: @@ -56,7 +56,7 @@ public: EFI_STATUS reInitialize(); void closeHandle(); - bool isInitialized() const { return m_CloverDir != NULL; } + XBool isInitialized() const { return m_CloverDir != NULL; } void checkInitialized() const { #ifdef DEBUG @@ -80,7 +80,7 @@ public: const XStringW& getCloverDirFullPath() { checkInitialized(); return m_CloverDirFullPath; } const XStringW& getCloverDirFullPath4Display() { checkInitialized(); return m_CloverDirFullPath4Display; } - bool themesDirExists() { checkInitialized(); return m_ThemesDirExists; } + XBool themesDirExists() { checkInitialized(); return m_ThemesDirExists; } const EFI_FILE& getThemesDir() { checkInitialized(); return *m_ThemesDir; } }; diff --git a/rEFIt_UEFI/Settings/SelfOem.cpp b/rEFIt_UEFI/Settings/SelfOem.cpp index 807cc4e3a..223de549a 100644 --- a/rEFIt_UEFI/Settings/SelfOem.cpp +++ b/rEFIt_UEFI/Settings/SelfOem.cpp @@ -30,7 +30,7 @@ constexpr const LStringW KEXTS_DIRNAME = L"Kexts"_XSW; SelfOem selfOem; -//EFI_STATUS SelfOem::_openDir(const XStringW& path, bool* b, EFI_FILE** efiDir) +//EFI_STATUS SelfOem::_openDir(const XStringW& path, XBool* b, EFI_FILE** efiDir) //{ // EFI_STATUS Status; // Status = self.getCloverDir().Open(&self.getCloverDir(), efiDir, path.wc_str(), EFI_FILE_MODE_READ, 0); @@ -45,7 +45,7 @@ SelfOem selfOem; //} -bool SelfOem::_checkOEMPath() +XBool SelfOem::_checkOEMPath() { EFI_STATUS Status; @@ -63,7 +63,7 @@ bool SelfOem::_checkOEMPath() m_OemDir = NULL; return false; } - BOOLEAN res2 = FileExists(m_OemDir, SWPrintf("%s.plist", m_ConfName.c_str())); + XBool res2 = FileExists(m_OemDir, SWPrintf("%s.plist", m_ConfName.c_str())); if ( !res2 ) { DBG("_checkOEMPath looked for config file at '%ls\\%ls\\%s.plist'. File doesn't exist.\n", self.getCloverDirFullPath().wc_str(), m_OemPathRelToSelfDir.wc_str(), m_ConfName.c_str()); m_OemDir->Close(m_OemDir); @@ -74,7 +74,7 @@ bool SelfOem::_checkOEMPath() return true; } -bool SelfOem::_setOemPathRelToSelfDir(bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray) +XBool SelfOem::_setOemPathRelToSelfDir(XBool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray) { for ( size_t idx = 0 ; idx < lanCardArray.size() ; ++idx ) { m_OemPathRelToSelfDir.SWPrintf("OEM\\%s--%02X-%02X-%02X-%02X-%02X-%02X", OEMProduct.c_str(), lanCardArray[idx].MacAddress[0], lanCardArray[idx].MacAddress[1], lanCardArray[idx].MacAddress[2], lanCardArray[idx].MacAddress[3], lanCardArray[idx].MacAddress[4], lanCardArray[idx].MacAddress[5]); @@ -170,7 +170,7 @@ EFI_STATUS SelfOem::_initialize() return EFI_SUCCESS; } -EFI_STATUS SelfOem::initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray) +EFI_STATUS SelfOem::initialize(const XString8& confName, XBool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray) { if ( m_ConfName.notEmpty() ) { log_technical_bug("%s : cannot be called twice. Use reinitialize.", __PRETTY_FUNCTION__); diff --git a/rEFIt_UEFI/Settings/SelfOem.h b/rEFIt_UEFI/Settings/SelfOem.h index 71da0c953..b8c4b07aa 100644 --- a/rEFIt_UEFI/Settings/SelfOem.h +++ b/rEFIt_UEFI/Settings/SelfOem.h @@ -16,7 +16,7 @@ class SelfOem protected: XString8 m_ConfName = NullXString8; // Initialisation required by -Weffc++. Couldn't use default ctor. -// bool m_OemDirExists; +// XBool m_OemDirExists; EFI_FILE* m_OemDir = NULL; XStringW m_OemPathRelToSelfDir = NullXStringW; XStringW m_OemFulPath = NullXStringW; @@ -29,9 +29,9 @@ protected: XStringW m_KextsPathRelToSelfDir = NullXStringW; XStringW m_KextsFullPath = NullXStringW; -// EFI_STATUS _openDir(const XStringW& path, bool* b, EFI_FILE** efiDir); - bool _checkOEMPath(); - bool _setOemPathRelToSelfDir(bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray); +// EFI_STATUS _openDir(const XStringW& path, XBool* b, EFI_FILE** efiDir); + XBool _checkOEMPath(); + XBool _setOemPathRelToSelfDir(XBool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray); EFI_STATUS _initialize(); public: @@ -41,16 +41,16 @@ public: ~SelfOem () {}; - EFI_STATUS initialize(const XString8& confName, bool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray); + EFI_STATUS initialize(const XString8& confName, XBool isFirmwareClover, const XString8& OEMBoard, const XString8& OEMProduct, INT32 frequency, const XObjArray& lanCardArray); void unInitialize(); EFI_STATUS reInitialize(); void closeHandle(); - bool isInitialized() const { return m_ConfName.notEmpty(); } + XBool isInitialized() const { return m_ConfName.notEmpty(); } const XString8& getConfName() { return m_ConfName; } - bool oemDirExists() { return m_OemPathRelToSelfDir.notEmpty(); } + XBool oemDirExists() { return m_OemPathRelToSelfDir.notEmpty(); } const EFI_FILE& getOemDir() { assert(m_OemDir != NULL); return *m_OemDir; } const XStringW& getOemPathRelToSelfDir() { assert(m_OemPathRelToSelfDir.notEmpty()); return m_OemPathRelToSelfDir; } const XStringW& getOemFullPath() { assert(m_OemFulPath.notEmpty()); return m_OemFulPath; } @@ -61,7 +61,7 @@ public: const XStringW& getConfigDirFullPath() { if ( m_OemDir != NULL ) return getOemFullPath(); return self.getCloverDirFullPath(); } - bool isKextsDirFound() { return m_KextsDir != NULL; } + XBool isKextsDirFound() { return m_KextsDir != NULL; } const EFI_FILE& getKextsDir() { assert(m_KextsDir != NULL); return *m_KextsDir; } const XStringW& getKextsDirPathRelToSelfDir() { assert(m_KextsPathRelToSelfDir.notEmpty()); return m_KextsPathRelToSelfDir; } const XStringW& getKextsFullPath() { assert(m_KextsFullPath.notEmpty()); return m_KextsFullPath; } diff --git a/rEFIt_UEFI/cpp_foundation/XBool.h b/rEFIt_UEFI/cpp_foundation/XBool.h new file mode 100644 index 000000000..18aef18b4 --- /dev/null +++ b/rEFIt_UEFI/cpp_foundation/XBool.h @@ -0,0 +1,55 @@ +// +// XBool.hpp +// CloverX64 +// +// Created by Jief on 27/09/2021. +// + +#ifndef XBool_hpp +#define XBool_hpp + +#include +#include "XToolsCommon.h" + +class XBool; + +template struct _xtools__is_xbool_st : public _xtools__false_type {}; +template <> struct _xtools__is_xbool_st : public _xtools__true_type {}; +#define is_xbool(x) _xtools__is_xbool_st::value + +class XBool +{ + bool value; +public: + constexpr XBool() : value(false) {} + //explicit XBool(const bool other) { value = other; } + constexpr XBool(bool other) : value(other) {} + constexpr XBool(const XBool& other) : value(other.value) {} + template + XBool(T other) = delete; + + ~XBool() {}; + + XBool& operator= (const XBool& other) { value = other.value; return *this; } + XBool& operator= (const bool other) { value = other; return *this; } + template + XBool& operator= (const T other) = delete; + + operator bool() const { return value; } + + bool operator == (bool other) const { return value == other; } + bool operator == (XBool other) const { return value == other.value; } + template + bool operator == (T other) const = delete; + bool operator != (bool other) const { return value != other; } + bool operator != (XBool other) const { return value != other.value; } + template + bool operator != (XBool other) const = delete; + + XBool& operator |= (bool other) { value |= other; return *this; } + XBool& operator |= (XBool other) { value |= other.value; return *this; } + template + XBool& operator |= (XBool other) = delete; +}; + +#endif /* XBool_hpp */ diff --git a/rEFIt_UEFI/cpp_foundation/XToolsCommon.h b/rEFIt_UEFI/cpp_foundation/XToolsCommon.h index ad72e00ec..3cd99cbb6 100644 --- a/rEFIt_UEFI/cpp_foundation/XToolsCommon.h +++ b/rEFIt_UEFI/cpp_foundation/XToolsCommon.h @@ -78,6 +78,9 @@ template <> struct _xtools__is_char_st : public template <> struct _xtools__is_char_st : public _xtools__true_type {}; template <> struct _xtools__is_char_st : public _xtools__true_type {}; +template struct _xtools__is_bool_st : public _xtools__false_type {}; +template <> struct _xtools__is_bool_st : public _xtools__true_type {}; + // //// STRUCT TEMPLATE remove_reference //template @@ -178,6 +181,7 @@ struct _xtools__has_type_member> : _xtool #define is_integral(x) _xtools__is_integral_st::value #define is_char(x) _xtools__is_char_st::value +#define is_bool(x) _xtools__is_bool_st::value #define is_char_ptr(x) _xtools__is_char_ptr_st::type>::value #define enable_if_t(x) typename _xtools_enable_if_t::type #define enable_if(x) typename enable_if_type = typename _xtools_enable_if_t::type diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteArrayTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteArrayTypes.h index c2e8f80b1..d2979efe9 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteArrayTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteArrayTypes.h @@ -42,10 +42,10 @@ class XmlArray : public XmlAbstractType, public XObjArray const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return *this; } // const ValueType& v() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return *this; } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("array"); } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("array"); } + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; // Validate remove invalid elements, but doesn't invalidate the whole array. So this is always returning true. - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; }; @@ -54,7 +54,7 @@ const typename XmlArray::ValueType XmlArray::nullValue; template -bool XmlArray::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlArray::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; RETURN_IF_FALSE ( xmlLiteParser->consumeOpeningTag("array") ); @@ -94,7 +94,7 @@ bool XmlArray::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& } template -bool XmlArray::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) +XBool XmlArray::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) { for ( size_t idx = 0 ; idx < super2::size() ; ) { if ( !super2::ElementAt(idx).validate(xmlLiteParser, xmlPath, pos, generateErrors) ) { @@ -119,18 +119,18 @@ class XmlString8Array : public XmlArray const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return array; } virtual void reset() override { super::reset(); array.setEmpty(); }; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override { - bool b = super::parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors); + XBool b = super::parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors); for ( size_t idx = 0 ; idx < super::size() ; idx++ ) { array.AddReference(&super::ElementAt(idx).value(), false); } return b; } // Validate can remove invalid element. So we have to regenerate 'array'. There is no object copy, so it's very quick - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { - bool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); + XBool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); array.setEmpty(); for ( size_t idx = 0 ; idx < super::size() ; idx++ ) { array.AddReference(&super::ElementAt(idx).value(), false); @@ -152,27 +152,26 @@ class XmlStringWArray : public XmlArray static const ValueType nullValue; ValueType array = ValueType(); - ValueType& value() { if ( !isDefined() ) log_technical_bug("%s : value is not defined", __PRETTY_FUNCTION__); return array; } const ValueType& value() const { if ( !isDefined() ) log_technical_bug("%s : value is not defined", __PRETTY_FUNCTION__); return array; } virtual void reset() override { super::reset(); array.setEmpty(); }; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override { #ifdef JIEF_DEBUG if (xmlPath == "/DisableDrivers"_XS8) { NOP; } #endif - bool b = super::parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors); + XBool b = super::parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors); array.setEmpty(); for ( size_t idx = 0 ; idx < super::size() ; idx++ ) { array.AddReference(&super::ElementAt(idx).value(), false); } return b; } - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { - bool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); + XBool b = super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors); // Validate can remove invalid element. So we have to regenerate 'array'. There is no object copy, so it's very quick array.setEmpty(); for ( size_t idx = 0 ; idx < super::size() ; idx++ ) { diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.cpp b/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.cpp index e0074965f..0e3ce50c4 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.cpp +++ b/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.cpp @@ -24,7 +24,7 @@ // } //} // -//bool XmlComposite::isTheNextTag(XmlLiteParser* xmlLiteParser) +//XBool XmlComposite::isTheNextTag(XmlLiteParser* xmlLiteParser) //{ // XmlCompositeField* fields; // size_t nb; @@ -39,7 +39,7 @@ // return false; //} // -//bool XmlComposite::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +//XBool XmlComposite::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) //{ // XmlCompositeField* fields; // size_t nb; @@ -65,7 +65,7 @@ //} // // -//bool XmlComposite::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) +//XBool XmlComposite::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) //{ // XmlCompositeField* fields; // size_t nb; diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.h index 514e613cd..8c11c8c14 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteCompositeTypes.h @@ -55,9 +55,9 @@ // // virtual void reset() override; // -// virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override; -// virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; -// virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; +// virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override; +// virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; //}; // // @@ -77,7 +77,7 @@ // virtual void getFields(XmlCompositeField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; // // // Super class parseFromXmlLite would be fine, execpt for the calculation of xmlPath -// virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override +// virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override // { // if ( !xmlKey.parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors) ) return false; // if ( !xmlValue.parseFromXmlLite(xmlLiteParser, S8Printf("%s/%s", xmlPath.c_str(), xmlKey.xstring8.c_str()), generateErrors) ) return false; diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.cpp b/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.cpp index dfa237b5d..bf857b674 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.cpp +++ b/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.cpp @@ -29,7 +29,7 @@ void XmlDict::reset() /* * Try to parse the tag following a key in a dict */ -XmlAbstractType& XmlDict::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, bool* keyFound) +XmlAbstractType& XmlDict::parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, XBool* keyFound) { XmlDictField* fields; size_t nb; @@ -88,7 +88,7 @@ if ( strcmp(fieldName, "AutoMerge") == 0 ) { return nullXmlType; } -XmlAbstractType& XmlDict::parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const char** keyValuePtr, +XmlAbstractType& XmlDict::parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr) { const char*& keyValue = *keyValuePtr; @@ -114,7 +114,7 @@ size_t* keyValueLengthPtr) //XmlParserPosition valuePos = xmlLiteParser->getPosition(); //#endif - bool keyFound; + XBool keyFound; XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound); if ( !keyFound ) { @@ -137,7 +137,7 @@ size_t* keyValueLengthPtr) return xmlAbstractType; } -bool XmlDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -158,7 +158,7 @@ bool XmlDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xml XmlParserPosition valuePos = xmlLiteParser->getPosition(); (void)valuePos; #endif -// bool keyFound; +// XBool keyFound; // XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound); XmlParserPosition keyPos = xmlLiteParser->getPosition(); @@ -177,7 +177,7 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition(); if ( xmlAbstractType.isDefined() ) { XString8 xmlSubPath = xmlPath.lastChar() == '/' ? S8Printf("%s%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue) : S8Printf("%s/%.*s", xmlPath.c_str(), (int)keyValueLength, keyValue); - bool validated = xmlAbstractType.validate(xmlLiteParser, xmlSubPath, keyPos, generateErrors); + XBool validated = xmlAbstractType.validate(xmlLiteParser, xmlSubPath, keyPos, generateErrors); if ( !validated ) xmlAbstractType.reset(); }else{ if ( xmlLiteParser->getPosition() == beforePos ) { @@ -198,7 +198,7 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition(); return true; } -bool XmlDict::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) +XBool XmlDict::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) { (void)xmlLiteParser; (void)xmlPath; diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.h index e6e83aaf0..3e01ec72e 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteDictTypes.h @@ -38,13 +38,13 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) { *fields = NULL; *nb = 0; }; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("dict"); } + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("dict"); } - virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, bool* keyFound); - virtual XmlAbstractType& parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr); - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, XBool* keyFound); + virtual XmlAbstractType& parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr); + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; }; @@ -93,7 +93,7 @@ protected: XmlKeyType keyTmp = XmlKeyType(); ValueArrayType m_valueArray = ValueArrayType(); public: - bool ignoreCommented = true; + XBool ignoreCommented = true; _XmlRepeatingDict() : super() {}; ~_XmlRepeatingDict() {}; @@ -109,18 +109,18 @@ public: virtual void getFields(XmlDictField** fields, size_t* nb) { panic("BUG : repeating dict don't use getFields()"); }; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("dict"); } + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("dict"); } -// virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, bool* keyFound); - virtual XmlValueType* parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors); - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; +// virtual XmlAbstractType& parseValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const XmlParserPosition &keyPos, const char *keyValue, size_t keyValueLength, XBool* keyFound); + virtual XmlValueType* parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors); + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; -// virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; +// virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; }; template -XmlValueType* _XmlRepeatingDict::parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XmlValueType* _XmlRepeatingDict::parseKeyAndValueFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { keyTmp.reset(); if ( keyTmp.parseFromXmlLite(xmlLiteParser, xmlPath, generateErrors) ) { @@ -150,7 +150,7 @@ XmlValueType* _XmlRepeatingDict::parseKeyAn } template -bool _XmlRepeatingDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool _XmlRepeatingDict::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -179,7 +179,7 @@ if ( xmlPath.startWithOrEqualToIC("/Devices/Properties"_XS8) ) { XmlParserPosition valuePos = xmlLiteParser->getPosition(); (void)valuePos; #endif -// bool keyFound; +// XBool keyFound; // XmlAbstractType& xmlAbstractType = parseValueFromXmlLite(xmlLiteParser, xmlSubPath, generateErrors, keyPos, keyValue, keyValueLength, &keyFound); XmlParserPosition keyPos = xmlLiteParser->getPosition(); @@ -199,7 +199,7 @@ XmlParserPosition valuePos = xmlLiteParser->getPosition(); if ( xmlValueType != NULL ) { if ( !xmlValueType->isDefined() ) panic("BUG: parseKeyAndValueFromXmlLite must not return an undefined item"); - bool validated = xmlValueType->validate(xmlLiteParser, S8Printf("%s/%s", xmlPath.c_str(), keyTmp.value().c_str()), keyPos, generateErrors); + XBool validated = xmlValueType->validate(xmlLiteParser, S8Printf("%s/%s", xmlPath.c_str(), keyTmp.value().c_str()), keyPos, generateErrors); if ( validated ) { xmlValueType->setKey(keyTmp); addValue(xmlValueType); @@ -349,9 +349,9 @@ class XmlRepeatingDict> : public _XmlRepeati // const typename XmlClass::ValueType& value() const { return super::value(); } // //// template -//// bool operator ==(const OtherXStringArrayClass &aXStrings) const { return super::operator ==(aXStrings); } +//// XBool operator ==(const OtherXStringArrayClass &aXStrings) const { return super::operator ==(aXStrings); } //// template -//// bool operator !=(const OtherXStringArrayClass &aXStrings) const { return super::operator !=(aXStrings); } +//// XBool operator !=(const OtherXStringArrayClass &aXStrings) const { return super::operator !=(aXStrings); } // //}; // diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteParser.cpp b/rEFIt_UEFI/cpp_lib/XmlLiteParser.cpp index fcb0a65ec..51a619c0c 100755 --- a/rEFIt_UEFI/cpp_lib/XmlLiteParser.cpp +++ b/rEFIt_UEFI/cpp_lib/XmlLiteParser.cpp @@ -19,25 +19,25 @@ #endif -bool strnnIsEqual(const char* key, size_t keyLength, const char* value, size_t valueLength) +XBool strnnIsEqual(const char* key, size_t keyLength, const char* value, size_t valueLength) { if ( keyLength != valueLength ) return false; return strncmp(key, value, keyLength) == 0; } -bool strnIsEqual(const char* key, size_t keyLength, const char* value) +XBool strnIsEqual(const char* key, size_t keyLength, const char* value) { return strnnIsEqual(key, keyLength, value, strlen(value)); } -bool strnnIsEqualIC(const char* key, size_t keyLength, const char* value, size_t valueLength) +XBool strnnIsEqualIC(const char* key, size_t keyLength, const char* value, size_t valueLength) { if ( keyLength != valueLength ) return false; return strncasecmp(key, value, keyLength) == 0; } -bool strnIsEqualIC(const char* key, size_t keyLength, const char* value) +XBool strnIsEqualIC(const char* key, size_t keyLength, const char* value) { return strnnIsEqualIC(key, keyLength, value, strlen(value)); } @@ -182,7 +182,7 @@ void XmlLiteParser::skipHeader() #define IS_TAGCHAR(x) ( ( x >= 'a' && x <='z' ) || ( x >= 'A' && x <='Z' ) || ( x >= '0' && x <= '9' ) ) -bool XmlLiteParser::getNextTag(const char** tag, size_t* length, bool* isOpeningTag, bool* isClosingTag, bool generateErrors) +XBool XmlLiteParser::getNextTag(const char** tag, size_t* length, XBool* isOpeningTag, XBool* isClosingTag, XBool generateErrors) { if (tag == NULL) panic("tag == NULL"); @@ -297,11 +297,11 @@ void XmlLiteParser::getString(const char** string, size_t* length) moveForwardUntil('<'); } -#define RETURN_IF_FALSE(Expression) do { bool b = Expression; if ( !b ) return false; } while (0); +#define RETURN_IF_FALSE(Expression) do { XBool b = Expression; if ( !b ) return false; } while (0); -bool XmlLiteParser::getSimpleTag(const char** tag, size_t* tagLength, const char** value, size_t* valueLength, const char* expectedTag/*, bool valueCanBeEmpty*/, bool generateErrors) +XBool XmlLiteParser::getSimpleTag(const char** tag, size_t* tagLength, const char** value, size_t* valueLength, const char* expectedTag/*, XBool valueCanBeEmpty*/, XBool generateErrors) { - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; XmlParserPosition pos = getPosition(); RETURN_IF_FALSE( getNextTag(tag, tagLength, &isOpeningTag, &isClosingTag, generateErrors) ); @@ -347,11 +347,11 @@ bool XmlLiteParser::getSimpleTag(const char** tag, size_t* tagLength, const char /* * The opening tag has been read. Skip until the closing tag */ -bool XmlLiteParser::skipUntilClosingTag(const char* tagToSkip, size_t tagToSkipLength, bool generateErrors) +XBool XmlLiteParser::skipUntilClosingTag(const char* tagToSkip, size_t tagToSkipLength, XBool generateErrors) { const char* value; size_t valueLength; - bool b; + XBool b; getString(&value, &valueLength); @@ -363,7 +363,7 @@ while ( valueLength > 0 && (*value == ' ' || *value == '\t' || *value == '\r const char* tag; size_t tagLength; - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; XmlParserPosition pos = getPosition(); b = getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, generateErrors); @@ -396,12 +396,12 @@ while ( valueLength > 0 && (*value == ' ' || *value == '\t' || *value == '\r return true; } -bool XmlLiteParser::skipNextTag(bool generateErrors) +XBool XmlLiteParser::skipNextTag(XBool generateErrors) { const char* tag; size_t tagLength; - bool isOpeningTag, isClosingTag; - bool b; + XBool isOpeningTag, isClosingTag; + XBool b; XmlParserPosition pos = getPosition(); b = getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, generateErrors); @@ -414,13 +414,13 @@ bool XmlLiteParser::skipNextTag(bool generateErrors) return skipUntilClosingTag(tag, tagLength, generateErrors); } -bool XmlLiteParser::getSimpleTagValue(const char* expectedTag, size_t expectedTagLength, const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, bool generateErrors) +XBool XmlLiteParser::getSimpleTagValue(const char* expectedTag, size_t expectedTagLength, const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, XBool generateErrors) { const char* tag; size_t tagLength; *xmlParserPosition = getPosition(); - bool b = getSimpleTag(&tag, &tagLength, value, valueLength, expectedTag, generateErrors); + XBool b = getSimpleTag(&tag, &tagLength, value, valueLength, expectedTag, generateErrors); if ( !b ) return false; if ( !strnnIsEqualIC(tag, tagLength, expectedTag, expectedTagLength) ) { addXmlError(generateErrors, S8Printf("Expecting a <%s> at line %d col %d", expectedTag, (*xmlParserPosition).line, (*xmlParserPosition).col)); @@ -439,7 +439,7 @@ bool XmlLiteParser::getSimpleTagValue(const char* expectedTag, size_t expectedTa } -bool XmlLiteParser::getKeyTagValue(const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, bool generateErrors) +XBool XmlLiteParser::getKeyTagValue(const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, XBool generateErrors) { const char* tag; size_t tagLength; @@ -447,7 +447,7 @@ bool XmlLiteParser::getKeyTagValue(const char** value, size_t* valueLength, XmlP #endif moveForwardUntilSignificant(); // to get the position more accurate *xmlParserPosition = getPosition(); - bool b = getSimpleTag(&tag, &tagLength, value, valueLength, "key", generateErrors); + XBool b = getSimpleTag(&tag, &tagLength, value, valueLength, "key", generateErrors); if ( !b ) { currentPos = *xmlParserPosition; return false; @@ -478,11 +478,11 @@ printf("\n"); } -bool XmlLiteParser::consumeOpeningTag(const char* expectedTag, bool generateErrors) +XBool XmlLiteParser::consumeOpeningTag(const char* expectedTag, XBool generateErrors) { const char* tag; size_t length; - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; auto pos = currentPos; @@ -501,11 +501,11 @@ bool XmlLiteParser::consumeOpeningTag(const char* expectedTag, bool generateErro return true; } -bool XmlLiteParser::consumeClosingTag(const char* expectedTag, bool generateErrors) +XBool XmlLiteParser::consumeClosingTag(const char* expectedTag, XBool generateErrors) { const char* tag; size_t length; - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; auto pos = currentPos; @@ -522,11 +522,11 @@ bool XmlLiteParser::consumeClosingTag(const char* expectedTag, bool generateErro return true; } -bool XmlLiteParser::nextTagIsOpeningTag(const char* expectedTag) +XBool XmlLiteParser::nextTagIsOpeningTag(const char* expectedTag) { const char* tag; size_t length; - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; XmlParserPosition pos = getPosition(); RETURN_IF_FALSE ( getNextTag(&tag, &length, &isOpeningTag, &isClosingTag, false) ); @@ -537,11 +537,11 @@ bool XmlLiteParser::nextTagIsOpeningTag(const char* expectedTag) return true; } -bool XmlLiteParser::nextTagIsClosingTag(const char* expectedTag) +XBool XmlLiteParser::nextTagIsClosingTag(const char* expectedTag) { const char* tag; size_t length; - bool isOpeningTag, isClosingTag; + XBool isOpeningTag, isClosingTag; XmlParserPosition pos = getPosition(); RETURN_IF_FALSE ( getNextTag(&tag, &length, &isOpeningTag, &isClosingTag, false) ); diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteParser.h b/rEFIt_UEFI/cpp_lib/XmlLiteParser.h index 0a7a59ca7..930445ec1 100755 --- a/rEFIt_UEFI/cpp_lib/XmlLiteParser.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteParser.h @@ -8,6 +8,7 @@ #ifndef __XML_LITE_H__ #define __XML_LITE_H__ +#include "../cpp_foundation/XBool.h" #include "../cpp_foundation/XStringArray.h" #include "../cpp_lib/XmlLiteSimpleTypes.h" #include "../cpp_lib/XmlLiteParser.h" @@ -17,17 +18,17 @@ #define __PRETTY_FUNCTION__ __FUNCSIG__ #endif -bool strnnIsEqual(const char* key, size_t keyLength, const char* value, size_t valueLength); -bool strnIsEqual(const char* key, size_t keyLength, const char* value); -bool strnnIsEqualIC(const char* key, size_t keyLength, const char* value, size_t valueLength); -bool strnIsEqualIC(const char* key, size_t keyLength, const char* value); +XBool strnnIsEqual(const char* key, size_t keyLength, const char* value, size_t valueLength); +XBool strnIsEqual(const char* key, size_t keyLength, const char* value); +XBool strnnIsEqualIC(const char* key, size_t keyLength, const char* value, size_t valueLength); +XBool strnIsEqualIC(const char* key, size_t keyLength, const char* value); class XmlParserMessage { public: - bool isError = true; + XBool isError = true; XString8 msg; - XmlParserMessage(bool _isError, const XString8& _msg) : isError(_isError), msg(_msg) {}; + XmlParserMessage(XBool _isError, const XString8& _msg) : isError(_isError), msg(_msg) {}; }; class XmlLiteParser; @@ -49,7 +50,7 @@ public: int getLine() const { return line; } int getCol() const { return col; } - bool operator == (const XmlParserPosition& other) const { + XBool operator == (const XmlParserPosition& other) const { return p == other.p; } }; @@ -63,13 +64,13 @@ class XmlLiteParser XmlParserPosition currentPos = XmlParserPosition(); XObjArray errorsAndWarnings = XObjArray(); - bool AddErrorOrWarning(XmlParserMessage* msg) { + XBool AddErrorOrWarning(XmlParserMessage* msg) { if ( errorsAndWarnings.size() < 500 ) errorsAndWarnings.AddReference(msg, true); if ( errorsAndWarnings.size() == 500 ) errorsAndWarnings.AddReference(new XmlParserMessage(true, "Too many error. Stopping"_XS8), true); return false; } public: - bool xmlParsingError = false; + XBool xmlParsingError = false; XmlLiteParser() {}; XmlLiteParser(char* _p) : p_start(_p) @@ -86,10 +87,10 @@ public: int getCol() { return currentPos.col; } XObjArray& getErrorsAndWarnings() { return errorsAndWarnings; } // Add warning, error and xml error always return false so you can return addWarning(...) from validate function - bool addWarning(bool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(false, warning)); return false; } - bool addError(bool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(true, warning)); return false; } + XBool addWarning(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(false, warning)); return false; } + XBool addError(XBool generateErrors, const XString8& warning) { if ( generateErrors ) AddErrorOrWarning(new XmlParserMessage(true, warning)); return false; } // Xml stuctural error. Parsing should probably stop. - bool addXmlError(bool generateErrors, const XString8& warning) { + XBool addXmlError(XBool generateErrors, const XString8& warning) { if ( generateErrors ) {xmlParsingError = true; AddErrorOrWarning(new XmlParserMessage(true, warning));} return false; } @@ -102,7 +103,7 @@ public: XmlParserPosition getPosition(); void restorePosition(XmlParserPosition& xml_position); - bool isEof() const { return currentPos.p >= p_end; } + XBool isEof() const { return currentPos.p >= p_end; } char getchar(); char* getcharPtr() { return currentPos.p; }; @@ -120,8 +121,8 @@ public: /* * The opening tag has been read. Skip until the closing tag */ - bool skipUntilClosingTag(const char* tagToSkip, size_t tagToSkipLength, bool generateErrors); - bool skipNextTag(bool generateErrors); + XBool skipUntilClosingTag(const char* tagToSkip, size_t tagToSkipLength, XBool generateErrors); + XBool skipNextTag(XBool generateErrors); @@ -139,45 +140,45 @@ public: * Get the next tag, either opening or closing tag. * For empty tag (), first call return that it's an opening tag. Second call return that it's a closing tag. */ - bool getNextTag(const char** tag, size_t* length, bool* isOpeningTag, bool* isClosingTag, bool generateErrors); - bool getSimpleTag(const char** tag, size_t* tagLength, const char** value, size_t* valueLength, const char* expectedTag/*, bool valueCanBeEmpty*/, bool generateErrors); + XBool getNextTag(const char** tag, size_t* length, XBool* isOpeningTag, XBool* isClosingTag, XBool generateErrors); + XBool getSimpleTag(const char** tag, size_t* tagLength, const char** value, size_t* valueLength, const char* expectedTag/*, XBool valueCanBeEmpty*/, XBool generateErrors); - bool getSimpleTagValue(const char* tag, size_t tagLength, const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, bool generateErrors); + XBool getSimpleTagValue(const char* tag, size_t tagLength, const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, XBool generateErrors); /* * Get the next tag, check it's a key, get the value and consume the closing tag (""). */ - bool getKeyTagValue(const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, bool generateErrors); + XBool getKeyTagValue(const char** value, size_t* valueLength, XmlParserPosition* xmlParserPosition, XBool generateErrors); /* * Check and consume the tag * Returns true if it's the expected opening tag * Returns false, add error in error list and don't change position if it's not */ - bool consumeOpeningTag(const char* expectedTag, bool generateErrors = true); + XBool consumeOpeningTag(const char* expectedTag, XBool generateErrors = true); /* * Check and consume the tag * Returns true if it's the expected closing tag * Returns false, add error in error list and don't change position if it's not */ - bool consumeClosingTag(const char* expectedTag, bool generateErrors); + XBool consumeClosingTag(const char* expectedTag, XBool generateErrors); /* * Check but do NOT consume the tag * Returns true if it's the expected opening tag * Returns false, DO NOT add error in error list and don't change position if it's not */ - bool nextTagIsOpeningTag(const char* expectedTag); - bool nextTagIsClosingTag(const char* expectedTag); + XBool nextTagIsOpeningTag(const char* expectedTag); + XBool nextTagIsClosingTag(const char* expectedTag); -// bool getTagBool(XmlBool* XmlBoolean); +// XBool getTagBool(XmlBool* XmlBoolean); }; -#define RETURN_IF_FALSE(Expression) do { bool b = Expression; if ( !b ) return false; } while (0); +#define RETURN_IF_FALSE(Expression) do { XBool b = Expression; if ( !b ) return false; } while (0); diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.cpp b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.cpp index dc903297e..22491425b 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.cpp +++ b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.cpp @@ -12,11 +12,11 @@ NullXmlType nullXmlType; -#define RETURN_IF_FALSE(Expression) do { bool b = Expression; if ( !b ) return false; } while (0); +#define RETURN_IF_FALSE(Expression) do { XBool b = Expression; if ( !b ) return false; } while (0); const XmlStrictBool::ValueType XmlStrictBool::nullValue = XmlStrictBool::ValueType(); -bool XmlStrictBool::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlStrictBool::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -52,18 +52,18 @@ if ( xmlPath == "/Boot/XMPDetection"_XS8 ) { return false; } -bool XmlBool::isTheNextTag(XmlLiteParser* xmlLiteParser) +XBool XmlBool::isTheNextTag(XmlLiteParser* xmlLiteParser) { XmlParserPosition pos = xmlLiteParser->getPosition(); - // Because we currently accept string tag as boolean, we have to parse to see if it can be a bool. We can't just check the next tag. + // Because we currently accept string tag as boolean, we have to parse to see if it can be a XBool. We can't just check the next tag. // Use a temporary variable. TODO improve by separating parsing and storage (ie Do not call setBoolValue in parseFromXmlLite(). XmlBool xmlBool; - bool b = xmlBool.parseFromXmlLite(xmlLiteParser, NullXString8, false); + XBool b = xmlBool.parseFromXmlLite(xmlLiteParser, NullXString8, false); xmlLiteParser->restorePosition(pos); return b; } -bool XmlBool::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlBool::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -119,18 +119,18 @@ if ( xmlPath.containsIC("/Debug"_XS8) ) { } -bool XmlBoolYesNo::isTheNextTag(XmlLiteParser* xmlLiteParser) +XBool XmlBoolYesNo::isTheNextTag(XmlLiteParser* xmlLiteParser) { XmlParserPosition pos = xmlLiteParser->getPosition(); - // Because we currently accept string tag as boolean, we have to parse to see if it can be a bool. We can't just check the next tag. + // Because we currently accept string tag as boolean, we have to parse to see if it can be a XBool. We can't just check the next tag. // Use a temporary variable. TODO improve by separating parsing and storage (ie Do not call setBoolValue in parseFromXmlLite(). XmlBoolYesNo xmlBool; - bool b = xmlBool.parseFromXmlLite(xmlLiteParser, NullXString8, false); + XBool b = xmlBool.parseFromXmlLite(xmlLiteParser, NullXString8, false); xmlLiteParser->restorePosition(pos); return b; } -bool XmlBoolYesNo::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlBoolYesNo::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -183,7 +183,7 @@ if ( xmlPath.containsIC("/Debug"_XS8) ) { -bool XmlString8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlString8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -230,7 +230,7 @@ if ( out && strcmp(out, "/SMBIOs") == 0 ) { } const XmlString8::ValueType XmlString8::nullValue = XmlString8::ValueType(); -bool XmlStringW::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlStringW::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -262,7 +262,7 @@ const XmlStringW::ValueType XmlStringW::nullValue = XmlString8::ValueType(); const XmlKey::ValueType XmlKey::nullValue = XmlKey::ValueType(); // TODO only difference with XmlString8::parseFromXmlLite is paramter "key" instead of "string" -bool XmlKey::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr) +XBool XmlKey::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr) { WARNING_IF_DEFINED; @@ -298,7 +298,7 @@ printf("\n"); return false; } -bool XmlKey::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlKey::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { const char* _value; size_t _valueLength; @@ -309,7 +309,7 @@ bool XmlKey::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlP const XmlData::ValueType XmlData::nullValue = XmlData::ValueType(); -bool XmlData::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlData::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { WARNING_IF_DEFINED; @@ -342,7 +342,7 @@ bool XmlData::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xml } -bool XmlIntegerAbstract::isTheNextTag(XmlLiteParser* xmlLiteParser) +XBool XmlIntegerAbstract::isTheNextTag(XmlLiteParser* xmlLiteParser) { if ( xmlLiteParser->nextTagIsOpeningTag("integer") ) return true; @@ -351,8 +351,8 @@ bool XmlIntegerAbstract::isTheNextTag(XmlLiteParser* xmlLiteParser) // Use a temporary variable. TODO improve by separating parsing and storage (ie Do not call setBoolValue in parseFromXmlLite(). UINTN result; - bool negative; - bool b = parseXmlInteger(xmlLiteParser, NullXString8, &result, &negative, INT64_MIN, UINT64_MAX, false); + XBool negative; + XBool b = parseXmlInteger(xmlLiteParser, NullXString8, &result, &negative, INT64_MIN, UINT64_MAX, false); xmlLiteParser->restorePosition(pos); return b; } @@ -362,7 +362,7 @@ bool XmlIntegerAbstract::isTheNextTag(XmlLiteParser* xmlLiteParser) * Minimum can be a positive integer. It's possible to pass minimum=10 and maximum=15. * Maximum can't be a negative integer. */ -bool XmlIntegerAbstract::parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, UINTN* resultPtr, bool* negativePtr, INTN minimum, UINTN maximum, bool generateErrors) +XBool XmlIntegerAbstract::parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, UINTN* resultPtr, XBool* negativePtr, INTN minimum, UINTN maximum, XBool generateErrors) { WARNING_IF_DEFINED; @@ -375,8 +375,8 @@ bool XmlIntegerAbstract::parseXmlInteger(XmlLiteParser* xmlLiteParser, const XSt RETURN_IF_FALSE( xmlLiteParser->getSimpleTag(&tag, &tagLength, &value, &valueLength, NULL, generateErrors) ); UINTN& result = *resultPtr; - bool& negative = *negativePtr; - bool atLeastOneDigit = false; + XBool& negative = *negativePtr; + XBool atLeastOneDigit = false; #ifdef JIEF_DEBUG if ( xmlPath.contains("CsrActiveConfig") ) { @@ -430,7 +430,7 @@ if ( xmlPath.contains("CsrActiveConfig") ) { if ( valueLength >= 1 && ( (value[0] >= '0' && value[0] <= '9') || value[0] == '-' ) ) { // Decimal value size_t idx = 0; if (value[idx] == '-') { - negative = TRUE; + negative = true; idx++; } for ( ; idx < valueLength; idx++) @@ -502,66 +502,66 @@ if ( xmlPath.contains("CsrActiveConfig") ) { } -bool XmlUInt8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlUInt8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, 0, UINT8_MAX, generateErrors) ); return setUInt8Value((uint8_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlUInt16::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlUInt16::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, 0, UINT16_MAX, generateErrors) ); return setUInt16Value((uint16_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlUInt32::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlUInt32::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, 0, UINT32_MAX, generateErrors) ); return setUInt32Value((uint32_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlUInt64::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlUInt64::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, 0, UINT64_MAX, generateErrors) ); return setUInt64Value((uint64_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlInt8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlInt8::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, INT8_MIN, INT8_MAX, generateErrors) ); return setInt8Value((int8_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlInt16::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlInt16::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, INT16_MIN, INT16_MAX, generateErrors) ); return setInt16Value((int16_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlInt32::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlInt32::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, INT32_MIN, INT32_MAX, generateErrors) ); return setInt32Value((int32_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } -bool XmlInt64::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlInt64::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { UINTN value; - bool sign; + XBool sign; RETURN_IF_FALSE( parseXmlInteger(xmlLiteParser, xmlPath, &value, &sign, INT64_MIN, INT64_MAX, generateErrors) ); return setInt64Value((int8_t)value, sign); // safe cast because parseXmlInteger minimum/maximum parameter } diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h index 5e6cf2adb..1294a1a64 100755 --- a/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteSimpleTypes.h @@ -40,7 +40,7 @@ static inline void WARNING_IF_DEFINED_breakpoint() class XmlAbstractType { private: - bool m_isDefined; + XBool m_isDefined; public: constexpr XmlAbstractType() : m_isDefined(false) {}; @@ -53,15 +53,15 @@ public: } m_isDefined = true; }; - virtual bool isDefined() const { return m_isDefined; }; + virtual XBool isDefined() const { return m_isDefined; }; virtual void reset() { m_isDefined = false; }; - virtual bool isKey() const { return false; } + virtual XBool isKey() const { return false; } virtual const XString8& getKey() const { return NullXString8; } // virtual void setKey(const char* keyValue, size_t keyValueLength) {}; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) = 0; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) = 0; /* * Parse just get the tag and value and translate it to the underlying representation. * Return false if there is a parsing problem. @@ -70,21 +70,21 @@ public: * In that case, ignoring the tag and trying to continue is possible. * It MUST NOT call validate. */ - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) = 0; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) = 0; /* * Validate the value. Intended for subclasser. * Return false if value is not accepted. */ - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) { (void)xmlLiteParser; (void)xmlPath; (void)keyPos; (void)generateErrors; return true; }; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) { (void)xmlLiteParser; (void)xmlPath; (void)keyPos; (void)generateErrors; return true; }; }; class NullXmlType : public XmlAbstractType { virtual const char* getDescription() override { return "null"; }; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override { (void)xmlLiteParser; (void)xmlPath; (void)generateErrors; panic("NullXmlType : can't call parseFromXmlLite"); }; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { (void)xmlLiteParser; return false; }; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override { (void)xmlLiteParser; (void)xmlPath; (void)generateErrors; panic("NullXmlType : can't call parseFromXmlLite"); }; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { (void)xmlLiteParser; return false; }; }; extern NullXmlType nullXmlType; @@ -93,31 +93,31 @@ class XmlStrictBool : public XmlAbstractType { using super = XmlAbstractType; public: - using ValueType = bool; + using ValueType = XBool; static const ValueType nullValue; protected: - bool booll = false; + XBool booll; public: - constexpr XmlStrictBool() : super() {}; + constexpr XmlStrictBool() : booll(false) {}; constexpr XmlStrictBool(bool b) : booll(b) { /*if (b) b = 1;*/ } - virtual void reset() override { super::reset(); booll = 0; }; + virtual void reset() override { super::reset(); booll = false; }; virtual const char* getDescription() override { return "boolean"; }; - const bool& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return booll; } + const XBool& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return booll; } - bool setBoolValue(bool b) { setDefined(); booll = b; return true; } + XBool setBoolValue(XBool b) { setDefined(); booll = b; return true; } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("true") || xmlLiteParser->nextTagIsOpeningTag("false"); }; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("true") || xmlLiteParser->nextTagIsOpeningTag("false"); }; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlBool : public XmlStrictBool { using super = XmlStrictBool; public: - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override; }; @@ -125,8 +125,8 @@ class XmlBoolYesNo : public XmlStrictBool { using super = XmlBoolYesNo; public: - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override; }; @@ -139,12 +139,12 @@ public: static const ValueType nullValue; protected: - bool canBeEmpty = false; + XBool canBeEmpty = false; ValueType xstring8 = ValueType(); public: XmlString8() : super() {}; - XmlString8(bool _canBeEmpty) : super(), canBeEmpty(_canBeEmpty) {}; + XmlString8(XBool _canBeEmpty) : super(), canBeEmpty(_canBeEmpty) {}; virtual ~XmlString8() {}; virtual const char* getDescription() override { return "string"; }; @@ -152,17 +152,16 @@ public: super::reset(); xstring8.setEmpty(); }; -// ValueType& value() { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstring8; } virtual const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstring8; } - virtual bool setStringValue(const ValueType& _value) { setDefined(); xstring8 = _value; return true; } - virtual bool setStringValue(const char* s, size_t size) { setDefined(); xstring8.strsicpy(s, size); return true; } - virtual bool stealStringValue(char* s, size_t size) { setDefined(); xstring8.stealValueFrom(s, size); return true; } + virtual XBool setStringValue(const ValueType& _value) { setDefined(); xstring8 = _value; return true; } + virtual XBool setStringValue(const char* s, size_t size) { setDefined(); xstring8.strsicpy(s, size); return true; } + virtual XBool stealStringValue(char* s, size_t size) { setDefined(); xstring8.stealValueFrom(s, size); return true; } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string"); } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string"); } + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; // TODO validate !_canBeEmpty - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { #ifdef JIEF_DEBUG if (xmlPath.containsIC("BoardSerialNumber"_XS8) ) { NOP; @@ -187,24 +186,24 @@ public: static const ValueType nullValue; protected: - bool canBeEmpty = false; + XBool canBeEmpty = false; XStringW xstringW = ValueType(); public: XmlStringW() : super() {}; - XmlStringW(bool _canBeEmpty) : super(), canBeEmpty(_canBeEmpty) {}; + XmlStringW(XBool _canBeEmpty) : super(), canBeEmpty(_canBeEmpty) {}; virtual ~XmlStringW() {}; virtual const char* getDescription() override { return "string"; }; virtual void reset() override { super::reset(); xstringW.setEmpty(); }; virtual const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstringW; } - virtual bool setStringValue(const char* s, size_t size) { setDefined(); xstringW.strsicpy(s, size); return true; } + virtual XBool setStringValue(const char* s, size_t size) { setDefined(); xstringW.strsicpy(s, size); return true; } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string"); } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string"); } + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; // TODO validate !_canBeEmpty - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !canBeEmpty && xstringW.isEmpty() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("String cannot be empty for tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); @@ -228,8 +227,8 @@ class XmlString8Trimed : public XmlString8 using super = XmlString8; public: XmlString8Trimed() : super(false) {}; - XmlString8Trimed(bool allowEmpty) : super(allowEmpty) {}; - virtual bool setStringValue(const char* s, size_t size) override { setDefined(); xstring8.strsicpy(s, size); xstring8.trim(); return true; } + XmlString8Trimed(XBool allowEmpty) : super(allowEmpty) {}; + virtual XBool setStringValue(const char* s, size_t size) override { setDefined(); xstring8.strsicpy(s, size); xstring8.trim(); return true; } }; class XmlKey : public XmlAbstractType @@ -248,17 +247,17 @@ public: virtual const char* getDescription() override { return "key"; }; virtual void reset() override { super::reset(); xstring8.setEmpty(); }; - virtual bool isKey() const override { return true; } + virtual XBool isKey() const override { return true; } virtual const XString8& getKey() const override { return value(); } const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstring8; } - virtual bool setStringValue(const char* s, size_t size) { setDefined(); xstring8.strsicpy(s, size); return true; } + virtual XBool setStringValue(const char* s, size_t size) { setDefined(); xstring8.strsicpy(s, size); return true; } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("key"); } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr); - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("key"); } + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors, const char** keyValuePtr, size_t* keyValueLengthPtr); + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( xstring8.isEmpty() ) return false; return true; @@ -271,7 +270,7 @@ class XmlKeyDisablable : public XmlKey { using super = XmlKey; protected: - bool Disabled = false; + XBool Disabled = false; public: XmlKeyDisablable() {}; ~XmlKeyDisablable() {}; @@ -280,11 +279,11 @@ public: virtual const char* getDescription() override { return "key(dis)"; }; - bool isDisabled() const { return Disabled; } - bool isEnabled() const { return !Disabled; } + XBool isDisabled() const { return Disabled; } + XBool isEnabled() const { return !Disabled; } const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return xstring8; } - virtual bool setStringValue(const char* s, size_t size) override { + virtual XBool setStringValue(const char* s, size_t size) override { setDefined(); if ( size > 0 && s[0] == '!' ) { xstring8.strsicpy(s+1, size-1); @@ -295,8 +294,8 @@ public: return true; } -// virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { +// virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( xstring8.isEqual("!") ) return false; // it's an empty disabled key return true; @@ -324,22 +323,22 @@ public: virtual const char* getDescription() override { return "data"; }; virtual void reset() override { super::reset(); m_value.setEmpty(); }; - ValueType& modifiableValue() { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return m_value; } const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return m_value; } - bool setDataValue(const uint8_t* s, size_t size) { setDefined(); m_value.ncpy(s, size); return true; } - bool stealDataValue(uint8_t* s, size_t size) { setDefined(); m_value.stealValueFrom(s, size); return true; } - bool stealDataValue(uint8_t* s, size_t size, size_t allocatedSize) { setDefined(); m_value.stealValueFrom(s, size, allocatedSize); return true; } + XBool setDataValue(const uint8_t* s, size_t size) { setDefined(); m_value.ncpy(s, size); return true; } + XBool stealDataValue(uint8_t* s, size_t size) { setDefined(); m_value.stealValueFrom(s, size); return true; } + XBool stealDataValue(uint8_t* s, size_t size, size_t allocatedSize) { setDefined(); m_value.stealValueFrom(s, size, allocatedSize); return true; } + void setSize(size_t size, uint8_t elementToCopy) { m_value.setSize(size, elementToCopy); } - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string") || xmlLiteParser->nextTagIsOpeningTag("data"); } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override { return xmlLiteParser->nextTagIsOpeningTag("string") || xmlLiteParser->nextTagIsOpeningTag("data"); } + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlIntegerAbstract : public XmlAbstractType { public: - bool isTheNextTag(XmlLiteParser* xmlLiteParser) override; - bool parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, uint64_t* result, bool* negative, int64_t minimum, uint64_t maximum, bool generateErrors); + XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override; + XBool parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, uint64_t* result, XBool* negative, int64_t minimum, uint64_t maximum, XBool generateErrors); }; template @@ -363,7 +362,7 @@ class XmlInteger : public XmlIntegerAbstract const ValueType& value() const { if ( !isDefined() ) panic("%s : value is not defined", __PRETTY_FUNCTION__); return m_value; } -// bool parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, UINTN* result, bool* negative, INTN minimum, UINTN maximum, bool generateErrors); +// XBool parseXmlInteger(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, UINTN* result, XBool* negative, INTN minimum, UINTN maximum, XBool generateErrors); }; template const typename XmlInteger::ValueType XmlInteger::nullValue = typename XmlInteger::ValueType(); @@ -376,18 +375,18 @@ public: virtual const char* getDescription() override { return "uint8"; }; - bool setUInt8Value(ValueType ui8) { setDefined(); m_value = ui8; return true; } - bool setUInt8Value(ValueType value, bool sign) { + XBool setUInt8Value(ValueType ui8) { setDefined(); m_value = ui8; return true; } + XBool setUInt8Value(ValueType value, XBool sign) { if ( sign ) { log_technical_bug("XmlUInt8 sign=true"); setUInt8Value(0); return false; } setUInt8Value(value); return true; } -// bool setUInt8Value(uint8_t value, bool sign, XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) { +// XBool setUInt8Value(uint8_t value, XBool sign, XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) { // setUInt8Value(value, sign); // return validate(xmlLiteParser, xmlPath, pos, generateErrors); // } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlInt8 : public XmlInteger @@ -398,10 +397,10 @@ public: virtual const char* getDescription() override { return "int8"; }; - bool setInt8Value(ValueType i8) { setDefined(); m_value = i8; return true; } - bool setInt8Value(ValueType value, bool sign) { if ( sign ) return setInt8Value(-value); else setInt8Value(value); return true; } + XBool setInt8Value(ValueType i8) { setDefined(); m_value = i8; return true; } + XBool setInt8Value(ValueType value, XBool sign) { if ( sign ) return setInt8Value(-value); else setInt8Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlUInt16 : public XmlInteger @@ -412,14 +411,14 @@ public: virtual const char* getDescription() override { return "uint16"; }; - bool setUInt16Value(ValueType ui16) { setDefined(); m_value = ui16; return true; } - bool setUInt16Value(ValueType value, bool sign) { + XBool setUInt16Value(ValueType ui16) { setDefined(); m_value = ui16; return true; } + XBool setUInt16Value(ValueType value, XBool sign) { if ( sign ) { log_technical_bug("XmlUInt16 sign=true"); setUInt16Value(0); return false; } setUInt16Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlInt16 : public XmlInteger @@ -430,10 +429,10 @@ public: virtual const char* getDescription() override { return "unt16"; }; - bool setInt16Value(ValueType ui16) { setDefined(); m_value = ui16; return true; } - bool setInt16Value(ValueType value, bool sign) { if ( sign ) return setInt16Value(-value); else setInt16Value(value); return true; } + XBool setInt16Value(ValueType ui16) { setDefined(); m_value = ui16; return true; } + XBool setInt16Value(ValueType value, XBool sign) { if ( sign ) return setInt16Value(-value); else setInt16Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlUInt32 : public XmlInteger @@ -444,14 +443,14 @@ public: virtual const char* getDescription() override { return "uint32"; }; - bool setUInt32Value(ValueType ui32) { setDefined(); m_value = ui32; return true; } - bool setUInt32Value(ValueType value, bool sign) { + XBool setUInt32Value(ValueType ui32) { setDefined(); m_value = ui32; return true; } + XBool setUInt32Value(ValueType value, XBool sign) { if ( sign ) { log_technical_bug("XmlUInt32 sign=true"); setUInt32Value(0); return false; } setUInt32Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlInt32 : public XmlInteger @@ -462,10 +461,10 @@ public: virtual const char* getDescription() override { return "int32"; }; - bool setInt32Value(ValueType i32) { setDefined(); m_value = i32; return true; } - bool setInt32Value(ValueType value, bool sign) { if ( sign ) return setInt32Value(-value); else setInt32Value(value); return true; } + XBool setInt32Value(ValueType i32) { setDefined(); m_value = i32; return true; } + XBool setInt32Value(ValueType value, XBool sign) { if ( sign ) return setInt32Value(-value); else setInt32Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlUInt64 : public XmlInteger @@ -476,14 +475,14 @@ public: virtual const char* getDescription() override { return "uint64"; }; - bool setUInt64Value(ValueType ui64) { setDefined(); m_value = ui64; return true; } - bool setUInt64Value(ValueType value, bool sign) { + XBool setUInt64Value(ValueType ui64) { setDefined(); m_value = ui64; return true; } + XBool setUInt64Value(ValueType value, XBool sign) { if ( sign ) { log_technical_bug("XmlUInt64 sign=true"); setUInt64Value(0); return false; } setUInt64Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; class XmlInt64 : public XmlInteger @@ -494,10 +493,10 @@ public: virtual const char* getDescription() override { return "int64"; }; - bool setInt64Value(ValueType i64) { setDefined(); m_value = i64; return true; } - bool setInt64Value(ValueType value, bool sign) { if ( sign ) return setInt64Value(-value); else setInt64Value(value); return true; } + XBool setInt64Value(ValueType i64) { setDefined(); m_value = i64; return true; } + XBool setInt64Value(ValueType value, XBool sign) { if ( sign ) return setInt64Value(-value); else setInt64Value(value); return true; } - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; }; diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.cpp b/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.cpp index db951defe..b3b29c8a4 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.cpp +++ b/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.cpp @@ -22,7 +22,7 @@ void XmlUnion::reset() } } -bool XmlUnion::isTheNextTag(XmlLiteParser* xmlLiteParser) +XBool XmlUnion::isTheNextTag(XmlLiteParser* xmlLiteParser) { XmlUnionField* fields; size_t nb; @@ -37,7 +37,7 @@ bool XmlUnion::isTheNextTag(XmlLiteParser* xmlLiteParser) return false; } -bool XmlUnion::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) +XBool XmlUnion::parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) { XmlParserPosition pos = xmlLiteParser->getPosition(); #ifdef JIEF_DEBUG @@ -67,7 +67,7 @@ if ( xmlPath == "/Boot/XMPDetection"_XS8 ) { return false; } -bool XmlUnion::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, bool generateErrors) +XBool XmlUnion::validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& pos, XBool generateErrors) { XmlUnionField* fields; size_t nb; diff --git a/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.h b/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.h index 5454ce8b0..11e4e567a 100644 --- a/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.h +++ b/rEFIt_UEFI/cpp_lib/XmlLiteUnionTypes.h @@ -51,9 +51,9 @@ public: virtual void reset() override; - virtual bool isTheNextTag(XmlLiteParser* xmlLiteParser) override; - virtual bool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, bool generateErrors) override; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override; + virtual XBool isTheNextTag(XmlLiteParser* xmlLiteParser) override; + virtual XBool parseFromXmlLite(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, XBool generateErrors) override; + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override; }; @@ -67,7 +67,7 @@ class XmlBoolOrString : public XmlUnion public: XmlBool xmlBool = XmlBool(); XmlString8 xmlString8 = XmlString8(); - virtual const char* getDescription() override { return "bool or string"; }; + virtual const char* getDescription() override { return "XBool or string"; }; XmlUnionField m_fields[2] = { xmlBool, xmlString8 }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; @@ -79,7 +79,7 @@ class XmlInt8OrBool : public XmlUnion public: XmlInt8 xmlInt8 = XmlInt8(); XmlBool xmlBool = XmlBool(); - virtual const char* getDescription() override { return "int8 or bool"; }; + virtual const char* getDescription() override { return "int8 or XBool"; }; XmlUnionField m_fields[2] = { xmlInt8, xmlBool }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; @@ -90,7 +90,7 @@ class XmlInt64OrBool : public XmlUnion public: XmlInt64 xmlInt64 = XmlInt64(); XmlBool xmlBool = XmlBool(); - virtual const char* getDescription() override { return "int64 or bool"; }; + virtual const char* getDescription() override { return "int64 or XBool"; }; XmlUnionField m_fields[2] = { xmlInt64, xmlBool }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; @@ -104,7 +104,7 @@ public: XmlString8 xmlString8 = XmlString8(); XmlData xmlData = XmlData(); - virtual const char* getDescription() override { return "bool|string|data"; }; + virtual const char* getDescription() override { return "XBool|string|data"; }; XmlUnionField m_fields[3] = { xmlBool, xmlString8, xmlData }; virtual void getFields(XmlUnionField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; }; diff --git a/rEFIt_UEFI/cpp_lib/undefinable.h b/rEFIt_UEFI/cpp_lib/undefinable.h index ebb6d13d0..be0025e1a 100644 --- a/rEFIt_UEFI/cpp_lib/undefinable.h +++ b/rEFIt_UEFI/cpp_lib/undefinable.h @@ -12,18 +12,18 @@ template class undefinable { protected: - bool m_defined = false; + XBool m_defined = false; T m_value = T(); public: - bool isDefined() const { return m_defined; } - void setDefined(bool b) { m_defined = b; } + XBool isDefined() const { return m_defined; } + void setDefined(XBool b) { m_defined = b; } -// T& value() { return m_value; } // never allow to return a modifiable value. We need to hook ever assignment possible. +// T& value() { return m_value; } // never allow to return a modifiable value. Breaks encapsulation. const T& value() const { if ( !isDefined() ) { panic("get value of an undefined undefinable type"); - } + } return m_value; } const T& dgetValue() const { return m_value; } // if !m_defined, m_value = T() @@ -38,13 +38,13 @@ public: return *this; } - bool operator ==(const undefinable& other) const + XBool operator ==(const undefinable& other) const { if ( !(m_defined == other.m_defined ) ) return false; if ( m_defined && !(m_value == other.m_value ) ) return false; // we don't test value if this is not defined. return true; } - bool operator !=(const undefinable& other) const { return !(*this == other); } + XBool operator !=(const undefinable& other) const { return !(*this == other); } }; class undefinable_bool : public undefinable @@ -56,6 +56,15 @@ public: undefinable_bool& operator = (bool newValue) { super::operator=(newValue); return *this; } }; +class undefinable_xbool : public undefinable +{ + using super = undefinable; +public: + undefinable_xbool() { } + explicit undefinable_xbool(XBool newValue) { super::operator=(newValue); } + undefinable_xbool& operator = (XBool newValue) { super::operator=(newValue); return *this; } +}; + class undefinable_uint8 : public undefinable { using super = undefinable; diff --git a/rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp b/rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp index 7676a33e4..783b7f3a6 100644 --- a/rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/MacOsVersion_test.cpp @@ -3,7 +3,7 @@ #include "../cpp_foundation/XStringArray.h" // -//static BOOLEAN IsOSValid_OLDOLD(const XString8& MatchOS, const XString8& CurrOS) +//static XBool IsOSValid_OLDOLD(const XString8& MatchOS, const XString8& CurrOS) //{ // /* example for valid matches are: // 10.7, only 10.7 (10.7.1 will be skipped) @@ -11,10 +11,10 @@ // 10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9)) // */ // -// BOOLEAN ret = FALSE; +// XBool ret = false; // // if (MatchOS.isEmpty() || CurrOS.isEmpty()) { -// return TRUE; //undefined matched corresponds to old behavior +// return true; //undefined matched corresponds to old behavior // } // //// osToc = GetStrArraySeparatedByChar(MatchOS, '.'); @@ -24,7 +24,7 @@ // if (macthOsToc.size() == 2) { // if (currOStoc.size() == 2) { // if ( macthOsToc[0] == currOStoc[0] && macthOsToc[1] == currOStoc[1]) { -// ret = TRUE; +// ret = true; // } // } // } else if (macthOsToc.size() == 3) { @@ -32,20 +32,20 @@ // if ( macthOsToc[0] == currOStoc[0] // && macthOsToc[1] == currOStoc[1] // && macthOsToc[2] == currOStoc[2]) { -// ret = TRUE; +// ret = true; // } else if ( macthOsToc[0] == currOStoc[0] // && macthOsToc[1] == currOStoc[1] // && macthOsToc[2].isEqualIC("x") ) { -// ret = TRUE; +// ret = true; // } // } else if (currOStoc.size() == 2) { // if ( macthOsToc[0] == currOStoc[0] // && macthOsToc[1] == currOStoc[1] ) { -// ret = TRUE; +// ret = true; // } else if ( macthOsToc[0] == currOStoc[0] // && macthOsToc[1] == currOStoc[1] // && macthOsToc[2].isEqualIC("x") == 0 ) { -// ret = TRUE; +// ret = true; // } // } // } @@ -62,10 +62,10 @@ static bool IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS) 10.10.x (or 10.10.X), in this case is valid for all minor version of 10.10 (10.10.(0-9)) */ - bool ret = FALSE; + bool ret = false; if (MatchOS.isEmpty() || CurrOS.isEmpty()) { - return TRUE; //undefined matched corresponds to old behavior + return true; //undefined matched corresponds to old behavior } // osToc = GetStrArraySeparatedByChar(MatchOS, '.'); @@ -82,7 +82,7 @@ static bool IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS) if (osToc.size() == 2) { if (currOStoc.size() == 2) { if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1]) { - ret = TRUE; + ret = true; } } } else if (osToc.size() == 3) { @@ -90,20 +90,20 @@ static bool IsOSValid_OLD(const XString8& MatchOS, const XString8& CurrOS) if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1] && osToc[2] == currOStoc[2]) { - ret = TRUE; + ret = true; } else if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1] && osToc[2].isEqualIC("x") ) { - ret = TRUE; + ret = true; } } else if (currOStoc.size() == 2) { if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1] ) { - ret = TRUE; + ret = true; } else if ( osToc[0] == currOStoc[0] && osToc[1] == currOStoc[1] && osToc[2].isEqualIC("x") == 0 ) { - ret = TRUE; + ret = true; } } } diff --git a/rEFIt_UEFI/cpp_unit_test/config-test.cpp b/rEFIt_UEFI/cpp_unit_test/config-test.cpp index c97041fb9..3643d1220 100755 --- a/rEFIt_UEFI/cpp_unit_test/config-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/config-test.cpp @@ -889,7 +889,9 @@ static const char* config_test = R"V0G0N( +#ifndef RETURN_IF_FALSE #define RETURN_IF_FALSE(Expression) do { bool b = Expression; if ( !b ) return false; } while (0); +#endif static int breakpoint(int i) { diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp index 54f5e155a..c9f21f576 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-reapeatingdict-test.cpp @@ -122,7 +122,7 @@ int repeatingdict_test2() gXmlLiteParser.printfErrorsAndWarnings(); for ( size_t idx = 0 ; idx < dict.valueArray().size() ; idx++ ) { auto item = dict.valueArray()[idx]; - printf("%s %d %s\n", dict.valueArray()[idx].key().c_str(), dict.valueArray()[idx].xmlBool.value(), dict.valueArray()[idx].xmlString.value().c_str()); + printf("%s %d %s\n", dict.valueArray()[idx].key().c_str(), (bool)dict.valueArray()[idx].xmlBool.value(), dict.valueArray()[idx].xmlString.value().c_str()); } if ( !b ) return breakpoint(1); if ( gXmlLiteParser.getErrorsAndWarnings().size() != 0 ) return breakpoint(1); diff --git a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp index 852035bf4..d1d2489b8 100755 --- a/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/xml_lite-test.cpp @@ -39,8 +39,8 @@ int getNextTag_tests() { const char* tag; size_t tagLength; - bool isOpeningTag, isClosingTag; - bool b; + XBool isOpeningTag, isClosingTag; + XBool b; gXmlLiteParserTest.init(""); b = gXmlLiteParserTest.getNextTag(&tag, &tagLength, &isOpeningTag, &isClosingTag, true); @@ -132,7 +132,7 @@ int getSimpleTag_tests() size_t tagLength; const char* value; size_t valueLength; - bool b; + XBool b; gXmlLiteParserTest.init("kv"); b = gXmlLiteParserTest.getSimpleTag(&tag, &tagLength, &value, &valueLength, "key", true); @@ -208,7 +208,7 @@ int getKey_tests() { const char* tag; size_t length; - bool b; + XBool b; XmlParserPosition xmlParserPosition; gXmlLiteParserTest.init("v"); @@ -251,7 +251,7 @@ int getKey_tests() int skip_tests() { - bool b; + XBool b; gXmlLiteParserTest.init("kv"); b = gXmlLiteParserTest.skipUntilClosingTag("key", strlen("key"), true); @@ -310,9 +310,9 @@ auto msg = gXmlLiteParserTest.getErrorsAndWarnings()[0].msg; int xml_integer_tests() { // XmlAbstractType xml_int8; -// bool b; +// XBool b; // UINTN result; -// bool negative; +// XBool negative; // XString8 s; // // xmlLiteParser.init("10"); @@ -377,7 +377,7 @@ int xml_integer_tests() int validate_dict_tests() { - bool b; + XBool b; class Dict1_Class : public XmlDict { @@ -385,7 +385,7 @@ int validate_dict_tests() class Test1Bool: public XmlBool { public: - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( XmlBool::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); xmlLiteParser->addWarning(generateErrors, S8Printf("Test1Bool tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); return false; // parsing can continue. @@ -403,7 +403,7 @@ int validate_dict_tests() public: Dict1_Class dict1 = Dict1_Class(); - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); xmlLiteParser->addWarning(generateErrors, S8Printf("dict1 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); return false; // parsing can continue. @@ -448,14 +448,14 @@ int validate_dict_tests() int validate_array_tests() { - bool b; + XBool b; class Main2Dict_Class : public XmlDict { public: XmlArray array = XmlArray(); - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { RETURN_IF_FALSE( XmlDict::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ); xmlLiteParser->addWarning(generateErrors, S8Printf("dict2 tag '%s:%d'.", xmlPath.c_str(), keyPos.getLine())); return false; // parsing can continue. @@ -501,7 +501,7 @@ int validate_array_tests() int documentation_test1() { - bool b; + XBool b; class MyDictClass : public XmlDict { @@ -543,7 +543,7 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test2() { - bool b; + XBool b; class MyInsideDictClass : public XmlDict { @@ -595,7 +595,7 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test3() { - bool b; + XBool b; class MyPlist : public ConfigPlistAbstractClass { @@ -605,7 +605,7 @@ int documentation_test3() class CountClass : public XmlInt64 { using super = XmlInt64; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( value() < -2 ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Count cannot be negative. It must a number between -2 and 18 inclusive at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -647,11 +647,11 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test4() { - bool b; + XBool b; class MyXmlType : public XmlUInt8 { using super = XmlUInt8; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( value() < 1 || value() > 2 ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Type must be 1 or 2 at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -664,7 +664,7 @@ int documentation_test4() class MyXmlSubType : public XmlUInt8 { using super = XmlUInt8; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( value() < 11 || value() > 12 ) { xmlLiteParser->addWarning(generateErrors, S8Printf("SubType must be 11 or 22 at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -688,7 +688,7 @@ int documentation_test4() }; virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !type.isDefined() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Type must befined at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -732,7 +732,7 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test5() { - bool b; + XBool b; class MyPlist : public ConfigPlistAbstractClass { using super = XmlDict; @@ -747,7 +747,7 @@ int documentation_test5() }; virtual void getFields(XmlDictField** fields, size_t* nb) override { *fields = m_fields; *nb = sizeof(m_fields)/sizeof(m_fields[0]); }; - virtual bool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, bool generateErrors) override { + virtual XBool validate(XmlLiteParser* xmlLiteParser, const XString8& xmlPath, const XmlParserPosition& keyPos, XBool generateErrors) override { if ( !super::validate(xmlLiteParser, xmlPath, keyPos, generateErrors) ) return false; if ( !type.isDefined() ) { xmlLiteParser->addWarning(generateErrors, S8Printf("Type must befined at '%s:%d'", xmlPath.c_str(), keyPos.getLine())); @@ -801,7 +801,7 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test6() { - bool b; + XBool b; class MyDictClass : public ConfigPlistAbstractClass { @@ -839,7 +839,7 @@ gXmlLiteParserTest.printfErrorsAndWarnings(); int documentation_test7() { - bool b; + XBool b; class MyDictClass : public ConfigPlistAbstractClass { diff --git a/rEFIt_UEFI/entry_scan/common.cpp b/rEFIt_UEFI/entry_scan/common.cpp index 79ff16a05..518416880 100644 --- a/rEFIt_UEFI/entry_scan/common.cpp +++ b/rEFIt_UEFI/entry_scan/common.cpp @@ -344,9 +344,9 @@ STATIC REFIT_SIMPLE_MENU_ENTRY_TAG NoMessageEntry(XStringW().takeValueFrom(L"N //REFIT_MENU_SCREEN(UINTN ID, CONST CHAR16* Title, CONST CHAR16* TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2) STATIC REFIT_MENU_SCREEN YesNoMessageMenu(0, XStringW(), XStringW(), &YesMessageEntry, &NoMessageEntry); // Display a yes/no prompt -BOOLEAN YesNoMessage(IN XStringW& Title, IN CONST XStringW& Message) +XBool YesNoMessage(IN XStringW& Title, IN CONST XStringW& Message) { - BOOLEAN Result = FALSE; + XBool Result = false; UINTN MenuExit; CreateInfoLines(Message, &YesNoMessageMenu.InfoLines); YesNoMessageMenu.Title = Title; @@ -356,7 +356,7 @@ BOOLEAN YesNoMessage(IN XStringW& Title, IN CONST XStringW& Message) MenuExit = YesNoMessageMenu.RunMenu(&ChosenEntry); if ( ChosenEntry != NULL && ChosenEntry->getREFIT_SIMPLE_MENU_ENTRY_TAG() && ChosenEntry->getREFIT_SIMPLE_MENU_ENTRY_TAG()->Tag == TAG_YES && ((MenuExit == MENU_EXIT_ENTER) || (MenuExit == MENU_EXIT_DETAILS))) { - Result = TRUE; + Result = true; MenuExit = MENU_EXIT_ENTER; } } while (MenuExit != MENU_EXIT_ENTER); @@ -364,34 +364,34 @@ BOOLEAN YesNoMessage(IN XStringW& Title, IN CONST XStringW& Message) return Result; } // Ask user for file path from directory menu -BOOLEAN AskUserForFilePathFromDir(const CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume, +XBool AskUserForFilePathFromDir(const CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume, const CHAR16 *ParentPath OPTIONAL, const EFI_FILE *Dir, OUT EFI_DEVICE_PATH_PROTOCOL **Result) { //REFIT_MENU_SCREEN Menu = { 0, L"Please Select File...", NULL, 0, NULL, 0, NULL, - // 0, NULL, FALSE, FALSE, 0, 0, 0, 0, { 0, 0, 0, 0 }, NULL}; + // 0, NULL, false, false, 0, 0, 0, 0, { 0, 0, 0, 0 }, NULL}; // Check parameters if ((Volume == NULL) || (Dir == NULL) || (Result == NULL)) { - return FALSE; + return false; } // TODO: Generate directory menu - return FALSE; + return false; } #define TAG_OFFSET 1000 //STATIC REFIT_MENU_SCREEN InitialMenu = {0, L"Please Select File...", NULL, 0, NULL, -// 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, +// 0, NULL, NULL, false, false, 0, 0, 0, 0, // { 0, 0, 0, 0 }, NULL}; //STATIC REFIT_MENU_SCREEN InitialMenu(0, L"Please Select File..."_XSW, XStringW()); // Ask user for file path from volumes menu -BOOLEAN AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result) +XBool AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result) { REFIT_MENU_SCREEN Menu(0, L"Please Select File..."_XSW, XStringW()); UINTN Index = 0, /*Count = 0,*/ MenuExit; - BOOLEAN Responded = FALSE; + XBool Responded = false; if (Result == NULL) { - return FALSE; + return false; } // Create volume entries for (Index = 0; Index < Volumes.size(); ++Index) { @@ -421,7 +421,7 @@ BOOLEAN AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVI if (!AskUserForFilePathFromDir(Title, &Volumes[Index], NULL, Volumes[Index].RootDir, Result)) { continue; } - Responded = TRUE; + Responded = true; } } break; @@ -432,11 +432,11 @@ BOOLEAN AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVI } // Ask user for file path -BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *Root OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result) +XBool AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *Root OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result) { EFI_FILE *Dir = NULL; if (Result == NULL) { - return FALSE; + return false; } if (Root != NULL) { // Get the file path @@ -474,10 +474,10 @@ BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCO FreePool(Info); Dir->Close(Dir); *Result = Root; - return TRUE; + return true; } else { // Ask user other wise - BOOLEAN Success = AskUserForFilePathFromDir(Title, Volume, FilePath, Dir, Result); + XBool Success = AskUserForFilePathFromDir(Title, Volume, FilePath, Dir, Result); FreePool(Info); Dir->Close(Dir); return Success; diff --git a/rEFIt_UEFI/entry_scan/common.h b/rEFIt_UEFI/entry_scan/common.h index ad7b06edb..0a1d098d4 100644 --- a/rEFIt_UEFI/entry_scan/common.h +++ b/rEFIt_UEFI/entry_scan/common.h @@ -33,7 +33,7 @@ StrToLower ( void AlertMessage (IN const XStringW& Title, IN const XStringW& Message); -BOOLEAN +XBool YesNoMessage ( IN CONST CHAR16 *Title, IN CONST CHAR16 *Message); diff --git a/rEFIt_UEFI/entry_scan/entry_scan.h b/rEFIt_UEFI/entry_scan/entry_scan.h index 4cf006503..eb132b0fa 100644 --- a/rEFIt_UEFI/entry_scan/entry_scan.h +++ b/rEFIt_UEFI/entry_scan/entry_scan.h @@ -48,13 +48,13 @@ const XIcon& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, const // Ask user for file path from directory menu -BOOLEAN AskUserForFilePathFromDir(const CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume, +XBool AskUserForFilePathFromDir(const CHAR16 *Title OPTIONAL, IN REFIT_VOLUME *Volume, const CHAR16 *ParentPath, const EFI_FILE *Dir, OUT EFI_DEVICE_PATH_PROTOCOL **Result); // Ask user for file path from volumes menu -BOOLEAN AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result); +XBool AskUserForFilePathFromVolumes(const CHAR16 *Title OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result); // Ask user for file path -BOOLEAN AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *Root OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result); +XBool AskUserForFilePath(IN CHAR16 *Title OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *Root OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **Result); // legacy void ScanLegacy(void); @@ -63,7 +63,7 @@ void AddCustomLegacy(void); // loader void ScanLoader(void); void AddCustomEntries(void); -BOOLEAN IsCustomBootEntry(IN LOADER_ENTRY *Entry); +XBool IsCustomBootEntry(IN LOADER_ENTRY *Entry); // tool void ScanTool(void); @@ -97,13 +97,13 @@ EFI_STATUS InstallSecureBoot(void); void UninstallSecureBoot(void); void EnableSecureBoot(void); void DisableSecureBoot(void); -BOOLEAN ConfigureSecureBoot(void); +XBool ConfigureSecureBoot(void); CONST CHAR16 *SecureBootPolicyToStr(IN UINTN Policy); EFI_STATUS VerifySecureBootImage(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath); UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath); EFI_STATUS EnrollSecureBootKeys(IN void *AuthorizedDatabase, IN UINTN AuthorizedDatabaseSize, - IN BOOLEAN WantDefaultKeys); + IN XBool WantDefaultKeys); EFI_STATUS ClearSecureBootKeys(void); // secure boot database @@ -123,7 +123,7 @@ EFI_STATUS ClearAuthorizedDatabase(void); void *GetImageSignatureDatabase(IN void *FileBuffer, IN UINT64 FileSize, IN UINTN *DatabaseSize, - IN BOOLEAN HashIfNoDatabase); + IN XBool HashIfNoDatabase); EFI_STATUS AppendImageDatabaseToAuthorizedDatabase(IN void *Database, IN UINTN DatabaseSize); EFI_STATUS RemoveImageDatabaseFromAuthorizedDatabase(IN void *Database, diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index ad872eda3..b8dcac98e 100755 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -57,7 +57,7 @@ //the function is not in the class and deals always with MainMenu //I made args as pointers to have an ability to call with NULL -BOOLEAN AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& _LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN char32_t Hotkey, IN BOOLEAN CustomEntry) +XBool AddLegacyEntry(IN const XStringW& FullTitle, IN const XStringW& _LoaderTitle, IN REFIT_VOLUME *Volume, IN const XIcon* Image, IN const XIcon* DriveImage, IN char32_t Hotkey, IN XBool CustomEntry) { LEGACY_ENTRY *Entry, *SubEntry; REFIT_MENU_SCREEN *SubScreen; @@ -207,7 +207,7 @@ DBG(" Volume->LegacyOS->Name=%ls\n", Volume->LegacyOS->Name.wc_str()); void ScanLegacy(void) { UINTN VolumeIndex, VolumeIndex2; - BOOLEAN ShowVolume, HideIfOthersFound; + XBool ShowVolume, HideIfOthersFound; REFIT_VOLUME *Volume; DBG("Scanning legacy ...\n"); @@ -243,20 +243,20 @@ void ScanLegacy(void) continue; } // DBG("not hidden\n"); - ShowVolume = FALSE; - HideIfOthersFound = FALSE; + ShowVolume = false; + HideIfOthersFound = false; if (Volume->IsAppleLegacy) { - ShowVolume = TRUE; - HideIfOthersFound = TRUE; + ShowVolume = true; + HideIfOthersFound = true; } else if (Volume->HasBootCode) { - ShowVolume = TRUE; + ShowVolume = true; // DBG("Volume %d will be shown BlockIo=%X WholeIo=%X\n", // VolumeIndex, Volume->BlockIO, Volume->WholeDiskBlockIO); if ((Volume->WholeDiskBlockIO == 0) && Volume->BlockIOOffset == 0 /* && Volume->OSName == NULL */) // this is a whole disk (MBR) entry; hide if we have entries for partitions - HideIfOthersFound = TRUE; + HideIfOthersFound = true; // DBG("Hide it!\n"); } if (HideIfOthersFound) { @@ -267,7 +267,7 @@ void ScanLegacy(void) if (VolumeIndex2 != VolumeIndex && Volumes[VolumeIndex2].HasBootCode && Volumes[VolumeIndex2].WholeDiskBlockIO == Volume->BlockIO){ - ShowVolume = FALSE; + ShowVolume = false; // DBG("PBR volume at index %d\n", VolumeIndex2); break; } @@ -276,7 +276,7 @@ void ScanLegacy(void) if (ShowVolume && (!Volume->Hidden)){ // DBG(" add legacy\n"); - if (!AddLegacyEntry(L""_XSW, L""_XSW, Volume, NULL, NULL, 0, FALSE)) { + if (!AddLegacyEntry(L""_XSW, L""_XSW, Volume, NULL, NULL, 0, false)) { DBG("...entry not added\n"); }; } else { @@ -289,7 +289,7 @@ void ScanLegacy(void) void AddCustomLegacy(void) { UINTN VolumeIndex, VolumeIndex2; - BOOLEAN ShowVolume, HideIfOthersFound; + XBool ShowVolume, HideIfOthersFound; REFIT_VOLUME *Volume; XIcon MainIcon; XIcon DriveIcon; @@ -338,17 +338,17 @@ void AddCustomLegacy(void) continue; } - ShowVolume = FALSE; - HideIfOthersFound = FALSE; + ShowVolume = false; + HideIfOthersFound = false; if (Volume->IsAppleLegacy) { - ShowVolume = TRUE; - HideIfOthersFound = TRUE; + ShowVolume = true; + HideIfOthersFound = true; } else if (Volume->HasBootCode) { - ShowVolume = TRUE; + ShowVolume = true; if ((Volume->WholeDiskBlockIO == 0) && Volume->BlockIOOffset == 0) { // this is a whole disk (MBR) entry; hide if we have entries for partitions - HideIfOthersFound = TRUE; + HideIfOthersFound = true; } } if (HideIfOthersFound) { @@ -358,7 +358,7 @@ void AddCustomLegacy(void) if (VolumeIndex2 != VolumeIndex && Volumes[VolumeIndex2].HasBootCode && Volumes[VolumeIndex2].WholeDiskBlockIO == Volume->BlockIO) { - ShowVolume = FALSE; + ShowVolume = false; break; } } @@ -402,7 +402,7 @@ void AddCustomLegacy(void) } // Create a legacy entry for this volume DBG("\n"); - if (AddLegacyEntry(Custom.settings.FullTitle, Custom.settings.Title, Volume, &MainIcon, &DriveIcon, Custom.settings.Hotkey, TRUE)) + if (AddLegacyEntry(Custom.settings.FullTitle, Custom.settings.Title, Volume, &MainIcon, &DriveIcon, Custom.settings.Hotkey, true)) { // DBG("match!\n"); } diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 977821305..62f0a34aa 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -388,7 +388,7 @@ STATIC XString8Array LinuxKernelOptions(const EFI_FILE_PROTOCOL *Dir, return CustomOptions; } -STATIC BOOLEAN isFirstRootUUID(REFIT_VOLUME *Volume) +STATIC XBool isFirstRootUUID(REFIT_VOLUME *Volume) { UINTN VolumeIndex; REFIT_VOLUME *scanedVolume; @@ -397,13 +397,13 @@ STATIC BOOLEAN isFirstRootUUID(REFIT_VOLUME *Volume) scanedVolume = &Volumes[VolumeIndex]; if (scanedVolume == Volume) - return TRUE; + return true; if (CompareGuid(&scanedVolume->RootUUID, &Volume->RootUUID)) - return FALSE; + return false; } - return TRUE; + return true; } //Set Entry->VolName to .disk_label.contentDetails if it exists @@ -902,7 +902,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST XStringW& LoaderPath, IN UINT8 CustomBoot, IN const XImage& CustomLogo, IN const KERNEL_AND_KEXT_PATCHES* Patches, - IN BOOLEAN CustomEntry) + IN XBool CustomEntry) { EFI_DEVICE_PATH *LoaderDevicePath; XStringW LoaderDevicePathString; @@ -1136,7 +1136,7 @@ if ( Entry->APFSTargetUUID.startWith("99999999") ) { } } - BOOLEAN BootCampStyle = ThemeX.BootCampStyle; + XBool BootCampStyle = ThemeX.BootCampStyle; if ( Entry->Title.isEmpty() && Entry->DisplayedVolName.isEmpty() ) { XStringW BasenameXW = XStringW(Basename(Volume->DevicePathString.wc_str())); @@ -1233,9 +1233,9 @@ void LOADER_ENTRY::AddDefaultMenu() LOADER_ENTRY *SubEntry; // REFIT_MENU_SCREEN *SubScreen; // REFIT_VOLUME *Volume; - UINT64 VolumeSize; + UINT64 VolumeSize; EFI_GUID *Guid = NULL; - BOOLEAN KernelIs64BitOnly; + XBool KernelIs64BitOnly; // UINT64 os_version = AsciiOSVersionToUint64(OSVersion); constexpr LString8 quietLitteral = "quiet"_XS8; @@ -1343,8 +1343,8 @@ void LOADER_ENTRY::AddDefaultMenu() } } else if (LoaderType == OSTYPE_LINEFI) { - BOOLEAN Quiet = LoadOptions.contains(quietLitteral); - BOOLEAN WithSplash = LoadOptions.contains(splashLitteral); + XBool Quiet = LoadOptions.contains(quietLitteral); + XBool WithSplash = LoadOptions.contains(splashLitteral); // default entry SubEntry = getPartiallyDuplicatedEntry(); @@ -1464,7 +1464,7 @@ LOADER_ENTRY* AddLoaderEntry(IN CONST XStringW& LoaderPath, IN CONST XString8Arr // } // } - Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NullXImage, NULL, FALSE); + Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, FullTitle, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NullXImage, NULL, false); if (Entry != NULL) { if ((Entry->LoaderType == OSTYPE_OSX) || (Entry->LoaderType == OSTYPE_OSX_INSTALLER ) || @@ -1975,7 +1975,7 @@ void ScanLoader(void) #if defined(ANDX86) - if (TRUE) { //gSettings.AndroidScan + if (true) { //gSettings.AndroidScan // check for Android loaders for (UINTN Index = 0; Index < AndroidEntryDataCount; ++Index) { UINTN aIndex, aFound; @@ -2188,7 +2188,7 @@ void ScanLoader(void) } } - bool hasMovedSomething; + XBool hasMovedSomething; // Re-order preboot partition do { @@ -2405,7 +2405,7 @@ STATIC void AddCustomSubEntry(REFIT_VOLUME *Volume, Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.getFullTitle(), Custom.getTitle(), Volume, NULL, NULL, parentType, newCustomFlags, 0, {0,0,0,0}, 0, NullXImage, - /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE); + /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, true); if (Entry != NULL) { // if ( Custom.settings.Settings.notEmpty() ) DBG("Custom settings: %ls.plist will %s be applied\n", Custom.settings.Settings.wc_str(), Custom.settings.CommonSettings?"not":""); // if (!Custom.settings.CommonSettings) { @@ -2466,7 +2466,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, REFIT_DIR_ITER *Iter = &SIter; CHAR16 PartUUID[40]; XStringW CustomPath = _CustomPath; - BOOLEAN FindCustomPath = (CustomPath.isEmpty()); + XBool FindCustomPath = (CustomPath.isEmpty()); if ( SubMenu != NULL ) panic("Call AddCustomSubEntry instead"); @@ -2557,7 +2557,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, if (Custom.settings.Volume.notEmpty()) { if ((StrStr(Volume->DevicePathString.wc_str(), Custom.settings.Volume.wc_str()) == NULL) && ((Volume->VolName.isEmpty()) || (StrStr(Volume->VolName.wc_str(), Custom.settings.Volume.wc_str()) == NULL))) { - bool CustomEntryFound = false; + XBool CustomEntryFound = false; //..\VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E97E25EA28F4DF46AAD44CC3F12E28D3) EFI_DEVICE_PATH *MediaPath = Clover_FindDevicePathNodeWithType(Volume->DevicePath, MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP); if (MediaPath) { @@ -2667,7 +2667,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, // Check to make sure that this entry is not hidden or disabled by another custom entry if (true) { - BOOLEAN BetterMatch = FALSE; + XBool BetterMatch = false; for (size_t i = 0 ; i < GlobalConfig.CustomEntries.size() ; ++i ) { CUSTOM_LOADER_ENTRY& CustomEntry = GlobalConfig.CustomEntries[i]; if ( CustomEntry.settings.Disabled ) continue; // before, disabled entries settings weren't loaded. @@ -2704,7 +2704,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, ((1ull<DiskKind) & Custom.settings.VolumeType) != 0); } else { // Better match - BetterMatch = TRUE; + BetterMatch = true; } // Duplicate volume match } else if (Custom.settings.Path != CustomEntry.settings.Path) { @@ -2766,7 +2766,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, Entry = CreateLoaderEntry(CustomPath, CustomOptions, Custom.settings.FullTitle, Custom.settings.dgetTitle(), Volume, (Image.isEmpty() ? NULL : &Image), (DriveImage.isEmpty() ? NULL : &DriveImage), Custom.settings.Type, newCustomFlags, Custom.settings.Hotkey, Custom.settings.BootBgColor, Custom.CustomLogoType, Custom.CustomLogoImage, - /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, TRUE); + /*(KERNEL_AND_KEXT_PATCHES *)(((UINTN)Custom) + OFFSET_OF(CUSTOM_LOADER_ENTRY, KernelAndKextPatches))*/ NULL, true); if (Entry != NULL) { if ( Custom.settings.Settings.notEmpty() ) { DBG("Custom settings: %ls.plist will %s be applied\n", Custom.settings.Settings.wc_str(), Custom.settings.CommonSettings?"not":""); diff --git a/rEFIt_UEFI/entry_scan/lockedgraphics.cpp b/rEFIt_UEFI/entry_scan/lockedgraphics.cpp index 365f8d0e0..0c22c13c1 100644 --- a/rEFIt_UEFI/entry_scan/lockedgraphics.cpp +++ b/rEFIt_UEFI/entry_scan/lockedgraphics.cpp @@ -72,7 +72,7 @@ static EFI_BOOT_SERVICES OldBootServices; // The locked graphics collection static LOCKED_GRAPHICS *LockedGraphics; // The screen lock -static BOOLEAN ScreenIsLocked; +static XBool ScreenIsLocked; static EFI_STATUS EFIAPI LockedGOPBlt(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, IN UINTN SourceX, IN UINTN SourceY, IN UINTN DestinationX, IN UINTN DestinationY, IN UINTN Width, IN UINTN Height, IN UINTN Delta OPTIONAL) { @@ -102,7 +102,7 @@ static EFI_STATUS EFIAPI LockedGOPQueryMode(IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Thi static EFI_STATUS AddLockedGraphicsGOP(IN EFI_HANDLE Handle, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GOPInterface) { - BOOLEAN Modify = TRUE; + XBool Modify = true; LOCKED_GRAPHICS *Ptr = LockedGraphics; if ((Handle == NULL) || (AgentHandle == NULL) || @@ -121,7 +121,7 @@ static EFI_STATUS AddLockedGraphicsGOP(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent return EFI_SUCCESS; } if (Ptr->GOPInterface == GOPInterface) { - Modify = FALSE; + Modify = false; } Ptr = Ptr->Next; } @@ -296,7 +296,7 @@ static EFI_STATUS RemoveLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE Ag static EFI_STATUS AddLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN EFI_UGA_DRAW_PROTOCOL *UGAInterface) { - BOOLEAN Modify = TRUE; + XBool Modify = true; LOCKED_GRAPHICS *Ptr = LockedGraphics; if ((Handle == NULL) || (AgentHandle == NULL) || @@ -315,7 +315,7 @@ static EFI_STATUS AddLockedGraphicsUGA(IN EFI_HANDLE Handle, IN EFI_HANDLE Agent return EFI_SUCCESS; } if (Ptr->UGAInterface == UGAInterface) { - Modify = FALSE; + Modify = false; } Ptr = Ptr->Next; } @@ -489,7 +489,7 @@ EFI_STATUS LockBootScreen(void) LockGraphicsGOP(); LockGraphicsUGA(); // Lock screen - ScreenIsLocked = TRUE; + ScreenIsLocked = true; return EFI_SUCCESS; } @@ -513,6 +513,6 @@ EFI_STATUS UnlockBootScreen(void) // Restore locate handle, open and close protocol CopyMem(gBS, &OldBootServices, sizeof(EFI_BOOT_SERVICES)); // Unlock - ScreenIsLocked = FALSE; + ScreenIsLocked = false; return EFI_SUCCESS; } diff --git a/rEFIt_UEFI/entry_scan/secureboot.cpp b/rEFIt_UEFI/entry_scan/secureboot.cpp index 5ee5fb524..f10c63d48 100644 --- a/rEFIt_UEFI/entry_scan/secureboot.cpp +++ b/rEFIt_UEFI/entry_scan/secureboot.cpp @@ -65,7 +65,7 @@ extern "C" { void EnableSecureBoot(void) { EFI_STATUS Status = EFI_NOT_FOUND; - BOOLEAN WantDefaultKeys; + XBool WantDefaultKeys; CONST CHAR16 *ErrorString = NULL; UINTN CloverSignatureSize = 0; void *CloverSignature = NULL; @@ -80,11 +80,11 @@ void EnableSecureBoot(void) UINT32 AuthenticationStatus = 0; UINTN FileSize = 0; // Open the file buffer - void *FileBuffer = GetFileBufferByFilePath(FALSE, &self.getCloverDirFullDevicePath(), &FileSize, &AuthenticationStatus); + void *FileBuffer = GetFileBufferByFilePath(false, &self.getCloverDirFullDevicePath(), &FileSize, &AuthenticationStatus); if (FileBuffer != NULL) { if (FileSize > 0) { // Retrieve the certificates - CloverSignature = GetImageSignatureDatabase(FileBuffer, FileSize, &CloverSignatureSize, FALSE); + CloverSignature = GetImageSignatureDatabase(FileBuffer, FileSize, &CloverSignatureSize, false); if (CloverSignature != NULL) { if (CloverSignatureSize > 0) { // Found signature @@ -218,64 +218,64 @@ STATIC EFI_SECURITY_FILE_AUTHENTICATION_STATE gSecurityFileAuthentication; STATIC EFI_SECURITY2_FILE_AUTHENTICATION gSecurity2FileAuthentication; // Pre check the secure boot policy -STATIC BOOLEAN EFIAPI +STATIC XBool EFIAPI PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) { CHAR16 *DevicePathStr; UINTN Index; if ((AuthenticationStatus == NULL) || (DevicePath == NULL)) { - return FALSE; + return false; } switch (gSettings.Boot.SecureBootPolicy) { case SECURE_BOOT_POLICY_ALLOW: // Allow all images *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; case SECURE_BOOT_POLICY_WHITELIST: // Check the white list for this image DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); if (DevicePathStr == NULL) { - return FALSE; + return false; } for (Index = 0; Index < gSettings.Boot.SecureBootWhiteList.size(); ++Index) { if ((gSettings.Boot.SecureBootWhiteList[Index].notEmpty()) && (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) { // White listed *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; } } - return TRUE; + return true; case SECURE_BOOT_POLICY_BLACKLIST: // Check the black list for this image DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); if (DevicePathStr == NULL) { - return FALSE; + return false; } for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) { if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) && (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) { // Black listed - return TRUE; + return true; } } *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; case SECURE_BOOT_POLICY_USER: DevicePathStr = FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL *)DevicePath); if (DevicePathStr == NULL) { - return FALSE; + return false; } // Check the black list for this image for (Index = 0; Index < gSettings.Boot.SecureBootBlackList.size(); ++Index) { if ((gSettings.Boot.SecureBootBlackList[Index].notEmpty()) && (StriStr(DevicePathStr, gSettings.Boot.SecureBootBlackList[Index].wc_str()) != NULL)) { // Black listed - return TRUE; + return true; } } // Check the white list for this image @@ -284,16 +284,16 @@ PrecheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationSt (StriStr(DevicePathStr, gSettings.Boot.SecureBootWhiteList[Index].wc_str()) != NULL)) { // White listed *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; } } break; } - return FALSE; + return false; } // Check the secure boot policy -STATIC BOOLEAN EFIAPI +STATIC XBool EFIAPI CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatus, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN void *FileBuffer, @@ -313,12 +313,12 @@ CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatu case SECURE_BOOT_POLICY_DENY: default: - return TRUE; + return true; case SECURE_BOOT_POLICY_INSERT: // If this is forced mode then no insert if (GlobalConfig.SecureBootSetupMode) { - return TRUE; + return true; } break; } @@ -328,18 +328,18 @@ CheckSecureBootPolicy(IN OUT EFI_STATUS *AuthenticationStatu // Insert image signature AppendImageToAuthorizedDatabase(DevicePath, FileBuffer, FileSize); *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; case SECURE_BOOT_POLICY_ALLOW: // Allow all images *AuthenticationStatus = EFI_SUCCESS; - return TRUE; + return true; case SECURE_BOOT_POLICY_DENY: // Deny all images - return TRUE; + return true; } - return FALSE; + return false; } @@ -375,7 +375,7 @@ Internal2FileAuthentication(IN CONST EFI_SECURITY2_ARCH_PROTOCOL *This, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN void *FileBuffer, IN UINTN FileSize, - IN BOOLEAN BootPolicy) + IN XBool BootPolicy) { EFI_STATUS Status = EFI_SECURITY_VIOLATION; // Check secure boot policy diff --git a/rEFIt_UEFI/entry_scan/securehash.cpp b/rEFIt_UEFI/entry_scan/securehash.cpp index 4e1af06e5..d989f97c1 100644 --- a/rEFIt_UEFI/entry_scan/securehash.cpp +++ b/rEFIt_UEFI/entry_scan/securehash.cpp @@ -745,7 +745,7 @@ Failed: void *GetImageSignatureDatabase(IN void *FileBuffer, IN UINT64 FileSize, IN UINTN *DatabaseSize, - IN BOOLEAN HashIfNoDatabase) + IN XBool HashIfNoDatabase) { UINTN Size = 0; void *Database = NULL; diff --git a/rEFIt_UEFI/entry_scan/securemenu.cpp b/rEFIt_UEFI/entry_scan/securemenu.cpp index d34df37a2..73385fa74 100644 --- a/rEFIt_UEFI/entry_scan/securemenu.cpp +++ b/rEFIt_UEFI/entry_scan/securemenu.cpp @@ -66,8 +66,8 @@ extern "C" { #define DBG(...) DebugLog(DEBUG_SECURE_MENU, __VA_ARGS__) #endif -extern BOOLEAN gGuiIsReady; -extern BOOLEAN gThemeNeedInit; +extern XBool gGuiIsReady; +extern XBool gThemeNeedInit; // Add secure boot tool entry void AddSecureBootTool(void) @@ -108,7 +108,7 @@ STATIC REFIT_SIMPLE_MENU_ENTRY_TAG QueryEntry[] = { }; /*commented out to avoid warning: STATIC*/ REFIT_SIMPLE_MENU_ENTRY_TAG *QueryEntries[] = { QueryEntry, QueryEntry + 1, QueryEntry + 2 }; //STATIC REFIT_MENU_SCREEN QueryUserMenu = { 0, L"Secure Boot Authentication"_XSW, L""_XSW, 3, NULL, 2, QueryEntries, -// 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, +// 0, NULL, NULL, false, false, 0, 0, 0, 0, // /* FILM_CENTRE, FILM_CENTRE,*/ { 0, 0, 0, 0 }, NULL }; STATIC REFIT_MENU_SCREEN QueryUserMenu = { 0, L"Secure Boot Authentication"_XSW, L""_XSW }; // TODO:add QueryEntries @@ -133,14 +133,14 @@ UINTN QuerySecureBootUser(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) DBG("VerifySecureBootImage: Query user for authentication action for %ls\n", QueryUserMenu.InfoLines[1].wc_str()); // Because we may if (!gGuiIsReady) { - InitScreen(FALSE); + InitScreen(false); if (gThemeNeedInit) { UINTN Size = 0; InitTheme((CHAR8*)GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size)); ThemeX.ClearScreen(); - gThemeNeedInit = FALSE; + gThemeNeedInit = false; } - gGuiIsReady = TRUE; + gGuiIsReady = true; } // Run the query menu do @@ -244,11 +244,11 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De } else if ((FileBuffer == NULL) || (FileSize == 0)) { // Load file by device path UINT32 AuthenticationStatus = 0; - FileBuffer = GetFileBufferByFilePath(FALSE, DevicePath, &FileSize, &AuthenticationStatus); + FileBuffer = GetFileBufferByFilePath(false, DevicePath, &FileSize, &AuthenticationStatus); if (FileBuffer) { if (FileSize > 0) { // Create image signature - Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, TRUE); + Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, true); if (Database) { // Add the image signature to database if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { @@ -267,7 +267,7 @@ EFI_STATUS AppendImageToAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL *De } } else { // Create image signature - Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, TRUE); + Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, true); if (Database) { // Add the image signature to database if (EFI_ERROR(Status = AppendImageDatabaseToAuthorizedDatabase(Database, DatabaseSize))) { @@ -318,11 +318,11 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL * } else if ((FileBuffer == NULL) || (FileSize == 0)) { // Load file by device path UINT32 AuthenticationStatus = 0; - FileBuffer = GetFileBufferByFilePath(FALSE, DevicePath, &FileSize, &AuthenticationStatus); + FileBuffer = GetFileBufferByFilePath(false, DevicePath, &FileSize, &AuthenticationStatus); if (FileBuffer) { if (FileSize > 0) { // Create image signature - Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, TRUE); + Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, true); if (Database) { // Remove the image signature from database if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { @@ -341,7 +341,7 @@ EFI_STATUS RemoveImageFromAuthorizedDatabase(IN CONST EFI_DEVICE_PATH_PROTOCOL * } } else { // Create image signature - Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, TRUE); + Database = GetImageSignatureDatabase(FileBuffer, FileSize, &DatabaseSize, true); if (Database) { // Remove the image signature from database if (EFI_ERROR(Status = RemoveImageDatabaseFromAuthorizedDatabase(Database, DatabaseSize))) { @@ -386,7 +386,7 @@ STATIC REFIT_SIMPLE_MENU_ENTRY_TAG ClearImageSignatureEntry = { L"Clear image STATIC REFIT_SIMPLE_MENU_ENTRY_TAG DisableSecureBootEntry = { L"Disable secure boot"_XSW, TAG_DISABLE, ActionEnter }; /*commented out to avoid warning: STATIC*/ REFIT_ABSTRACT_MENU_ENTRY *SecureBootEntries[] = { NULL, NULL, NULL, NULL, NULL, NULL }; //STATIC REFIT_MENU_SCREEN SecureBootMenu = { 0, L"Secure Boot Configuration"_XSW, NULL, 0, NULL, 0, SecureBootEntries, -// 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, +// 0, NULL, NULL, false, false, 0, 0, 0, 0, // /* FILM_CENTRE, FILM_CENTRE,*/ { 0, 0, 0, 0 }, NULL }; STATIC REFIT_MENU_SCREEN SecureBootMenu = { 0, L"Secure Boot Configuration"_XSW, L""_XSW }; // TODO: what was this SecureBootEntries array. @@ -413,14 +413,14 @@ STATIC REFIT_SIMPLE_MENU_ENTRY_TAG SecureBootPolicyNameEntry[] = { //STATIC REFIT_MENU_SCREEN SecureBootPolicyMenu = { 0, L"Secure Boot Policy", NULL, 0, NULL, // sizeof(SecureBootPolicyEntries) / sizeof(REFIT_MENU_ENTRY *), SecureBootPolicyEntries, -// 0, NULL, NULL, FALSE, FALSE, 0, 0, 0, 0, +// 0, NULL, NULL, false, false, 0, 0, 0, 0, // /* FILM_CENTRE, FILM_CENTRE,*/ { 0, 0, 0, 0 } , NULL }; STATIC REFIT_MENU_SCREEN SecureBootPolicyMenu = { 0, L"Secure Boot Policy"_XSW, L""_XSW }; // TODO: add entries from SecureBootPolicyEntries // Configure secure boot -BOOLEAN ConfigureSecureBoot(void) +XBool ConfigureSecureBoot(void) { - BOOLEAN StillConfiguring = TRUE; + XBool StillConfiguring = true; do { UINTN MenuExit; @@ -510,21 +510,21 @@ BOOLEAN ConfigureSecureBoot(void) DBG("User disabled secure boot\n"); DisableSecureBoot(); if (!GlobalConfig.SecureBoot) { - return TRUE; + return true; } AlertMessage(L"Disable Secure Boot"_XSW, L"Disabling secure boot failed!\nClover does not appear to own the PK"_XSW); } break; default: - StillConfiguring = FALSE; + StillConfiguring = false; break; } } else if (MenuExit == MENU_EXIT_ESCAPE) { - StillConfiguring = FALSE; + StillConfiguring = false; } } while (StillConfiguring); - return FALSE; + return false; } #endif // ENABLE_SECURE_BOOT diff --git a/rEFIt_UEFI/entry_scan/securevars.cpp b/rEFIt_UEFI/entry_scan/securevars.cpp index 53d818732..5d18686ef 100644 --- a/rEFIt_UEFI/entry_scan/securevars.cpp +++ b/rEFIt_UEFI/entry_scan/securevars.cpp @@ -76,7 +76,7 @@ EFI_STATUS ClearSecureBootKeys(void) // Enroll the secure boot keys EFI_STATUS EnrollSecureBootKeys(IN void *AuthorizedDatabase, IN UINTN AuthorizedDatabaseSize, - IN BOOLEAN WantDefaultKeys) + IN XBool WantDefaultKeys) { EFI_STATUS Status; diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 1f7bf93f1..f5c707538 100755 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -79,7 +79,7 @@ #define DBG(...) DebugLog(DEBUG_SCAN_TOOL, __VA_ARGS__) #endif -STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle, +STATIC XBool AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *FullTitle, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume, const XIcon& Image, IN char32_t ShortcutLetter, IN CONST XString8Array& Options) { @@ -87,7 +87,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full // Check the loader exists if ((LoaderPath.isEmpty()) || (Volume == NULL) || (Volume->RootDir == NULL) || !FileExists(Volume->RootDir, LoaderPath)) { - return FALSE; + return false; } // Allocate the entry Entry = new REFIT_MENU_ENTRY_LOADER_TOOL; @@ -113,7 +113,7 @@ STATIC BOOLEAN AddToolEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *Full DBG("found tool %ls\n", LoaderPath.s()); MainMenu.AddMenuEntry(Entry, true); - return TRUE; + return true; } STATIC void AddCloverEntry(IN CONST XStringW& LoaderPath, IN CONST CHAR16 *LoaderTitle, IN REFIT_VOLUME *Volume) diff --git a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp index aa0e38bee..c763294aa 100644 --- a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp @@ -120,7 +120,7 @@ void REFIT_MAINMENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN X INTN X = XPos - (TextWidth >> 1) - (BadgeDim + 16); INTN Y = YPos - ((BadgeDim - ThemeX.TextHeight) >> 1); Back.CopyRect(ThemeX.Background, X, Y); - bool free = false; + XBool free = false; XImage *CurrSel = Entries[ScrollState.CurrentSelection].Image.GetBest(!Daylight, &free); Back.Compose(0, 0, *CurrSel, false, BadgeDim/128.f); Back.DrawOnBack(X, Y, Back); @@ -163,7 +163,7 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align) // HIDEUI_ALL - included ((TextC == TEXT_CORNER_REVISION) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_REVISION) != 0)) || ((TextC == TEXT_CORNER_HELP) && ((ThemeX.HideUIFlags & HIDEUI_FLAG_HELP) != 0)) || - ((TextC == TEXT_CORNER_OPTIMUS) && (gSettings.GUI.ShowOptimus == FALSE)) + ((TextC == TEXT_CORNER_OPTIMUS) && (gSettings.GUI.ShowOptimus == false)) ) { return; } @@ -212,7 +212,7 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align) DrawTextXY(Text, Xpos, UGAHeight - (INTN)(ThemeX.TextHeight * 1.5f), Align); } -void REFIT_MAINMENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos) +void REFIT_MAINMENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, XBool selected, INTN XPos, INTN YPos) { INTN MainSize = ThemeX.MainEntriesSize; // XImage MainImage(MainSize, MainSize); @@ -238,7 +238,7 @@ void REFIT_MAINMENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, } // const XImage& MainImage = (!ThemeX.Daylight && !MainIcon.ImageNight.isEmpty())? MainIcon.ImageNight : MainIcon.Image; - bool free = false; + XBool free = false; XImage *MainImage = MainIcon.GetBest(!Daylight, &free); INTN CompWidth = (Entry->Row == 0) ? ThemeX.row0TileSize : ThemeX.row1TileSize; @@ -371,7 +371,7 @@ void REFIT_MAINMENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa egGetScreenSize(&UGAWidth, &UGAHeight); InitAnime(); SwitchToGraphicsAndClear(); - //BltClearScreen(FALSE); + //BltClearScreen(false); EntriesGap = (int)(ThemeX.TileXSpace * ThemeX.Scale); EntriesWidth = ThemeX.row0TileSize; @@ -453,7 +453,7 @@ void REFIT_MAINMENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa for (INTN i = 0; i <= ScrollState.MaxIndex; i++) { if (Entries[i].Row == 0) { if ((i >= ScrollState.FirstVisible) && (i <= ScrollState.LastVisible)) { - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, + DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?true:false, itemPosX[i - ScrollState.FirstVisible], row0PosY); // draw static text for the boot options, BootCampStyle @@ -467,7 +467,7 @@ void REFIT_MAINMENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa } } } else { - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, + DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?true:false, itemPosX[i], row1PosY); } } @@ -504,18 +504,18 @@ void REFIT_MAINMENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa case MENU_FUNCTION_PAINT_SELECTION: HidePointer(); if (Entries[ScrollState.LastSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, + DrawMainMenuEntry(&Entries[ScrollState.LastSelection], false, itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], row0PosY); } else { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, + DrawMainMenuEntry(&Entries[ScrollState.LastSelection], false, itemPosX[ScrollState.LastSelection], row1PosY); } if (Entries[ScrollState.CurrentSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, + DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], true, itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], row0PosY); } else { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, + DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], true, itemPosX[ScrollState.CurrentSelection], row1PosY); } @@ -574,7 +574,7 @@ void REFIT_MAINMENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CH egGetScreenSize(&UGAWidth, &UGAHeight); //do this when needed InitAnime(); SwitchToGraphicsAndClear(); - //BltClearScreen(FALSE); + //BltClearScreen(false); //adjustable by theme.plist? EntriesPosY = (int)(LAYOUT_Y_EDGE * ThemeX.Scale); EntriesGap = (int)(ThemeX.TileYSpace * ThemeX.Scale); @@ -641,11 +641,11 @@ void REFIT_MAINMENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CH for (INTN i = 0; i <= ScrollState.MaxIndex; i++) { if (Entries[i].Row == 0) { if ((i >= ScrollState.FirstVisible) && (i <= ScrollState.LastVisible)) { - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, + DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?true:false, itemPosX[i - ScrollState.FirstVisible], itemPosY[i - ScrollState.FirstVisible]); } } else { //row1 - DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?1:0, + DrawMainMenuEntry(&Entries[i], (i == ScrollState.CurrentSelection)?true:false, itemPosX[i], itemPosY[i]); } } @@ -663,21 +663,21 @@ void REFIT_MAINMENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CH case MENU_FUNCTION_PAINT_SELECTION: HidePointer(); if (Entries[ScrollState.LastSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, + DrawMainMenuEntry(&Entries[ScrollState.LastSelection], false, itemPosX[ScrollState.LastSelection - ScrollState.FirstVisible], itemPosY[ScrollState.LastSelection - ScrollState.FirstVisible]); } else { - DrawMainMenuEntry(&Entries[ScrollState.LastSelection], FALSE, + DrawMainMenuEntry(&Entries[ScrollState.LastSelection], false, itemPosX[ScrollState.LastSelection], itemPosY[ScrollState.LastSelection]); } if (Entries[ScrollState.CurrentSelection].Row == 0) { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, + DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], true, itemPosX[ScrollState.CurrentSelection - ScrollState.FirstVisible], itemPosY[ScrollState.CurrentSelection - ScrollState.FirstVisible]); } else { - DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], TRUE, + DrawMainMenuEntry(&Entries[ScrollState.CurrentSelection], true, itemPosX[ScrollState.CurrentSelection], itemPosY[ScrollState.CurrentSelection]); } diff --git a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.h index 626bdbfcc..ef2aab2d5 100644 --- a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.h @@ -81,7 +81,7 @@ public: } } - void DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN XPos, INTN YPos); + void DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, XBool selected, INTN XPos, INTN YPos); void DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos, IN INTN YPos); virtual void call_MENU_FUNCTION_INIT(IN CONST CHAR16 *ParamText) { MenuStyle(MENU_FUNCTION_INIT, ParamText); } diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index 3eed8a278..712507f7a 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -79,10 +79,10 @@ const CHAR16 ArrowUp[2] = { ARROW_UP, 0 }; //defined in Simple Text Out protocol const CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 }; // -//BOOLEAN MainAnime = FALSE; +//XBool MainAnime = false; // ////TODO Scroll variables must be a part of REFIT_SCREEN -////BOOLEAN ScrollEnabled = FALSE; +////XBool ScrollEnabled = false; // static INTN ScrollbarYMovement; // @@ -102,7 +102,7 @@ INTN MenuWidth , TimeoutPosY; UINTN MenuMaxTextLen = 0; INTN EntriesPosX, EntriesPosY; -BOOLEAN mGuiReady = FALSE; +XBool mGuiReady = false; XPointer REFIT_MENU_SCREEN::mPointer; @@ -174,8 +174,8 @@ void REFIT_MENU_SCREEN::InitScroll(IN INTN ItemCount, IN UINTN MaxCount, ScrollState.IsScrolling = (ScrollState.MaxFirstVisible > 0); - ScrollState.PaintAll = TRUE; - ScrollState.PaintSelection = FALSE; + ScrollState.PaintAll = true; + ScrollState.PaintSelection = false; ScrollState.LastVisible = ScrollState.FirstVisible + ScrollState.MaxVisible; @@ -228,15 +228,15 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) if (ScrollState.CurrentSelection > 0) { ScrollState.CurrentSelection --; if (ScrollState.CurrentSelection < ScrollState.FirstVisible) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = ScrollState.CurrentSelection; } if (ScrollState.CurrentSelection == ScrollState.MaxScroll) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } if ((ScrollState.CurrentSelection < ScrollState.MaxScroll) && (ScrollState.CurrentSelection > ScrollState.LastVisible)) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.LastVisible = ScrollState.CurrentSelection; ScrollState.FirstVisible = ScrollState.LastVisible - ScrollState.MaxVisible; } @@ -248,12 +248,12 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) ScrollState.CurrentSelection++; if ((ScrollState.CurrentSelection > ScrollState.LastVisible) && (ScrollState.CurrentSelection <= ScrollState.MaxScroll)){ - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible++; CONSTRAIN_MAX(ScrollState.FirstVisible, ScrollState.MaxFirstVisible); } if (ScrollState.CurrentSelection == ScrollState.MaxScroll + 1) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } } break; @@ -264,7 +264,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) ScrollState.CurrentSelection++; ScrollState.FirstVisible++; ScrollState.LastVisible++; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } break; @@ -274,7 +274,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) ScrollState.CurrentSelection--; ScrollState.FirstVisible--; ScrollState.LastVisible--; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } break; @@ -287,14 +287,14 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) ScrollState.CurrentSelection = 0; // move to first entry } else { if (ScrollState.FirstVisible > 0) - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.CurrentSelection -= ScrollState.MaxVisible; // move one page and scroll synchronously ScrollState.FirstVisible -= ScrollState.MaxVisible; } CONSTRAIN_MIN(ScrollState.CurrentSelection, 0); CONSTRAIN_MIN(ScrollState.FirstVisible, 0); if (ScrollState.CurrentSelection < ScrollState.FirstVisible) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = ScrollState.CurrentSelection; } } @@ -313,7 +313,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) ScrollState.CurrentSelection = ScrollState.MaxIndex; // move to last entry } else { // if (ScrollState.FirstVisible < ScrollState.MaxFirstVisible) -// ScrollState.PaintAll = TRUE; +// ScrollState.PaintAll = true; ScrollState.CurrentSelection += ScrollState.MaxVisible; // move one page and scroll synchronously ScrollState.FirstVisible += ScrollState.MaxVisible; } @@ -321,11 +321,11 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) CONSTRAIN_MAX(ScrollState.FirstVisible, ScrollState.MaxFirstVisible); if ((ScrollState.CurrentSelection > ScrollState.LastVisible) && (ScrollState.CurrentSelection <= ScrollState.MaxScroll)){ - // ScrollState.PaintAll = TRUE; + // ScrollState.PaintAll = true; ScrollState.FirstVisible+= ScrollState.MaxVisible; CONSTRAIN_MAX(ScrollState.FirstVisible, ScrollState.MaxFirstVisible); } - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } // DBG("after cur=%lld, maxInd=%lld, maxVis=%lld, First=%lld, maxFirst=%lld, lastVis=%lld, maxscr=%lld\n", // ScrollState.CurrentSelection, ScrollState.MaxIndex, ScrollState.MaxVisible, ScrollState.FirstVisible, @@ -337,7 +337,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) if (ScrollState.CurrentSelection > 0) { ScrollState.CurrentSelection = 0; if (ScrollState.FirstVisible > 0) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = 0; } } @@ -347,7 +347,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) if (ScrollState.CurrentSelection < ScrollState.MaxIndex) { ScrollState.CurrentSelection = ScrollState.MaxIndex; if (ScrollState.FirstVisible < ScrollState.MaxFirstVisible) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = ScrollState.MaxFirstVisible; } } @@ -357,12 +357,12 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) // The caller has already updated CurrentSelection, but we may // have to scroll to make it visible. if (ScrollState.CurrentSelection < ScrollState.FirstVisible) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = ScrollState.CurrentSelection; // - (ScrollState.MaxVisible >> 1); CONSTRAIN_MIN(ScrollState.FirstVisible, 0); } else if ((ScrollState.CurrentSelection > ScrollState.LastVisible) && (ScrollState.CurrentSelection <= ScrollState.MaxScroll)) { - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; ScrollState.FirstVisible = ScrollState.CurrentSelection - ScrollState.MaxVisible; CONSTRAIN_MAX(ScrollState.FirstVisible, ScrollState.MaxFirstVisible); } @@ -371,7 +371,7 @@ void REFIT_MENU_SCREEN::UpdateScroll(IN UINTN Movement) } if (!ScrollState.PaintAll && ScrollState.CurrentSelection != ScrollState.LastSelection) - ScrollState.PaintSelection = TRUE; + ScrollState.PaintSelection = true; ScrollState.LastVisible = ScrollState.FirstVisible + ScrollState.MaxVisible; //ycr.ru @@ -406,7 +406,7 @@ void REFIT_MENU_SCREEN::AddMenuInfoLine_f(CONST char *format, ...) InfoLines.AddReference(s, true); } -void REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt) +void REFIT_MENU_SCREEN::AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, XBool freeIt) { if ( !Entry ) return; Entries.AddReference(Entry, freeIt); @@ -568,7 +568,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog() continue; break; case SCAN_F2: - SavePreBootLog = TRUE; + SavePreBootLog = true; break; //not used here /* case SCAN_F6: @@ -641,7 +641,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog() switch (MenuExit) { case MENU_EXIT_ENTER: - Item->Valid = TRUE; + Item->Valid = true; ApplyInputs(); break; @@ -656,7 +656,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog() } break; } - Item->Valid = FALSE; + Item->Valid = false; if (Item->SValue.notEmpty()) { MsgLog("EDITED: %ls\n", Item->SValue.wc_str()); } @@ -701,7 +701,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI EFI_INPUT_KEY key; // UINTN Index; INTN ShortcutEntry; - BOOLEAN HaveTimeout = FALSE; + XBool HaveTimeout = false; INTN TimeoutCountdown = 0; UINTN MenuExit; @@ -733,7 +733,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI //no default - no timeout! if ((*DefaultEntryIndex != -1) && (TimeoutSeconds > 0)) { // DBG("have timeout\n"); - HaveTimeout = TRUE; + HaveTimeout = true; TimeoutCountdown = TimeoutSeconds; } MenuExit = 0; @@ -770,10 +770,10 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI // update the screen if (ScrollState.PaintAll) { call_MENU_FUNCTION_PAINT_ALL(NULL); - ScrollState.PaintAll = FALSE; + ScrollState.PaintAll = false; } else if (ScrollState.PaintSelection) { call_MENU_FUNCTION_PAINT_SELECTION(NULL); - ScrollState.PaintSelection = FALSE; + ScrollState.PaintSelection = false; } if (HaveTimeout) { @@ -783,14 +783,14 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI if (gEvent) { //for now used at CD eject. MenuExit = MENU_EXIT_ESCAPE; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; gEvent = 0; //to prevent looping break; } key.UnicodeChar = 0; key.ScanCode = 0; if (!mGuiReady) { - mGuiReady = TRUE; + mGuiReady = true; DBG("GUI ready\n"); } @@ -813,7 +813,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI case ActionSelect: ScrollState.LastSelection = ScrollState.CurrentSelection; ScrollState.CurrentSelection = mItemID; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; HidePointer(); break; case ActionEnter: @@ -823,7 +823,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI MenuExit = InputDialog(); } else if (Entries[mItemID].getREFIT_MENU_SWITCH()) { MenuExit = InputDialog(); - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; HidePointer(); } else if (!Entries[mItemID].getREFIT_INFO_DIALOG()) { MenuExit = MENU_EXIT_ENTER; @@ -846,7 +846,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI MenuExit = InputDialog(); } else if (Entries[mItemID].getREFIT_MENU_SWITCH()) { MenuExit = InputDialog(); - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; HidePointer(); } else if (!Entries[mItemID].getREFIT_INFO_DIALOG()) { MenuExit = MENU_EXIT_DETAILS; @@ -854,7 +854,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI break; case ActionDeselect: ScrollState.LastSelection = ScrollState.CurrentSelection; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; HidePointer(); break; case ActionFinish: @@ -885,7 +885,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI // the user pressed a key, cancel the timeout call_MENU_FUNCTION_PAINT_TIMEOUT(L""); HidePointer(); //ycr.ru - HaveTimeout = FALSE; + HaveTimeout = false; } mAction = ActionNone; //do action once @@ -926,7 +926,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI MenuExit = MENU_EXIT_HELP; break; case SCAN_F2: - SavePreBootLog = TRUE; + SavePreBootLog = true; //let it be twice Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG); // Jief : don't write outside SelfDir @@ -941,7 +941,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI SaveOemTables(); break; case SCAN_F5: - SaveOemDsdt(TRUE); //full patch + SaveOemDsdt(true); //full patch break; case SCAN_F6: Status = egSaveFile(&self.getCloverDir(), VBIOS_BIN, (UINT8*)(UINTN)0xc0000, 0x20000); @@ -984,7 +984,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI case SCAN_F9: SetNextScreenMode(1); egGetScreenSize(&UGAWidth, &UGAHeight); //before init theme - GlobalConfig.gThemeChanged = TRUE; + GlobalConfig.gThemeChanged = true; MenuExit = MENU_EXIT_ESCAPE; //to redraw screen break; case SCAN_F10: @@ -996,7 +996,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI break; case SCAN_F12: MenuExit = MENU_EXIT_EJECT; - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; break; } @@ -1008,7 +1008,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI MenuExit = InputDialog(); } else if (Entries[ScrollState.CurrentSelection].getREFIT_MENU_SWITCH()){ MenuExit = InputDialog(); - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; } else if (Entries[ScrollState.CurrentSelection].getREFIT_MENU_ENTRY_CLOVER()){ MenuExit = MENU_EXIT_DETAILS; } else if (!Entries[ScrollState.CurrentSelection].getREFIT_INFO_DIALOG()) { @@ -1021,7 +1021,7 @@ UINTN REFIT_MENU_SCREEN::RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFI MenuExit = InputDialog(); } else if (Entries[ScrollState.CurrentSelection].getREFIT_MENU_SWITCH()){ MenuExit = InputDialog(); - ScrollState.PaintAll = TRUE; + ScrollState.PaintAll = true; HidePointer(); } else if (!Entries[ScrollState.CurrentSelection].getREFIT_INFO_DIALOG()) { MenuExit = MENU_EXIT_DETAILS; @@ -1342,7 +1342,7 @@ INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INT } OldTextHeight = Height; -// TextBufferXY = egCreateFilledImage(TextWidth, Height, TRUE, &MenuBackgroundPixel); +// TextBufferXY = egCreateFilledImage(TextWidth, Height, true, &MenuBackgroundPixel); TextBufferXY.setSizeInPixels(TextWidth, Height); // TextBufferXY.Fill(MenuBackgroundPixel); @@ -1508,20 +1508,20 @@ void REFIT_MENU_SCREEN::ScrollingBar() Total.CopyRect(ThemeX.Background, ScrollTotal.XPos, ScrollTotal.YPos); if (!ThemeX.ScrollbarBackgroundImage.isEmpty()) { for (INTN i = 0; i < ScrollbarBackground.Height; i+=ThemeX.ScrollbarBackgroundImage.GetHeight()) { - Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, FALSE); + Total.Compose(ScrollbarBackground.XPos - ScrollTotal.XPos, ScrollbarBackground.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarBackgroundImage, false); } } - Total.Compose(BarStart.XPos - ScrollTotal.XPos, BarStart.YPos - ScrollTotal.YPos, ThemeX.BarStartImage, FALSE); - Total.Compose(BarEnd.XPos - ScrollTotal.XPos, BarEnd.YPos - ScrollTotal.YPos, ThemeX.BarEndImage, FALSE); + Total.Compose(BarStart.XPos - ScrollTotal.XPos, BarStart.YPos - ScrollTotal.YPos, ThemeX.BarStartImage, false); + Total.Compose(BarEnd.XPos - ScrollTotal.XPos, BarEnd.YPos - ScrollTotal.YPos, ThemeX.BarEndImage, false); if (!ThemeX.ScrollbarImage.isEmpty()) { for (INTN i = 0; i < Scrollbar.Height; i+=ThemeX.ScrollbarImage.GetHeight()) { - Total.Compose(Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarImage, FALSE); + Total.Compose(Scrollbar.XPos - ScrollTotal.XPos, Scrollbar.YPos + i - ScrollTotal.YPos, ThemeX.ScrollbarImage, false); } } - Total.Compose(UpButton.XPos - ScrollTotal.XPos, UpButton.YPos - ScrollTotal.YPos, ThemeX.UpButtonImage, FALSE); - Total.Compose(DownButton.XPos - ScrollTotal.XPos, DownButton.YPos - ScrollTotal.YPos, ThemeX.DownButtonImage, FALSE); - Total.Compose(ScrollStart.XPos - ScrollTotal.XPos, ScrollStart.YPos - ScrollTotal.YPos, ThemeX.ScrollStartImage, FALSE); - Total.Compose(ScrollEnd.XPos - ScrollTotal.XPos, ScrollEnd.YPos - ScrollTotal.YPos, ThemeX.ScrollEndImage, FALSE); + Total.Compose(UpButton.XPos - ScrollTotal.XPos, UpButton.YPos - ScrollTotal.YPos, ThemeX.UpButtonImage, false); + Total.Compose(DownButton.XPos - ScrollTotal.XPos, DownButton.YPos - ScrollTotal.YPos, ThemeX.DownButtonImage, false); + Total.Compose(ScrollStart.XPos - ScrollTotal.XPos, ScrollStart.YPos - ScrollTotal.YPos, ThemeX.ScrollStartImage, false); + Total.Compose(ScrollEnd.XPos - ScrollTotal.XPos, ScrollEnd.YPos - ScrollTotal.YPos, ThemeX.ScrollEndImage, false); Total.Draw(ScrollTotal.XPos, ScrollTotal.YPos, ThemeX.ScrollWidth / 16.f); //ScrollWidth can be set in theme.plist but usually=16 } /** @@ -1601,7 +1601,7 @@ void REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa if (!TitleImage.isEmpty()) { INTN FilmXPos = (INTN)(EntriesPosX - (TitleImage.Image.GetWidth() + (int)(TITLEICON_SPACING * ThemeX.Scale))); INTN FilmYPos = (INTN)EntriesPosY; - bool free; + XBool free; XImage *tImage = TitleImage.GetBest(!Daylight, &free); // TitleImage.Image.Draw(FilmXPos, FilmYPos); //TODO - account night and svg @@ -1869,7 +1869,7 @@ void REFIT_MENU_SCREEN::AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum) } -void REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor) +void REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Line, XBool Cursor) { InputBootArgs->Title.takeValueFrom(Line); if (Inx == 3 || Inx == 116) { @@ -1885,13 +1885,13 @@ void REFIT_MENU_SCREEN::AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootAr AddMenuEntry(InputBootArgs, true); } -void REFIT_MENU_SCREEN::AddMenuItemInput(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor) +void REFIT_MENU_SCREEN::AddMenuItemInput(INTN Inx, CONST CHAR8 *Line, XBool Cursor) { REFIT_INPUT_DIALOG *InputBootArgs = new REFIT_INPUT_DIALOG; AddMenuItem_(InputBootArgs, Inx, Line, Cursor); } -void REFIT_MENU_SCREEN::AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Line, BOOLEAN Cursor) +void REFIT_MENU_SCREEN::AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Line, XBool Cursor) { REFIT_MENU_SWITCH *InputBootArgs = new REFIT_MENU_SWITCH; AddMenuItem_(InputBootArgs, Inx, Line, Cursor); @@ -1903,7 +1903,7 @@ EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent() EFI_STATUS Status = EFI_TIMEOUT; mAction = ActionNone; MOUSE_EVENT Event = mPointer.GetEvent(); - bool Move = false; + XBool Move = false; if (!IsDragging && Event == MouseMove) Event = NoEvents; @@ -1914,7 +1914,7 @@ EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent() else if (mPointer.MouseInRect(&DownButton) && Event == LeftClick) mAction = ActionScrollDown; else if (mPointer.MouseInRect(&Scrollbar) && Event == LeftMouseDown) { - IsDragging = TRUE; + IsDragging = true; Move = true; // mAction = ActionMoveScrollbar; ScrollbarYMovement = 0; @@ -1922,7 +1922,7 @@ EFI_STATUS REFIT_MENU_SCREEN::CheckMouseEvent() ScrollbarOldPointerPlace.YPos = ScrollbarNewPointerPlace.YPos = mPointer.GetPlace().YPos; } else if (IsDragging && Event == LeftClick) { - IsDragging = FALSE; + IsDragging = false; Move = true; // mAction = ActionMoveScrollbar; } diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h index 6b7f25ece..2121b8a62 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.h @@ -121,7 +121,7 @@ typedef void (REFIT_MENU_SCREEN::*MENU_STYLE_FUNC)(IN UINTN Function, IN CONST C class EntryArray : public XObjArray { public: - bool includeHidden = false; + XBool includeHidden = false; size_t sizeIncludingHidden() const { return XObjArray::size(); } @@ -328,20 +328,20 @@ public: EntryArray Entries = EntryArray(); INTN TimeoutSeconds = 0; - bool Daylight = true; + XBool Daylight = true; XStringW TimeoutText = XStringW(); XStringW ThemeName = XStringW(); //? EG_RECT OldTextBufferRect = EG_RECT(); XImage OldTextBufferImage = XImage(); - BOOLEAN isBootScreen = 0; - FILM *FilmC = 0; + XBool isBootScreen = false; + FILM *FilmC = 0; ACTION mAction = ActionNone; UINTN mItemID = 0; - SCROLL_STATE ScrollState = {0,0,0,0,0,0,0,0,0,0,0}; - BOOLEAN ScrollEnabled = 0; + SCROLL_STATE ScrollState = {0,0,0,0,0,0,0,0,false,false,false}; + XBool ScrollEnabled = false; INTN TextStyle = 0; - BOOLEAN IsDragging = 0; + XBool IsDragging = false; //TODO scroll positions should depends on REFIT_SCREEN? // Or it just currently calculated to be global variables? @@ -415,13 +415,13 @@ public: EFI_STATUS WaitForInputEventPoll(UINTN TimeoutDefault); //menu functions - void AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor); + void AddMenuItem_(REFIT_MENU_ENTRY_ITEM_ABSTRACT* InputBootArgs, INTN Inx, CONST CHAR8 *Title, XBool Cursor); void AddMenuInfo_f(CONST char *format, ...) __attribute__((format(printf, 2, 3))); void AddMenuInfoLine_f(CONST char *format, ...) __attribute__((format(printf, 2, 3))); - void AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, bool freeIt); - void AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor); + void AddMenuEntry(IN REFIT_ABSTRACT_MENU_ENTRY *Entry, XBool freeIt); + void AddMenuItemSwitch(INTN Inx, CONST CHAR8 *Title, XBool Cursor); void AddMenuCheck(CONST CHAR8 *Text, UINTN Bit, INTN ItemNum); - void AddMenuItemInput(INTN Inx, CONST CHAR8 *Title, BOOLEAN Cursor); + void AddMenuItemInput(INTN Inx, CONST CHAR8 *Title, XBool Cursor); void FreeMenu(); INTN FindMenuShortcutEntry(IN char32_t Shortcut); UINTN RunGenericMenu(IN OUT INTN *DefaultEntryIndex, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry); diff --git a/rEFIt_UEFI/gui/menu_items/menu_items.h b/rEFIt_UEFI/gui/menu_items/menu_items.h index 783eb29c7..cd45a3a7b 100644 --- a/rEFIt_UEFI/gui/menu_items/menu_items.h +++ b/rEFIt_UEFI/gui/menu_items/menu_items.h @@ -105,7 +105,7 @@ class REFIT_ABSTRACT_MENU_ENTRY { public: XStringW Title = XStringW(); - bool Hidden = 0; + XBool Hidden = false; UINTN Row = 0; CHAR16 ShortcutDigit = 0; char32_t ShortcutLetter = 0; @@ -372,11 +372,11 @@ class REFIT_ABSTRACT_MENU_ENTRY UINT32 NamesTable; INT32 SegVAddr; INT32 shift; - BOOLEAN PatcherInited; - BOOLEAN gSNBEAICPUFixRequire; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not - BOOLEAN gBDWEIOPCIFixRequire; // Broadwell-E IOPCIFamily fix require or not - BOOLEAN isKernelcache; - BOOLEAN is64BitKernel; + XBool PatcherInited; + XBool gSNBEAICPUFixRequire; // SandyBridge-E AppleIntelCpuPowerManagement patch require or not + XBool gBDWEIOPCIFixRequire; // Broadwell-E IOPCIFamily fix require or not + XBool isKernelcache; + XBool is64BitKernel; UINT32 KernelSlide; UINT32 KernelOffset; // notes: @@ -426,15 +426,15 @@ class REFIT_ABSTRACT_MENU_ENTRY UINT32 searchSectionByNum(UINT8 * Binary, UINT32 Num); // void KernelAndKextsPatcherStart(); // void KernelAndKextPatcherInit(); - BOOLEAN KernelUserPatch(); - BOOLEAN KernelPatchPm(); - BOOLEAN KernelLapicPatch_32(); - BOOLEAN KernelLapicPatch_64(); - BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize); + XBool KernelUserPatch(); + XBool KernelPatchPm(); + XBool KernelLapicPatch_32(); + XBool KernelLapicPatch_64(); + XBool BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize); void EFIAPI KernelBooterExtensionsPatch(); - BOOLEAN KernelPanicNoKextDump(); + XBool KernelPanicNoKextDump(); void KernelCPUIDPatch(); - BOOLEAN PatchCPUID(const UINT8* Location, INT32 LenLoc, + XBool PatchCPUID(const UINT8* Location, INT32 LenLoc, const UINT8* Search4, const UINT8* Search10, const UINT8* ReplaceModel, const UINT8* ReplaceExt, INT32 Len); void KernelPatcher_32(); @@ -452,7 +452,7 @@ class REFIT_ABSTRACT_MENU_ENTRY EFI_STATUS LoadKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT void *kext); EFI_STATUS AddKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType); - void LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN BOOLEAN Force); + void LoadPlugInKexts(const EFI_FILE *RootDir, const XString8& DirName, IN cpu_type_t archCpuType, IN XBool Force); // void AddKexts(const XStringW& SrcDir, const XStringW& Path, cpu_type_t archCpuType); void AddKextsFromDirInArray(const XString8& SrcDir, cpu_type_t archCpuType, XObjArray* kextArray); void AddKextsInArray(XObjArray* kextArray); @@ -471,12 +471,12 @@ class REFIT_ABSTRACT_MENU_ENTRY void DellSMBIOSPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize); void SNBE_AICPUPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize); void BDWE_IOPCIPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPlist, UINT32 InfoPlistSize); - BOOLEAN SandyBridgeEPM(); - BOOLEAN HaswellEXCPM(); - BOOLEAN HaswellLowEndXCPM(); - BOOLEAN BroadwellEPM(); - BOOLEAN KernelIvyBridgeXCPM(); - BOOLEAN KernelIvyE5XCPM(); + XBool SandyBridgeEPM(); + XBool HaswellEXCPM(); + XBool HaswellLowEndXCPM(); + XBool BroadwellEPM(); + XBool KernelIvyBridgeXCPM(); + XBool KernelIvyE5XCPM(); void EightApplePatch(UINT8 *Driver, UINT32 DriverSize); void Stall(int Pause) { if ( KernelAndKextPatches.KPDebug ) { gBS->Stall(Pause); } }; @@ -487,10 +487,10 @@ class REFIT_ABSTRACT_MENU_ENTRY LOADER_ENTRY* SubMenuKextInjectMgmt(); void DelegateKernelPatches(); - BOOLEAN checkOSBundleRequired(const TagDict* dict); - XStringW getKextPlist(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, BOOLEAN* NoContents); + XBool checkOSBundleRequired(const TagDict* dict); + XStringW getKextPlist(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, XBool* NoContents); TagDict* getInfoPlist(const XStringW& infoPlistPath); - XString8 getKextExecPath(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, TagDict* dict, BOOLEAN NoContents); + XString8 getKextExecPath(const XStringW& dirPath, const SIDELOAD_KEXT& KextEntry, TagDict* dict, XBool NoContents); } ; diff --git a/rEFIt_UEFI/gui/shared_with_menu.cpp b/rEFIt_UEFI/gui/shared_with_menu.cpp index 7daddd5df..cac20b21b 100644 --- a/rEFIt_UEFI/gui/shared_with_menu.cpp +++ b/rEFIt_UEFI/gui/shared_with_menu.cpp @@ -113,7 +113,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry) // Only for non-legacy entries, as LEGACY_ENTRY doesn't have OSVersion if (GlobalConfig.OptionsBits & OPT_NVWEBON) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8) ) { - gSettings.SystemParameters.NvidiaWeb = TRUE; + gSettings.SystemParameters.NvidiaWeb = true; } else { //Entry->LoadOptions = loaderEntry->LoadOptions; // Entry->LoadOptions = Split(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " "); @@ -122,7 +122,7 @@ void DecodeOptions(REFIT_MENU_ITEM_BOOTNUM *Entry) } if ((GlobalConfig.OptionsBits & OPT_NVWEBON) == 0) { if ( loaderEntry->macOSVersion >= MacOsVersion("10.12"_XS8)) { - gSettings.SystemParameters.NvidiaWeb = FALSE; + gSettings.SystemParameters.NvidiaWeb = false; } else { //Entry->LoadOptions = loaderEntry->LoadOptions; // Entry->LoadOptions = Split(loaderEntry->LoadOptions.ConcatAll(" "_XS8).wc_str(), " "); diff --git a/rEFIt_UEFI/include/Pci.h b/rEFIt_UEFI/include/Pci.h index de644771d..4b80cac87 100644 --- a/rEFIt_UEFI/include/Pci.h +++ b/rEFIt_UEFI/include/Pci.h @@ -9,6 +9,7 @@ #define INCLUDE_PCI_H_ #include +#include "../cpp_foundation/XBool.h" /* PCI */ #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ @@ -35,19 +36,19 @@ typedef struct { } pci_addr_t; typedef union { + uint32_t addr = 0; pci_addr_t bits; - uint32_t addr; } pci_dev_t; typedef struct pci_dt_t { // EFI_PCI_IO_PROTOCOL *PciIo; // PCI_TYPE00 Pci; - EFI_HANDLE DeviceHandle; - UINT8* regs; - pci_dev_t dev; + EFI_HANDLE DeviceHandle = NULL; + UINT8* regs = NULL; + pci_dev_t dev = pci_dev_t(); - UINT16 vendor_id; - UINT16 device_id; + UINT16 vendor_id = 0; + UINT16 device_id = 0; union { struct { @@ -55,15 +56,15 @@ typedef struct pci_dt_t { UINT16 device_id; } subsys; UINT32 subsys_id; - } subsys_id; - UINT8 revision; - UINT8 subclass; - UINT16 class_id; + } subsys_id_union = { {0, 0} }; + UINT8 revision = 0; + UINT8 subclass = 0; + UINT16 class_id = 0; - struct pci_dt_t *parent; - struct pci_dt_t *children; - struct pci_dt_t *next; - BOOLEAN used; + struct pci_dt_t *parent = NULL; + struct pci_dt_t *children = NULL; + struct pci_dt_t *next = NULL; + XBool used = false; } pci_dt_t; diff --git a/rEFIt_UEFI/libeg/BmLib.cpp b/rEFIt_UEFI/libeg/BmLib.cpp index e0f4b4f90..54fa42849 100644 --- a/rEFIt_UEFI/libeg/BmLib.cpp +++ b/rEFIt_UEFI/libeg/BmLib.cpp @@ -147,8 +147,8 @@ StriCmp ( return *SecondS; //if all chars equal then compare sizes, last char in SecondS will be 0 } -// If Null-terminated strings are case insensitive equal or its sSize symbols are equal then TRUE -BOOLEAN +// If Null-terminated strings are case insensitive equal or its sSize symbols are equal then true +XBool AsciiStriNCmp( IN CONST CHAR8 *FirstS, IN CONST CHAR8 *SecondS, @@ -158,16 +158,16 @@ AsciiStriNCmp( INTN i = sSize; while ( i && (*FirstS != '\0') ) { if ( (((*FirstS >= 'a') && (*FirstS <= 'z')) ? (*FirstS - ('a' - 'A')) : *FirstS ) != - (((*SecondS >= 'a') && (*SecondS <= 'z')) ? (*SecondS - ('a' - 'A')) : *SecondS ) ) return FALSE; + (((*SecondS >= 'a') && (*SecondS <= 'z')) ? (*SecondS - ('a' - 'A')) : *SecondS ) ) return false; FirstS++; SecondS++; i--; } - return TRUE; + return true; } // Case insensitive search of WhatString in WhereString -BOOLEAN +XBool AsciiStrStriN ( IN CONST CHAR8 *WhatString, IN CONST UINTN sWhatSize, @@ -176,8 +176,8 @@ AsciiStrStriN ( ) { INTN i = sWhereSize; - BOOLEAN Found = FALSE; - if (sWhatSize > sWhereSize) return FALSE; + XBool Found = false; + if (sWhatSize > sWhereSize) return false; for (; i && !Found; i--) { Found = AsciiStriNCmp(WhatString, WhereString, sWhatSize); WhereString++; @@ -306,31 +306,31 @@ EfiReallocatePool ( @param FirstTime - A pointer to the first EFI_TIME data. @param SecondTime - A pointer to the second EFI_TIME data. - @retval TRUE The FirstTime is not later than the SecondTime. - @retval FALSE The FirstTime is later than the SecondTime. + @retval true The FirstTime is not later than the SecondTime. + @retval false The FirstTime is later than the SecondTime. **/ -BOOLEAN +XBool TimeCompare ( IN EFI_TIME *FirstTime, IN EFI_TIME *SecondTime ) { if (FirstTime->Year != SecondTime->Year) { - return (BOOLEAN) (FirstTime->Year < SecondTime->Year); + return (FirstTime->Year < SecondTime->Year); } else if (FirstTime->Month != SecondTime->Month) { - return (BOOLEAN) (FirstTime->Month < SecondTime->Month); + return (FirstTime->Month < SecondTime->Month); } else if (FirstTime->Day != SecondTime->Day) { - return (BOOLEAN) (FirstTime->Day < SecondTime->Day); + return (FirstTime->Day < SecondTime->Day); } else if (FirstTime->Hour != SecondTime->Hour) { - return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour); + return (FirstTime->Hour < SecondTime->Hour); } else if (FirstTime->Minute != SecondTime->Minute) { - return (BOOLEAN) (FirstTime->Minute < SecondTime->Minute); + return (FirstTime->Minute < SecondTime->Minute); } else if (FirstTime->Second != SecondTime->Second) { - return (BOOLEAN) (FirstTime->Second < SecondTime->Second); + return (FirstTime->Second < SecondTime->Second); } - return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond); + return (FirstTime->Nanosecond <= SecondTime->Nanosecond); } /* diff --git a/rEFIt_UEFI/libeg/BmLib.h b/rEFIt_UEFI/libeg/BmLib.h index 7db278b36..6839c2313 100644 --- a/rEFIt_UEFI/libeg/BmLib.h +++ b/rEFIt_UEFI/libeg/BmLib.h @@ -75,8 +75,8 @@ StriCmp ( IN CONST CHAR16 *SecondS ); -// If Null-terminated strings are case insensitive equal or its sSize symbols are equal then TRUE -BOOLEAN +// If Null-terminated strings are case insensitive equal or its sSize symbols are equal then true +XBool AsciiStriNCmp( IN CONST CHAR8 *FirstS, IN CONST CHAR8 *SecondS, @@ -84,7 +84,7 @@ AsciiStriNCmp( ); // Case insensitive search of WhatString in WhereString -BOOLEAN +XBool AsciiStrStriN ( IN CONST CHAR8 *WhatString, IN CONST UINTN sWhatSize, @@ -155,11 +155,11 @@ EfiReallocatePool ( @param FirstTime - A pointer to the first EFI_TIME data. @param SecondTime - A pointer to the second EFI_TIME data. - @retval TRUE The FirstTime is not later than the SecondTime. - @retval FALSE The FirstTime is later than the SecondTime. + @retval true The FirstTime is not later than the SecondTime. + @retval false The FirstTime is later than the SecondTime. **/ -BOOLEAN +XBool TimeCompare ( IN EFI_TIME *FirstTime, IN EFI_TIME *SecondTime diff --git a/rEFIt_UEFI/libeg/EfiFileLib.h b/rEFIt_UEFI/libeg/EfiFileLib.h index 141eb00b6..cc2918077 100644 --- a/rEFIt_UEFI/libeg/EfiFileLib.h +++ b/rEFIt_UEFI/libeg/EfiFileLib.h @@ -105,8 +105,8 @@ typedef struct { EFI_LOAD_FILE_PROTOCOL *LoadFile; // Information valid for l#: EFI_IP_ADDRESS ServerIp; // Information valid for t: - BOOLEAN IsDirty; - BOOLEAN IsBufferValid; + XBool IsDirty; + XBool IsBufferValid; } EFI_OPEN_FILE; diff --git a/rEFIt_UEFI/libeg/FloatLib.cpp b/rEFIt_UEFI/libeg/FloatLib.cpp index 537315c32..ce381f16e 100644 --- a/rEFIt_UEFI/libeg/FloatLib.cpp +++ b/rEFIt_UEFI/libeg/FloatLib.cpp @@ -391,7 +391,7 @@ int dither(float x, int level) } //there is #if 0 -BOOLEAN +XBool EFIAPI AsmRdRand16 ( OUT UINT16 *Rand diff --git a/rEFIt_UEFI/libeg/VectorGraphics.cpp b/rEFIt_UEFI/libeg/VectorGraphics.cpp index 49affbdd8..91f08fb19 100755 --- a/rEFIt_UEFI/libeg/VectorGraphics.cpp +++ b/rEFIt_UEFI/libeg/VectorGraphics.cpp @@ -87,7 +87,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage* if ((Id == BUILTIN_SELECTION_BIG) || (Id == BUILTIN_ICON_BACKGROUND) || (Id == BUILTIN_ICON_BANNER)) { - shape->debug = TRUE; + shape->debug = true; } */ // if (BootCampStyle && (strstr(IconName, "selection_big") != NULL)) { // shape->opacity = 0.f; @@ -196,7 +196,7 @@ EFI_STATUS XTheme::ParseSVGXIcon(INTN Id, const XString8& IconNameX, OUT XImage* // DBG("icon %s width=%f height=%f\n", IconNameX.c_str(), Width, Height); int iWidth = (int)(Width + 0.5f); int iHeight = (int)(Height + 0.5f); -// EG_IMAGE *NewImage = egCreateFilledImage(iWidth, iHeight, TRUE, &MenuBackgroundPixel); +// EG_IMAGE *NewImage = egCreateFilledImage(iWidth, iHeight, true, &MenuBackgroundPixel); XImage NewImage(iWidth, iHeight); //empty if (IconImage->shapes == NULL) { *Image = NewImage; @@ -422,7 +422,7 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer) // nsvgDeleteRasterizer(rast); - TypeSVG = TRUE; + TypeSVG = true; ThemeDesignHeight = (int)SVGimage->height; ThemeDesignWidth = (int)SVGimage->width; if (SelectionOnTop) { @@ -510,7 +510,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType Scale = sy; x = (float)posX; //0.f; y = (float)posY + fontSVG->bbox[1] * Scale; - p->isText = TRUE; + p->isText = true; size_t len = string.length(); for (size_t i=0; i < len; i++) { CHAR16 letter = string.char16At(i); @@ -579,7 +579,7 @@ void testSVG() NSVGparser* p; #if TEST_DITHER { - EG_IMAGE *RndImage = egCreateImage(256, 256, FALSE); + EG_IMAGE *RndImage = egCreateImage(256, 256, false); INTN i,j; EG_PIXEL pixel = WhitePixel; for (i=0; i<256; i++) { diff --git a/rEFIt_UEFI/libeg/XCinema.cpp b/rEFIt_UEFI/libeg/XCinema.cpp index 7d395b6ba..a78c647d1 100644 --- a/rEFIt_UEFI/libeg/XCinema.cpp +++ b/rEFIt_UEFI/libeg/XCinema.cpp @@ -58,7 +58,7 @@ const XImage& FILM::GetImage(INTN Index) const return NullImage; } -const XImage& FILM::GetImage(bool *free) const +const XImage& FILM::GetImage(XBool *free) const { /* * for SVG anime we have to generate new XImage using CurrentFrame as an argument diff --git a/rEFIt_UEFI/libeg/XCinema.h b/rEFIt_UEFI/libeg/XCinema.h index b6731c222..ec28d4906 100644 --- a/rEFIt_UEFI/libeg/XCinema.h +++ b/rEFIt_UEFI/libeg/XCinema.h @@ -26,7 +26,7 @@ protected: INTN Id; //ScreenID, enumeration value but keep it to be int for extensibility public: //I see no reason to make they protected - BOOLEAN RunOnce; + XBool RunOnce; INTN NumFrames; //set by user in Theme.plist or in Theme.svg INTN FrameTime; //usually 50, 100, 200 ms INTN FilmX, FilmY; //relative @@ -34,7 +34,7 @@ public: INTN ScreenEdgeVertical; INTN NudgeX, NudgeY; XStringW Path; //user defined name for folder and files Path/Path_002.png etc - BOOLEAN AnimeRun; + XBool AnimeRun; UINT64 LastDraw; protected: @@ -46,11 +46,11 @@ public: EG_RECT FilmPlace; // Screen has several Films each in own place public: - FILM() : Id(0), RunOnce(0), NumFrames(0), FrameTime(0), FilmX(0), FilmY(0), ScreenEdgeHorizontal(0), ScreenEdgeVertical(0), - NudgeX(0), NudgeY(0), Path(), AnimeRun(0), LastDraw(0), Frames(), LastIndex(0), CurrentFrame(0), FilmPlace() + FILM() : Id(0), RunOnce(false), NumFrames(0), FrameTime(0), FilmX(0), FilmY(0), ScreenEdgeHorizontal(0), ScreenEdgeVertical(0), + NudgeX(0), NudgeY(0), Path(), AnimeRun(false), LastDraw(0), Frames(), LastIndex(0), CurrentFrame(0), FilmPlace() {} - FILM(INTN Id) : Id(Id), RunOnce(0), NumFrames(0), FrameTime(0), FilmX(0), FilmY(0), ScreenEdgeHorizontal(0), ScreenEdgeVertical(0), - NudgeX(0), NudgeY(0), Path(), AnimeRun(0), LastDraw(0), Frames(), LastIndex(0), CurrentFrame(0), FilmPlace() + FILM(INTN Id) : Id(Id), RunOnce(false), NumFrames(0), FrameTime(0), FilmX(0), FilmY(0), ScreenEdgeHorizontal(0), ScreenEdgeVertical(0), + NudgeX(0), NudgeY(0), Path(), AnimeRun(false), LastDraw(0), Frames(), LastIndex(0), CurrentFrame(0), FilmPlace() {} ~FILM() {} @@ -58,11 +58,11 @@ public: void SetIndex(INTN Index) { Id = Index; } const XImage& GetImage(INTN Index) const; - const XImage& GetImage(bool *free = nullptr) const; + const XImage& GetImage(XBool *free = nullptr) const; void AddFrame(XImage* Frame, INTN Index); //IndexedImage will be created size_t Size() { return Frames.size(); } INTN LastFrameID() { return LastIndex; } - bool Finished() { return CurrentFrame == 0; } + XBool Finished() { return CurrentFrame == 0; } void GetFrames(XTheme& TheTheme/*, const XStringW& Path*/); //read image sequence from Theme/Path/ void SetPlace(const EG_RECT& Rect) { FilmPlace = Rect; } void Advance() { ++CurrentFrame %= (LastIndex + 1); } diff --git a/rEFIt_UEFI/libeg/XIcon.cpp b/rEFIt_UEFI/libeg/XIcon.cpp index 3b62dd778..e50e84c3f 100644 --- a/rEFIt_UEFI/libeg/XIcon.cpp +++ b/rEFIt_UEFI/libeg/XIcon.cpp @@ -105,8 +105,8 @@ XIcon::~XIcon() // memory leak : we can't free (yet?) ImageSVG and ImageSVGnight because operator might have copied it } -XIcon::XIcon(INTN Index, bool TakeEmbedded) : Id(Index), Name(), Image(), ImageNight(), Native(false), - ImageSVG(nullptr), ImageSVGnight(nullptr), Empty(0) +XIcon::XIcon(INTN Index, XBool TakeEmbedded) : Id(Index), Name(), Image(), ImageNight(), Native(false), + ImageSVG(nullptr), ImageSVGnight(nullptr), Empty(false) { // Id = Index; // Name.setEmpty(); @@ -248,7 +248,7 @@ EFI_STATUS XIcon::LoadXImage(const EFI_FILE *BaseDir, const XStringW& IconName) return Status; } -XImage* XIcon::GetBest(bool night, bool *free) +XImage* XIcon::GetBest(XBool night, XBool *free) { #if 1 if (ImageSVG) { diff --git a/rEFIt_UEFI/libeg/XIcon.h b/rEFIt_UEFI/libeg/XIcon.h index dfcaebc7d..e01c90f49 100644 --- a/rEFIt_UEFI/libeg/XIcon.h +++ b/rEFIt_UEFI/libeg/XIcon.h @@ -16,20 +16,20 @@ public: XString8 Name; //for example "os_moja", "vol_internal" XImage Image; XImage ImageNight; - bool Native; + XBool Native; void *ImageSVG; //NSVGimage* void *ImageSVGnight; protected: - bool Empty; + XBool Empty; public: XIcon(): Id(0), Name(), Image(), ImageNight(), Native(false), ImageSVG(nullptr), ImageSVGnight(nullptr), Empty(true) {}; - XIcon(INTN Id, bool Embedded = false); + XIcon(INTN Id, XBool Embedded = false); // Initialisation of ImageSVG(other.ImageSVG), ImageSVGnight(other.ImageSVGnight) is wrong because we just copy the pointer XIcon(const XIcon& other) : Id(other.Id), Name(other.Name), Image(other.Image), ImageNight(other.ImageNight), Native(other.Native), ImageSVG(other.ImageSVG), ImageSVGnight(other.ImageSVGnight), Empty(other.Empty) {} ; ~XIcon(); - bool isEmpty() const { return Empty; } + XBool isEmpty() const { return Empty; } void setFilled() { Empty = false; } void setEmpty() { Empty = true; } @@ -41,7 +41,7 @@ public: // Default are not valid, as usual. We delete them. If needed, proper ones can be created // Icon(const Icon&) = delete; XIcon& operator=(const XIcon&); // = delete; - XImage* GetBest(bool night, bool *free = nullptr); + XImage* GetBest(XBool night, XBool *free = nullptr); }; diff --git a/rEFIt_UEFI/libeg/XImage.cpp b/rEFIt_UEFI/libeg/XImage.cpp index 45a210751..b84b14649 100644 --- a/rEFIt_UEFI/libeg/XImage.cpp +++ b/rEFIt_UEFI/libeg/XImage.cpp @@ -268,7 +268,7 @@ void XImage::CopyRect(const XImage& Image, const EG_RECT& OwnPlace, const EG_REC } } -void XImage::Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest, float topScale) +void XImage::Compose(INTN PosX, INTN PosY, const XImage& TopImage, XBool Lowest, float topScale) { EG_RECT OutPlace; OutPlace.XPos = PosX; @@ -285,13 +285,13 @@ void XImage::Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest, } // TopScale is for scaling TopImage. = 0.f means no scale or = 1.f // InPlace is a place in TopImage before scaling -void XImage::Compose(const EG_RECT& OutPlace, const EG_RECT& InPlace, const XImage& TopImage, bool Lowest, float TopScale) +void XImage::Compose(const EG_RECT& OutPlace, const EG_RECT& InPlace, const XImage& TopImage, XBool Lowest, float TopScale) { INTN PosX = InPlace.XPos; INTN PosY = InPlace.YPos; INTN WArea = InPlace.Width; INTN HArea = InPlace.Height; - bool gray = false; + XBool gray = false; if (TopScale < 0) { gray = true; TopScale = -TopScale; @@ -365,7 +365,7 @@ void XImage::Compose(const EG_RECT& OutPlace, const EG_RECT& InPlace, const XIma * But pixels will be moved anyway so it's impossible without double copy * */ -//void XImage::ComposeOnBack(INTN PosX, INTN PosY, const XImage& BackImage, bool Lowest) +//void XImage::ComposeOnBack(INTN PosX, INTN PosY, const XImage& BackImage, XBool Lowest) void XImage::FlipRB() @@ -580,7 +580,7 @@ void XImage::Draw(INTN x, INTN y, float scale) Draw(x, y, scale, true); } -void XImage::Draw(INTN x, INTN y, float scale, bool Opaque) +void XImage::Draw(INTN x, INTN y, float scale, XBool Opaque) { //prepare images if (isEmpty()) { @@ -749,7 +749,7 @@ EFI_STATUS XImage::LoadIcns(const EFI_FILE* BaseDir, IN CONST CHAR16 *FileName, } // decode it -// NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, TRUE); +// NewImage = egDecodeICNS(FileData, FileDataLength, PixelSize, true); // Status = FromEGImage(NewImage); Status = FromICNS(FileData, FileDataLength, PixelSize); FreePool(FileData); diff --git a/rEFIt_UEFI/libeg/XImage.h b/rEFIt_UEFI/libeg/XImage.h index 01f6fc37d..2e1d19be3 100644 --- a/rEFIt_UEFI/libeg/XImage.h +++ b/rEFIt_UEFI/libeg/XImage.h @@ -72,7 +72,7 @@ public: void setZero() { SetMem( (void*)GetPixelPtr(0, 0), GetSizeInBytes(), 0); } void setEmpty() { Width=0; Height=0; PixelData.setEmpty(); } - bool isEmpty() const { return PixelData.size() == 0; } + XBool isEmpty() const { return PixelData.size() == 0; } void Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color = { 0, 0, 0, 0 }); @@ -84,8 +84,8 @@ public: void CopyScaled(const XImage& Image, float scale = 0.f); void CopyRect(const XImage& Image, INTN X, INTN Y); void CopyRect(const XImage& Image, const EG_RECT& OwnPlace, const EG_RECT& InputRect); - void Compose(const EG_RECT& OwnPlace, const EG_RECT& InputRect, const XImage& TopImage, bool Lowest, float TopScale = 0.f); - void Compose(INTN PosX, INTN PosY, const XImage& TopImage, bool Lowest, float topScale = 0); //instead of compose we often can Back.Draw(...) + Top.Draw(...) + void Compose(const EG_RECT& OwnPlace, const EG_RECT& InputRect, const XImage& TopImage, XBool Lowest, float TopScale = 0.f); + void Compose(INTN PosX, INTN PosY, const XImage& TopImage, XBool Lowest, float topScale = 0); //instead of compose we often can Back.Draw(...) + Top.Draw(...) void FlipRB(); EFI_STATUS FromPNG(const UINT8 * Data, UINTN Lenght); EFI_STATUS ToPNG(UINT8** Data, UINTN& OutSize); @@ -94,7 +94,7 @@ public: void GetArea(const EG_RECT& Rect); void GetArea(INTN x, INTN y, UINTN W, UINTN H); - void Draw(INTN x, INTN y, float scale, bool Opaque); + void Draw(INTN x, INTN y, float scale, XBool Opaque); void Draw(INTN x, INTN y, float scale); //can accept 0 scale as 1.f void Draw(INTN x, INTN y); void DrawWithoutCompose(INTN x, INTN y, UINTN width = 0, UINTN height = 0); diff --git a/rEFIt_UEFI/libeg/XPointer.cpp b/rEFIt_UEFI/libeg/XPointer.cpp index 5f1a6ac39..7adcf5900 100644 --- a/rEFIt_UEFI/libeg/XPointer.cpp +++ b/rEFIt_UEFI/libeg/XPointer.cpp @@ -33,7 +33,7 @@ void XPointer::Hide() } } -bool XPointer::isAlive() +XBool XPointer::isAlive() { return Alive; } @@ -68,7 +68,7 @@ EFI_STATUS XPointer::MouseBirth() } MouseEvent = NoEvents; SimplePointerProtocol = NULL; - gSettings.GUI.Mouse.PointerEnabled = FALSE; + gSettings.GUI.Mouse.PointerEnabled = false; return Status; } @@ -124,7 +124,7 @@ void XPointer::KillMouse() SimplePointerProtocol = NULL; } -void XPointer::UpdatePointer(bool isDaylight) // cannot be called daylight because of a global var on macOS +void XPointer::UpdatePointer(XBool isDaylight) // cannot be called daylight because of a global var on macOS { UINT64 Now; EFI_STATUS Status; @@ -193,7 +193,7 @@ MOUSE_EVENT XPointer::GetEvent() return MouseEvent; } -bool XPointer::MouseInRect(EG_RECT *Place) +XBool XPointer::MouseInRect(EG_RECT *Place) { return ((newPlace.XPos >= Place->XPos) && (newPlace.XPos < (Place->XPos + (INTN)Place->Width)) && diff --git a/rEFIt_UEFI/libeg/XPointer.h b/rEFIt_UEFI/libeg/XPointer.h index 14bbe17fd..6e6082057 100644 --- a/rEFIt_UEFI/libeg/XPointer.h +++ b/rEFIt_UEFI/libeg/XPointer.h @@ -22,8 +22,8 @@ protected: UINT64 LastClickTime; //not EFI_TIME EFI_SIMPLE_POINTER_STATE State; MOUSE_EVENT MouseEvent; - bool Alive; - bool night; + XBool Alive; + XBool night; public: XPointer() : SimplePointerProtocol(NULL), PointerImage(NULL), @@ -39,13 +39,13 @@ public: void Hide(); - bool isAlive(); + XBool isAlive(); EFI_STATUS MouseBirth(); void KillMouse(); - void UpdatePointer(bool daylight); - bool MouseInRect(EG_RECT *Place); + void UpdatePointer(XBool daylight); + XBool MouseInRect(EG_RECT *Place); - bool isEmpty() const { return PointerImage->isEmpty(); } + XBool isEmpty() const { return PointerImage->isEmpty(); } void ClearEvent() { MouseEvent = NoEvents; } MOUSE_EVENT GetEvent(); EG_RECT& GetPlace() { return newPlace; } diff --git a/rEFIt_UEFI/libeg/XTheme.cpp b/rEFIt_UEFI/libeg/XTheme.cpp index 4509b422c..c4ac98612 100644 --- a/rEFIt_UEFI/libeg/XTheme.cpp +++ b/rEFIt_UEFI/libeg/XTheme.cpp @@ -56,7 +56,7 @@ InitTheme(const CHAR8* ChosenTheme) if (NowHour >= 24 ) NowHour -= 24; ThemeX.Daylight = (NowHour > 8) && (NowHour < 20); } else { - ThemeX.Daylight = TRUE; // when timezone is not set + ThemeX.Daylight = true; // when timezone is not set } if (ThemeX.Daylight) { DBG("use Daylight theme\n"); @@ -66,7 +66,7 @@ InitTheme(const CHAR8* ChosenTheme) for (i = 0; i < 3; i++) { // DBG("validate %d face\n", i); - textFace[i].valid = FALSE; + textFace[i].valid = false; } NSVGfontChain *fontChain = fontsDB; @@ -175,9 +175,9 @@ finish: if (!ThemeDict) { // No theme could be loaded, use embedded DBG(" using embedded theme\n"); if (ThemeX.DarkEmbedded) { // when using embedded, set Daylight according to darkembedded - ThemeX.Daylight = FALSE; + ThemeX.Daylight = false; } else { - ThemeX.Daylight = TRUE; + ThemeX.Daylight = true; } ThemeX.FillByEmbedded(); @@ -246,13 +246,13 @@ finish: //xtheme class XTheme::XTheme() : Icons(), ThemeDir(0), HideBadges(0), HideUIFlags(0), Font(FONT_ALFA), CharWidth(0), SelectionColor(0), FontFileName(), Theme(), BannerFileName(), SelectionSmallFileName(), SelectionBigFileName(), SelectionIndicatorName(), DefaultSelection(), - BackgroundName(), BackgroundScale(imNone), BackgroundSharp(0), BackgroundDark(0), SelectionOnTop(0), BootCampStyle(0), + BackgroundName(), BackgroundScale(imNone), BackgroundSharp(0), BackgroundDark(false), SelectionOnTop(false), BootCampStyle(false), BadgeOffsetX(0), BadgeOffsetY(0), BadgeScale(0), ThemeDesignWidth(0), ThemeDesignHeight(0), BannerPosX(0), BannerPosY(0), - BannerEdgeHorizontal(0), BannerEdgeVertical(0), BannerNudgeX(0), BannerNudgeY(0), VerticalLayout(0), NonSelectedGrey(0), - MainEntriesSize(0), TileXSpace(0), TileYSpace(0), Proportional(0), embedded(0), DarkEmbedded(0), TypeSVG(0), Scale(0), CentreShift(0), + BannerEdgeHorizontal(0), BannerEdgeVertical(0), BannerNudgeX(0), BannerNudgeY(0), VerticalLayout(false), NonSelectedGrey(false), + MainEntriesSize(0), TileXSpace(0), TileYSpace(0), Proportional(false), embedded(false), DarkEmbedded(false), TypeSVG(false), Scale(0), CentreShift(0), row0TileSize(0), row1TileSize(0), BanHeight(0), LayoutHeight(0), LayoutBannerOffset(0), LayoutButtonOffset(0), LayoutTextOffset(0), LayoutAnimMoveForMenuX(0), ScrollWidth(0), ScrollButtonsHeight(0), ScrollBarDecorationsHeight(0), ScrollScrollDecorationsHeight(0), - FontWidth(0), FontHeight(0), TextHeight(0), Daylight(0), Background(), BigBack(), Banner(), SelectionImages(), Buttons(), ScrollbarBackgroundImage(), BarStartImage(), BarEndImage(), + FontWidth(0), FontHeight(0), TextHeight(0), Daylight(false), Background(), BigBack(), Banner(), SelectionImages(), Buttons(), ScrollbarBackgroundImage(), BarStartImage(), BarEndImage(), ScrollbarImage(), ScrollStartImage(), ScrollEndImage(), UpButtonImage(), DownButtonImage(), FontImage(), BannerPlace(), Cinema(), SVGParser(0) { Init(); @@ -267,7 +267,7 @@ void XTheme::Init() // DisableFlags = 0; HideBadges = 0; HideUIFlags = 0; -// TextOnly = FALSE; +// TextOnly = false; Font = FONT_GRAY; // FONT_TYPE CharWidth = 9; SelectionColor = 0x80808080; @@ -285,10 +285,10 @@ void XTheme::Init() BackgroundName.setEmpty(); BackgroundScale = imNone; // SCALING BackgroundSharp = 0; - BackgroundDark = FALSE; //TODO should be set to true if Night theme -// CustomIcons = FALSE; //TODO don't know how to handle with SVG theme - SelectionOnTop = FALSE; - BootCampStyle = FALSE; + BackgroundDark = false; //TODO should be set to true if Night theme +// CustomIcons = false; //TODO don't know how to handle with SVG theme + SelectionOnTop = false; + BootCampStyle = false; BadgeOffsetX = 0xFFFF; //default offset BadgeOffsetY = 0xFFFF; BadgeScale = 4; // TODO now we have float scale = BadgeScale/16 @@ -301,16 +301,16 @@ void XTheme::Init() BannerNudgeX = 0; BannerNudgeY = 0; BanHeight = 0; - VerticalLayout = FALSE; - NonSelectedGrey = FALSE; + VerticalLayout = false; + NonSelectedGrey = false; MainEntriesSize = 128; TileXSpace = 8; TileYSpace = 24; - Proportional = FALSE; -// ShowOptimus = FALSE; -// DarkEmbedded = FALSE; //looks like redundant, we always check Night or Daylight - TypeSVG = FALSE; + Proportional = false; +// ShowOptimus = false; +// DarkEmbedded = false; //looks like redundant, we always check Night or Daylight + TypeSVG = false; // Codepage = 0xC0; //this is for PNG theme // CodepageSize = 0xC0; // INTN CodepageSize; //extended latin Scale = 1.0f; @@ -807,7 +807,7 @@ XIcon* XTheme::GetIconP(const XString8& Name) return &NullIcon; //if name is not found } -bool XTheme::CheckNative(INTN Id) +XBool XTheme::CheckNative(INTN Id) { for (size_t i = 0; i < Icons.size(); i++) { diff --git a/rEFIt_UEFI/libeg/XTheme.h b/rEFIt_UEFI/libeg/XTheme.h index 902403a81..9f7206621 100644 --- a/rEFIt_UEFI/libeg/XTheme.h +++ b/rEFIt_UEFI/libeg/XTheme.h @@ -48,7 +48,7 @@ public: const EFI_FILE& getThemeDir() { return *ThemeDir; } - bool IsEmbeddedTheme(void) + XBool IsEmbeddedTheme(void) { if (embedded) { ThemeDir = NULL; @@ -61,7 +61,7 @@ public: // UINTN DisableFlags; UINTN HideBadges; UINTN HideUIFlags; -// BOOLEAN TextOnly; +// XBool TextOnly; FONT_TYPE Font; INTN CharWidth; UINTN SelectionColor; @@ -75,10 +75,10 @@ public: XStringW BackgroundName; SCALING BackgroundScale; INTN BackgroundSharp; - BOOLEAN BackgroundDark; -// BOOLEAN CustomIcons; - BOOLEAN SelectionOnTop; - BOOLEAN BootCampStyle; + XBool BackgroundDark; +// XBool CustomIcons; + XBool SelectionOnTop; + XBool BootCampStyle; INTN BadgeOffsetX; INTN BadgeOffsetY; INTN BadgeScale; @@ -90,17 +90,17 @@ public: INTN BannerEdgeVertical; INTN BannerNudgeX; INTN BannerNudgeY; - BOOLEAN VerticalLayout; - BOOLEAN NonSelectedGrey; + XBool VerticalLayout; + XBool NonSelectedGrey; INTN MainEntriesSize; INTN TileXSpace; INTN TileYSpace; // INTN IconFormat; - BOOLEAN Proportional; -// BOOLEAN ShowOptimus; - BOOLEAN embedded; - BOOLEAN DarkEmbedded; - BOOLEAN TypeSVG; + XBool Proportional; +// XBool ShowOptimus; + XBool embedded; + XBool DarkEmbedded; + XBool TypeSVG; // INTN Codepage; //no! it is global settings // INTN CodepageSize; float Scale; @@ -123,7 +123,7 @@ public: INTN FontHeight; INTN TextHeight; - BOOLEAN Daylight; + XBool Daylight; XImage Background; //Background and Banner will not be in array as they live own life XImage BigBack; //it size is not equal to screen size will be scaled or cropped @@ -165,10 +165,10 @@ public: XIcon& GetIconAlt(INTN Id, INTN Alt); //if id not found const XIcon& LoadOSIcon(const CHAR16* OSIconName); //TODO make XString provider const XIcon& LoadOSIcon(const XString8& Full); - bool CheckNative(INTN Id); + XBool CheckNative(INTN Id); //fonts - void LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols); + void LoadFontImage(IN XBool UseEmbedded, IN INTN Rows, IN INTN Cols); void PrepareFont(); INTN GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel, INTN MaxWidth, INTN Start, INTN Step); INTN RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr, diff --git a/rEFIt_UEFI/libeg/image.cpp b/rEFIt_UEFI/libeg/image.cpp index d5a36b496..9f6846400 100644 --- a/rEFIt_UEFI/libeg/image.cpp +++ b/rEFIt_UEFI/libeg/image.cpp @@ -152,7 +152,7 @@ EFI_STATUS egSaveFile(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *FileNam EFI_STATUS Status; EFI_FILE* FileHandle; UINTN BufferSize; - BOOLEAN CreateNew = TRUE; + XBool CreateNew = true; CONST CHAR16 *p = FileName + StrLen(FileName); CHAR16 DirName[256]; UINTN dirNameLen; @@ -194,7 +194,7 @@ EFI_STATUS egSaveFile(const EFI_FILE* BaseDir OPTIONAL, IN CONST CHAR16 *FileNam Status = FileHandle->Delete(FileHandle); if (Status == EFI_WARN_DELETE_FAILURE) { //This is READ_ONLY file system - CreateNew = FALSE; // will write into existing file (Slice - ???) + CreateNew = false; // will write into existing file (Slice - ???) // DBG("RO FS %s\n", efiStrError(Status)); } } diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index b96b0a822..d4d3b325d 100755 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -39,6 +39,7 @@ //#include +#include "../cpp_foundation/XBool.h" #include "../cpp_foundation/XString.h" #include "../cpp_foundation/XStringArray.h" #include "../cpp_foundation/XBuffer.h" @@ -99,7 +100,7 @@ typedef struct { INTN CurrentSelection, LastSelection; INTN MaxScroll, MaxIndex; INTN FirstVisible, LastVisible, MaxVisible, MaxFirstVisible; - BOOLEAN IsScrolling, PaintAll, PaintSelection; + XBool IsScrolling, PaintAll, PaintSelection; } SCROLL_STATE; typedef enum { @@ -115,14 +116,14 @@ typedef enum { class INPUT_ITEM { public: ITEM_TYPE ItemType = BoolValue; //string, value, boolean - BOOLEAN Valid = 0; - UINT8 BValue = 0; // was BOOLEAN, but value 2 is sometimes assigned. + XBool Valid = false; + UINT8 BValue = 0; // was XBool, but value 2 is sometimes assigned. //UINT8 Pad8; UINT32 IValue = 0; XStringW SValue = XStringW(); UINTN LineShift = 0; - bool operator == (const INPUT_ITEM& other) const + XBool operator == (const INPUT_ITEM& other) const { if ( !(ItemType == other.ItemType ) ) return false; if ( !(Valid == other.Valid ) ) return false; @@ -132,14 +133,14 @@ public: if ( !(LineShift == other.LineShift ) ) return false; return true; } - bool operator != (const INPUT_ITEM& other) const { return !(*this == other); } + XBool operator != (const INPUT_ITEM& other) const { return !(*this == other); } }; typedef struct { - EFI_STATUS LastStatus; - const EFI_FILE *DirHandle; - BOOLEAN CloseDirHandle; - EFI_FILE_INFO *LastFileInfo; + EFI_STATUS LastStatus = 0; + const EFI_FILE *DirHandle = NULL; + XBool CloseDirHandle = false; + EFI_FILE_INFO *LastFileInfo = NULL; } REFIT_DIR_ITER; typedef struct { @@ -197,8 +198,8 @@ public: EG_RECT(INTN x, INTN y, INTN w, INTN h) : XPos(x), YPos(y), Width(w), Height(h) { } EG_RECT(const EG_RECT& other) : XPos(other.XPos), YPos(other.YPos), Width(other.Width), Height(other.Height) { } const EG_RECT& operator = (const EG_RECT& other) { XPos = other.XPos; YPos = other.YPos; Width = other.Width; Height = other.Height; return *this; } - bool operator == (const EG_RECT& other) { return XPos == other.XPos && YPos == other.YPos && Width == other.Width && Height == other.Height; } - bool operator != (const EG_RECT& other) { return !(*this == other); } + XBool operator == (const EG_RECT& other) { return XPos == other.XPos && YPos == other.YPos && Width == other.Width && Height == other.Height; } + XBool operator != (const EG_RECT& other) { return !(*this == other); } }; #else typedef struct EG_RECT { @@ -226,7 +227,7 @@ typedef struct EG_RECT { /* functions */ -void egInitScreen(IN BOOLEAN SetMaxResolution); +void egInitScreen(IN XBool SetMaxResolution); void egDumpGOPVideoModes(void); //EFI_STATUS egSetScreenResolution(IN CHAR16 *WidthHeight); //EFI_STATUS egSetMaxResolution(void); @@ -234,11 +235,11 @@ EFI_STATUS egSetMode(INT32 Next); void egGetScreenSize(OUT INTN *ScreenWidth, OUT INTN *ScreenHeight); XString8 egScreenDescription(void); -BOOLEAN egHasGraphicsMode(void); -BOOLEAN egIsGraphicsModeEnabled(void); -void egSetGraphicsModeEnabled(IN BOOLEAN Enable); -// NOTE: Even when egHasGraphicsMode() returns FALSE, you should -// call egSetGraphicsModeEnabled(FALSE) to ensure the system +XBool egHasGraphicsMode(void); +XBool egIsGraphicsModeEnabled(void); +void egSetGraphicsModeEnabled(IN XBool Enable); +// NOTE: Even when egHasGraphicsMode() returns false, you should +// call egSetGraphicsModeEnabled(false) to ensure the system // is running in text mode. egHasGraphicsMode() only determines // if libeg can draw to the screen in graphics mode. diff --git a/rEFIt_UEFI/libeg/libscreen.cpp b/rEFIt_UEFI/libeg/libscreen.cpp index 44558f223..37be89542 100644 --- a/rEFIt_UEFI/libeg/libscreen.cpp +++ b/rEFIt_UEFI/libeg/libscreen.cpp @@ -52,11 +52,11 @@ static EFI_UGA_DRAW_PROTOCOL *UgaDraw = NULL; static EFI_GUID GraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; static EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput = NULL; -static BOOLEAN egHasGraphics = FALSE; +static XBool egHasGraphics = false; static UINTN egScreenWidth = 0; //1024; static UINTN egScreenHeight = 0; //768; -static BOOLEAN IgnoreConsoleSetMode = FALSE; +static XBool IgnoreConsoleSetMode = false; static EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentForcedConsoleMode = EfiConsoleControlScreenText; static EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE ConsoleControlGetMode = NULL; static EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE ConsoleControlSetMode = NULL; @@ -71,9 +71,9 @@ egConsoleControlGetMode(IN EFI_CONSOLE_CONTROL_PROTOCOL *This, OUT EFI_CONSOLE_C if (IgnoreConsoleSetMode) { *Mode = CurrentForcedConsoleMode; if (GopUgaExists) - *GopUgaExists = TRUE; + *GopUgaExists = true; if (StdInLocked) - *StdInLocked = FALSE; + *StdInLocked = false; return EFI_SUCCESS; } @@ -355,7 +355,7 @@ EFI_STATUS egSetScreenResolution(IN const CHAR16 *WidthHeight) return EFI_UNSUPPORTED; } -void egInitScreen(IN BOOLEAN SetMaxResolution) +void egInitScreen(IN XBool SetMaxResolution) { EFI_STATUS Status; UINT32 Width, Height, Depth, RefreshRate; @@ -394,7 +394,7 @@ void egInitScreen(IN BOOLEAN SetMaxResolution) egDumpSetConsoleVideoModes(); // get screen size - egHasGraphics = FALSE; + egHasGraphics = false; if (GraphicsOutput != NULL) { // egDumpGOPVideoModes(); if (gSettings.GUI.ScreenResolution.notEmpty()) { @@ -410,7 +410,7 @@ void egInitScreen(IN BOOLEAN SetMaxResolution) } egScreenWidth = GraphicsOutput->Mode->Info->HorizontalResolution; egScreenHeight = GraphicsOutput->Mode->Info->VerticalResolution; - egHasGraphics = TRUE; + egHasGraphics = true; } //is there anybody ever see UGA protocol??? else if (UgaDraw != NULL) { @@ -421,7 +421,7 @@ void egInitScreen(IN BOOLEAN SetMaxResolution) } else { egScreenWidth = Width; egScreenHeight = Height; - egHasGraphics = TRUE; + egHasGraphics = true; } } } @@ -449,24 +449,24 @@ XString8 egScreenDescription(void) } } -BOOLEAN egHasGraphicsMode(void) +XBool egHasGraphicsMode(void) { return egHasGraphics; } -BOOLEAN egIsGraphicsModeEnabled(void) +XBool egIsGraphicsModeEnabled(void) { EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentMode; if (ConsoleControl != NULL) { ConsoleControl->GetMode(ConsoleControl, &CurrentMode, NULL, NULL); - return (CurrentMode == EfiConsoleControlScreenGraphics) ? TRUE : FALSE; + return (CurrentMode == EfiConsoleControlScreenGraphics) ? true : false; } - return FALSE; + return false; } -void egSetGraphicsModeEnabled(IN BOOLEAN Enable) +void egSetGraphicsModeEnabled(IN XBool Enable) { EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentMode; EFI_CONSOLE_CONTROL_SCREEN_MODE NewMode; @@ -486,11 +486,11 @@ void egSetGraphicsModeEnabled(IN BOOLEAN Enable) if (!Enable) { // Don't allow switching to text mode, but report that we are in text mode when queried CurrentForcedConsoleMode = EfiConsoleControlScreenText; - IgnoreConsoleSetMode = TRUE; + IgnoreConsoleSetMode = true; return; } // Allow mode switching to work normally again - IgnoreConsoleSetMode = FALSE; + IgnoreConsoleSetMode = false; } ConsoleControl->GetMode(ConsoleControl, &CurrentMode, NULL, NULL); @@ -599,7 +599,7 @@ static EFI_STATUS GopSetModeAndReconnectTextOut(IN UINT32 ModeNumber) gBS->DisconnectController (HandleBuffer[Index], NULL, NULL); } for (UINTN Index = 0; Index < HandleCount; Index++) { - gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE); + gBS->ConnectController (HandleBuffer[Index], NULL, NULL, true); } if (HandleBuffer != NULL) { FreePool(HandleBuffer); diff --git a/rEFIt_UEFI/libeg/nanosvg.cpp b/rEFIt_UEFI/libeg/nanosvg.cpp index cb0193f00..a9e58d9a0 100755 --- a/rEFIt_UEFI/libeg/nanosvg.cpp +++ b/rEFIt_UEFI/libeg/nanosvg.cpp @@ -521,7 +521,7 @@ NSVGparser* nsvg__createParser() p->attr[0].fillRule = NSVG_FILLRULE_NONZERO; p->attr[0].hasFill = 1; p->attr[0].visible = NSVG_VIS_DISPLAY | NSVG_VIS_VISIBLE; - p->isText = FALSE; + p->isText = false; return p; } @@ -2800,7 +2800,7 @@ static void nsvg__parseUse(NSVGparser* p, char** dict) shape = (NSVGshape*)AllocateCopyPool(sizeof(NSVGshape), ref); if (!shape) return; memcpy(shape->xform, &xform[0], sizeof(float)*6); - shape->isSymbol = FALSE; + shape->isSymbol = false; shape->link = ref; shape->group = attr->group; AsciiStrCatS(shape->id, 64, "_lnk"); @@ -2815,7 +2815,7 @@ static void nsvg__parseUse(NSVGparser* p, char** dict) if (!shape) return; memcpy(shape->xform, xform, sizeof(float)*6); // nsvg__xformMultiply(shape->xform, &xform[0]); - shape->isSymbol = TRUE; + shape->isSymbol = true; shape->link = refSym->shapes; shape->group = attr->group; AsciiStrCpyS(shape->id, 64, attr->id); @@ -3025,7 +3025,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict) textFace[1].font = fontSVG; textFace[1].size = (INTN)text->fontSize; textFace[1].color = text->fontColor; - textFace[1].valid = TRUE; + textFace[1].valid = true; DBG("set message->font=%s color=%X size=%f as in MessageRow\n", fontSVG->fontFamily, text->fontColor, text->fontSize); } break; @@ -3037,7 +3037,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict) textFace[1].font = fontSVG; textFace[1].size = (INTN)text->fontSize; textFace[1].color = text->fontColor; - textFace[1].valid = TRUE; + textFace[1].valid = true; DBG("set message_night->font=%s color=%X size=%f as in MessageRow\n", fontSVG->fontFamily, text->fontColor, text->fontSize); break; } else if (strcmp(group->id, "MenuRows") == 0) { @@ -3045,7 +3045,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict) textFace[2].font = fontSVG; textFace[2].size = (INTN)text->fontSize; textFace[2].color = text->fontColor; - textFace[2].valid = TRUE; + textFace[2].valid = true; DBG("set menu->font=%s color=%X size=%f as in MenuRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize); } break; @@ -3053,14 +3053,14 @@ static void nsvg__parseText(NSVGparser* p, char** dict) textFace[2].font = fontSVG; textFace[2].size = (INTN)text->fontSize; textFace[2].color = text->fontColor; - textFace[2].valid = TRUE; + textFace[2].valid = true; break; } else if (strcmp(group->id, "HelpRows") == 0) { if (!textFace[0].valid) { textFace[0].font = fontSVG; textFace[0].size = (INTN)text->fontSize; textFace[0].color = text->fontColor; - textFace[0].valid = TRUE; + textFace[0].valid = true; DBG("set help->font=%s color=%X size=%f as in HelpRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize); } break; @@ -3068,7 +3068,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict) textFace[0].font = fontSVG; textFace[0].size = (INTN)text->fontSize; textFace[0].color = text->fontColor; - textFace[0].valid = TRUE; + textFace[0].valid = true; DBG("set help_night->font=%s color=%X size=%f as in HelpRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize); break; } @@ -3079,7 +3079,7 @@ static void nsvg__parseText(NSVGparser* p, char** dict) //add to head text->next = p->text; p->text = text; - p->isText = TRUE; + p->isText = true; } static void nsvg__parseCircle(NSVGparser* p, char** attr) @@ -3311,7 +3311,7 @@ static void parseImage(NSVGparser* p, char** dict) if (len == 0) { DBG("image not decoded from base64\n"); } -// NewImage = egDecodePNG(tmpData, len, TRUE); +// NewImage = egDecodePNG(tmpData, len, true); NewImage->FromPNG(tmpData, len); pt->image = (void *)NewImage; if (tmpData) { @@ -3589,7 +3589,7 @@ static void nsvg__parseGroup(NSVGparser* p, char** dict) void XTheme::parseTheme(void* parser, char** dict) { NSVGparser* p = (NSVGparser*)parser; - BOOLEAN found = FALSE; + XBool found = false; UINT32 Color = 0x80808080; //default value for (int i = 0; dict[i]; i += 2) { if (strcmp(dict[i], "SelectionOnTop") == 0) { @@ -3641,7 +3641,7 @@ void XTheme::parseTheme(void* parser, char** dict) SelectionColor = Color; } } else if (strcmp(dict[i], "SelectionColor_night") == 0) { - found = TRUE; + found = true; if (!ThemeX.Daylight) { SelectionColor = getIntegerDict(dict[i + 1]); } @@ -3831,7 +3831,7 @@ CHAR16 nsvg__parseUnicode(const char *s) return A; } -static void nsvg__parseGlyph(NSVGparser* p, char** dict, BOOLEAN missing) +static void nsvg__parseGlyph(NSVGparser* p, char** dict, XBool missing) { //glyph-name="E_d" unicode="Ed" horiz-adv-x="1289" d="M679 ..."/> /* @@ -3867,7 +3867,7 @@ static void nsvg__parseGlyph(NSVGparser* p, char** dict, BOOLEAN missing) if (strcmp(dict[i+1], "nonmarkingreturn") == 0) { glyph->unicode = L'\n'; } else if (strcmp(dict[i+1], ".notdef") == 0) { - missing = TRUE; + missing = true; } } } @@ -3918,9 +3918,9 @@ static void nsvg__startElement(void* ud, const char* el, char** dict) } else if (strcmp(el, "font-face") == 0) { nsvg__parseFontFace(p, dict); } else if (strcmp(el, "missing-glyph") == 0) { - nsvg__parseGlyph(p, dict, TRUE); + nsvg__parseGlyph(p, dict, true); } else if (strcmp(el, "glyph") == 0) { - nsvg__parseGlyph(p, dict, FALSE); + nsvg__parseGlyph(p, dict, false); } else if (strcmp(el, "style") == 0) { p->styleFlag = 1; } else if (strcmp(el, "g") == 0) { @@ -3928,7 +3928,7 @@ static void nsvg__startElement(void* ud, const char* el, char** dict) nsvg__parseGroup(p, dict); } else if (strcmp(el, "text") == 0) { nsvg__pushAttr(p); - p->isText = 1; + p->isText = true; nsvg__parseText(p, dict); } else if (strcmp(el, "tspan") == 0) { nsvg__pushAttr(p); @@ -4048,7 +4048,7 @@ static void nsvg__endElement(void* ud, const char* el) nsvg__popAttr(p); } else if (strcmp(el, "text") == 0) { nsvg__popAttr(p); - p->isText = 0; + p->isText = false; // } else if (strcmp(el, "tspan") == 0) { // nsvg__popAttr(p); @@ -4097,7 +4097,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN if (letter == L'C') { DBG("Found glyph %X, point[0]=(%d,%d) points=%d\n", letter, (int)shape->paths->pts[0], (int)shape->paths->pts[1], shape->paths->npts); - shape->debug = TRUE; + shape->debug = true; } } */ break; @@ -4145,7 +4145,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN } shape->flags = NSVG_VIS_DISPLAY | NSVG_VIS_VISIBLE; - shape->isText = TRUE; + shape->isText = true; nsvg__xformIdentity(shape->xform); //scale convert shape from glyph size to user's font-size shape->xform[0] = scale; //1.f; diff --git a/rEFIt_UEFI/libeg/nanosvg.h b/rEFIt_UEFI/libeg/nanosvg.h index 247c292eb..bdfb65e1f 100644 --- a/rEFIt_UEFI/libeg/nanosvg.h +++ b/rEFIt_UEFI/libeg/nanosvg.h @@ -175,9 +175,9 @@ typedef struct NSVGshape char strokeLineCap; // Stroke cap type. char fillRule; // Fill rule, see NSVGfillRule. unsigned char flags; // Logical or of NSVG_FLAGS_* flags - BOOLEAN isText; - BOOLEAN debug; - BOOLEAN isSymbol; + XBool isText; + XBool debug; + XBool isSymbol; float miterLimit; // Miter limit float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy]. float xform[6]; @@ -208,7 +208,7 @@ typedef struct NSVGimage NSVGshape* shapes; // Linked list of shapes in the image. NSVGgroup* groups; // Linked list of all groups in the image NSVGpath* paths; // Linked list of paths in the image. - BOOLEAN isFont; + XBool isFont; NSVGclipPath* clipPaths; } NSVGimage; @@ -355,10 +355,10 @@ typedef struct NSVGfontChain { } NSVGfontChain; typedef struct textFaces { - NSVGfont *font; - UINT32 color; - INTN size; - BOOLEAN valid; + NSVGfont *font = NULL; + UINT32 color = 0; + INTN size = 0; + XBool valid = false; } textFaces; extern textFaces textFace[]; //0-help 1-message 2-menu 3-test @@ -425,7 +425,7 @@ typedef struct NSVGparser char styleFlag; char patternFlag; char symbolFlag; - BOOLEAN isText; + XBool isText; char unknown[64]; NSVGtext* text; NSVGsymbol* symbols; diff --git a/rEFIt_UEFI/libeg/text.cpp b/rEFIt_UEFI/libeg/text.cpp index 08ca737e3..19059d956 100644 --- a/rEFIt_UEFI/libeg/text.cpp +++ b/rEFIt_UEFI/libeg/text.cpp @@ -85,7 +85,7 @@ void XTheme::MeasureText(IN const XStringW& Text, OUT INTN *Width, OUT INTN *Hei if (Height != NULL) *Height = ScaledHeight; } -void XTheme::LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols) +void XTheme::LoadFontImage(IN XBool UseEmbedded, IN INTN Rows, IN INTN Cols) { EFI_STATUS Status = EFI_NOT_FOUND; XImage NewImage; //tempopary image from file @@ -94,7 +94,7 @@ void XTheme::LoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols) EFI_GRAPHICS_OUTPUT_BLT_PIXEL *PixelPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FontPtr; EFI_GRAPHICS_OUTPUT_BLT_PIXEL FirstPixel; - BOOLEAN isKorean = (gSettings.GUI.languageCode == korean); + XBool isKorean = (gSettings.GUI.languageCode == korean); XStringW fontFilePath; const XStringW& commonFontDir = L"font"_XSW; @@ -183,7 +183,7 @@ void XTheme::PrepareFont() // load the font if (FontImage.isEmpty()) { DBG("load font image type %d\n", Font); - LoadFontImage(TRUE, 16, 16); //anyway success + LoadFontImage(true, 16, 16); //anyway success } if (!FontImage.isEmpty()) { @@ -208,7 +208,7 @@ void XTheme::PrepareFont() } //search pixel similar to first -inline bool SamePix(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Ptr, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel) +inline XBool SamePix(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Ptr, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel) { //compare with first pixel of the array top-left point [0][0] return ((Ptr.Red >= FirstPixel.Red - (FirstPixel.Red >> 2)) && diff --git a/rEFIt_UEFI/refit.inf b/rEFIt_UEFI/refit.inf index cd623083c..d152ac357 100644 --- a/rEFIt_UEFI/refit.inf +++ b/rEFIt_UEFI/refit.inf @@ -38,6 +38,7 @@ cpp_foundation/unicode_conversions.cpp cpp_foundation/unicode_conversions.h cpp_foundation/XArray.h + cpp_foundation/XBool.h cpp_foundation/XBuffer.cpp cpp_foundation/XBuffer.h cpp_foundation/XObjArray.h diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index 0bf8d154f..7ce0b10eb 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -68,8 +68,8 @@ //XStringW ThemePath; -//BOOLEAN gBootArgsChanged = FALSE; -BOOLEAN gThemeOptionsChanged = FALSE; +//XBool gBootArgsChanged = false; +XBool gThemeOptionsChanged = false; // @@ -124,7 +124,7 @@ NodeParser (UINT8 *DevPath, UINTN PathSize, UINT8 Type) return PathSize; } -BOOLEAN MetaiMatch ( +XBool MetaiMatch ( IN CONST CHAR16 *String, IN CONST CHAR16 *Pattern ); @@ -220,7 +220,7 @@ EFI_STATUS ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, UINTN PathIndex; EFI_LOADED_IMAGE *LoadedImage; EFI_DEVICE_PATH *DevicePath; - BOOLEAN Seen; + XBool Seen; MaxPaths--; // leave space for the terminating NULL pointer @@ -252,12 +252,12 @@ EFI_STATUS ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, // Check if we have this device path in the list already // WARNING: This assumes the first node in the device path is unique! - Seen = FALSE; + Seen = false; for (PathIndex = 0; PathIndex < PathCount; PathIndex++) { if (DevicePathNodeLength(DevicePath) != DevicePathNodeLength(PathList[PathIndex])) continue; if (CompareMem(DevicePath, PathList[PathIndex], DevicePathNodeLength(DevicePath)) == 0) { - Seen = TRUE; + Seen = true; break; } } @@ -280,25 +280,25 @@ EFI_STATUS ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, // volume functions // -static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootable) +static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT XBool *Bootable) { EFI_STATUS Status; - UINT8 *SectorBuffer; + UINT8 *SectorBuffer; UINTN i; - //MBR_PARTITION_INFO *MbrTable; - //BOOLEAN MbrTableFound; - UINTN BlockSize = 0; - CHAR16 volumeName[255]; - CHAR8 tmp[64]; - UINT32 VCrc32; - // CHAR16 *kind = NULL; + //MBR_PARTITION_INFO *MbrTable; + //XBool MbrTableFound; + UINTN BlockSize = 0; + CHAR16 volumeName[255]; + CHAR8 tmp[64]; + UINT32 VCrc32; + //CHAR16 *kind = NULL; - Volume->HasBootCode = FALSE; + Volume->HasBootCode = false; Volume->LegacyOS->IconName.setEmpty(); Volume->LegacyOS->Name.setEmpty(); // Volume->BootType = BOOTING_BY_MBR; //default value Volume->BootType = BOOTING_BY_EFI; - *Bootable = FALSE; + *Bootable = false; if ((Volume->BlockIO == NULL) || (!Volume->BlockIO->Media->MediaPresent)) return; @@ -315,8 +315,8 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl if (!EFI_ERROR(Status) && (SectorBuffer[1] != 0)) { // calc crc checksum of first 2 sectors - it's used later for legacy boot BIOS drive num detection // note: possible future issues with AF 4K disks - *Bootable = TRUE; - Volume->HasBootCode = TRUE; //we assume that all CD are bootable + *Bootable = true; + Volume->HasBootCode = true; //we assume that all CD are bootable /* DBG("check SectorBuffer\n"); for (i=0; i<32; i++) { DBG("%2hhX ", SectorBuffer[i]); @@ -395,8 +395,8 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl /* // apianti - does this detect every partition as legacy? if (*((UINT16 *)(SectorBuffer + 510)) == 0xaa55 && SectorBuffer[0] != 0) { - *Bootable = TRUE; - Volume->HasBootCode = TRUE; + *Bootable = true; + Volume->HasBootCode = true; // DBG("The volume has bootcode\n"); Volume->LegacyOS->IconName = L"legacy"; Volume->LegacyOS->Name = L"Legacy"; @@ -410,14 +410,14 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl CompareMem(SectorBuffer + 6, "LILO", 4) == 0 || CompareMem(SectorBuffer + 3, "SYSLINUX", 8) == 0 || FindMem(SectorBuffer, 2048, "ISOLINUX", 8) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"linux"_XSW; Volume->LegacyOS->Name = L"Linux"_XSW; Volume->LegacyOS->Type = OSTYPE_LIN; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "Geom\0Hard Disk\0Read\0 Error", 26) >= 0) { // GRUB - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"grub,linux"_XSW; Volume->LegacyOS->Name = L"Linux"_XSW; Volume->BootType = BOOTING_BY_PBR; @@ -425,7 +425,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if ((*((UINT32 *)(SectorBuffer)) == 0x4d0062e9 && *((UINT16 *)(SectorBuffer + 510)) == 0xaa55) || FindMem(SectorBuffer, 2048, "BOOT ", 10) >= 0) { //reboot Clover - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"clover"; Volume->LegacyOS->Name = L"Clover"; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -437,7 +437,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl *((UINT32 *)(SectorBuffer + 506)) == 50000 && *((UINT16 *)(SectorBuffer + 510)) == 0xaa55) || FindMem(SectorBuffer, 2048, "Starting the BTX loader", 23) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"freebsd,linux"_XSW; Volume->LegacyOS->Name = L"FreeBSD"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -446,7 +446,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 512, "!Loading", 8) >= 0 || FindMem(SectorBuffer, 2048, "/cdboot\0/CDBOOT\0", 16) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"openbsd,linux"_XSW; Volume->LegacyOS->Name = L"OpenBSD"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -454,14 +454,14 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 512, "Not a bootxx image", 18) >= 0 || *((UINT32 *)(SectorBuffer + 1028)) == 0x7886b6d1) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"netbsd,linux"_XSW; Volume->LegacyOS->Name = L"NetBSD"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 2048, "NTLDR", 5) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"win"_XSW; Volume->LegacyOS->Name = L"Windows"_XSW; Volume->LegacyOS->Type = OSTYPE_WIN; @@ -469,7 +469,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 2048, "BOOTMGR", 7) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"vista,win"_XSW; Volume->LegacyOS->Name = L"Windows"_XSW; Volume->LegacyOS->Type = OSTYPE_WIN; @@ -477,7 +477,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 512, "CPUBOOT SYS", 11) >= 0 || FindMem(SectorBuffer, 512, "KERNEL SYS", 11) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"freedos,win"_XSW; Volume->LegacyOS->Name = L"FreeDOS"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -485,21 +485,21 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 512, "OS2LDR", 6) >= 0 || FindMem(SectorBuffer, 512, "OS2BOOT", 7) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"ecomstation"_XSW; Volume->LegacyOS->Name = L"eComStation"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "Be Boot Loader", 14) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"beos"_XSW; Volume->LegacyOS->Name = L"BeOS"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; Volume->BootType = BOOTING_BY_PBR; } else if (FindMem(SectorBuffer, 512, "yT Boot Loader", 14) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"zeta"_XSW; Volume->LegacyOS->Name = L"ZETA"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -507,7 +507,7 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl } else if (FindMem(SectorBuffer, 512, "\x04" "beos\x06" "system\x05" "zbeos", 18) >= 0 || FindMem(SectorBuffer, 512, "haiku_loader", 12) >= 0) { - Volume->HasBootCode = TRUE; + Volume->HasBootCode = true; Volume->LegacyOS->IconName = L"haiku"_XSW; Volume->LegacyOS->Name = L"Haiku"_XSW; Volume->LegacyOS->Type = OSTYPE_VAR; @@ -527,11 +527,11 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl #endif if (FindMem(SectorBuffer, 512, "Non-system disk", 15) >= 0) // dummy FAT boot sector - Volume->HasBootCode = FALSE; + Volume->HasBootCode = false; #ifdef JIEF_DEBUG -////*Bootable = TRUE; -//Volume->HasBootCode = TRUE; +////*Bootable = true; +//Volume->HasBootCode = true; //Volume->LegacyOS->IconName = L"win"_XSW; //Volume->LegacyOS->Name = L"Windows"_XSW; //Volume->LegacyOS->Type = OSTYPE_WIN; @@ -542,14 +542,14 @@ static void ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl /* // apianti - this is littered with bugs and probably not needed lol if (*((UINT16 *)(SectorBuffer + 510)) == 0xaa55) { - MbrTableFound = FALSE; + MbrTableFound = false; MbrTable = (MBR_PARTITION_INFO *)(SectorBuffer + 446); for (i = 0; i < 4; i++) if (MbrTable[i].StartLBA && MbrTable[i].Size) - MbrTableFound = TRUE; + MbrTableFound = true; for (i = 0; i < 4; i++) if (MbrTable[i].Flags != 0x00 && MbrTable[i].Flags != 0x80) - MbrTableFound = FALSE; + MbrTableFound = false; if (MbrTableFound) { Volume->MbrPartitionTable = (__typeof__(Volume->MbrPartitionTable))AllocatePool(4 * 16); CopyMem(Volume->MbrPartitionTable, MbrTable, 4 * 16); @@ -576,7 +576,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) // UINTN BufferSize = 255; EFI_FILE_SYSTEM_INFO *FileSystemInfoPtr; EFI_FILE_INFO *RootInfo = NULL; - BOOLEAN Bootable; + XBool Bootable; // EFI_INPUT_KEY Key; // get device path @@ -612,7 +612,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) return Status; } - Bootable = FALSE; + Bootable = false; if (Volume->BlockIO->Media->BlockSize == 2048){ // DBG(" Found optical drive\n"); Volume->DiskKind = DISK_KIND_OPTICAL; @@ -689,14 +689,14 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) } /* what is the bread? - // Bootable = TRUE; + // Bootable = true; if (DevicePathType(DevicePath) == MEDIA_DEVICE_PATH && DevicePathSubType(DevicePath) == MEDIA_VENDOR_DP) { - Volume->IsAppleLegacy = TRUE; // legacy BIOS device entry + Volume->IsAppleLegacy = true; // legacy BIOS device entry // TODO: also check for Boot Camp GUID //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 DBG("AppleLegacy device\n"); } */ @@ -769,7 +769,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) // gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); } #endif - Volume->HasBootCode = FALSE; + Volume->HasBootCode = false; } // open the root directory of the volume @@ -900,13 +900,13 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) static void ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_INFO *MbrEntry) { EFI_STATUS Status; - REFIT_VOLUME *Volume; + REFIT_VOLUME *Volume; UINT32 ExtBase, ExtCurrent, NextExtCurrent; UINTN i; UINTN LogicalPartitionIndex = 4; - UINT8 *SectorBuffer; - BOOLEAN Bootable; - MBR_PARTITION_INFO *EMbrTable; + UINT8 *SectorBuffer; + XBool Bootable; + MBR_PARTITION_INFO *EMbrTable; ExtBase = MbrEntry->StartLBA; SectorBuffer = (__typeof__(SectorBuffer))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), WholeDiskVolume->BlockIO->Media->IoAlign); @@ -937,7 +937,7 @@ static void ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I // found a logical partition Volume = new REFIT_VOLUME; Volume->DiskKind = WholeDiskVolume->DiskKind; - Volume->IsMbrPartition = TRUE; + Volume->IsMbrPartition = true; Volume->MbrPartitionIndex = LogicalPartitionIndex++; Volume->VolName = SWPrintf("Partition %llu", Volume->MbrPartitionIndex + 1); Volume->BlockIO = WholeDiskVolume->BlockIO; @@ -945,10 +945,10 @@ static void ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I Volume->WholeDiskBlockIO = WholeDiskVolume->BlockIO; Volume->WholeDiskDeviceHandle = WholeDiskVolume->DeviceHandle; - Bootable = FALSE; + Bootable = false; ScanVolumeBootcode(Volume, &Bootable); if (!Bootable) - Volume->HasBootCode = FALSE; + Volume->HasBootCode = false; Volumes.AddReference(Volume, false); // AddListElement((void ***) &Volumes, &VolumesCount, Volume); @@ -994,7 +994,7 @@ void ScanVolumes(void) DBG("- [%02llu]: Volume:", HandleIndex); - Volume->Hidden = FALSE; // default to not hidden + Volume->Hidden = false; // default to not hidden Status = ScanVolume(Volume); if (!EFI_ERROR(Status)) { @@ -1003,7 +1003,7 @@ void ScanVolumes(void) if ( Volume->DevicePathString.containsIC(gSettings.GUI.HVHideStrings[HVi]) || Volume->VolName.containsIC(gSettings.GUI.HVHideStrings[HVi]) ) { - Volume->Hidden = TRUE; + Volume->Hidden = true; DBG(" hiding this volume\n"); } } @@ -1034,7 +1034,7 @@ void ScanVolumes(void) SelfVolume->DiskKind = DISK_KIND_BOOTER; SelfVolume->VolName = L"Clover"_XSW; SelfVolume->LegacyOS->Type = OSTYPE_EFI; - SelfVolume->HasBootCode = TRUE; + SelfVolume->HasBootCode = true; SelfVolume->BootType = BOOTING_BY_PBR; // AddListElement((void ***) &Volumes, &VolumesCount, SelfVolume); // DBG("SelfVolume Nr %d created\n", VolumesCount); @@ -1098,7 +1098,7 @@ void ScanVolumes(void) // TODO: mark entry as non-bootable if it is an extended partition // now we're reasonably sure the association is correct... - Volume->IsMbrPartition = TRUE; + Volume->IsMbrPartition = true; Volume->MbrPartitionTable = MbrTable; Volume->MbrPartitionIndex = PartitionIndex; if (Volume->VolName.isEmpty()) @@ -1219,7 +1219,7 @@ REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName) // file and dir functions // -BOOLEAN FileExists(IN CONST EFI_FILE *Root, IN CONST CHAR16 *RelativePath) +XBool FileExists(IN CONST EFI_FILE *Root, IN CONST CHAR16 *RelativePath) { EFI_STATUS Status; EFI_FILE *TestFile = NULL; @@ -1229,17 +1229,17 @@ BOOLEAN FileExists(IN CONST EFI_FILE *Root, IN CONST CHAR16 *RelativePath) if (TestFile && TestFile->Close) { TestFile->Close(TestFile); } - return TRUE; + return true; } - return FALSE; + return false; } -BOOLEAN FileExists(const EFI_FILE *Root, const XStringW& RelativePath) +XBool FileExists(const EFI_FILE *Root, const XStringW& RelativePath) { return FileExists(Root, RelativePath.wc_str()); } -BOOLEAN FileExists(const EFI_FILE& Root, const XStringW& RelativePath) +XBool FileExists(const EFI_FILE& Root, const XStringW& RelativePath) { return FileExists(&Root, RelativePath.wc_str()); } @@ -1249,7 +1249,7 @@ EFI_DEVICE_PATH_PROTOCOL* FileDevicePath(IN EFI_HANDLE Device, IN CONST XStringW return FileDevicePath(Device, FileName.wc_str()); } -BOOLEAN DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath) +XBool DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath) { EFI_STATUS Status; EFI_FILE *File; @@ -1266,7 +1266,7 @@ BOOLEAN DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath) // error //DBG(" FileInfo is NULL\n"); File->Close(File); - return FALSE; + return false; } //DBG(" FileInfo attr: %hhX\n", FileInfo->Attribute); if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { @@ -1274,7 +1274,7 @@ BOOLEAN DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath) //DBG(" File is DIR\n"); FreePool(FileInfo); File->Close(File); - return FALSE; + return false; } FreePool(FileInfo); // it's a file - delete it @@ -1284,7 +1284,7 @@ BOOLEAN DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath) return Status == EFI_SUCCESS; } - return FALSE; + return false; } EFI_STATUS DirNextEntry(const EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry, IN UINTN FilterMode) @@ -1353,15 +1353,15 @@ void DirIterOpen(const EFI_FILE *BaseDir, IN CONST CHAR16 *RelativePath OPTIONAL if (RelativePath == NULL) { DirIter->LastStatus = EFI_SUCCESS; DirIter->DirHandle = BaseDir; - DirIter->CloseDirHandle = FALSE; + DirIter->CloseDirHandle = false; } else { DirIter->LastStatus = BaseDir->Open(BaseDir, const_cast(&(DirIter->DirHandle)), RelativePath, EFI_FILE_MODE_READ, 0); - DirIter->CloseDirHandle = EFI_ERROR(DirIter->LastStatus) ? FALSE : TRUE; + DirIter->CloseDirHandle = EFI_ERROR(DirIter->LastStatus) ? false : true; } DirIter->LastFileInfo = NULL; } -BOOLEAN DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONST CHAR16 *FilePattern OPTIONAL, +XBool DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONST CHAR16 *FilePattern OPTIONAL, OUT EFI_FILE_INFO **DirEntry) { if (DirIter->LastFileInfo != NULL) { @@ -1370,14 +1370,14 @@ BOOLEAN DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONS } if (EFI_ERROR(DirIter->LastStatus)) - return FALSE; // stop iteration + return false; // stop iteration for (;;) { DirIter->LastStatus = DirNextEntry(DirIter->DirHandle, &(DirIter->LastFileInfo), FilterMode); if (EFI_ERROR(DirIter->LastStatus)) - return FALSE; + return false; if (DirIter->LastFileInfo == NULL) // end of listing - return FALSE; + return false; if (FilePattern != NULL) { if ((DirIter->LastFileInfo->Attribute & EFI_FILE_DIRECTORY)) break; @@ -1389,7 +1389,7 @@ BOOLEAN DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONS } *DirEntry = DirIter->LastFileInfo; - return TRUE; + return true; } EFI_STATUS DirIterClose(IN OUT REFIT_DIR_ITER *DirIter) @@ -1406,7 +1406,7 @@ EFI_STATUS DirIterClose(IN OUT REFIT_DIR_ITER *DirIter) // // file name manipulation // -BOOLEAN +XBool MetaiMatch ( IN CONST CHAR16 *String, IN CONST CHAR16 *Pattern @@ -1414,10 +1414,10 @@ MetaiMatch ( { if (!mUnicodeCollation) { // quick fix for driver loading on UEFIs without UnicodeCollation - //return FALSE; - return TRUE; //this is wrong anyway + //return false; + return true; //this is wrong anyway } - return mUnicodeCollation->MetaiMatch (mUnicodeCollation, String, Pattern); + return mUnicodeCollation->MetaiMatch (mUnicodeCollation, String, Pattern) == TRUE; } @@ -1531,7 +1531,7 @@ XStringW DevicePathToXStringW ( const EFI_DEVICE_PATH_PROTOCOL *DevPath ) { - CHAR16* DevicePathStr = ConvertDevicePathToText (DevPath, TRUE, TRUE); + CHAR16* DevicePathStr = ConvertDevicePathToText (DevPath, true, true); XStringW returnValue; returnValue.stealValueFrom(DevicePathStr); // do not FreePool FilePath, it's now owned by returnValue return returnValue; @@ -1547,7 +1547,7 @@ XStringW FileDevicePathToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath) CHAR16 *Char; CONST CHAR16 *Tail; - FilePath = ConvertDevicePathToText(DevPath, TRUE, TRUE); + FilePath = ConvertDevicePathToText(DevPath, true, true); // fix / into '\\' if (FilePath != NULL) { for (Char = FilePath; *Char != L'\0'; Char++) { @@ -1590,7 +1590,7 @@ XStringW FileDevicePathFileToXStringW(const EFI_DEVICE_PATH_PROTOCOL *DevPath) return NullXStringW; } -BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt) +XBool DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt) { UINTN dataSize = 0; UINT8 *data = NULL; @@ -1618,9 +1618,9 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt) } if (data) { FreePool(data); - return TRUE; + return true; } - return FALSE; + return false; } // EOF diff --git a/rEFIt_UEFI/refit/lib.h b/rEFIt_UEFI/refit/lib.h index 0e9b4eb61..b71bd64be 100644 --- a/rEFIt_UEFI/refit/lib.h +++ b/rEFIt_UEFI/refit/lib.h @@ -221,8 +221,8 @@ typedef enum { -//extern BOOLEAN gBootArgsChanged; -extern BOOLEAN gThemeOptionsChanged; +//extern XBool gBootArgsChanged; +extern XBool gThemeOptionsChanged; //extern POINTERS gPointer; //extern EFI_GUID gEfiAppleBootGuid; @@ -245,19 +245,19 @@ void ScanVolumes(void); REFIT_VOLUME *FindVolumeByName(IN CONST CHAR16 *VolName); -BOOLEAN FileExists(const EFI_FILE *BaseDir, const CHAR16 *RelativePath); -BOOLEAN FileExists(const EFI_FILE *BaseDir, const XStringW& RelativePath); -BOOLEAN FileExists(const EFI_FILE& Root, const XStringW& RelativePath); +XBool FileExists(const EFI_FILE *BaseDir, const CHAR16 *RelativePath); +XBool FileExists(const EFI_FILE *BaseDir, const XStringW& RelativePath); +XBool FileExists(const EFI_FILE& Root, const XStringW& RelativePath); //inline EFI_DEVICE_PATH_PROTOCOL* FileDevicePath (IN EFI_HANDLE Device, IN CONST XStringW& FileName) { return FileDevicePath(Device, FileName.wc_str()); } EFI_DEVICE_PATH_PROTOCOL* FileDevicePath (IN EFI_HANDLE Device, IN CONST XStringW& FileName); -BOOLEAN DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath); +XBool DeleteFile(const EFI_FILE *Root, IN CONST CHAR16 *RelativePath); EFI_STATUS DirNextEntry(const EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry, IN UINTN FilterMode); void DirIterOpen(const EFI_FILE *BaseDir, IN CONST CHAR16 *RelativePath OPTIONAL, OUT REFIT_DIR_ITER *DirIter); -BOOLEAN DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONST CHAR16 *FilePattern OPTIONAL, OUT EFI_FILE_INFO **DirEntry); +XBool DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CONST CHAR16 *FilePattern OPTIONAL, OUT EFI_FILE_INFO **DirEntry); EFI_STATUS DirIterClose(IN OUT REFIT_DIR_ITER *DirIter); CONST CHAR16 * Basename(IN CONST CHAR16 *Path); @@ -316,7 +316,7 @@ extern CHAR16 *BlankLine; extern INTN UGAWidth; extern INTN UGAHeight; -extern BOOLEAN AllowGraphicsMode; +extern XBool AllowGraphicsMode; #endif @@ -396,7 +396,7 @@ void DebugPause(void); // BmLib // -extern BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt); +extern XBool DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt); //void FilterKextPatches(IN LOADER_ENTRY *Entry); diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 3eb6b4560..3ea63b1d8 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -118,9 +118,9 @@ // variables -BOOLEAN gGuiIsReady = FALSE; -BOOLEAN gThemeNeedInit = TRUE; -BOOLEAN DoHibernateWake = FALSE; +XBool gGuiIsReady = false; +XBool gThemeNeedInit = true; +XBool DoHibernateWake = false; EFI_HANDLE ConsoleInHandle; @@ -132,7 +132,7 @@ XStringW OpenRuntimeEfiName; extern void HelpRefit(void); extern void AboutRefit(void); -//extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry); +//extern XBool BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry); extern EFI_AUDIO_IO_PROTOCOL *AudioIo; @@ -166,7 +166,7 @@ static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, // load the image into memory ReturnStatus = Status = EFI_NOT_FOUND; // in case the list is empty for (DevicePathIndex = 0; DevicePaths[DevicePathIndex] != NULL; DevicePathIndex++) { - ReturnStatus = Status = gBS->LoadImage(FALSE, self.getSelfImageHandle(), DevicePaths[DevicePathIndex], NULL, 0, &ChildImageHandle); + ReturnStatus = Status = gBS->LoadImage(false, self.getSelfImageHandle(), DevicePaths[DevicePathIndex], NULL, 0, &ChildImageHandle); DBG(" status=%s", efiStrError(Status)); if (ReturnStatus != EFI_NOT_FOUND) break; @@ -561,7 +561,7 @@ NullConOutOutputString(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *, IN CONST CHAR16 *) void CheckEmptyFB() { - BOOLEAN EmptyFB = (GlobalConfig.IgPlatform == 0x00050000) || + XBool EmptyFB = (GlobalConfig.IgPlatform == 0x00050000) || (GlobalConfig.IgPlatform == 0x01620007) || (GlobalConfig.IgPlatform == 0x04120004) || (GlobalConfig.IgPlatform == 0x19120001) || @@ -648,20 +648,20 @@ void debugStartImageWithOC() UINTN HandleIndex = 0; for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { EFI_DEVICE_PATH_PROTOCOL* DevicePath = DevicePathFromHandle(Handles[HandleIndex]); - CHAR16* UnicodeDevicePath = ConvertDevicePathToText(DevicePath, FALSE, FALSE); + CHAR16* UnicodeDevicePath = ConvertDevicePathToText(DevicePath, false, false); MsgLog("debugStartImageWithOC : path %ls\n", UnicodeDevicePath); if ( StrCmp(devicePathToLookFor.wc_str(), UnicodeDevicePath) == 0 ) break; } if ( HandleIndex < HandleCount ) { EFI_DEVICE_PATH_PROTOCOL* jfkImagePath = FileDevicePath(Handles[HandleIndex], L"\\System\\Library\\CoreServices\\boot.efi"); - CHAR16* UnicodeDevicePath = ConvertDevicePathToText (jfkImagePath, FALSE, FALSE); (void)UnicodeDevicePath; + CHAR16* UnicodeDevicePath = ConvertDevicePathToText (jfkImagePath, false, false); (void)UnicodeDevicePath; EFI_HANDLE EntryHandle = NULL; // point to InternalEfiLoadImage from OC Status = gBS->LoadImage ( - FALSE, + false, gImageHandle, jfkImagePath, NULL, @@ -1122,11 +1122,11 @@ void LOADER_ENTRY::StartLoader() } #if 1 //CFBundleExecutable - BOOLEAN NoContents = FALSE; + XBool NoContents = false; XStringW infoPlistPath = getKextPlist(dirPath, KextEntry, &NoContents); //it will be fullPath, including dir TagDict* dict = getInfoPlist(infoPlistPath); - // BOOLEAN inject = checkOSBundleRequired(dict); - BOOLEAN inject = true; + // XBool inject = checkOSBundleRequired(dict); + XBool inject = true; if (inject) { if ( infoPlistPath.notEmpty()) { if (NoContents) { @@ -1221,7 +1221,7 @@ void LOADER_ENTRY::StartLoader() { // point to InternalEfiLoadImage from OC Status = gBS->LoadImage ( - FALSE, + false, gImageHandle, DevicePath, NULL, @@ -1248,7 +1248,7 @@ void LOADER_ENTRY::StartLoader() PreviousNode = Node; break; } - // CHAR16* s1 = ConvertDeviceNodeToText(Node, FALSE, FALSE); + // CHAR16* s1 = ConvertDeviceNodeToText(Node, false, false); // MsgLog("Split DevicePath = %ls\n", s1); PreviousNode = Node; Node = NextDevicePathNode(Node); @@ -1266,7 +1266,7 @@ void LOADER_ENTRY::StartLoader() // point to InternalEfiLoadImage from OC Status = gBS->LoadImage ( - FALSE, + false, gImageHandle, BootEfiFromDmgDevicePath, NULL, @@ -1313,8 +1313,8 @@ void LOADER_ENTRY::StartLoader() // 1. Ensure we have graphics mode set (since it is a must in the future). // 2. Request text mode for boot.efi, which it expects by default (here a SetMode libeg hack will trigger // on problematic UEFI implementations like AMI). - egSetGraphicsModeEnabled(TRUE); - egSetGraphicsModeEnabled(FALSE); + egSetGraphicsModeEnabled(true); + egSetGraphicsModeEnabled(false); DBG("GetOSVersion:"); @@ -1462,7 +1462,7 @@ void LOADER_ENTRY::StartLoader() */ if (KernelAndKextPatches.KPKernelXCPM && gCPUStructure.Vendor == CPU_VENDOR_INTEL && gCPUStructure.Model >= CPU_MODEL_HASWELL && - (AsciiStrStr(gCPUStructure.BrandString, "Celeron") || AsciiStrStr(gCPUStructure.BrandString, "Pentium")) && + (gCPUStructure.BrandString.contains("Celeron") || gCPUStructure.BrandString.contains("Pentium")) && macOSVersion >= MacOsVersion("10.8.5"_XS8) && macOSVersion < MacOsVersion("10.12"_XS8) && (!LoadOptions.containsIC("-xcpm"))) { // add "-xcpm" argv if not present on Haswell+ Celeron/Pentium @@ -1523,7 +1523,7 @@ void LOADER_ENTRY::StartLoader() gEmuVariableControl->UninstallEmulation(gEmuVariableControl); } - PatchACPI_OtherOS(L"Windows", FALSE); + PatchACPI_OtherOS(L"Windows", false); //PauseForKey(L"continue"); } @@ -1538,7 +1538,7 @@ void LOADER_ENTRY::StartLoader() gEmuVariableControl->UninstallEmulation(gEmuVariableControl); } //FinalizeSmbios(); - PatchACPI_OtherOS(L"Linux", FALSE); + PatchACPI_OtherOS(L"Linux", false); //PauseForKey(L"continue"); } @@ -1610,7 +1610,7 @@ void LOADER_ENTRY::StartLoader() gBS->CloseEvent (mSimpleFileSystemChangeEvent); // gBS->CloseEvent (mVirtualAddressChangeEvent); // When doing hibernate wake, save to DataHub only up to initial size of log - SavePreBootLog = FALSE; + SavePreBootLog = false; } else { // delete boot-switch-vars if exists Status = gRT->SetVariable(L"boot-switch-vars", &gEfiAppleBootGuid, @@ -1731,7 +1731,7 @@ void LEGACY_ENTRY::StartLegacy() egClearScreen(&MenuBackgroundPixel); - BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/); + BeginExternalScreen(true/*, L"Booting Legacy OS"*/); XImage BootLogoX; BootLogoX.LoadXImage(&ThemeX.getThemeDir(), Volume->LegacyOS->IconName); BootLogoX.Draw((UGAWidth - BootLogoX.GetWidth()) >> 1, @@ -1751,10 +1751,10 @@ void LEGACY_ENTRY::StartLegacy() } else if (gSettings.Boot.LegacyBoot == "PBRtest"_XS8) { Status = bootPBRtest(Volume); } else if (gSettings.Boot.LegacyBoot == "PBRsata"_XS8) { - Status = bootPBR(Volume, TRUE); + Status = bootPBR(Volume, true); } else { // default - Status = bootPBR(Volume, FALSE); + Status = bootPBR(Volume, false); } break; default: @@ -1793,7 +1793,7 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne UINTN DriversArrSize; UINTN DriversArrNum; EFI_HANDLE *DriversArr; - BOOLEAN Skip; + XBool Skip; UINT8 AptioBlessed; STATIC CHAR16 CONST * CONST AptioNames[] = { L"AptioMemoryFix", @@ -1817,9 +1817,9 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne //only one driver with highest priority will obtain status "Loaded" DirIterOpen(&self.getCloverDir(), Path, &DirIter); -#define BOOLEAN_AT_INDEX(k) (*(BOOLEAN*)((UINTN)&gDriversFlags + AptioIndices[(k)])) +#define BOOLEAN_AT_INDEX(k) (*(XBool*)((UINTN)&gDriversFlags + AptioIndices[(k)])) for (size_t i = 0; i != ARRAY_SIZE(AptioIndices); ++i) - BOOLEAN_AT_INDEX(i) = FALSE; + BOOLEAN_AT_INDEX(i) = false; AptioBlessed = (UINT8) ARRAY_SIZE(AptioNames); while (DirIterNext(&DirIter, 2, L"*.efi", &DirEntry)) { size_t i; @@ -1840,13 +1840,16 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne Skip = (DirEntry->FileName[0] == L'.'); for (size_t i=0; iFileName, gSettings.DisabledDriverArray[i].wc_str()) != NULL) { - Skip = TRUE; // skip this + Skip = true; // skip this break; } } if (Skip) { continue; } + if ( LStringW(DirEntry->FileName).startWith("._") ) { + continue; + } if ( LStringW(DirEntry->FileName).containsIC("OcQuirks") ) { continue; } @@ -1878,7 +1881,7 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne if (((UINT8) i) != AptioBlessed) continue; if (AptioBlessed < (UINT8) ARRAY_SIZE(AptioIndices)) - BOOLEAN_AT_INDEX(AptioBlessed) = TRUE; + BOOLEAN_AT_INDEX(AptioBlessed) = true; AptioBlessed = (UINT8) ARRAY_SIZE(AptioNames); } } @@ -1893,15 +1896,15 @@ static void ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne AudioDriverHandle = DriverHandle; } if ( FileName.containsIC("EmuVariable") ) { - gDriversFlags.EmuVariableLoaded = TRUE; + gDriversFlags.EmuVariableLoaded = true; } else if ( FileName.containsIC("Video") ) { - gDriversFlags.VideoLoaded = TRUE; + gDriversFlags.VideoLoaded = true; } else if ( FileName.containsIC("Partition") ) { - gDriversFlags.PartitionLoaded = TRUE; + gDriversFlags.PartitionLoaded = true; } else if ( FileName.containsIC("HFS") ) { - gDriversFlags.HFSLoaded = TRUE; + gDriversFlags.HFSLoaded = true; } else if ( FileName.containsIC("apfs") ) { - gDriversFlags.APFSLoaded = TRUE; + gDriversFlags.APFSLoaded = true; } if (DriverHandle != NULL && DriversToConnectNum != NULL && DriversToConnect != NULL) { // driver loaded - check for EFI_DRIVER_BINDING_PROTOCOL @@ -1957,7 +1960,7 @@ void DisconnectInvalidDiskIoChildDrivers(void) EFI_BLOCK_IO_PROTOCOL *BlockIo; EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfo; UINTN OpenInfoCount; - BOOLEAN Found; + XBool Found; DBG("Searching for invalid DiskIo BY_DRIVER connects:"); @@ -1973,7 +1976,7 @@ void DisconnectInvalidDiskIoChildDrivers(void) // // Check every DiskIo handle // - Found = FALSE; + Found = false; for (Index = 0; Index < HandleCount; Index++) { //DBG("\n"); //DBG(" - Handle %p:", Handles[Index]); @@ -2038,7 +2041,7 @@ void DisconnectInvalidDiskIoChildDrivers(void) if (!Found) { DBG("\n"); } - Found = TRUE; + Found = true; Status = gBS->DisconnectController (Handles[Index], OpenInfo[OpenInfoIndex].AgentHandle, NULL); //DBG(" BY_DRIVER Agent: %p, Disconnect: %s", OpenInfo[OpenInfoIndex].AgentHandle, efiStrError(Status)); DBG(" - Handle %llx with DiskIo, is Partition, no Fs, BY_DRIVER Agent: %llx, Disconnect: %s\n", (uintptr_t)Handles[Index], (uintptr_t)(OpenInfo[OpenInfoIndex].AgentHandle), efiStrError(Status)); @@ -2174,7 +2177,7 @@ void DisconnectSomeDevices(void) } Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0, sizeof (Pci) / sizeof (UINT32), &Pci); if (!EFI_ERROR(Status)) { - if(IS_PCI_VGA(&Pci) == TRUE) { + if(IS_PCI_VGA(&Pci) == true) { // disconnect VGA Status = gBS->DisconnectController(Handles[Index], NULL, NULL); DBG("disconnect %s", efiStrError(Status)); @@ -2212,7 +2215,7 @@ static void LoadDrivers(void) UINTN DriversToConnectNum = 0; UINT8 *Edid; UINTN VarSize = 0; - BOOLEAN VBiosPatchNeeded; + XBool VBiosPatchNeeded; DbgHeader("LoadDrivers"); @@ -2246,14 +2249,14 @@ static void LoadDrivers(void) ); if (Status == EFI_BUFFER_TOO_SMALL) { // var exists - it's done - let's not do it again - VBiosPatchNeeded = FALSE; + VBiosPatchNeeded = false; } } if ( (gSettings.Graphics.EDID.CustomEDID.notEmpty() && gFirmwareClover) || (VBiosPatchNeeded && !gDriversFlags.VideoLoaded)) { // we have video bios patch - force video driver reconnect DBG("Video bios patch requested or CustomEDID - forcing video reconnect\n"); - gDriversFlags.VideoLoaded = TRUE; + gDriversFlags.VideoLoaded = true; DriversToConnectNum++; } @@ -2293,7 +2296,7 @@ INTN FindDefaultEntry(void) { INTN Index = -1; REFIT_VOLUME *Volume; - BOOLEAN SearchForLoader; + XBool SearchForLoader; // DBG("FindDefaultEntry ...\n"); //DbgHeader("FindDefaultEntry"); @@ -2386,7 +2389,7 @@ void SetVariablesFromNvram() arg = (__typeof__(arg))AllocatePool(Size+1); /* if (AsciiStrStr(tmpString, "nvda_drv=1")) { //found substring - gSettings.NvidiaWeb = TRUE; + gSettings.NvidiaWeb = true; } */ //first we will find new args that is not present in main args index = 0; @@ -2437,7 +2440,7 @@ void SetVariablesFromNvram() tmpString = (__typeof__(tmpString))GetNvramVariable(L"nvda_drv", &gEfiAppleBootGuid, NULL, NULL); if (tmpString && AsciiStrCmp(tmpString, "1") == 0) { - gSettings.SystemParameters.NvidiaWeb = TRUE; + gSettings.SystemParameters.NvidiaWeb = true; } if (tmpString) { FreePool(tmpString); @@ -2519,7 +2522,7 @@ GetListOfACPI() continue; } // DBG("Found name %ls\n", DirEntry->FileName); - BOOLEAN ACPIDisabled = FALSE; + XBool ACPIDisabled = false; ACPI_PATCHED_AML* ACPIPatchedAMLTmp = new ACPI_PATCHED_AML; ACPIPatchedAMLTmp->FileName.takeValueFrom(DirEntry->FileName); @@ -2529,7 +2532,7 @@ GetListOfACPI() // if ((gSettings.ACPI.DisabledAML[i] != NULL) && // (StriCmp(ACPIPatchedAMLTmp->FileName, gSettings.ACPI.DisabledAML[i]) == 0) // ) { - ACPIDisabled = TRUE; + ACPIDisabled = true; break; } } @@ -2706,9 +2709,9 @@ RefitMain (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) { EFI_STATUS Status; - BOOLEAN MainLoopRunning = TRUE; - BOOLEAN ReinitDesktop = TRUE; - BOOLEAN AfterTool = FALSE; + XBool MainLoopRunning = true; + XBool ReinitDesktop = true; + XBool AfterTool = false; REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry = NULL; REFIT_ABSTRACT_MENU_ENTRY *DefaultEntry = NULL; REFIT_ABSTRACT_MENU_ENTRY *OptionEntry = NULL; @@ -2720,9 +2723,9 @@ RefitMain (IN EFI_HANDLE ImageHandle, // LOADER_ENTRY *LoaderEntry; // XStringW ConfName; // TagDict* smbiosTags = NULL; -// BOOLEAN UniteConfigs = FALSE; +// XBool UniteConfigs = false; EFI_TIME Now; - BOOLEAN HaveDefaultVolume; + XBool HaveDefaultVolume; REFIT_MENU_SCREEN BootScreen; BootScreen.isBootScreen = true; //other screens will be constructed as false // CHAR16 *InputBuffer; //, *Y; @@ -2732,9 +2735,8 @@ RefitMain (IN EFI_HANDLE ImageHandle, /*Status = */ //egMkDir(&self.getCloverDir(), L"misc"); //Should apply to: "ACPI/origin/" too - // get TSC freq and init MemLog if needed - gCPUStructure.TSCCalibr = GetMemLogTscTicksPerSecond(); //ticks for 1second - //gSettings.GUI.TextOnly = TRUE; + MemLogInit(); + //gSettings.GUI.TextOnly = true; // bootstrap gST = SystemTable; @@ -2780,7 +2782,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, } #ifdef JIEF_DEBUG gBS->Stall(2500000); // to give time to gdb to connect -// PauseForKey(L"press\n"); +// PauseForKey("press\n"_XS8); #endif } @@ -2790,9 +2792,13 @@ RefitMain (IN EFI_HANDLE ImageHandle, #endif #ifdef CLOVER_BUILD + // BE CAREFUL. construct_globals_objects will call ctor on every static struct and classes. + // For example, if you do "gCPUStructure.TSCCalibr = GetMemLogTscTicksPerSecond();" before this point, it will be erased by construct_globals_objects() construct_globals_objects(gImageHandle); // do this after self.getSelfLoadedImage() is initialized #endif + gCPUStructure.TSCCalibr = GetMemLogTscTicksPerSecond(); //ticks for 1second + #ifdef DEBUG_ERALY_CRASH SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step5"); PauseForKey("press any key\n"_XS8); @@ -2970,7 +2976,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, //read aptiofixflag from nvram for special boot Status = GetVariable2(L"aptiofixflag", &gEfiAppleBootGuid, &Value, &Size); if (!EFI_ERROR(Status)) { - GlobalConfig.SpecialBootMode = TRUE; + GlobalConfig.SpecialBootMode = true; FreePool(Value); DBG("Fast option enabled\n"); } @@ -2999,7 +3005,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, /* if (!gFirmwareClover && !gDriversFlags.EmuVariableLoaded) { - GetSmcKeys(FALSE); // later we can get here SMC information + GetSmcKeys(false); // later we can get here SMC information } */ Status = gBS->LocateProtocol (&gEmuVariableControlProtocolGuid, NULL, (void**)&gEmuVariableControl); @@ -3015,14 +3021,14 @@ RefitMain (IN EFI_HANDLE ImageHandle, if (!GlobalConfig.isFastBoot()) { // init screen and dump video modes to log if (gDriversFlags.VideoLoaded) { - InitScreen(FALSE); + InitScreen(false); } else { - InitScreen(!gFirmwareClover); // ? FALSE : TRUE); + InitScreen(!gFirmwareClover); // ? false : true); } //DBG("DBG: setup screen\n"); SetupScreen(); } else { - InitScreen(FALSE); + InitScreen(false); } //DBG("ReinitRefitLib\n"); @@ -3094,7 +3100,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, if (gSettings.Boot.StrictHibernate) { DBG(" Don't use StrictHibernate with emulated NVRAM!\n"); } - gSettings.Boot.StrictHibernate = FALSE; + gSettings.Boot.StrictHibernate = false; } */ HaveDefaultVolume = gSettings.Boot.DefaultVolume.notEmpty(); @@ -3115,17 +3121,17 @@ RefitMain (IN EFI_HANDLE ImageHandle, BootScreen.DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER); } - AfterTool = FALSE; - gGuiIsReady = TRUE; - GlobalConfig.gBootChanged = TRUE; - GlobalConfig.gThemeChanged = TRUE; + AfterTool = false; + gGuiIsReady = true; + GlobalConfig.gBootChanged = true; + GlobalConfig.gThemeChanged = true; do { if (GlobalConfig.gBootChanged && GlobalConfig.gThemeChanged) { // config changed GetListOfDsdts(); //only after GetUserSettings GetListOfACPI(); //ssdt and other tables } - GlobalConfig.gBootChanged = FALSE; + GlobalConfig.gBootChanged = false; MainMenu.Entries.setEmpty(); OptionMenu.Entries.setEmpty(); InitKextList(); @@ -3152,7 +3158,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, if (gThemeNeedInit) { UINTN Size = 0; InitTheme((CHAR8*)GetNvramVariable(L"Clover.Theme", &gEfiAppleBootGuid, NULL, &Size)); - gThemeNeedInit = FALSE; + gThemeNeedInit = false; } else if (GlobalConfig.gThemeChanged) { DBG("change theme\n"); InitTheme(NULL); @@ -3175,7 +3181,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, DBG("after NVRAM boot-args=%s\n", gSettings.Boot.BootArgs.c_str()); GlobalConfig.OptionsBits = EncodeOptions(TmpArgs); // DBG("initial OptionsBits %X\n", GlobalConfig.OptionsBits); - FillInputs(TRUE); + FillInputs(true); // scan for loaders and tools, add then to the menu if (gSettings.GUI.Scan.LegacyFirst){ @@ -3185,7 +3191,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, } } } - GetSmcKeys(TRUE); + GetSmcKeys(true); // Add custom entries AddCustomEntries(); @@ -3248,7 +3254,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, // } } // wait for user ACK when there were errors - FinishTextScreen(FALSE); + FinishTextScreen(false); #if CHECK_SMC DumpSmcKeys(); #endif @@ -3261,7 +3267,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, DefaultEntry = NULL; } - MainLoopRunning = TRUE; + MainLoopRunning = true; // MainMenu.TimeoutSeconds = gSettings.Boot.Timeout >= 0 ? gSettings.Boot.Timeout : 0; if (DefaultEntry && (GlobalConfig.isFastBoot() || (gSettings.Boot.SkipHibernateTimeout && @@ -3276,11 +3282,11 @@ RefitMain (IN EFI_HANDLE ImageHandle, } else if (DefaultEntry->getLEGACY_ENTRY()){ DefaultEntry->StartLegacy(); } - gSettings.Boot.FastBoot = FALSE; //Hmm... will never be here + gSettings.Boot.FastBoot = false; //Hmm... will never be here } -// BOOLEAN MainAnime = MainMenu.GetAnime(); +// XBool MainAnime = MainMenu.GetAnime(); // DBG("MainAnime=%d\n", MainAnime); - AfterTool = FALSE; + AfterTool = false; gEvent = 0; //clear to cancel loop while (MainLoopRunning) { // CHAR8 *LastChosenOS = NULL; @@ -3290,7 +3296,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, } else { MainMenu.GetAnime(); if (GlobalConfig.gThemeChanged) { - GlobalConfig.gThemeChanged = FALSE; + GlobalConfig.gThemeChanged = false; ThemeX.ClearScreen(); } MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry); @@ -3309,11 +3315,11 @@ RefitMain (IN EFI_HANDLE ImageHandle, } if (MenuExit == MENU_EXIT_OPTIONS){ - GlobalConfig.gBootChanged = FALSE; + GlobalConfig.gBootChanged = false; OptionsMenu(&OptionEntry); if (GlobalConfig.gBootChanged) { - AfterTool = TRUE; - MainLoopRunning = FALSE; + AfterTool = true; + MainLoopRunning = false; break; } continue; @@ -3375,25 +3381,25 @@ RefitMain (IN EFI_HANDLE ImageHandle, gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); // Terminate the screen and just exit TerminateScreen(); - MainLoopRunning = FALSE; - ReinitDesktop = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; + ReinitDesktop = false; + AfterTool = true; } if ( ChosenEntry->getREFIT_MENU_ITEM_SHUTDOWN() ) { // It is not Shut Down, it is Exit from Clover TerminateScreen(); // gRT->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); - MainLoopRunning = FALSE; // just in case we get this far - ReinitDesktop = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; // just in case we get this far + ReinitDesktop = false; + AfterTool = true; } if ( ChosenEntry->getREFIT_MENU_ITEM_OPTIONS() ) { // Options like KernelFlags, DSDTname etc. - GlobalConfig.gBootChanged = FALSE; + GlobalConfig.gBootChanged = false; OptionsMenu(&OptionEntry); if (GlobalConfig.gBootChanged) - AfterTool = TRUE; + AfterTool = true; if (GlobalConfig.gBootChanged || GlobalConfig.gThemeChanged) // If theme has changed reinit the desktop - MainLoopRunning = FALSE; + MainLoopRunning = false; } if ( ChosenEntry->getREFIT_MENU_ITEM_ABOUT() ) { // About rEFIt AboutRefit(); @@ -3409,9 +3415,9 @@ RefitMain (IN EFI_HANDLE ImageHandle, ChosenEntry->StartLoader(); //if boot.efi failed we should somehow exit from the loop TerminateScreen(); - MainLoopRunning = FALSE; - ReinitDesktop = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; + ReinitDesktop = false; + AfterTool = true; } if ( ChosenEntry->getLEGACY_ENTRY() ) { // Boot legacy OS if (StrCmp(gST->FirmwareVendor, L"Phoenix Technologies Ltd.") == 0 && @@ -3420,9 +3426,9 @@ RefitMain (IN EFI_HANDLE ImageHandle, // which results in "Operating System not found" message coming from BIOS // in this case just quit Clover to enter BIOS again TerminateScreen(); - MainLoopRunning = FALSE; - ReinitDesktop = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; + ReinitDesktop = false; + AfterTool = true; } else { SetBootCurrent(ChosenEntry->getLEGACY_ENTRY()); ChosenEntry->StartLegacy(); @@ -3435,21 +3441,21 @@ RefitMain (IN EFI_HANDLE ImageHandle, // return EFI_SUCCESS; // BdsLibConnectAllDriversToAllControllers(); // PauseForKey(L"Returned from StartTool\n"); - MainLoopRunning = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; + AfterTool = true; } #ifdef ENABLE_SECURE_BOOT panic("not done yet"); // if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot // EnableSecureBoot(); -// MainLoopRunning = FALSE; -// AfterTool = TRUE; +// MainLoopRunning = false; +// AfterTool = true; // } // // if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT_CONFIG() ) { // Configure secure boot // MainLoopRunning = !ConfigureSecureBoot(); -// AfterTool = TRUE; +// AfterTool = true; // } #endif // ENABLE_SECURE_BOOT @@ -3472,7 +3478,7 @@ panic("not done yet"); UINTN OptionalDataSize; UINTN BootNum; - PrintBootOptions(FALSE); + PrintBootOptions(false); for (EntryIndex = 0; EntryIndex < (INTN)MainMenu.Entries.size(); EntryIndex++) { if (MainMenu.Entries[EntryIndex].Row != 0) { @@ -3514,7 +3520,7 @@ panic("not done yet"); Status = AddBootOptionForFile ( LoaderEntry->Volume->DeviceHandle, LoaderEntry->LoaderPath, - TRUE, + true, Description.wc_str(), OptionalData, OptionalDataSize, @@ -3529,20 +3535,20 @@ panic("not done yet"); } //for (EntryIndex - PrintBootOptions(FALSE); + PrintBootOptions(false); } else if ( LoaderEntry->LoadOptions.contains("BO-REMOVE") ) { - PrintBootOptions(FALSE); + PrintBootOptions(false); Status = DeleteBootOptionForFile (LoaderEntry->Volume->DeviceHandle, LoaderEntry->LoaderPath ); - PrintBootOptions(FALSE); + PrintBootOptions(false); } else if ( LoaderEntry->LoadOptions.contains("BO-PRINT") ) { - PrintBootOptions(TRUE); + PrintBootOptions(true); } } - MainLoopRunning = FALSE; - AfterTool = TRUE; + MainLoopRunning = false; + AfterTool = true; } } //MainLoopRunning UninitRefitLib(); diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 6e4de1716..e586a561f 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -115,7 +115,7 @@ INTN LayoutAnimMoveForMenuX = 0; //static CHAR16 ArrowUp[2] = { ARROW_UP, 0 }; //static CHAR16 ArrowDown[2] = { ARROW_DOWN, 0 }; // -//BOOLEAN MainAnime = FALSE; +//XBool MainAnime = false; // REFIT_MENU_ITEM_OPTIONS MenuEntryOptions (L"Options"_XSW, 1, 0, 'O', ActionEnter); REFIT_MENU_ITEM_ABOUT MenuEntryAbout (L"About Clover"_XSW, 1, 0, 'A', ActionEnter); @@ -129,11 +129,11 @@ REFIT_MENU_SCREEN HelpMenu(3, L"Help"_XSW, L""_XSW); REFIT_MENU_SCREEN OptionMenu(4, L"Options"_XSW, L""_XSW); -void FillInputs(BOOLEAN New) +void FillInputs(XBool New) { UINTN i,j; //for loops CHAR8 tmp[41]; -// BOOLEAN bit; +// XBool bit; tmp[40] = 0; //make it null-terminated @@ -478,7 +478,7 @@ void ApplyInputs(void) { // EFI_STATUS Status = EFI_NOT_FOUND; MACHINE_TYPES Model; - BOOLEAN NeedSave = TRUE; + XBool NeedSave = true; INTN i = 0; UINTN j; @@ -486,7 +486,7 @@ void ApplyInputs(void) if (InputItems[i].Valid) { gSettings.Boot.BootArgs = InputItems[i].SValue; gSettings.Boot.BootArgs.replaceAll('\\', '_'); - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.gBootChanged = true; } i++; //1 if (InputItems[i].Valid) { @@ -505,19 +505,19 @@ void ApplyInputs(void) } //will change theme after ESC - GlobalConfig.gThemeChanged = TRUE; + GlobalConfig.gThemeChanged = true; } i++; //4 if (InputItems[i].Valid) { - GlobalConfig.DropSSDT = InputItems[i].BValue; + GlobalConfig.DropSSDT = InputItems[i].BValue != 0; } i++; //5 if (InputItems[i].Valid) { - gSettings.ACPI.SSDT.Generate.GeneratePStates = InputItems[i].BValue; + gSettings.ACPI.SSDT.Generate.GeneratePStates = InputItems[i].BValue != 0; } i++; //6 if (InputItems[i].Valid) { - gSettings.ACPI.SlpSmiEnable = InputItems[i].BValue; + gSettings.ACPI.SlpSmiEnable = InputItems[i].BValue != 0; } i++; //7 if (InputItems[i].Valid) { @@ -532,23 +532,23 @@ void ApplyInputs(void) } i++; //9 if (InputItems[i].Valid) { - gSettings.ACPI.SSDT.Generate.GenerateCStates = InputItems[i].BValue; + gSettings.ACPI.SSDT.Generate.GenerateCStates = InputItems[i].BValue != 0; } i++; //10 if (InputItems[i].Valid) { - GlobalConfig.EnableC2 = InputItems[i].BValue; + GlobalConfig.EnableC2 = InputItems[i].BValue != 0; } i++; //11 if (InputItems[i].Valid) { - GlobalConfig.EnableC4 = InputItems[i].BValue; + GlobalConfig.EnableC4 = InputItems[i].BValue != 0; } i++; //12 if (InputItems[i].Valid) { - GlobalConfig.EnableC6 = InputItems[i].BValue; + GlobalConfig.EnableC6 = InputItems[i].BValue != 0; } i++; //13 if (InputItems[i].Valid) { - gSettings.ACPI.SSDT.EnableISS = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableISS = InputItems[i].BValue != 0; } i++; //14 if (InputItems[i].Valid) { @@ -557,11 +557,11 @@ void ApplyInputs(void) } i++; //15 if (InputItems[i].Valid) { - gSettings.ACPI.PatchNMI = InputItems[i].BValue; + gSettings.ACPI.PatchNMI = InputItems[i].BValue != 0; } i++; //16 if (InputItems[i].Valid) { - gSettings.Graphics.PatchVBios = InputItems[i].BValue; + gSettings.Graphics.PatchVBios = InputItems[i].BValue != 0; } i++; //17 if (InputItems[i].Valid) { @@ -571,7 +571,7 @@ void ApplyInputs(void) i++; //18 | Download-Fritz: There is no GUI element for BacklightLevel; please revise if (InputItems[i].Valid) { gSettings.SystemParameters.BacklightLevel = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str()); - gSettings.SystemParameters.BacklightLevelConfig = TRUE; + gSettings.SystemParameters.BacklightLevelConfig = true; } i++; //19 if (InputItems[i].Valid) { @@ -588,11 +588,11 @@ void ApplyInputs(void) i++; //21 if (InputItems[i].Valid) { if (gConf.GfxPropertiesArrayNonConst[j].Vendor == Ati) { - gSettings.Graphics.InjectAsDict.InjectATI = InputItems[i].BValue; + gSettings.Graphics.InjectAsDict.InjectATI = InputItems[i].BValue != 0; } else if (gConf.GfxPropertiesArrayNonConst[j].Vendor == Nvidia) { - gSettings.Graphics.InjectAsDict.InjectNVidia = InputItems[i].BValue; + gSettings.Graphics.InjectAsDict.InjectNVidia = InputItems[i].BValue != 0; } else if (gConf.GfxPropertiesArrayNonConst[j].Vendor == Intel) { - gSettings.Graphics.InjectAsDict.InjectIntel = InputItems[i].BValue; + gSettings.Graphics.InjectAsDict.InjectIntel = InputItems[i].BValue != 0; } } i++; //22 @@ -625,44 +625,44 @@ void ApplyInputs(void) } } else { gConf.GfxPropertiesArrayNonConst[j].Connectors = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); - gConf.GfxPropertiesArrayNonConst[j].ConnChanged = TRUE; + gConf.GfxPropertiesArrayNonConst[j].ConnChanged = true; } } i++; //25 if (InputItems[i].Valid) { - gConf.GfxPropertiesArrayNonConst[j].LoadVBios = InputItems[i].BValue; + gConf.GfxPropertiesArrayNonConst[j].LoadVBios = InputItems[i].BValue != 0; } } //end of Graphics Cards // next number == 42 i = 44; if (InputItems[i].Valid) { - GlobalConfig.KextPatchesAllowed = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.KextPatchesAllowed = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //45 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.EightApple = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + gSettings.KernelAndKextPatches.EightApple = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //46 if (InputItems[i].Valid) { - GlobalConfig.KPAppleIntelCPUPM = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.KPAppleIntelCPUPM = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //47 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPAppleRTC = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + gSettings.KernelAndKextPatches.KPAppleRTC = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //48 if (InputItems[i].Valid) { - GlobalConfig.KPKernelPm = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.KPKernelPm = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //49 if (InputItems[i].Valid) { - gSettings.ACPI.FixMCFG = InputItems[i].BValue; + gSettings.ACPI.FixMCFG = InputItems[i].BValue != 0; } i++; //50 @@ -677,7 +677,7 @@ void ApplyInputs(void) i++; //52 if (InputItems[i].Valid) { - gSettings.Graphics.EDID.InjectEDID = InputItems[i].BValue; + gSettings.Graphics.EDID.InjectEDID = InputItems[i].BValue != 0; } i++; //53 if (InputItems[i].Valid) { @@ -688,25 +688,25 @@ void ApplyInputs(void) gSettings.Graphics.EDID.ProductEDID = (UINT16)StrHexToUint64(InputItems[i].SValue.wc_str()); } i++; //55 - // ErmaC: NvidiaGeneric bool(Y/N) + // ErmaC: NvidiaGeneric XBool(Y/N) if (InputItems[i].Valid) { - gSettings.Graphics.NvidiaGeneric = InputItems[i].BValue; + gSettings.Graphics.NvidiaGeneric = InputItems[i].BValue != 0; } i++; //56 if (InputItems[i].Valid) { - gSettings.SystemParameters.NvidiaWeb = InputItems[i].BValue; + gSettings.SystemParameters.NvidiaWeb = InputItems[i].BValue != 0; } i++; //57 if (InputItems[i].Valid) { - gSettings.Devices.Audio.ResetHDA = InputItems[i].BValue; + gSettings.Devices.Audio.ResetHDA = InputItems[i].BValue != 0; } i++; //58 if (InputItems[i].Valid) { - gSettings.Devices.Audio.AFGLowPowerState = InputItems[i].BValue; + gSettings.Devices.Audio.AFGLowPowerState = InputItems[i].BValue != 0; } i++; //59 if (InputItems[i].Valid) { - gSettings.Devices.Audio.HDAInjection = InputItems[i].BValue; + gSettings.Devices.Audio.HDAInjection = InputItems[i].BValue != 0; } i++; //60 if (InputItems[i].Valid) { @@ -714,10 +714,10 @@ void ApplyInputs(void) } i++; //61 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPDELLSMBIOS = InputItems[i].BValue; + gSettings.KernelAndKextPatches.KPDELLSMBIOS = InputItems[i].BValue != 0; // // yes, we do need to change gRemapSmBiosIsRequire here as well // gRemapSmBiosIsRequire = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.gBootChanged = true; } i++; //62 if (InputItems[i].Valid) { @@ -731,8 +731,8 @@ void ApplyInputs(void) } i++; //64 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPDebug = InputItems[i].BValue; - // GlobalConfig.gBootChanged = TRUE; + gSettings.KernelAndKextPatches.KPDebug = InputItems[i].BValue != 0; + // GlobalConfig.gBootChanged = true; } // CSR @@ -778,13 +778,13 @@ void ApplyInputs(void) } i++; //72 if (InputItems[i].Valid) { - gSettings.GUI.Mouse.PointerMirror = InputItems[i].BValue; + gSettings.GUI.Mouse.PointerMirror = InputItems[i].BValue != 0; } i = 74; if (InputItems[i].Valid) { - gSettings.Devices.USB.USBFixOwnership = InputItems[i].BValue; + gSettings.Devices.USB.USBFixOwnership = InputItems[i].BValue != 0; } i++; //75 if (InputItems[i].Valid) { @@ -850,11 +850,11 @@ void ApplyInputs(void) i++; //88 if (InputItems[i].Valid) { - gSettings.ACPI.SSDT.DoubleFirstState = InputItems[i].BValue; + gSettings.ACPI.SSDT.DoubleFirstState = InputItems[i].BValue != 0; } i++; //89 if (InputItems[i].Valid) { - gSettings.ACPI.SSDT.EnableC7 = InputItems[i].BValue; + gSettings.ACPI.SSDT.EnableC7 = InputItems[i].BValue != 0; } i++; //90 @@ -862,28 +862,28 @@ void ApplyInputs(void) // TagDict* dict; /*Status = */gConf.ReLoadConfig(XStringW(ConfigsList[OldChosenConfig])/*, &dict*/); // TODO: make a ReloadConfig, because in case of a reload, there are probably slightly different things to do. // if (!EFI_ERROR(Status)) { - GlobalConfig.gBootChanged = TRUE; - GlobalConfig.gThemeChanged = TRUE; + GlobalConfig.gBootChanged = true; + GlobalConfig.gThemeChanged = true; // Status = GetUserSettings(dict, gSettings); // if (gConfigDict[2]) gConfigDict[2]->FreeTag(); // gConfigDict[2] = dict; // GlobalConfig.ConfigName.takeValueFrom(ConfigsList[OldChosenConfig]); // } - FillInputs(FALSE); - NeedSave = FALSE; + FillInputs(false); + NeedSave = false; } i++; //91 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPKernelLapic = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + gSettings.KernelAndKextPatches.KPKernelLapic = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //92 if (InputItems[i].Valid) { - gSettings.Devices.USB.USBInjection = InputItems[i].BValue; + gSettings.Devices.USB.USBInjection = InputItems[i].BValue != 0; } i++; //93 if (InputItems[i].Valid) { - gSettings.Devices.USB.InjectClockID = InputItems[i].BValue; + gSettings.Devices.USB.InjectClockID = InputItems[i].BValue != 0; } i++; //94 if (InputItems[i].Valid) { @@ -938,7 +938,7 @@ void ApplyInputs(void) } i++; //102 if (InputItems[i].Valid) { - gSettings.ACPI.DSDT.DebugDSDT = InputItems[i].BValue; + gSettings.ACPI.DSDT.DebugDSDT = InputItems[i].BValue != 0; } i++; //103 if (InputItems[i].Valid) { @@ -949,30 +949,30 @@ void ApplyInputs(void) if (InputItems[i].Valid) { gSettings.KernelAndKextPatches.FakeCPUID = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str()); DBG("applied FakeCPUID=%06X\n", gSettings.KernelAndKextPatches.FakeCPUID); - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.gBootChanged = true; } i++; //105 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPKernelXCPM = InputItems[i].BValue; + gSettings.KernelAndKextPatches.KPKernelXCPM = InputItems[i].BValue != 0; DBG("applied KernelXCPM\n"); - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.gBootChanged = true; } i++; //106 if (InputItems[i].Valid) { - gSettings.Devices.StringInjector = InputItems[i].BValue; + gSettings.Devices.StringInjector = InputItems[i].BValue != 0; } i++; //107 if (InputItems[i].Valid) { - gSettings.Devices.NoDefaultProperties = InputItems[i].BValue; + gSettings.Devices.NoDefaultProperties = InputItems[i].BValue != 0; } i++; //108 if (InputItems[i].Valid) { - GlobalConfig.KernelPatchesAllowed = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + GlobalConfig.KernelPatchesAllowed = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //109 @@ -983,12 +983,12 @@ void ApplyInputs(void) i++; //110 if (InputItems[i].Valid) { - gSettings.Graphics.NvidiaNoEFI = InputItems[i].BValue; + gSettings.Graphics.NvidiaNoEFI = InputItems[i].BValue != 0; } i++; //111 if (InputItems[i].Valid) { - gSettings.Graphics.NvidiaSingle = InputItems[i].BValue; + gSettings.Graphics.NvidiaSingle = InputItems[i].BValue != 0; } i++; //112 if (InputItems[i].Valid) { @@ -996,15 +996,15 @@ void ApplyInputs(void) } i++; //113 if (InputItems[i].Valid) { - gSettings.ACPI.AutoMerge = InputItems[i].BValue; + gSettings.ACPI.AutoMerge = InputItems[i].BValue != 0; } i++; //114 if (InputItems[i].Valid) { - gSettings.Graphics.RadeonDeInit = InputItems[i].BValue; + gSettings.Graphics.RadeonDeInit = InputItems[i].BValue != 0; } i++; //115 if (InputItems[i].Valid) { - gSettings.SystemParameters.NoCaches = InputItems[i].BValue; + gSettings.SystemParameters.NoCaches = InputItems[i].BValue != 0; } i++; //116 if (InputItems[i].Valid) { @@ -1061,8 +1061,8 @@ void ApplyInputs(void) } i++; //121 if (InputItems[i].Valid) { - gSettings.KernelAndKextPatches.KPPanicNoKextDump = InputItems[i].BValue; - GlobalConfig.gBootChanged = TRUE; + gSettings.KernelAndKextPatches.KPPanicNoKextDump = InputItems[i].BValue != 0; + GlobalConfig.gBootChanged = true; } i++; //122 if (InputItems[i].Valid) { @@ -1071,12 +1071,12 @@ void ApplyInputs(void) } i++; //123 if (InputItems[i].Valid) { - gSettings.GUI.ProvideConsoleGop = InputItems[i].BValue; + gSettings.GUI.ProvideConsoleGop = InputItems[i].BValue != 0; DBG("applied ConsoleGopEnable=%s\n", gSettings.GUI.ProvideConsoleGop ? "Y" : "N" ); } i++; //124 if (InputItems[i].Valid) { - gSettings.ACPI.FixHeaders = InputItems[i].BValue; + gSettings.ACPI.FixHeaders = InputItems[i].BValue != 0; DBG("applied gSettings.ACPI.FixHeaders=%s\n", gSettings.ACPI.FixHeaders ? "Y" : "N" ); } i++; //125 @@ -1594,27 +1594,27 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_GRAPHICS, "Graphics Injector->"_XS8); SubScreen->AddMenuInfoLine_f("Number of VideoCard%s=%zu",((gConf.GfxPropertiesArray.size()!=1)?"s":""), gConf.GfxPropertiesArray.size()); - SubScreen->AddMenuItemInput(52, "InjectEDID", FALSE); - SubScreen->AddMenuItemInput(53, "Fake Vendor EDID:", TRUE); - SubScreen->AddMenuItemInput(54, "Fake Product EDID:", TRUE); - SubScreen->AddMenuItemInput(18, "Backlight Level:", TRUE); - SubScreen->AddMenuItemInput(112, "Intel Max Backlight:", TRUE); //gSettings.Devices.IntelMaxValue + SubScreen->AddMenuItemInput(52, "InjectEDID", false); + SubScreen->AddMenuItemInput(53, "Fake Vendor EDID:", true); + SubScreen->AddMenuItemInput(54, "Fake Product EDID:", true); + SubScreen->AddMenuItemInput(18, "Backlight Level:", true); + SubScreen->AddMenuItemInput(112, "Intel Max Backlight:", true); //gSettings.Devices.IntelMaxValue for (UINTN i = 0; i < gConf.GfxPropertiesArray.size(); i++) { SubScreen->AddMenuInfo_f("----------------------"); SubScreen->AddMenuInfo_f("Card DeviceID=%04hx", gConf.GfxPropertiesArray[i].DeviceID); UINTN N = 20 + i * 6; - SubScreen->AddMenuItemInput(N, "Model:", TRUE); + SubScreen->AddMenuItemInput(N, "Model:", true); if (gConf.GfxPropertiesArray[i].Vendor == Nvidia) { - SubScreen->AddMenuItemInput(N+1, "InjectNVidia", FALSE); + SubScreen->AddMenuItemInput(N+1, "InjectNVidia", false); } else if (gConf.GfxPropertiesArray[i].Vendor == Ati) { - SubScreen->AddMenuItemInput(N+1, "InjectATI", FALSE); + SubScreen->AddMenuItemInput(N+1, "InjectATI", false); } else if (gConf.GfxPropertiesArray[i].Vendor == Intel) { - SubScreen->AddMenuItemInput(N+1, "InjectIntel", FALSE); + SubScreen->AddMenuItemInput(N+1, "InjectIntel", false); } else { - SubScreen->AddMenuItemInput(N+1, "InjectX3", FALSE); + SubScreen->AddMenuItemInput(N+1, "InjectX3", false); } UINTN Ven = 97; //it can be used for non Ati, Nvidia, Intel in QEMU for example @@ -1627,42 +1627,42 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics() } if ((gConf.GfxPropertiesArray[i].Vendor == Ati) || (gConf.GfxPropertiesArray[i].Vendor == Intel)) { - SubScreen->AddMenuItemInput(109, "DualLink:", TRUE); + SubScreen->AddMenuItemInput(109, "DualLink:", true); } if (gConf.GfxPropertiesArray[i].Vendor == Ati) { - SubScreen->AddMenuItemInput(114, "DeInit:", TRUE); + SubScreen->AddMenuItemInput(114, "DeInit:", true); } - SubScreen->AddMenuItemInput(Ven, "FakeID:", TRUE); + SubScreen->AddMenuItemInput(Ven, "FakeID:", true); if (gConf.GfxPropertiesArray[i].Vendor == Nvidia) { - SubScreen->AddMenuItemInput(N+2, "DisplayCFG:", TRUE); + SubScreen->AddMenuItemInput(N+2, "DisplayCFG:", true); } else if (gConf.GfxPropertiesArray[i].Vendor == Ati) { - SubScreen->AddMenuItemInput(N+2, "FBConfig:", TRUE); + SubScreen->AddMenuItemInput(N+2, "FBConfig:", true); } else /*if (gGraphics[i].Vendor == Intel)*/{ - SubScreen->AddMenuItemInput(N+2, "*-platform-id:", TRUE); + SubScreen->AddMenuItemInput(N+2, "*-platform-id:", true); } // ErmaC: NvidiaGeneric entry if (gConf.GfxPropertiesArray[i].Vendor == Nvidia) { - SubScreen->AddMenuItemInput(55, "Generic NVIDIA name", FALSE); - SubScreen->AddMenuItemInput(110, "NVIDIA No EFI", FALSE); - SubScreen->AddMenuItemInput(111, "NVIDIA Single", FALSE); - SubScreen->AddMenuItemInput(56, "Use NVIDIA WEB drivers", FALSE); + SubScreen->AddMenuItemInput(55, "Generic NVIDIA name", false); + SubScreen->AddMenuItemInput(110, "NVIDIA No EFI", false); + SubScreen->AddMenuItemInput(111, "NVIDIA Single", false); + SubScreen->AddMenuItemInput(56, "Use NVIDIA WEB drivers", false); } if (gConf.GfxPropertiesArray[i].Vendor == Intel) { continue; } - SubScreen->AddMenuItemInput(N+3, "Ports:", TRUE); + SubScreen->AddMenuItemInput(N+3, "Ports:", true); if (gConf.GfxPropertiesArray[i].Vendor == Nvidia) { - SubScreen->AddMenuItemInput(N+4, "NVCAP:", TRUE); + SubScreen->AddMenuItemInput(N+4, "NVCAP:", true); } else { - SubScreen->AddMenuItemInput(N+4, "Connectors:", TRUE); - SubScreen->AddMenuItemInput(50, "RefCLK:", TRUE); + SubScreen->AddMenuItemInput(N+4, "Connectors:", true); + SubScreen->AddMenuItemInput(50, "RefCLK:", true); } - SubScreen->AddMenuItemInput(N+5, "Load Video Bios", FALSE); + SubScreen->AddMenuItemInput(N+5, "Load Video Bios", false); } SubScreen->AddMenuEntry(&MenuEntryReturn, false); @@ -1694,14 +1694,14 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio() ); } - //SubScreen->AddMenuItemInput(59, "HDAInjection", FALSE); + //SubScreen->AddMenuItemInput(59, "HDAInjection", false); if (gSettings.Devices.Audio.HDAInjection) { - SubScreen->AddMenuItemInput(60, "HDALayoutId:", TRUE); + SubScreen->AddMenuItemInput(60, "HDALayoutId:", true); } // avaiable configuration - SubScreen->AddMenuItemInput(57, "ResetHDA", FALSE); - SubScreen->AddMenuItemInput(58, "AFGLowPowerState", FALSE); + SubScreen->AddMenuItemInput(57, "ResetHDA", false); + SubScreen->AddMenuItemInput(58, "AFGLowPowerState", false); // return SubScreen->AddMenuEntry(&MenuEntryReturn, false); @@ -1716,7 +1716,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSpeedStep() REFIT_MENU_SCREEN *SubScreen; Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_CPU, "CPU tuning->"_XS8); - SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString); + SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString.c_str()); SubScreen->AddMenuInfoLine_f("Model: %2X/%2X/%2X", gCPUStructure.Family, gCPUStructure.Model, gCPUStructure.Stepping); SubScreen->AddMenuInfoLine_f("Cores: %d Threads: %d", @@ -1730,23 +1730,23 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSpeedStep() nya(gCPUStructure.Turbo4), nya(gCPUStructure.Turbo3), nya(gCPUStructure.Turbo2), nya(gCPUStructure.Turbo1)); - SubScreen->AddMenuItemInput(76, "Cores enabled:", TRUE); - SubScreen->AddMenuItemInput(6, "Halt Enabler", FALSE); - SubScreen->AddMenuItemInput(7, "PLimitDict:", TRUE); - SubScreen->AddMenuItemInput(8, "UnderVoltStep:", TRUE); - SubScreen->AddMenuItemInput(88, "DoubleFirstState", FALSE); - SubScreen->AddMenuItemInput(5, "GeneratePStates", FALSE); - SubScreen->AddMenuItemInput(9, "GenerateCStates", FALSE); - SubScreen->AddMenuItemInput(10, "EnableC2", FALSE); - SubScreen->AddMenuItemInput(11, "EnableC4", FALSE); - SubScreen->AddMenuItemInput(12, "EnableC6", FALSE); - SubScreen->AddMenuItemInput(89, "EnableC7", FALSE); - SubScreen->AddMenuItemInput(13, "Use SystemIO", FALSE); - SubScreen->AddMenuItemInput(75, "C3Latency:", TRUE); - SubScreen->AddMenuItemInput(19, "BusSpeed [kHz]:", TRUE); - SubScreen->AddMenuItemInput(14, "QPI [MHz]:", TRUE); - SubScreen->AddMenuItemInput(77, "Saving Mode:", TRUE); - SubScreen->AddMenuItemInput(15, "PatchAPIC", FALSE); //-> move to ACPI? + SubScreen->AddMenuItemInput(76, "Cores enabled:", true); + SubScreen->AddMenuItemInput(6, "Halt Enabler", false); + SubScreen->AddMenuItemInput(7, "PLimitDict:", true); + SubScreen->AddMenuItemInput(8, "UnderVoltStep:", true); + SubScreen->AddMenuItemInput(88, "DoubleFirstState", false); + SubScreen->AddMenuItemInput(5, "GeneratePStates", false); + SubScreen->AddMenuItemInput(9, "GenerateCStates", false); + SubScreen->AddMenuItemInput(10, "EnableC2", false); + SubScreen->AddMenuItemInput(11, "EnableC4", false); + SubScreen->AddMenuItemInput(12, "EnableC6", false); + SubScreen->AddMenuItemInput(89, "EnableC7", false); + SubScreen->AddMenuItemInput(13, "Use SystemIO", false); + SubScreen->AddMenuItemInput(75, "C3Latency:", true); + SubScreen->AddMenuItemInput(19, "BusSpeed [kHz]:", true); + SubScreen->AddMenuItemInput(14, "QPI [MHz]:", true); + SubScreen->AddMenuItemInput(77, "Saving Mode:", true); + SubScreen->AddMenuItemInput(15, "PatchAPIC", false); //-> move to ACPI? SubScreen->AddMenuEntry(&MenuEntryReturn, false); return Entry; @@ -1868,11 +1868,11 @@ LOADER_ENTRY* LOADER_ENTRY::SubMenuKextInjectMgmt() } XStringW kextDir; - kextDir = GetOtherKextsDir(TRUE); + kextDir = GetOtherKextsDir(true); if ( kextDir.notEmpty() ) { SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Other"_XS8), true); } - kextDir = GetOtherKextsDir(FALSE); + kextDir = GetOtherKextsDir(false); if ( kextDir.notEmpty() ) { SubSubScreen->AddMenuEntry(SubMenuKextBlockInjection("Off"_XS8), true); } @@ -1936,24 +1936,24 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuBinaries() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_BINARIES, "Binaries patching->"_XS8); - SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString); + SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString.c_str()); SubScreen->AddMenuInfoLine_f("Real CPUID: 0x%06X", gCPUStructure.Signature); - SubScreen->AddMenuItemInput(64, "Debug", FALSE); + SubScreen->AddMenuItemInput(64, "Debug", false); SubScreen->AddMenuInfo_f("----------------------"); - SubScreen->AddMenuItemInput(104, "Fake CPUID:", TRUE); - SubScreen->AddMenuItemInput(91, "Kernel Lapic", FALSE); - SubScreen->AddMenuItemInput(105, "Kernel XCPM", FALSE); - SubScreen->AddMenuItemInput(48, "Kernel PM", FALSE); - SubScreen->AddMenuItemInput(121, "Panic No Kext Dump", FALSE); + SubScreen->AddMenuItemInput(104, "Fake CPUID:", true); + SubScreen->AddMenuItemInput(91, "Kernel Lapic", false); + SubScreen->AddMenuItemInput(105, "Kernel XCPM", false); + SubScreen->AddMenuItemInput(48, "Kernel PM", false); + SubScreen->AddMenuItemInput(121, "Panic No Kext Dump", false); SubScreen->AddMenuEntry(SubMenuKernelPatches(), true); SubScreen->AddMenuInfo_f("----------------------"); - SubScreen->AddMenuItemInput(46, "AppleIntelCPUPM Patch", FALSE); - SubScreen->AddMenuItemInput(47, "AppleRTC Patch", FALSE); - SubScreen->AddMenuItemInput(45, "No 8 Apples Patch", FALSE); - SubScreen->AddMenuItemInput(61, "Dell SMBIOS Patch", FALSE); -// SubScreen->AddMenuItemInput(115, "No Caches", FALSE); -// SubScreen->AddMenuItemInput(44, "Kext patching allowed", FALSE); + SubScreen->AddMenuItemInput(46, "AppleIntelCPUPM Patch", false); + SubScreen->AddMenuItemInput(47, "AppleRTC Patch", false); + SubScreen->AddMenuItemInput(45, "No 8 Apples Patch", false); + SubScreen->AddMenuItemInput(61, "Dell SMBIOS Patch", false); +// SubScreen->AddMenuItemInput(115, "No Caches", false); +// SubScreen->AddMenuItemInput(44, "Kext patching allowed", false); SubScreen->AddMenuEntry(SubMenuKextPatches(), true); SubScreen->AddMenuInfo_f("----------------------"); SubScreen->AddMenuEntry(SubMenuBootPatches(), true); @@ -1997,8 +1997,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropTables() } } - SubScreen->AddMenuItemInput(4, "Drop all OEM SSDT", FALSE); - SubScreen->AddMenuItemInput(113, "Automatic smart merge", FALSE); + SubScreen->AddMenuItemInput(4, "Drop all OEM SSDT", false); + SubScreen->AddMenuItemInput(113, "Automatic smart merge", false); for ( size_t idx = 0 ; idx < ACPIPatchedAML.size() ; ++idx) { ACPI_PATCHED_AML& ACPIPatchedAMLTmp = ACPIPatchedAML[idx]; @@ -2023,26 +2023,26 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_SMBIOS, "SMBIOS->"_XS8); - SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString); + SubScreen->AddMenuInfoLine_f("%s", gCPUStructure.BrandString.c_str()); SubScreen->AddMenuInfoLine_f("%s", GlobalConfig.OEMProductFromSmbios.c_str()); SubScreen->AddMenuInfoLine_f("with board %s", GlobalConfig.OEMBoardFromSmbios.c_str()); - SubScreen->AddMenuItemInput(78, "Product Name:", TRUE); - SubScreen->AddMenuItemInput(79, "Product Version:", TRUE); - SubScreen->AddMenuItemInput(80, "Product SN:", TRUE); - SubScreen->AddMenuItemInput(81, "Board ID:", TRUE); - SubScreen->AddMenuItemInput(82, "Board SN:", TRUE); - SubScreen->AddMenuItemInput(83, "Board Type:", TRUE); - SubScreen->AddMenuItemInput(84, "Board Version:", TRUE); - SubScreen->AddMenuItemInput(85, "Chassis Type:", TRUE); - SubScreen->AddMenuItemInput(86, "ROM Version:", TRUE); - SubScreen->AddMenuItemInput(87, "ROM Release Date:", TRUE); - SubScreen->AddMenuItemInput(62, "FirmwareFeatures:", TRUE); - SubScreen->AddMenuItemInput(63, "FirmwareFeaturesMask:", TRUE); - SubScreen->AddMenuItemInput(125, "ExtendedFirmwareFeatures:", TRUE); - SubScreen->AddMenuItemInput(126, "ExtendedFirmwareFeaturesMask:", TRUE); - SubScreen->AddMenuItemInput(17, "PlatformFeature:", TRUE); - SubScreen->AddMenuItemInput(117, "EFI Version:", TRUE); + SubScreen->AddMenuItemInput(78, "Product Name:", true); + SubScreen->AddMenuItemInput(79, "Product Version:", true); + SubScreen->AddMenuItemInput(80, "Product SN:", true); + SubScreen->AddMenuItemInput(81, "Board ID:", true); + SubScreen->AddMenuItemInput(82, "Board SN:", true); + SubScreen->AddMenuItemInput(83, "Board Type:", true); + SubScreen->AddMenuItemInput(84, "Board Version:", true); + SubScreen->AddMenuItemInput(85, "Chassis Type:", true); + SubScreen->AddMenuItemInput(86, "ROM Version:", true); + SubScreen->AddMenuItemInput(87, "ROM Release Date:", true); + SubScreen->AddMenuItemInput(62, "FirmwareFeatures:", true); + SubScreen->AddMenuItemInput(63, "FirmwareFeaturesMask:", true); + SubScreen->AddMenuItemInput(125, "ExtendedFirmwareFeatures:", true); + SubScreen->AddMenuItemInput(126, "ExtendedFirmwareFeaturesMask:", true); + SubScreen->AddMenuItemInput(17, "PlatformFeature:", true); + SubScreen->AddMenuItemInput(117, "EFI Version:", true); SubScreen->AddMenuEntry(&MenuEntryReturn, false); return Entry; @@ -2132,7 +2132,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdts() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_ACPI, "Dsdt name->"_XS8); SubScreen->AddMenuInfoLine_f("Select a DSDT file:"); - SubScreen->AddMenuItemSwitch(116, "BIOS.aml", FALSE); + SubScreen->AddMenuItemSwitch(116, "BIOS.aml", false); for (i = 0; i < DsdtsList.size(); i++) { InputBootArgs = new REFIT_MENU_SWITCH; @@ -2161,14 +2161,14 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuACPI() // submenu description SubScreen->AddMenuInfoLine_f("Choose options to patch ACPI"); - SubScreen->AddMenuItemInput(102, "Debug DSDT", FALSE); + SubScreen->AddMenuItemInput(102, "Debug DSDT", false); SubScreen->AddMenuEntry(SubMenuDsdts(), true); SubScreen->AddMenuEntry(SubMenuDropTables(), true); // SubScreen->AddMenuEntry(SubMenuDropDSM(), true); SubScreen->AddMenuEntry(SubMenuDsdtFix(), true); SubScreen->AddMenuEntry(SubMenuDSDTPatches(), true); - SubScreen->AddMenuItemInput(49, "Fix MCFG", FALSE); + SubScreen->AddMenuItemInput(49, "Fix MCFG", false); SubScreen->AddMenuItemInput(124, "Fix Headers", gSettings.ACPI.FixHeaders); SubScreen->AddMenuEntry(&MenuEntryReturn, false); @@ -2185,7 +2185,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuAudioPort() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_AUDIOPORTS, "Startup sound output->"_XS8); SubScreen->AddMenuInfoLine_f("Select an audio output, press F7 to test"); - SubScreen->AddMenuItemInput(120, "Volume:", TRUE); + SubScreen->AddMenuItemInput(120, "Volume:", true); for (i = 0; i < AudioList.size(); i++) { InputBootArgs = new REFIT_MENU_SWITCH; @@ -2372,16 +2372,16 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuPCI() Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_USB, "PCI devices->"_XS8); - SubScreen->AddMenuItemInput(74, "USB Ownership", FALSE); - SubScreen->AddMenuItemInput(92, "USB Injection", FALSE); - SubScreen->AddMenuItemInput(93, "Inject ClockID", FALSE); - SubScreen->AddMenuItemInput(106, "Inject EFI Strings", FALSE); - SubScreen->AddMenuItemInput(107, "No Default Properties", FALSE); - SubScreen->AddMenuItemInput(97, "FakeID LAN:", TRUE); - SubScreen->AddMenuItemInput(98, "FakeID WIFI:", TRUE); - SubScreen->AddMenuItemInput(99, "FakeID SATA:", TRUE); - SubScreen->AddMenuItemInput(100, "FakeID XHCI:", TRUE); - SubScreen->AddMenuItemInput(103, "FakeID IMEI:", TRUE); + SubScreen->AddMenuItemInput(74, "USB Ownership", false); + SubScreen->AddMenuItemInput(92, "USB Injection", false); + SubScreen->AddMenuItemInput(93, "Inject ClockID", false); + SubScreen->AddMenuItemInput(106, "Inject EFI Strings", false); + SubScreen->AddMenuItemInput(107, "No Default Properties", false); + SubScreen->AddMenuItemInput(97, "FakeID LAN:", true); + SubScreen->AddMenuItemInput(98, "FakeID WIFI:", true); + SubScreen->AddMenuItemInput(99, "FakeID SATA:", true); + SubScreen->AddMenuItemInput(100, "FakeID XHCI:", true); + SubScreen->AddMenuItemInput(103, "FakeID IMEI:", true); // SubScreen->AddMenuEntry(SubMenuCustomDevices(), true); SubScreen->AddMenuEntry(SubMenuProperties(), true); SubScreen->AddMenuEntry(SubMenuArbProperties(), true); @@ -2404,7 +2404,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuThemes() SubScreen->AddMenuInfoLine_f("Installed themes:"); //add embedded - SubScreen->AddMenuItemSwitch(3, "embedded", FALSE); + SubScreen->AddMenuItemSwitch(3, "embedded", false); for (i = 0; i < ThemeNameArray.size(); i++) { InputBootArgs = new REFIT_MENU_SWITCH; @@ -2432,8 +2432,8 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuGUI() // submenu description SubScreen->AddMenuInfoLine_f("Choose options to tune the Interface"); - SubScreen->AddMenuItemInput(70, "Pointer Speed:", TRUE); - SubScreen->AddMenuItemInput(72, "Mirror Move", FALSE); + SubScreen->AddMenuItemInput(70, "Pointer Speed:", true); + SubScreen->AddMenuItemInput(72, "Mirror Move", false); SubScreen->AddMenuEntry(SubMenuThemes(), true); @@ -2521,9 +2521,9 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSystem() // submenu description SubScreen->AddMenuInfoLine_f("Choose options for booted OS"); - SubScreen->AddMenuItemInput(2, "Block kext:", TRUE); - SubScreen->AddMenuItemInput(51, "Set OS version if not detected:", TRUE); - SubScreen->AddMenuItemInput(118, "Booter Cfg Command:", TRUE); + SubScreen->AddMenuItemInput(2, "Block kext:", true); + SubScreen->AddMenuItemInput(51, "Set OS version if not detected:", true); + SubScreen->AddMenuItemInput(118, "Booter Cfg Command:", true); SubScreen->AddMenuEntry(SubMenuCSR(), true); SubScreen->AddMenuEntry(SubMenuBLC(), true); @@ -2581,10 +2581,10 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuQuirks() SubScreen->AddMenuCheck("ProtectMemoryRegions", QUIRK_REGION, 101); SubScreen->AddMenuCheck("ProtectSecureBoot", QUIRK_SECURE, 101); SubScreen->AddMenuCheck("ProtectUefiServices", QUIRK_UEFI, 101); - SubScreen->AddMenuItemInput(123, "ProvideConsoleGopEnable", FALSE); + SubScreen->AddMenuItemInput(123, "ProvideConsoleGopEnable", false); SubScreen->AddMenuCheck("ProvideCustomSlide", QUIRK_CUSTOM, 101); //decimal - SubScreen->AddMenuItemInput(122, "ProvideMaxSlide:", TRUE); + SubScreen->AddMenuItemInput(122, "ProvideMaxSlide:", true); SubScreen->AddMenuCheck("RebuildAppleMemoryMap", QUIRK_MAP, 101); SubScreen->AddMenuCheck("SetupVirtualMap", QUIRK_VIRT, 101); SubScreen->AddMenuCheck("SignalAppleOS", QUIRK_OS, 101); @@ -2612,8 +2612,8 @@ void OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) INTN SubEntryIndex = -1; //value -1 means old position to remember INTN NextEntryIndex = -1; - BOOLEAN OldFontStyle = ThemeX.Proportional; - ThemeX.Proportional = FALSE; //temporary disable proportional + XBool OldFontStyle = ThemeX.Proportional; + ThemeX.Proportional = false; //temporary disable proportional // if (AllowGraphicsMode) { // Style = &REFIT_MENU_SCREEN::GraphicsMenuStyle; @@ -2621,20 +2621,20 @@ void OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry) // remember, if you extended this menu then change procedures // FillInputs and ApplyInputs - gThemeOptionsChanged = FALSE; + gThemeOptionsChanged = false; if (OptionMenu.Entries.size() == 0) { OptionMenu.Daylight = ThemeX.Daylight; if (!(ThemeX.HideUIFlags & HIDEUI_FLAG_MENU_TITLE_IMAGE)) { OptionMenu.TitleImage = ThemeX.GetIcon(BUILTIN_ICON_FUNC_OPTIONS); } - gThemeOptionsChanged = TRUE; + gThemeOptionsChanged = true; OptionMenu.ID = SCREEN_OPTIONS; - OptionMenu.GetAnime(); //FALSE; + OptionMenu.GetAnime(); //false; - OptionMenu.AddMenuItemInput(0, "Boot Args:", TRUE); + OptionMenu.AddMenuItemInput(0, "Boot Args:", true); -// AddMenuItemInput(&OptionMenu, 90, "Config:", TRUE); +// AddMenuItemInput(&OptionMenu, 90, "Config:", true); // InputBootArgs->ShortcutDigit = 0xF1; OptionMenu.AddMenuEntry( SubMenuConfigs(), true); diff --git a/rEFIt_UEFI/refit/menu.h b/rEFIt_UEFI/refit/menu.h index 80590168d..904df9d55 100644 --- a/rEFIt_UEFI/refit/menu.h +++ b/rEFIt_UEFI/refit/menu.h @@ -8,7 +8,7 @@ class REFIT_MAINMENU_SCREEN; //void AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CONST CHAR16 *InfoLine); //void AddMenuInfo(IN REFIT_MENU_SCREEN *SubScreen, IN CONST CHAR16 *Line); -//void AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry, bool freeIt); +//void AddMenuEntry(IN REFIT_MENU_SCREEN *Screen, IN REFIT_MENU_ENTRY *Entry, XBool freeIt); //void AddMenuCheck(REFIT_MENU_SCREEN *SubScreen, CONST CHAR8 *Text, UINTN Bit, INTN ItemNum); //void FreeMenu(IN REFIT_MENU_SCREEN *Screen); //UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry); @@ -38,7 +38,7 @@ void FreeScrollBar(void); void FillInputs ( - BOOLEAN New + XBool New ); void diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index cdd62444b..1b937552d 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -62,14 +62,14 @@ UINTN ConHeight; CHAR16 *BlankLine = NULL; INTN BanHeight = 0; -static void SwitchToText(IN BOOLEAN CursorEnabled); +static void SwitchToText(IN XBool CursorEnabled); static void SwitchToGraphics(void); static void DrawScreenHeader(IN CONST CHAR16 *Title); static void UpdateConsoleVars(void); static INTN ConvertEdgeAndPercentageToPixelPosition(INTN Edge, INTN DesiredPercentageFromEdge, INTN ImageDimension, INTN ScreenDimension); INTN CalculateNudgePosition(INTN Position, INTN NudgeValue, INTN ImageDimension, INTN ScreenDimension); //INTN RecalculateImageOffset(INTN AnimDimension, INTN ValueToScale, INTN ScreenDimensionToFit, INTN ThemeDesignDimension); -static BOOLEAN IsImageWithinScreenLimits(INTN Value, INTN ImageDimension, INTN ScreenDimension); +static XBool IsImageWithinScreenLimits(INTN Value, INTN ImageDimension, INTN ScreenDimension); static INTN RepositionFixedByCenter(INTN Value, INTN ScreenDimension, INTN DesignScreenDimension); static INTN RepositionRelativeByGapsOnEdges(INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension); INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension); @@ -77,7 +77,7 @@ INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN Screen INTN UGAWidth; INTN UGAHeight; -BOOLEAN AllowGraphicsMode; +XBool AllowGraphicsMode; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL InputBackgroundPixel = { 0xcf, 0xcf, 0xcf, 0x80}; @@ -89,7 +89,7 @@ const EFI_GRAPHICS_OUTPUT_BLT_PIXEL WhitePixel = { 0xff, 0xff, 0xff, 0xff}; const EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlackPixel = { 0x00, 0x00, 0x00, 0xff}; EFI_GRAPHICS_OUTPUT_BLT_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; -static BOOLEAN GraphicsScreenDirty; +static XBool GraphicsScreenDirty; // general defines and variables @@ -97,7 +97,7 @@ static BOOLEAN GraphicsScreenDirty; // Screen initialization and switching // -void InitScreen(IN BOOLEAN SetMaxResolution) +void InitScreen(IN XBool SetMaxResolution) { //DbgHeader("InitScreen"); // initialize libeg @@ -105,16 +105,16 @@ void InitScreen(IN BOOLEAN SetMaxResolution) if (egHasGraphicsMode()) { egGetScreenSize(&UGAWidth, &UGAHeight); - AllowGraphicsMode = TRUE; + AllowGraphicsMode = true; } else { - AllowGraphicsMode = FALSE; - //egSetGraphicsModeEnabled(FALSE); // just to be sure we are in text mode + AllowGraphicsMode = false; + //egSetGraphicsModeEnabled(false); // just to be sure we are in text mode } - GraphicsScreenDirty = TRUE; + GraphicsScreenDirty = true; // disable cursor - gST->ConOut->EnableCursor(gST->ConOut, FALSE); + gST->ConOut->EnableCursor(gST->ConOut, false); UpdateConsoleVars(); @@ -126,28 +126,28 @@ void SetupScreen(void) { if (gSettings.GUI.TextOnly) { // switch to text mode if requested - AllowGraphicsMode = FALSE; - SwitchToText(FALSE); + AllowGraphicsMode = false; + SwitchToText(false); } else if (AllowGraphicsMode) { // clear screen and show banner // (now we know we'll stay in graphics mode) SwitchToGraphics(); - //BltClearScreen(TRUE); + //BltClearScreen(true); } } -static void SwitchToText(IN BOOLEAN CursorEnabled) +static void SwitchToText(IN XBool CursorEnabled) { - egSetGraphicsModeEnabled(FALSE); + egSetGraphicsModeEnabled(false); gST->ConOut->EnableCursor(gST->ConOut, CursorEnabled); } static void SwitchToGraphics(void) { if (AllowGraphicsMode && !egIsGraphicsModeEnabled()) { - InitScreen(FALSE); - egSetGraphicsModeEnabled(TRUE); - GraphicsScreenDirty = TRUE; + InitScreen(false); + egSetGraphicsModeEnabled(true); + GraphicsScreenDirty = true; } } @@ -157,59 +157,59 @@ static void SwitchToGraphics(void) void BeginTextScreen(IN CONST CHAR16 *Title) { DrawScreenHeader(Title); - SwitchToText(FALSE); + SwitchToText(false); // reset error flag - haveError = FALSE; + haveError = false; } -void FinishTextScreen(IN BOOLEAN WaitAlways) +void FinishTextScreen(IN XBool WaitAlways) { if (haveError || WaitAlways) { - SwitchToText(FALSE); + SwitchToText(false); // PauseForKey(L"FinishTextScreen"); } // reset error flag - haveError = FALSE; + haveError = false; } -void BeginExternalScreen(IN BOOLEAN UseGraphicsMode/*, IN CONST CHAR16 *Title*/) +void BeginExternalScreen(IN XBool UseGraphicsMode/*, IN CONST CHAR16 *Title*/) { if (!AllowGraphicsMode) { - UseGraphicsMode = FALSE; + UseGraphicsMode = false; } if (UseGraphicsMode) { SwitchToGraphics(); - //BltClearScreen(FALSE); + //BltClearScreen(false); } // show the header //DrawScreenHeader(Title); if (!UseGraphicsMode) { - SwitchToText(TRUE); + SwitchToText(true); } // reset error flag - haveError = FALSE; + haveError = false; } void FinishExternalScreen(void) { // make sure we clean up later - GraphicsScreenDirty = TRUE; + GraphicsScreenDirty = true; if (haveError) { // leave error messages on screen in case of error, // wait for a key press, and then switch PauseForKey("was error."_XS8); - SwitchToText(FALSE); + SwitchToText(false); } // reset error flag - haveError = FALSE; + haveError = false; } void TerminateScreen(void) @@ -219,7 +219,7 @@ void TerminateScreen(void) gST->ConOut->ClearScreen(gST->ConOut); // enable cursor - gST->ConOut->EnableCursor(gST->ConOut, TRUE); + gST->ConOut->EnableCursor(gST->ConOut, true); } static void DrawScreenHeader(IN CONST CHAR16 *Title) @@ -340,7 +340,7 @@ INTN CalculateNudgePosition(INTN Position, INTN NudgeValue, INTN ImageDimension, return value; } -static BOOLEAN IsImageWithinScreenLimits(INTN Value, INTN ImageDimension, INTN ScreenDimension) +static XBool IsImageWithinScreenLimits(INTN Value, INTN ImageDimension, INTN ScreenDimension) { return (Value >= 0 && Value + ImageDimension <= ScreenDimension); } @@ -391,7 +391,7 @@ void REFIT_MENU_SCREEN::InitAnime() } if (FilmC == nullptr) { // DBG("Screen %lld inited without anime\n", ID); -// FilmC->AnimeRun = FALSE; +// FilmC->AnimeRun = false; return; } // DBG("=== Debug Film ===\n"); @@ -433,7 +433,7 @@ void REFIT_MENU_SCREEN::InitAnime() } if (FilmC->NumFrames != 0) { DBG(" Anime seems OK, init it\n"); - FilmC->AnimeRun = TRUE; + FilmC->AnimeRun = true; FilmC->Reset(); FilmC->LastDraw = 0; } diff --git a/rEFIt_UEFI/refit/screen.h b/rEFIt_UEFI/refit/screen.h index 023d58ed9..67191dbe5 100644 --- a/rEFIt_UEFI/refit/screen.h +++ b/rEFIt_UEFI/refit/screen.h @@ -1,10 +1,10 @@ #include "../libeg/libeg.h" -void InitScreen(IN BOOLEAN SetMaxResolution); +void InitScreen(IN XBool SetMaxResolution); void SetupScreen(void); void BeginTextScreen(IN CONST CHAR16 *Title); -void FinishTextScreen(IN BOOLEAN WaitAlways); -void BeginExternalScreen(IN BOOLEAN UseGraphicsMode/*, IN CONST CHAR16 *Title*/); +void FinishTextScreen(IN XBool WaitAlways); +void BeginExternalScreen(IN XBool UseGraphicsMode/*, IN CONST CHAR16 *Title*/); void FinishExternalScreen(void); void TerminateScreen(void); void SetNextScreenMode(INT32);