mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Refactor tagNext in tagSruct as a XObjArray<TagStruct>
This commit is contained in:
parent
3eece0918c
commit
95d477c9a3
@ -380,7 +380,10 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
|
|||||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||||
UINT8 *PrefBuffer = NULL;
|
UINT8 *PrefBuffer = NULL;
|
||||||
UINTN PrefBufferLen = 0;
|
UINTN PrefBufferLen = 0;
|
||||||
TagPtr PrefDict, dict, dict2, prop;
|
TagStruct* PrefDict;
|
||||||
|
const TagStruct* dict;
|
||||||
|
const TagStruct* dict2;
|
||||||
|
const TagStruct* prop;
|
||||||
CONST CHAR16 *PrefName = L"\\Library\\Preferences\\SystemConfiguration\\com.apple.PowerManagement.plist";
|
CONST CHAR16 *PrefName = L"\\Library\\Preferences\\SystemConfiguration\\com.apple.PowerManagement.plist";
|
||||||
CONST CHAR16 *PrefName2 = L"\\Library\\Preferences\\com.apple.PowerManagement.plist";
|
CONST CHAR16 *PrefName2 = L"\\Library\\Preferences\\com.apple.PowerManagement.plist";
|
||||||
REFIT_VOLUME *ImageVolume = Volume;
|
REFIT_VOLUME *ImageVolume = Volume;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
extern XObjArray<REFIT_VOLUME> Volumes;
|
extern XObjArray<REFIT_VOLUME> Volumes;
|
||||||
|
|
||||||
// for saving nvram.plist and it's data
|
// for saving nvram.plist and it's data
|
||||||
TagPtr gNvramDict;
|
TagStruct* gNvramDict;
|
||||||
|
|
||||||
//
|
//
|
||||||
// vars filled after call to GetEfiBootDeviceFromNvram ()
|
// vars filled after call to GetEfiBootDeviceFromNvram ()
|
||||||
@ -1030,10 +1030,9 @@ VOID
|
|||||||
PutNvramPlistToRtVars ()
|
PutNvramPlistToRtVars ()
|
||||||
{
|
{
|
||||||
// EFI_STATUS Status;
|
// EFI_STATUS Status;
|
||||||
TagPtr Tag;
|
const TagStruct* ValTag;
|
||||||
TagPtr ValTag;
|
|
||||||
INTN Size, i;
|
INTN Size, i;
|
||||||
VOID *Value;
|
const VOID *Value;
|
||||||
|
|
||||||
if (gNvramDict == NULL) {
|
if (gNvramDict == NULL) {
|
||||||
/*Status = */LoadLatestNvramPlist();
|
/*Status = */LoadLatestNvramPlist();
|
||||||
@ -1046,48 +1045,51 @@ PutNvramPlistToRtVars ()
|
|||||||
DbgHeader("PutNvramPlistToRtVars");
|
DbgHeader("PutNvramPlistToRtVars");
|
||||||
// DBG("PutNvramPlistToRtVars ...\n");
|
// DBG("PutNvramPlistToRtVars ...\n");
|
||||||
// iterate over dict elements
|
// iterate over dict elements
|
||||||
for (Tag = gNvramDict->dictTagValue(); Tag != NULL; Tag = Tag->nextTagValue())
|
for (size_t tagIdx = 0 ; tagIdx < gNvramDict->dictOrArrayContent().size() ; tagIdx++ )
|
||||||
{
|
{
|
||||||
|
const TagStruct& Tag = gNvramDict->dictOrArrayContent()[tagIdx];
|
||||||
EFI_GUID *VendorGuid = &gEfiAppleBootGuid;
|
EFI_GUID *VendorGuid = &gEfiAppleBootGuid;
|
||||||
Value = NULL;
|
Value = NULL;
|
||||||
if ( Tag->isKey() ) ValTag = Tag->keyTagValue();
|
if ( Tag.isKey() )
|
||||||
|
{
|
||||||
|
ValTag = Tag.keyTagValue();
|
||||||
|
|
||||||
// process only valid <key> tags
|
// process only valid <key> tags
|
||||||
if (!Tag->isKey() || ValTag == NULL) {
|
if (!Tag.isKey() || ValTag == NULL) {
|
||||||
DBG(" ERROR: Tag is not <key> : type %s\n", ValTag->getTypeAsXString8().c_str());
|
DBG(" ERROR: Tag is not <key> : type %s\n", ValTag->getTypeAsXString8().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// DBG("tag: %s\n", Tag->stringValue());
|
// DBG("tag: %s\n", Tag.stringValue());
|
||||||
// skip OsxAptioFixDrv-RelocBase - appears and causes trouble
|
// skip OsxAptioFixDrv-RelocBase - appears and causes trouble
|
||||||
// in kernel and kext patcher when mixing UEFI and CloverEFI boot
|
// in kernel and kext patcher when mixing UEFI and CloverEFI boot
|
||||||
if ( Tag->keyValue() == "OsxAptioFixDrv-RelocBase"_XS8 ) {
|
if ( Tag.keyValue() == "OsxAptioFixDrv-RelocBase"_XS8 ) {
|
||||||
DBG(" Skipping OsxAptioFixDrv-RelocBase\n");
|
DBG(" Skipping OsxAptioFixDrv-RelocBase\n");
|
||||||
continue;
|
continue;
|
||||||
} else if ( Tag->keyValue() == "OsxAptioFixDrv-ErrorExitingBootServices"_XS8 ) {
|
} else if ( Tag.keyValue() == "OsxAptioFixDrv-ErrorExitingBootServices"_XS8 ) {
|
||||||
DBG(" Skipping OsxAptioFixDrv-ErrorExitingBootServices\n");
|
DBG(" Skipping OsxAptioFixDrv-ErrorExitingBootServices\n");
|
||||||
continue;
|
continue;
|
||||||
} else if ( Tag->keyValue() == "EmuVariableUefiPresent"_XS8 ) {
|
} else if ( Tag.keyValue() == "EmuVariableUefiPresent"_XS8 ) {
|
||||||
DBG(" Skipping EmuVariableUefiPresent\n");
|
DBG(" Skipping EmuVariableUefiPresent\n");
|
||||||
continue;
|
continue;
|
||||||
} else if ( Tag->keyValue() == "aapl,panic-info"_XS8 ) {
|
} else if ( Tag.keyValue() == "aapl,panic-info"_XS8 ) {
|
||||||
DBG(" Skipping aapl,panic-info\n");
|
DBG(" Skipping aapl,panic-info\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // key to unicode; check if key buffer is large enough
|
// // key to unicode; check if key buffer is large enough
|
||||||
// if ( Tag->keyValue().length() > sizeof(KeyBuf) - 1 ) {
|
// if ( Tag.keyValue().length() > sizeof(KeyBuf) - 1 ) {
|
||||||
// DBG(" ERROR: Skipping too large key %s\n", Tag->keyValue().c_str());
|
// DBG(" ERROR: Skipping too large key %s\n", Tag.keyValue().c_str());
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if ( Tag->keyValue() == "Boot0082"_XS8 || Tag->keyValue() == "BootNext"_XS8 ) {
|
if ( Tag.keyValue() == "Boot0082"_XS8 || Tag.keyValue() == "BootNext"_XS8 ) {
|
||||||
VendorGuid = &gEfiGlobalVariableGuid;
|
VendorGuid = &gEfiGlobalVariableGuid;
|
||||||
// it may happen only in this case
|
// it may happen only in this case
|
||||||
GlobalConfig.HibernationFixup = TRUE;
|
GlobalConfig.HibernationFixup = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsciiStrToUnicodeStrS(Tag->stringValue(), KeyBuf, 128);
|
// AsciiStrToUnicodeStrS(Tag.stringValue(), KeyBuf, 128);
|
||||||
XStringW KeyBuf = Tag->keyValue();
|
XStringW KeyBuf = Tag.keyValue();
|
||||||
if (!GlobalConfig.DebugLog) {
|
if (!GlobalConfig.DebugLog) {
|
||||||
DBG(" Adding Key: %ls: ", KeyBuf.wc_str());
|
DBG(" Adding Key: %ls: ", KeyBuf.wc_str());
|
||||||
}
|
}
|
||||||
@ -1126,7 +1128,7 @@ PutNvramPlistToRtVars ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set RT var: all vars visible in nvram.plist are gEfiAppleBootGuid
|
// set RT var: all vars visible in nvram.plist are gEfiAppleBootGuid
|
||||||
/* Status = gRT->SetVariable (
|
/* Status = gRT->SetVariable (
|
||||||
KeyBuf,
|
KeyBuf,
|
||||||
VendorGuid,
|
VendorGuid,
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
@ -1142,6 +1144,7 @@ PutNvramPlistToRtVars ()
|
|||||||
Value
|
Value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ SIDELOAD_KEXT *InjectKextList = NULL;
|
|||||||
//SYSVARIABLES *SysVariables;
|
//SYSVARIABLES *SysVariables;
|
||||||
CHAR16 *IconFormat = NULL;
|
CHAR16 *IconFormat = NULL;
|
||||||
|
|
||||||
TagPtr gConfigDict[NUM_OF_CONFIGS] = {NULL, NULL, NULL};
|
TagStruct* gConfigDict[NUM_OF_CONFIGS] = {NULL, NULL, NULL};
|
||||||
|
|
||||||
SETTINGS_DATA gSettings;
|
SETTINGS_DATA gSettings;
|
||||||
LANGUAGES gLanguage;
|
LANGUAGES gLanguage;
|
||||||
@ -238,7 +238,7 @@ ParseACPIName(const XString8& String)
|
|||||||
VOID
|
VOID
|
||||||
ParseLoadOptions (
|
ParseLoadOptions (
|
||||||
OUT XStringW* ConfNamePtr,
|
OUT XStringW* ConfNamePtr,
|
||||||
OUT TagPtr* Dict
|
OUT TagStruct** Dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *End;
|
CHAR8 *End;
|
||||||
@ -455,12 +455,12 @@ SetBootCurrent(REFIT_MENU_ITEM_BOOTNUM *Entry)
|
|||||||
//
|
//
|
||||||
UINT8
|
UINT8
|
||||||
*GetDataSetting (
|
*GetDataSetting (
|
||||||
IN TagPtr Dict,
|
IN const TagStruct* Dict,
|
||||||
IN CONST CHAR8 *PropName,
|
IN CONST CHAR8 *PropName,
|
||||||
OUT UINTN *DataLen
|
OUT UINTN *DataLen
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
UINT8 *Data = NULL;
|
UINT8 *Data = NULL;
|
||||||
|
|
||||||
Prop = GetProperty(Dict, PropName);
|
Prop = GetProperty(Dict, PropName);
|
||||||
@ -506,7 +506,7 @@ EFI_STATUS
|
|||||||
LoadUserSettings (
|
LoadUserSettings (
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
IN const XStringW& ConfName,
|
IN const XStringW& ConfName,
|
||||||
TagPtr *Dict)
|
TagStruct** Dict)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||||
UINTN Size = 0;
|
UINTN Size = 0;
|
||||||
@ -836,9 +836,9 @@ CUSTOM_LOADER_ENTRY
|
|||||||
STATIC
|
STATIC
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||||
TagPtr DictPointer)
|
const TagStruct* DictPointer)
|
||||||
{
|
{
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
// UINTN i;
|
// UINTN i;
|
||||||
|
|
||||||
if (Patches == NULL || DictPointer == NULL) {
|
if (Patches == NULL || DictPointer == NULL) {
|
||||||
@ -944,7 +944,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
|||||||
if ( Prop != NULL ) {
|
if ( Prop != NULL ) {
|
||||||
INTN i, Count = GetTagCount (Prop);
|
INTN i, Count = GetTagCount (Prop);
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
TagPtr Prop2 = NULL;
|
const TagStruct* Prop2 = NULL;
|
||||||
|
|
||||||
DBG("ForceKextsToLoad: %lld requested\n", Count);
|
DBG("ForceKextsToLoad: %lld requested\n", Count);
|
||||||
|
|
||||||
@ -984,7 +984,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
|||||||
Patches->KextPatches.setEmpty();
|
Patches->KextPatches.setEmpty();
|
||||||
|
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
TagPtr Prop2 = NULL, Dict = NULL;
|
const TagStruct* Prop2 = NULL;
|
||||||
|
const TagStruct* Dict = NULL;
|
||||||
|
|
||||||
DBG("KextsToPatch: %lld requested\n", Count);
|
DBG("KextsToPatch: %lld requested\n", Count);
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
@ -1147,7 +1148,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
|||||||
//delete old and create new
|
//delete old and create new
|
||||||
Patches->KernelPatches.setEmpty();
|
Patches->KernelPatches.setEmpty();
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
TagPtr Prop2 = NULL, Dict = NULL;
|
const TagStruct* Prop2 = NULL;
|
||||||
|
const TagStruct* Dict = NULL;
|
||||||
DBG("KernelToPatch: %lld requested\n", Count);
|
DBG("KernelToPatch: %lld requested\n", Count);
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
UINTN FindLen = 0, ReplaceLen = 0, MaskLen = 0;
|
UINTN FindLen = 0, ReplaceLen = 0, MaskLen = 0;
|
||||||
@ -1274,7 +1276,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
|||||||
//delete old and create new
|
//delete old and create new
|
||||||
Patches->BootPatches.setEmpty();
|
Patches->BootPatches.setEmpty();
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
TagPtr Prop2 = NULL, Dict = NULL;
|
const TagStruct* Prop2 = NULL;
|
||||||
|
const TagStruct* Dict = NULL;
|
||||||
|
|
||||||
DBG("BootPatches: %lld requested\n", Count);
|
DBG("BootPatches: %lld requested\n", Count);
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
@ -1468,7 +1471,7 @@ BOOLEAN IsOSValid(const XString8& MatchOS, const XString8& CurrOS)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 CheckVolumeType(UINT8 VolumeType, TagPtr Prop)
|
UINT8 CheckVolumeType(UINT8 VolumeType, const TagStruct* Prop)
|
||||||
{
|
{
|
||||||
if ( !Prop->isString() ) {
|
if ( !Prop->isString() ) {
|
||||||
MsgLog("ATTENTION : Prop property not string in CheckVolumeType\n");
|
MsgLog("ATTENTION : Prop property not string in CheckVolumeType\n");
|
||||||
@ -1487,9 +1490,10 @@ UINT8 CheckVolumeType(UINT8 VolumeType, TagPtr Prop)
|
|||||||
return VolumeTypeTmp;
|
return VolumeTypeTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 GetVolumeType(TagPtr DictPointer)
|
UINT8 GetVolumeType(const TagStruct* DictPointer)
|
||||||
{
|
{
|
||||||
TagPtr Prop, Prop2;
|
const TagStruct* Prop;
|
||||||
|
const TagStruct* Prop2;
|
||||||
UINT8 VolumeType = 0;
|
UINT8 VolumeType = 0;
|
||||||
|
|
||||||
Prop = GetProperty(DictPointer, "VolumeType");
|
Prop = GetProperty(DictPointer, "VolumeType");
|
||||||
@ -1525,11 +1529,11 @@ STATIC
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
FillinCustomEntry (
|
FillinCustomEntry (
|
||||||
IN OUT CUSTOM_LOADER_ENTRY *Entry,
|
IN OUT CUSTOM_LOADER_ENTRY *Entry,
|
||||||
TagPtr DictPointer,
|
const TagStruct* DictPointer,
|
||||||
IN BOOLEAN SubEntry
|
IN BOOLEAN SubEntry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
|
|
||||||
if ((Entry == NULL) || (DictPointer == NULL)) {
|
if ((Entry == NULL) || (DictPointer == NULL)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1829,7 +1833,7 @@ FillinCustomEntry (
|
|||||||
} else if ( Prop->isDict() || Prop->isArray() ) {
|
} else if ( Prop->isDict() || Prop->isArray() ) {
|
||||||
CUSTOM_LOADER_ENTRY *CustomSubEntry;
|
CUSTOM_LOADER_ENTRY *CustomSubEntry;
|
||||||
INTN i, Count = GetTagCount (Prop);
|
INTN i, Count = GetTagCount (Prop);
|
||||||
TagPtr Dict = NULL;
|
const TagStruct* Dict = NULL;
|
||||||
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTMENU);
|
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NODEFAULTMENU);
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
@ -1858,10 +1862,10 @@ FillinCustomEntry (
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
FillingCustomLegacy (
|
FillingCustomLegacy (
|
||||||
IN OUT CUSTOM_LEGACY_ENTRY *Entry,
|
IN OUT CUSTOM_LEGACY_ENTRY *Entry,
|
||||||
TagPtr DictPointer
|
const TagStruct* DictPointer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
if ((Entry == NULL) || (DictPointer == NULL)) {
|
if ((Entry == NULL) || (DictPointer == NULL)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1954,9 +1958,9 @@ FillingCustomLegacy (
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr DictPointer)
|
FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, const TagStruct* DictPointer)
|
||||||
{
|
{
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
if ((Entry == NULL) || (DictPointer == NULL)) {
|
if ((Entry == NULL) || (DictPointer == NULL)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -2041,9 +2045,10 @@ FillingCustomTool (IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr DictPointer)
|
|||||||
|
|
||||||
// EDID reworked by Sherlocks
|
// EDID reworked by Sherlocks
|
||||||
VOID
|
VOID
|
||||||
GetEDIDSettings(TagPtr DictPointer)
|
GetEDIDSettings(const TagStruct* DictPointer)
|
||||||
{
|
{
|
||||||
TagPtr Prop, Dict;
|
const TagStruct* Prop;
|
||||||
|
const TagStruct* Dict;
|
||||||
UINTN j = 128;
|
UINTN j = 128;
|
||||||
|
|
||||||
Dict = GetProperty(DictPointer, "EDID");
|
Dict = GetProperty(DictPointer, "EDID");
|
||||||
@ -2097,14 +2102,14 @@ GetEDIDSettings(TagPtr DictPointer)
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetEarlyUserSettings (
|
GetEarlyUserSettings (
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
TagPtr CfgDict
|
const TagStruct* CfgDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status = EFI_SUCCESS;
|
EFI_STATUS Status = EFI_SUCCESS;
|
||||||
TagPtr Dict;
|
const TagStruct* Dict;
|
||||||
TagPtr Dict2;
|
const TagStruct* Dict2;
|
||||||
TagPtr DictPointer;
|
const TagStruct* DictPointer;
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
VOID *Value = NULL;
|
VOID *Value = NULL;
|
||||||
BOOLEAN SpecialBootMode = FALSE;
|
BOOLEAN SpecialBootMode = FALSE;
|
||||||
|
|
||||||
@ -2663,7 +2668,7 @@ GetEarlyUserSettings (
|
|||||||
if (Prop != NULL) {
|
if (Prop != NULL) {
|
||||||
// CUSTOM_LOADER_ENTRY *Entry;
|
// CUSTOM_LOADER_ENTRY *Entry;
|
||||||
INTN i, Count = GetTagCount(Prop);
|
INTN i, Count = GetTagCount(Prop);
|
||||||
TagPtr Dict3;
|
const TagStruct* Dict3;
|
||||||
|
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
@ -2689,7 +2694,7 @@ GetEarlyUserSettings (
|
|||||||
if (Prop != NULL) {
|
if (Prop != NULL) {
|
||||||
CUSTOM_LEGACY_ENTRY *Entry;
|
CUSTOM_LEGACY_ENTRY *Entry;
|
||||||
INTN i, Count = GetTagCount(Prop);
|
INTN i, Count = GetTagCount(Prop);
|
||||||
TagPtr Dict3;
|
const TagStruct* Dict3;
|
||||||
|
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
@ -2716,7 +2721,7 @@ GetEarlyUserSettings (
|
|||||||
if (Prop != NULL) {
|
if (Prop != NULL) {
|
||||||
CUSTOM_TOOL_ENTRY *Entry;
|
CUSTOM_TOOL_ENTRY *Entry;
|
||||||
INTN i, Count = GetTagCount(Prop);
|
INTN i, Count = GetTagCount(Prop);
|
||||||
TagPtr Dict3;
|
const TagStruct* Dict3;
|
||||||
if (Count > 0) {
|
if (Count > 0) {
|
||||||
for (i = 0; i < Count; i++) {
|
for (i = 0; i < Count; i++) {
|
||||||
if (EFI_ERROR(GetElement(Prop, i, &Dict3))) {
|
if (EFI_ERROR(GetElement(Prop, i, &Dict3))) {
|
||||||
@ -2919,7 +2924,7 @@ GetEarlyUserSettings (
|
|||||||
Dict2 = GetProperty(DictPointer, "MmioWhitelist");
|
Dict2 = GetProperty(DictPointer, "MmioWhitelist");
|
||||||
if (Dict2 != NULL) {
|
if (Dict2 != NULL) {
|
||||||
INTN Count = GetTagCount(Dict2);
|
INTN Count = GetTagCount(Dict2);
|
||||||
TagPtr Dict3;
|
const TagStruct* Dict3;
|
||||||
//OC_SCHEMA_INTEGER_IN ("Address", OC_MMIO_WL_STRUCT, Address),
|
//OC_SCHEMA_INTEGER_IN ("Address", OC_MMIO_WL_STRUCT, Address),
|
||||||
//OC_SCHEMA_STRING_IN ("Comment", OC_MMIO_WL_STRUCT, Comment),
|
//OC_SCHEMA_STRING_IN ("Comment", OC_MMIO_WL_STRUCT, Comment),
|
||||||
//OC_SCHEMA_BOOLEAN_IN ("Enabled", OC_MMIO_WL_STRUCT, Enabled),
|
//OC_SCHEMA_BOOLEAN_IN ("Enabled", OC_MMIO_WL_STRUCT, Enabled),
|
||||||
@ -3095,8 +3100,8 @@ XStringW GetBundleVersion(const XStringW& FullName)
|
|||||||
XStringW CFBundleVersion;
|
XStringW CFBundleVersion;
|
||||||
XStringW InfoPlistPath;
|
XStringW InfoPlistPath;
|
||||||
CHAR8* InfoPlistPtr = NULL;
|
CHAR8* InfoPlistPtr = NULL;
|
||||||
TagPtr InfoPlistDict = NULL;
|
TagStruct* InfoPlistDict = NULL;
|
||||||
TagPtr Prop = NULL;
|
const TagStruct* Prop = NULL;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
|
|
||||||
InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Contents\\Info.plist");
|
InfoPlistPath = SWPrintf("%ls\\%ls", FullName.wc_str(), L"Contents\\Info.plist");
|
||||||
@ -3260,10 +3265,11 @@ GetListOfThemes ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
XTheme::GetThemeTagSettings(void* DictP)
|
XTheme::GetThemeTagSettings(const TagStruct* DictPointer)
|
||||||
{
|
{
|
||||||
TagPtr Dict, Dict2, Dict3;
|
const TagStruct* Dict;
|
||||||
TagPtr DictPointer = (TagPtr)DictP;
|
const TagStruct* Dict2;
|
||||||
|
const TagStruct* Dict3;
|
||||||
|
|
||||||
//fill default to have an ability change theme
|
//fill default to have an ability change theme
|
||||||
//assume Xtheme is already inited by embedded values
|
//assume Xtheme is already inited by embedded values
|
||||||
@ -3275,7 +3281,7 @@ XTheme::GetThemeTagSettings(void* DictP)
|
|||||||
Font = FONT_LOAD; //not default
|
Font = FONT_LOAD; //not default
|
||||||
|
|
||||||
// if NULL parameter, quit after setting default values, this is embedded theme
|
// if NULL parameter, quit after setting default values, this is embedded theme
|
||||||
if (DictP == NULL) {
|
if (DictPointer == NULL) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3626,11 +3632,11 @@ XTheme::GetThemeTagSettings(void* DictP)
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* XTheme::LoadTheme(const XStringW& TestTheme)
|
TagStruct* XTheme::LoadTheme(const XStringW& TestTheme)
|
||||||
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status = EFI_UNSUPPORTED;
|
EFI_STATUS Status = EFI_UNSUPPORTED;
|
||||||
TagPtr ThemeDict = NULL;
|
TagStruct* ThemeDict = NULL;
|
||||||
CHAR8 *ThemePtr = NULL;
|
CHAR8 *ThemePtr = NULL;
|
||||||
UINTN Size = 0;
|
UINTN Size = 0;
|
||||||
|
|
||||||
@ -3655,11 +3661,12 @@ void* XTheme::LoadTheme(const XStringW& TestTheme)
|
|||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
Status = egLoadFile(ThemeDir, CONFIG_THEME_SVG, (UINT8**)&ThemePtr, &Size);
|
Status = egLoadFile(ThemeDir, CONFIG_THEME_SVG, (UINT8**)&ThemePtr, &Size);
|
||||||
if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
|
if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
|
||||||
Status = ParseSVGXTheme((const CHAR8*)ThemePtr);
|
Status = ParseSVGXTheme(ThemePtr);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
ThemeDict = NULL;
|
ThemeDict = NULL;
|
||||||
} else {
|
} else {
|
||||||
ThemeDict = new TagStruct;
|
ThemeDict = NewTag();
|
||||||
|
ThemeDict->setDictTagValue(NULL); // to make it a dict // TODO improve by creating a newDictTag static method.
|
||||||
}
|
}
|
||||||
if (ThemeDict == NULL) {
|
if (ThemeDict == NULL) {
|
||||||
DBG("svg file %ls not parsed\n", CONFIG_THEME_SVG);
|
DBG("svg file %ls not parsed\n", CONFIG_THEME_SVG);
|
||||||
@ -3669,7 +3676,7 @@ void* XTheme::LoadTheme(const XStringW& TestTheme)
|
|||||||
} else {
|
} else {
|
||||||
Status = egLoadFile(ThemeDir, CONFIG_THEME_FILENAME, (UINT8**)&ThemePtr, &Size);
|
Status = egLoadFile(ThemeDir, CONFIG_THEME_FILENAME, (UINT8**)&ThemePtr, &Size);
|
||||||
if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
|
if (!EFI_ERROR(Status) && (ThemePtr != NULL) && (Size != 0)) {
|
||||||
Status = ParseXML((const CHAR8*)ThemePtr, &ThemeDict, 0);
|
Status = ParseXML(ThemePtr, &ThemeDict, 0);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
ThemeDict = NULL;
|
ThemeDict = NULL;
|
||||||
}
|
}
|
||||||
@ -3684,7 +3691,7 @@ void* XTheme::LoadTheme(const XStringW& TestTheme)
|
|||||||
if (ThemePtr != NULL) {
|
if (ThemePtr != NULL) {
|
||||||
FreePool(ThemePtr);
|
FreePool(ThemePtr);
|
||||||
}
|
}
|
||||||
return (void*)ThemeDict;
|
return ThemeDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -3693,7 +3700,7 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
|
|||||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||||
UINTN Size = 0;
|
UINTN Size = 0;
|
||||||
UINTN i;
|
UINTN i;
|
||||||
TagPtr ThemeDict = NULL;
|
TagStruct* ThemeDict = NULL;
|
||||||
CHAR8 *ChosenTheme = NULL;
|
CHAR8 *ChosenTheme = NULL;
|
||||||
UINTN Rnd;
|
UINTN Rnd;
|
||||||
EFI_TIME Now;
|
EFI_TIME Now;
|
||||||
@ -3763,7 +3770,7 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TestTheme.notEmpty()) {
|
if (TestTheme.notEmpty()) {
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme(TestTheme);
|
ThemeDict = ThemeX.LoadTheme(TestTheme);
|
||||||
if (ThemeDict != NULL) {
|
if (ThemeDict != NULL) {
|
||||||
DBG("special theme %ls found and %ls parsed\n", TestTheme.wc_str(), CONFIG_THEME_FILENAME);
|
DBG("special theme %ls found and %ls parsed\n", TestTheme.wc_str(), CONFIG_THEME_FILENAME);
|
||||||
// ThemeX.Theme.takeValueFrom(TestTheme);
|
// ThemeX.Theme.takeValueFrom(TestTheme);
|
||||||
@ -3783,13 +3790,13 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
if (AsciiStrCmp(ChosenTheme, "random") == 0) {
|
if (AsciiStrCmp(ChosenTheme, "random") == 0) {
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
ThemeDict = ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTheme.takeValueFrom(ChosenTheme);
|
TestTheme.takeValueFrom(ChosenTheme);
|
||||||
if (TestTheme.notEmpty()) {
|
if (TestTheme.notEmpty()) {
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme (TestTheme);
|
ThemeDict = ThemeX.LoadTheme (TestTheme);
|
||||||
if (ThemeDict != NULL) {
|
if (ThemeDict != NULL) {
|
||||||
DBG("theme %s defined in NVRAM found and %ls parsed\n", ChosenTheme, CONFIG_THEME_FILENAME);
|
DBG("theme %s defined in NVRAM found and %ls parsed\n", ChosenTheme, CONFIG_THEME_FILENAME);
|
||||||
// ThemeX.Theme.takeValueFrom(TestTheme);
|
// ThemeX.Theme.takeValueFrom(TestTheme);
|
||||||
@ -3811,12 +3818,12 @@ InitTheme(BOOLEAN UseThemeDefinedInNVRam)
|
|||||||
if (ThemeDict == NULL) {
|
if (ThemeDict == NULL) {
|
||||||
if (GlobalConfig.Theme.isEmpty()) {
|
if (GlobalConfig.Theme.isEmpty()) {
|
||||||
DBG("no default theme, get random theme %ls\n", ThemesList[Rnd]);
|
DBG("no default theme, get random theme %ls\n", ThemesList[Rnd]);
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
ThemeDict = ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
||||||
} else {
|
} else {
|
||||||
if (StriCmp(GlobalConfig.Theme.wc_str(), L"random") == 0) {
|
if (StriCmp(GlobalConfig.Theme.wc_str(), L"random") == 0) {
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
ThemeDict = ThemeX.LoadTheme(XStringW(ThemesList[Rnd]));
|
||||||
} else {
|
} else {
|
||||||
ThemeDict = (TagPtr)ThemeX.LoadTheme(GlobalConfig.Theme);
|
ThemeDict = ThemeX.LoadTheme(GlobalConfig.Theme);
|
||||||
if (ThemeDict == NULL) {
|
if (ThemeDict == NULL) {
|
||||||
DBG("GlobalConfig: %ls not found, get embedded theme\n", GlobalConfig.Theme.wc_str());
|
DBG("GlobalConfig: %ls not found, get embedded theme\n", GlobalConfig.Theme.wc_str());
|
||||||
} else {
|
} else {
|
||||||
@ -3854,9 +3861,9 @@ finish:
|
|||||||
ThemeX.Theme.takeValueFrom(GlobalConfig.Theme); //XStringW from CHAR16*)
|
ThemeX.Theme.takeValueFrom(GlobalConfig.Theme); //XStringW from CHAR16*)
|
||||||
// read theme settings
|
// read theme settings
|
||||||
if (!ThemeX.TypeSVG) {
|
if (!ThemeX.TypeSVG) {
|
||||||
TagPtr DictPointer = GetProperty(ThemeDict, "Theme");
|
const TagStruct* DictPointer = GetProperty(ThemeDict, "Theme");
|
||||||
if (DictPointer != NULL) {
|
if (DictPointer != NULL) {
|
||||||
Status = ThemeX.GetThemeTagSettings((void*)DictPointer);
|
Status = ThemeX.GetThemeTagSettings(DictPointer);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
DBG("Config theme error: %s\n", strerror(Status));
|
DBG("Config theme error: %s\n", strerror(Status));
|
||||||
} else {
|
} else {
|
||||||
@ -3895,10 +3902,11 @@ finish:
|
|||||||
|
|
||||||
VOID
|
VOID
|
||||||
ParseSMBIOSSettings(
|
ParseSMBIOSSettings(
|
||||||
TagPtr DictPointer
|
const TagStruct* DictPointer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TagPtr Prop, Prop1;
|
const TagStruct* Prop;
|
||||||
|
const TagStruct* Prop1;
|
||||||
BOOLEAN Default = FALSE;
|
BOOLEAN Default = FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -4352,16 +4360,16 @@ ParseSMBIOSSettings(
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetUserSettings(
|
GetUserSettings(
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
TagPtr CfgDict
|
const TagStruct* CfgDict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||||
TagPtr Dict;
|
const TagStruct* Dict;
|
||||||
TagPtr Dict2;
|
const TagStruct* Dict2;
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
TagPtr Prop2;
|
const TagStruct* Prop2;
|
||||||
TagPtr Prop3;
|
const TagStruct* Prop3;
|
||||||
TagPtr DictPointer;
|
const TagStruct* DictPointer;
|
||||||
BOOLEAN IsValidCustomUUID = FALSE;
|
BOOLEAN IsValidCustomUUID = FALSE;
|
||||||
//UINTN i;
|
//UINTN i;
|
||||||
|
|
||||||
@ -4715,7 +4723,7 @@ GetUserSettings(
|
|||||||
DBG("\n");
|
DBG("\n");
|
||||||
Dict2 = GetProperty(Prop2, "CustomProperties");
|
Dict2 = GetProperty(Prop2, "CustomProperties");
|
||||||
if (Dict2 != NULL) {
|
if (Dict2 != NULL) {
|
||||||
TagPtr Dict3;
|
const TagStruct* Dict3;
|
||||||
INTN PropIndex, PropCount = GetTagCount (Dict2);
|
INTN PropIndex, PropCount = GetTagCount (Dict2);
|
||||||
|
|
||||||
for (PropIndex = 0; PropIndex < PropCount; PropIndex++) {
|
for (PropIndex = 0; PropIndex < PropCount; PropIndex++) {
|
||||||
@ -6030,7 +6038,7 @@ GetUserSettings(
|
|||||||
|
|
||||||
DictPointer = GetProperty(Dict, "SMCKeys");
|
DictPointer = GetProperty(Dict, "SMCKeys");
|
||||||
if (DictPointer != NULL) { //sss
|
if (DictPointer != NULL) { //sss
|
||||||
TagPtr Key, ValArray;
|
TagStruct* Key, ValArray;
|
||||||
for (Key = DictPointer->tag; Key != NULL; Key = Key->tagNext) {
|
for (Key = DictPointer->tag; Key != NULL; Key = Key->tagNext) {
|
||||||
ValArray = Prop->tag;
|
ValArray = Prop->tag;
|
||||||
if (Key->type != kTagTypeKey || ValArray == NULL) {
|
if (Key->type != kTagTypeKey || ValArray == NULL) {
|
||||||
@ -6104,9 +6112,9 @@ XString8 GetOSVersion(IN LOADER_ENTRY *Entry)
|
|||||||
EFI_STATUS Status = EFI_NOT_FOUND;
|
EFI_STATUS Status = EFI_NOT_FOUND;
|
||||||
CHAR8* PlistBuffer = NULL;
|
CHAR8* PlistBuffer = NULL;
|
||||||
UINTN PlistLen;
|
UINTN PlistLen;
|
||||||
TagPtr DictPointer = NULL;
|
TagStruct* Dict = NULL;
|
||||||
TagPtr Dict = NULL;
|
const TagStruct* DictPointer = NULL;
|
||||||
TagPtr Prop = NULL;
|
const TagStruct* Prop = NULL;
|
||||||
|
|
||||||
if (!Entry || !Entry->Volume) {
|
if (!Entry || !Entry->Volume) {
|
||||||
return NullXString8;
|
return NullXString8;
|
||||||
@ -6508,8 +6516,8 @@ GetRootUUID (IN REFIT_VOLUME *Volume)
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR8 *PlistBuffer;
|
CHAR8 *PlistBuffer;
|
||||||
UINTN PlistLen;
|
UINTN PlistLen;
|
||||||
TagPtr Dict;
|
TagStruct* Dict;
|
||||||
TagPtr Prop;
|
const TagStruct* Prop;
|
||||||
|
|
||||||
CONST CHAR16* SystemPlistR;
|
CONST CHAR16* SystemPlistR;
|
||||||
CONST CHAR16* SystemPlistP;
|
CONST CHAR16* SystemPlistP;
|
||||||
|
@ -738,7 +738,7 @@ extern UINT16 gBacklightLevel;
|
|||||||
//extern BOOLEAN defDSM;
|
//extern BOOLEAN defDSM;
|
||||||
//extern UINT16 dropDSM;
|
//extern UINT16 dropDSM;
|
||||||
|
|
||||||
extern TagPtr gConfigDict[];
|
extern TagStruct* gConfigDict[];
|
||||||
|
|
||||||
// ACPI/PATCHED/AML
|
// ACPI/PATCHED/AML
|
||||||
extern ACPI_PATCHED_AML *ACPIPatchedAML;
|
extern ACPI_PATCHED_AML *ACPIPatchedAML;
|
||||||
@ -890,13 +890,13 @@ GetRootUUID (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetEarlyUserSettings (
|
GetEarlyUserSettings (
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
TagPtr CfgDict
|
const TagStruct* CfgDict
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetUserSettings (
|
GetUserSettings (
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
TagPtr CfgDict
|
const TagStruct* CfgDict
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -922,7 +922,7 @@ InjectKextsFromDir (
|
|||||||
VOID
|
VOID
|
||||||
ParseLoadOptions (
|
ParseLoadOptions (
|
||||||
OUT XStringW* ConfName,
|
OUT XStringW* ConfName,
|
||||||
OUT TagPtr *Dict
|
OUT TagStruct** Dict
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -948,12 +948,12 @@ EFI_STATUS
|
|||||||
LoadUserSettings (
|
LoadUserSettings (
|
||||||
IN EFI_FILE *RootDir,
|
IN EFI_FILE *RootDir,
|
||||||
const XStringW& ConfName,
|
const XStringW& ConfName,
|
||||||
TagPtr *dict
|
TagStruct** dict
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ParseSMBIOSSettings (
|
ParseSMBIOSSettings (
|
||||||
TagPtr dictPointer
|
const TagStruct* dictPointer
|
||||||
);
|
);
|
||||||
|
|
||||||
//BOOLEAN
|
//BOOLEAN
|
||||||
|
@ -101,12 +101,12 @@ CARDLIST* FindCardWithIds(UINT32 Id, UINT32 SubId)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FillCardList(TagPtr CfgDict)
|
VOID FillCardList(const TagStruct* CfgDict)
|
||||||
{
|
{
|
||||||
if (IsListEmpty(&gCardList) && (CfgDict != NULL)) {
|
if (IsListEmpty(&gCardList) && (CfgDict != NULL)) {
|
||||||
CONST CHAR8 *VEN[] = { "NVIDIA", "ATI" };
|
CONST CHAR8 *VEN[] = { "NVIDIA", "ATI" };
|
||||||
INTN Index, Count = sizeof(VEN) / sizeof(VEN[0]);
|
INTN Index, Count = sizeof(VEN) / sizeof(VEN[0]);
|
||||||
TagPtr prop;
|
const TagStruct* prop;
|
||||||
|
|
||||||
for (Index = 0; Index < Count; Index++) {
|
for (Index = 0; Index < Count; Index++) {
|
||||||
CONST CHAR8 *key = VEN[Index];
|
CONST CHAR8 *key = VEN[Index];
|
||||||
@ -116,8 +116,8 @@ VOID FillCardList(TagPtr CfgDict)
|
|||||||
INTN i;
|
INTN i;
|
||||||
INTN count;
|
INTN count;
|
||||||
|
|
||||||
TagPtr element = 0;
|
const TagStruct* prop2 = 0;
|
||||||
TagPtr prop2 = 0;
|
const TagStruct* element = 0;
|
||||||
count = GetTagCount(prop);
|
count = GetTagCount(prop);
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
CONST CHAR8 *model_name = NULL;
|
CONST CHAR8 *model_name = NULL;
|
||||||
|
@ -28,7 +28,7 @@ typedef struct {
|
|||||||
|
|
||||||
VOID
|
VOID
|
||||||
FillCardList (
|
FillCardList (
|
||||||
TagPtr CfgDict
|
const TagStruct* CfgDict
|
||||||
);
|
);
|
||||||
|
|
||||||
CARDLIST
|
CARDLIST
|
||||||
|
@ -95,10 +95,10 @@ void toLowerStr(CHAR8 *tstr, IN CONST CHAR8 *str) {
|
|||||||
*tstr = '\0';
|
*tstr = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN checkOSBundleRequired(UINT8 loaderType, TagPtr dict)
|
BOOLEAN checkOSBundleRequired(UINT8 loaderType, const TagStruct* dict)
|
||||||
{
|
{
|
||||||
BOOLEAN inject = TRUE;
|
BOOLEAN inject = TRUE;
|
||||||
TagPtr osBundleRequiredTag;
|
const TagStruct* osBundleRequiredTag;
|
||||||
XString8 osbundlerequired;
|
XString8 osbundlerequired;
|
||||||
|
|
||||||
osBundleRequiredTag = GetProperty(dict,"OSBundleRequired");
|
osBundleRequiredTag = GetProperty(dict,"OSBundleRequired");
|
||||||
@ -135,8 +135,8 @@ EFI_STATUS LOADER_ENTRY::LoadKext(IN EFI_FILE *RootDir, IN CONST CHAR16 *FileNam
|
|||||||
UINTN bundlePathBufferLength = 0;
|
UINTN bundlePathBufferLength = 0;
|
||||||
XStringW TempName;
|
XStringW TempName;
|
||||||
XStringW Executable;
|
XStringW Executable;
|
||||||
TagPtr dict = NULL;
|
TagStruct* dict = NULL;
|
||||||
TagPtr prop = NULL;
|
const TagStruct* prop = NULL;
|
||||||
BOOLEAN NoContents = FALSE;
|
BOOLEAN NoContents = FALSE;
|
||||||
BOOLEAN inject = FALSE;
|
BOOLEAN inject = FALSE;
|
||||||
_BooterKextFileInfo *infoAddr = NULL;
|
_BooterKextFileInfo *infoAddr = NULL;
|
||||||
|
@ -70,11 +70,22 @@ void TagStruct::FreeTag()
|
|||||||
_tag->FreeTag();
|
_tag->FreeTag();
|
||||||
_tag = NULL;
|
_tag = NULL;
|
||||||
}
|
}
|
||||||
if ( _nextTag ) {
|
// while ( tagIdx < _dictOrArrayContent.notEmpty() ) {
|
||||||
_nextTag->FreeTag();
|
// _dictOrArrayContent[0].FreeTag();
|
||||||
_nextTag = NULL;
|
// _dictOrArrayContent.RemoveWithoutFreeingAtIndex(0);
|
||||||
|
// }
|
||||||
|
// this loop is better because removing objects from the end don't do any memory copying.
|
||||||
|
for (size_t tagIdx = _dictOrArrayContent.size() ; tagIdx > 0 ; ) {
|
||||||
|
tagIdx--;
|
||||||
|
_dictOrArrayContent[tagIdx].FreeTag();
|
||||||
|
_dictOrArrayContent.RemoveWithoutFreeingAtIndex(tagIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ( _nextTag ) {
|
||||||
|
// _nextTag->FreeTag();
|
||||||
|
// _nextTag = NULL;
|
||||||
|
// }
|
||||||
|
|
||||||
gTagsFree.AddReference(this, false);
|
gTagsFree.AddReference(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,20 +100,19 @@ void TagStruct::FreeTag()
|
|||||||
CHAR8* buffer_start = NULL;
|
CHAR8* buffer_start = NULL;
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
EFI_STATUS ParseTagDict( CHAR8* buffer, TagPtr * tag, UINT32 empty, UINT32* lenPtr);
|
EFI_STATUS ParseTagDict( CHAR8* buffer, TagStruct* * tag, UINT32 empty, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagArray( CHAR8* buffer, TagPtr * tag, UINT32 empty, UINT32* lenPtr);
|
EFI_STATUS ParseTagArray( CHAR8* buffer, TagStruct* * tag, UINT32 empty, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagKey( char * buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagKey( char * buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagString(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagString(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagFloat(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagFloat(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagData(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagData(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagDate(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr);
|
EFI_STATUS ParseTagDate(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr);
|
||||||
EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagPtr * tag, bool value, UINT32* lenPtr);
|
EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagStruct* * tag, bool value, UINT32* lenPtr);
|
||||||
//defined in Platform.h
|
|
||||||
//EFI_STATUS GetElement( TagPtr dict, INTN id, TagPtr *dict1);
|
|
||||||
//INTN GetTagCount( TagPtr dict );
|
|
||||||
|
|
||||||
TagPtr NewTag( void );
|
EFI_STATUS XMLParseNextTag (CHAR8 *buffer, TagStruct**tag, UINT32 *lenPtr);
|
||||||
|
|
||||||
|
TagStruct* NewTag( void );
|
||||||
EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag,UINT32* lenPtr);
|
EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag,UINT32* lenPtr);
|
||||||
|
|
||||||
/* Function for basic XML character entities parsing */
|
/* Function for basic XML character entities parsing */
|
||||||
@ -171,56 +181,53 @@ XMLDecode(CHAR8* src)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTN GetTagCount( TagPtr dict )
|
INTN GetTagCount(const TagStruct* dict )
|
||||||
{
|
{
|
||||||
INTN count = 0;
|
INTN count = 0;
|
||||||
TagPtr tagList, tag;
|
|
||||||
|
|
||||||
if ( !dict || (!dict->isDict() && !dict->isArray()) ) {
|
if ( !dict ) return 0;
|
||||||
|
|
||||||
|
if ( dict->isArray() ) {
|
||||||
|
return dict->dictOrArrayContent().size(); // If we are an array, any element is valid
|
||||||
|
}else
|
||||||
|
if ( dict->isDict() ) {
|
||||||
|
const XObjArray<TagStruct>& tagList = dict->dictOrArrayContent();
|
||||||
|
for (size_t tagIdx = 0 ; tagIdx < tagList.size() ; tagIdx++ ) {
|
||||||
|
if ( tagList[tagIdx].isKey() ) count++;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tag = 0;
|
|
||||||
tagList = dict->dictOrArrayTagValue();
|
|
||||||
while (tagList)
|
|
||||||
{
|
|
||||||
tag = tagList;
|
|
||||||
tagList = tag->nextTagValue();
|
|
||||||
|
|
||||||
if ( (dict->isDict() && tag->isKey()) ||
|
|
||||||
dict->isArray() // If we are an array, any element is valid
|
|
||||||
)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if(tag->type == kTagTypeKey) printf("Located key %s\n", tag->stringValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS GetElement( TagPtr dict, INTN id, TagPtr * dict1)
|
EFI_STATUS GetElement(const TagStruct* dict, INTN id, const TagStruct** dict1)
|
||||||
{
|
{
|
||||||
INTN element = 0;
|
INTN element = 0;
|
||||||
TagPtr child;
|
|
||||||
|
|
||||||
if( !dict || (!dict->isArray() && !dict->isDict()) ) {
|
if ( !dict ) return EFI_UNSUPPORTED;
|
||||||
return EFI_UNSUPPORTED;
|
if ( id < 0 ) return EFI_UNSUPPORTED;
|
||||||
}
|
|
||||||
|
|
||||||
child = dict->dictOrArrayTagValue();
|
if ( dict->isArray() ) {
|
||||||
while (child != NULL)
|
if ( (size_t)id < dict->dictOrArrayContent().size() ) {
|
||||||
{
|
*dict1 = &dict->dictOrArrayContent()[id];
|
||||||
if ( (dict->isDict() && child->isKey()) || //in Dict count Keys
|
|
||||||
dict->isArray() // If we are an array, any element is valid
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (element++ >= id) break;
|
|
||||||
}
|
|
||||||
child = child->nextTagValue();
|
|
||||||
}
|
|
||||||
*dict1 = child;
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if ( dict->isDict() ) {
|
||||||
|
const XObjArray<TagStruct>& tagList = dict->dictOrArrayContent();
|
||||||
|
size_t tagIdx;
|
||||||
|
for (tagIdx = 0 ; tagIdx < tagList.size() ; tagIdx++ ) {
|
||||||
|
if ( tagList[tagIdx].isKey() ) {
|
||||||
|
if ( element == id ) {
|
||||||
|
*dict1 = &tagList[tagIdx];
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
element++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expects to see one dictionary in the XML file, the final pos will be returned
|
// Expects to see one dictionary in the XML file, the final pos will be returned
|
||||||
@ -229,12 +236,12 @@ EFI_STATUS GetElement( TagPtr dict, INTN id, TagPtr * dict1)
|
|||||||
// tag pointer and returns the end of the dic, or returns -1 if not found.
|
// tag pointer and returns the end of the dic, or returns -1 if not found.
|
||||||
//
|
//
|
||||||
|
|
||||||
EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
|
EFI_STATUS ParseXML(const CHAR8* buffer, TagStruct** dict, UINT32 bufSize)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
UINT32 pos = 0;
|
UINT32 pos = 0;
|
||||||
TagPtr tag = NULL;
|
TagStruct* tag = NULL;
|
||||||
CHAR8* configBuffer = NULL;
|
CHAR8* configBuffer = NULL;
|
||||||
UINT32 bufferSize = 0;
|
UINT32 bufferSize = 0;
|
||||||
UINTN i;
|
UINTN i;
|
||||||
@ -301,26 +308,22 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// GetProperty
|
// GetProperty
|
||||||
|
|
||||||
TagPtr GetProperty( TagPtr dict, const CHAR8* key )
|
const TagStruct* GetProperty(const TagStruct* dict, const CHAR8* key )
|
||||||
{
|
{
|
||||||
if ( !dict->isDict() ) return NULL;
|
if ( !dict->isDict() ) return NULL;
|
||||||
|
|
||||||
TagPtr tag = NULL;
|
const XObjArray<TagStruct>& tagList = dict->dictOrArrayContent();
|
||||||
TagPtr tagList = dict->dictOrArrayTagValue();
|
for (size_t tagIdx = 0 ; tagIdx < tagList.size() ; tagIdx++ )
|
||||||
while (tagList)
|
|
||||||
{
|
{
|
||||||
tag = tagList;
|
if ( tagList[tagIdx].isKey() && tagList[tagIdx].keyValue().equalIC(key) ) return tagList[tagIdx].keyTagValue();
|
||||||
tagList = tag->nextTagValue();
|
|
||||||
|
|
||||||
if ( tag->isKey() && tag->keyValue().equalIC(key) ) return tag->keyTagValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TagPtr GetNextProperty(TagPtr dict)
|
//TagStruct* GetNextProperty(TagStruct* dict)
|
||||||
//{
|
//{
|
||||||
// TagPtr tagList, tag;
|
// TagStruct* tagList, tag;
|
||||||
//
|
//
|
||||||
// if (dict->isDict()) {
|
// if (dict->isDict()) {
|
||||||
// return NULL;
|
// return NULL;
|
||||||
@ -348,7 +351,7 @@ TagPtr GetProperty( TagPtr dict, const CHAR8* key )
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseNextTag
|
// ParseNextTag
|
||||||
|
|
||||||
EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
|
EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagStruct** tag, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
@ -484,13 +487,11 @@ EFI_STATUS XMLParseNextTag(CHAR8* buffer, TagPtr* tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagList
|
// ParseTagList
|
||||||
|
|
||||||
EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagPtr* tag, UINT32 empty, UINT32* lenPtr)
|
EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagStruct** tag, UINT32 empty, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status = EFI_SUCCESS;
|
EFI_STATUS Status = EFI_SUCCESS;
|
||||||
UINT32 pos;
|
UINT32 pos;
|
||||||
TagPtr tagList;
|
TagStruct* tagTail;
|
||||||
TagPtr tagTail;
|
|
||||||
TagPtr tmpTag = NULL;
|
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
|
|
||||||
if (isArray) {
|
if (isArray) {
|
||||||
@ -498,13 +499,21 @@ EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagPtr* tag, UINT32 empty
|
|||||||
} else {
|
} else {
|
||||||
DBG("parsing dict len=%d\n", *lenPtr);
|
DBG("parsing dict len=%d\n", *lenPtr);
|
||||||
}
|
}
|
||||||
tagList = NULL;
|
|
||||||
tagTail = NULL;
|
tagTail = NULL;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
|
TagStruct* dictOrArrayTag = NewTag();
|
||||||
|
if (isArray) {
|
||||||
|
dictOrArrayTag->setArrayTagValue(NULL);
|
||||||
|
} else {
|
||||||
|
dictOrArrayTag->setDictTagValue(NULL);
|
||||||
|
}
|
||||||
|
XObjArray<TagStruct>& tagList = dictOrArrayTag->dictOrArrayContent();
|
||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
Status = XMLParseNextTag(buffer + pos, &tmpTag, &length);
|
TagStruct* newDictOrArrayTag = NULL;
|
||||||
|
Status = XMLParseNextTag(buffer + pos, &newDictOrArrayTag, &length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
DBG("error XMLParseNextTag in array: %s\n", strerror(Status));
|
DBG("error XMLParseNextTag in array: %s\n", strerror(Status));
|
||||||
break;
|
break;
|
||||||
@ -512,53 +521,31 @@ EFI_STATUS __ParseTagList(bool isArray, CHAR8* buffer, TagPtr* tag, UINT32 empty
|
|||||||
|
|
||||||
pos += length;
|
pos += length;
|
||||||
|
|
||||||
if (tmpTag == NULL) {
|
if (newDictOrArrayTag == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagTail) {
|
tagList.AddReference(newDictOrArrayTag, true);
|
||||||
tagTail->setNextTagValue(tmpTag);
|
|
||||||
} else {
|
|
||||||
tagList = tmpTag;
|
|
||||||
}
|
|
||||||
tagTail = tmpTag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
if (tagList) {
|
FreeTag(dictOrArrayTag);
|
||||||
FreeTag(tagList);
|
|
||||||
}
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpTag = NewTag();
|
*tag = dictOrArrayTag;
|
||||||
if (tmpTag == NULL) {
|
|
||||||
if (tagList) {
|
|
||||||
FreeTag(tagList);
|
|
||||||
}
|
|
||||||
DBG("next tag is NULL\n");
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isArray) {
|
|
||||||
tmpTag->setArrayTagValue(tagList);
|
|
||||||
} else {
|
|
||||||
tmpTag->setDictTagValue(tagList);
|
|
||||||
}
|
|
||||||
|
|
||||||
*tag = tmpTag;
|
|
||||||
*lenPtr=pos;
|
*lenPtr=pos;
|
||||||
DBG(" return from ParseTagList with len=%d\n", *lenPtr);
|
DBG(" return from ParseTagList with len=%d\n", *lenPtr);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS ParseTagDict( CHAR8* buffer, TagPtr* tag, UINT32 empty, UINT32* lenPtr)
|
EFI_STATUS ParseTagDict( CHAR8* buffer, TagStruct** tag, UINT32 empty, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
return __ParseTagList(false, buffer, tag, empty, lenPtr);
|
return __ParseTagList(false, buffer, tag, empty, lenPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS ParseTagArray( CHAR8* buffer, TagPtr* tag, UINT32 empty, UINT32* lenPtr)
|
EFI_STATUS ParseTagArray( CHAR8* buffer, TagStruct** tag, UINT32 empty, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
return __ParseTagList(true, buffer, tag, empty, lenPtr);
|
return __ParseTagList(true, buffer, tag, empty, lenPtr);
|
||||||
}
|
}
|
||||||
@ -566,13 +553,13 @@ EFI_STATUS ParseTagArray( CHAR8* buffer, TagPtr* tag, UINT32 empty, UINT32* lenP
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagKey
|
// ParseTagKey
|
||||||
|
|
||||||
EFI_STATUS ParseTagKey( char * buffer, TagPtr* tag, UINT32* lenPtr)
|
EFI_STATUS ParseTagKey( char * buffer, TagStruct** tag, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
UINT32 length2 = 0;
|
UINT32 length2 = 0;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
TagPtr subTag = NULL;
|
TagStruct* subTag = NULL;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagKey, &length);
|
Status = FixDataMatchingTag(buffer, kXMLTagKey, &length);
|
||||||
DBG("fixing key len=%d status=%s\n", length, strerror(Status));
|
DBG("fixing key len=%d status=%s\n", length, strerror(Status));
|
||||||
@ -596,11 +583,11 @@ EFI_STATUS ParseTagKey( char * buffer, TagPtr* tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagString
|
// ParseTagString
|
||||||
|
|
||||||
EFI_STATUS ParseTagString(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
EFI_STATUS ParseTagString(CHAR8* buffer, TagStruct* * tag,UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagString, &length);
|
Status = FixDataMatchingTag(buffer, kXMLTagString, &length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -622,7 +609,7 @@ EFI_STATUS ParseTagString(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagInteger
|
// ParseTagInteger
|
||||||
|
|
||||||
EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
EFI_STATUS ParseTagInteger(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
@ -630,7 +617,7 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
|||||||
UINT32 size;
|
UINT32 size;
|
||||||
BOOLEAN negative = FALSE;
|
BOOLEAN negative = FALSE;
|
||||||
CHAR8* val = buffer;
|
CHAR8* val = buffer;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagInteger, &length);
|
Status = FixDataMatchingTag(buffer, kXMLTagInteger, &length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -704,11 +691,11 @@ EFI_STATUS ParseTagInteger(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagFloat
|
// ParseTagFloat
|
||||||
|
|
||||||
EFI_STATUS ParseTagFloat(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
EFI_STATUS ParseTagFloat(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length;
|
UINT32 length;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagFloat, &length);
|
Status = FixDataMatchingTag(buffer, kXMLTagFloat, &length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -733,11 +720,11 @@ EFI_STATUS ParseTagFloat(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagData
|
// ParseTagData
|
||||||
|
|
||||||
EFI_STATUS ParseTagData(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
EFI_STATUS ParseTagData(CHAR8* buffer, TagStruct* * tag, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagData,&length);
|
Status = FixDataMatchingTag(buffer, kXMLTagData,&length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -764,11 +751,11 @@ EFI_STATUS ParseTagData(CHAR8* buffer, TagPtr * tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagDate
|
// ParseTagDate
|
||||||
|
|
||||||
EFI_STATUS ParseTagDate(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
EFI_STATUS ParseTagDate(CHAR8* buffer, TagStruct* * tag,UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 length = 0;
|
UINT32 length = 0;
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
Status = FixDataMatchingTag(buffer, kXMLTagDate,&length);
|
Status = FixDataMatchingTag(buffer, kXMLTagDate,&length);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
@ -792,9 +779,9 @@ EFI_STATUS ParseTagDate(CHAR8* buffer, TagPtr * tag,UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// ParseTagBoolean
|
// ParseTagBoolean
|
||||||
|
|
||||||
EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagPtr * tag, bool value, UINT32* lenPtr)
|
EFI_STATUS ParseTagBoolean(CHAR8* buffer, TagStruct* * tag, bool value, UINT32* lenPtr)
|
||||||
{
|
{
|
||||||
TagPtr tmpTag;
|
TagStruct* tmpTag;
|
||||||
|
|
||||||
tmpTag = NewTag();
|
tmpTag = NewTag();
|
||||||
if (tmpTag == NULL) {
|
if (tmpTag == NULL) {
|
||||||
@ -898,9 +885,9 @@ EFI_STATUS FixDataMatchingTag( CHAR8* buffer, CONST CHAR8* tag, UINT32* lenPtr)
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// NewTag
|
// NewTag
|
||||||
|
|
||||||
TagPtr NewTag( void )
|
TagStruct* NewTag( void )
|
||||||
{
|
{
|
||||||
TagPtr tag;
|
TagStruct* tag;
|
||||||
|
|
||||||
if ( gTagsFree.size() > 0 ) {
|
if ( gTagsFree.size() > 0 ) {
|
||||||
tag = &gTagsFree[0];
|
tag = &gTagsFree[0];
|
||||||
@ -914,7 +901,7 @@ TagPtr NewTag( void )
|
|||||||
//==========================================================================
|
//==========================================================================
|
||||||
// XMLFreeTag
|
// XMLFreeTag
|
||||||
|
|
||||||
void FreeTag( TagPtr tag )
|
void FreeTag( TagStruct* tag )
|
||||||
{
|
{
|
||||||
if (tag == NULL) {
|
if (tag == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -931,7 +918,7 @@ void FreeTag( TagPtr tag )
|
|||||||
else return FALSE
|
else return FALSE
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPropertyTrue(TagPtr Prop)
|
IsPropertyTrue(const TagStruct* Prop)
|
||||||
{
|
{
|
||||||
return Prop != NULL && Prop->isTrueOrYy();
|
return Prop != NULL && Prop->isTrueOrYy();
|
||||||
}
|
}
|
||||||
@ -941,7 +928,7 @@ IsPropertyTrue(TagPtr Prop)
|
|||||||
else return FALSE
|
else return FALSE
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPropertyFalse(TagPtr Prop)
|
IsPropertyFalse(const TagStruct* Prop)
|
||||||
{
|
{
|
||||||
return Prop != NULL && Prop->isFalseOrNn();
|
return Prop != NULL && Prop->isFalseOrNn();
|
||||||
}
|
}
|
||||||
@ -955,7 +942,7 @@ IsPropertyFalse(TagPtr Prop)
|
|||||||
*/
|
*/
|
||||||
INTN
|
INTN
|
||||||
GetPropertyInteger(
|
GetPropertyInteger(
|
||||||
TagPtr Prop,
|
const TagStruct* Prop,
|
||||||
INTN Default
|
INTN Default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -980,7 +967,7 @@ GetPropertyInteger(
|
|||||||
return Default;
|
return Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetPropertyFloat (TagPtr Prop, float Default)
|
float GetPropertyFloat (const TagStruct* Prop, float Default)
|
||||||
{
|
{
|
||||||
if (Prop == NULL) {
|
if (Prop == NULL) {
|
||||||
return Default;
|
return Default;
|
||||||
|
@ -45,47 +45,55 @@ extern XObjArray<TagStruct> gTagsFree;
|
|||||||
|
|
||||||
class TagStruct
|
class TagStruct
|
||||||
{
|
{
|
||||||
UINTN type; // type is private. Use is... functions.
|
UINTN type; // type is private. Use is...() functions.
|
||||||
XString8 _string;
|
XString8 _string;
|
||||||
INTN _intValue;
|
INTN _intValue;
|
||||||
float _floatValue;
|
float _floatValue;
|
||||||
UINT8 *_data;
|
UINT8 *_data;
|
||||||
UINTN _dataLen;
|
UINTN _dataLen;
|
||||||
TagStruct *_tag;
|
TagStruct *_tag;
|
||||||
TagStruct *_nextTag;
|
XObjArray<TagStruct> _dictOrArrayContent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TagStruct() : type(kTagTypeNone), _string(), _intValue(0), _floatValue(0), _data(0), _dataLen(0), /*offset(0), */_tag(NULL), _nextTag(NULL) {}
|
TagStruct() : type(kTagTypeNone), _string(), _intValue(0), _floatValue(0), _data(0), _dataLen(0), /*offset(0), */_tag(NULL), _dictOrArrayContent() {}
|
||||||
TagStruct(const TagStruct& other) = delete; // Can be defined if needed
|
TagStruct(const TagStruct& other) = delete; // Can be defined if needed
|
||||||
const TagStruct& operator = ( const TagStruct & ) = delete; // Can be defined if needed
|
const TagStruct& operator = ( const TagStruct & ) = delete; // Can be defined if needed
|
||||||
~TagStruct() {}
|
~TagStruct() { delete _data; delete _tag; }
|
||||||
|
|
||||||
void FreeTag();
|
void FreeTag();
|
||||||
|
|
||||||
// Property<XString8> string();
|
// Property<XString8> string();
|
||||||
bool isDict() { return type == kTagTypeDict; }
|
bool isDict() const { return type == kTagTypeDict; }
|
||||||
bool isKey() { return type == kTagTypeKey; }
|
bool isKey() const { return type == kTagTypeKey; }
|
||||||
bool isString() { return type == kTagTypeString; }
|
bool isString() const { return type == kTagTypeString; }
|
||||||
bool isInt() { return type == kTagTypeInteger; }
|
bool isInt() const { return type == kTagTypeInteger; }
|
||||||
bool isFloat() { return type == kTagTypeFloat; }
|
bool isFloat() const { return type == kTagTypeFloat; }
|
||||||
bool isBool() { return type == kTagTypeTrue || type == kTagTypeFalse; }
|
bool isBool() const { return type == kTagTypeTrue || type == kTagTypeFalse; }
|
||||||
bool isData() { return type == kTagTypeData; }
|
bool isData() const { return type == kTagTypeData; }
|
||||||
bool isDate() { return type == kTagTypeDate; }
|
bool isDate() const { return type == kTagTypeDate; }
|
||||||
bool isArray() { return type == kTagTypeArray; }
|
bool isArray() const { return type == kTagTypeArray; }
|
||||||
|
|
||||||
TagStruct* nextTagValue()
|
const XObjArray<TagStruct>& dictOrArrayContent() const
|
||||||
{
|
{
|
||||||
return _nextTag;
|
if ( isDict() ) return _dictOrArrayContent;
|
||||||
|
if ( isArray() ) return _dictOrArrayContent;
|
||||||
|
panic("TagStruct::dictOrArrayTagValue() : !isDict() && isArray() ");
|
||||||
}
|
}
|
||||||
void setNextTagValue(TagStruct* nextTag)
|
XObjArray<TagStruct>& dictOrArrayContent()
|
||||||
{
|
{
|
||||||
if ( nextTag == NULL ) panic("TagStruct::setDictNextTagValue() : nextTag == NULL ");
|
if ( isDict() ) return _dictOrArrayContent;
|
||||||
if ( _nextTag != NULL ) panic("TagStruct::setDictNextTagValue() : _nextTag != NULL ");
|
if ( isArray() ) return _dictOrArrayContent;
|
||||||
_nextTag = nextTag;
|
panic("TagStruct::dictOrArrayTagValue() : !isDict() && isArray() ");
|
||||||
}
|
}
|
||||||
|
// void setNextTagValue(TagStruct* nextTag)
|
||||||
|
// {
|
||||||
|
// if ( nextTag == NULL ) panic("TagStruct::setDictNextTagValue() : nextTag == NULL ");
|
||||||
|
// if ( _nextTag != NULL ) panic("TagStruct::setDictNextTagValue() : _nextTag != NULL ");
|
||||||
|
// _nextTag = nextTag;
|
||||||
|
// }
|
||||||
|
|
||||||
const XString8 getTypeAsXString8() {
|
const XString8 getTypeAsXString8() const {
|
||||||
if ( isDict() ) return "Dict"_XS8;
|
if ( isDict() ) return "Dict"_XS8;
|
||||||
if ( isKey() ) return "Dict"_XS8;
|
if ( isKey() ) return "Dict"_XS8;
|
||||||
if ( isString() ) return "Dict"_XS8;
|
if ( isString() ) return "Dict"_XS8;
|
||||||
@ -99,6 +107,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getter and setter
|
// getter and setter
|
||||||
|
const UINT8* dataValue() const
|
||||||
|
{
|
||||||
|
if ( !isData() ) panic("TagStruct::dataValue() : !isData() ");
|
||||||
|
return _data;
|
||||||
|
}
|
||||||
UINT8* dataValue()
|
UINT8* dataValue()
|
||||||
{
|
{
|
||||||
if ( !isData() ) panic("TagStruct::dataValue() : !isData() ");
|
if ( !isData() ) panic("TagStruct::dataValue() : !isData() ");
|
||||||
@ -109,7 +122,7 @@ public:
|
|||||||
if ( !isData() ) panic("TagStruct::dataStringValue() : !isData() ");
|
if ( !isData() ) panic("TagStruct::dataStringValue() : !isData() ");
|
||||||
return _string;
|
return _string;
|
||||||
}
|
}
|
||||||
UINTN dataLenValue()
|
UINTN dataLenValue() const
|
||||||
{
|
{
|
||||||
if ( !isData() ) panic("TagStruct::dataLenValue() : !isData() ");
|
if ( !isData() ) panic("TagStruct::dataLenValue() : !isData() ");
|
||||||
return _dataLen;
|
return _dataLen;
|
||||||
@ -144,9 +157,8 @@ public:
|
|||||||
// empty dict is allowed
|
// empty dict is allowed
|
||||||
//if ( tagList == NULL ) panic("TagStruct::setDictTagValue() : tagList == NULL ");
|
//if ( tagList == NULL ) panic("TagStruct::setDictTagValue() : tagList == NULL ");
|
||||||
if ( _tag != NULL ) panic("TagStruct::setDictTagValue() : _tag != NULL ");
|
if ( _tag != NULL ) panic("TagStruct::setDictTagValue() : _tag != NULL ");
|
||||||
if ( _nextTag != NULL ) panic("TagStruct::setDictTagValue() : _nextTag != NULL ");
|
if ( _dictOrArrayContent.notEmpty() ) panic("TagStruct::setDictTagValue() : __dictOrArrayContent.notEmpty() ");
|
||||||
_tag = tagList;
|
_tag = tagList;
|
||||||
_nextTag = NULL;
|
|
||||||
type = kTagTypeDict;
|
type = kTagTypeDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,17 +172,23 @@ public:
|
|||||||
// Array value with tagList = NULL is allowed
|
// Array value with tagList = NULL is allowed
|
||||||
//if ( tag == NULL ) panic("TagStruct::setArrayValue() : tag == NULL ");
|
//if ( tag == NULL ) panic("TagStruct::setArrayValue() : tag == NULL ");
|
||||||
if ( _tag != NULL ) panic("TagStruct::setArrayValue() : _tag != NULL ");
|
if ( _tag != NULL ) panic("TagStruct::setArrayValue() : _tag != NULL ");
|
||||||
if ( _nextTag != NULL ) panic("TagStruct::setArrayTagValue() : _nextTag != NULL ");
|
if ( _dictOrArrayContent.notEmpty() ) panic("TagStruct::setArrayTagValue() : __dictOrArrayContent.notEmpty() ");
|
||||||
_tag = tag;
|
_tag = tag;
|
||||||
type = kTagTypeArray;
|
type = kTagTypeArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const XString8& keyValue() const
|
||||||
|
{
|
||||||
|
if ( !isKey() ) panic("TagStruct::keyValue() : !isKey() ");
|
||||||
|
return _string;
|
||||||
|
}
|
||||||
XString8& keyValue()
|
XString8& keyValue()
|
||||||
{
|
{
|
||||||
if ( !isKey() ) panic("TagStruct::keyValue() : !isKey() ");
|
if ( !isKey() ) panic("TagStruct::keyValue() : !isKey() ");
|
||||||
return _string;
|
return _string;
|
||||||
}
|
}
|
||||||
TagStruct* keyTagValue()
|
const TagStruct* keyTagValue() const
|
||||||
{
|
{
|
||||||
if ( !isKey() ) panic("TagStruct::keyTagValue() : !isKey() ");
|
if ( !isKey() ) panic("TagStruct::keyTagValue() : !isKey() ");
|
||||||
return _tag;
|
return _tag;
|
||||||
@ -183,7 +201,12 @@ public:
|
|||||||
_tag = subTag;
|
_tag = subTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
const XString8& stringValue()
|
const XString8& stringValue() const
|
||||||
|
{
|
||||||
|
if ( !isString() ) panic("TagStruct::stringValue() : !isString() ");
|
||||||
|
return _string;
|
||||||
|
}
|
||||||
|
XString8& stringValue()
|
||||||
{
|
{
|
||||||
if ( !isString() ) panic("TagStruct::stringValue() : !isString() ");
|
if ( !isString() ) panic("TagStruct::stringValue() : !isString() ");
|
||||||
return _string;
|
return _string;
|
||||||
@ -196,7 +219,7 @@ public:
|
|||||||
_string = xstring;
|
_string = xstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTN intValue()
|
INTN intValue() const
|
||||||
{
|
{
|
||||||
if ( !isInt() ) panic("TagStruct::intValue() : !isInt() ");
|
if ( !isInt() ) panic("TagStruct::intValue() : !isInt() ");
|
||||||
return _intValue;
|
return _intValue;
|
||||||
@ -207,7 +230,7 @@ public:
|
|||||||
_intValue = i;
|
_intValue = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
float floatValue()
|
float floatValue() const
|
||||||
{
|
{
|
||||||
if ( !isFloat() ) panic("TagStruct::floatValue() : !isFloat() ");
|
if ( !isFloat() ) panic("TagStruct::floatValue() : !isFloat() ");
|
||||||
return _floatValue;
|
return _floatValue;
|
||||||
@ -218,7 +241,7 @@ public:
|
|||||||
_floatValue = f;
|
_floatValue = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTN boolValue()
|
INTN boolValue() const
|
||||||
{
|
{
|
||||||
if ( !isBool() ) panic("TagStruct::boolValue() : !isBool() ");
|
if ( !isBool() ) panic("TagStruct::boolValue() : !isBool() ");
|
||||||
return type == kTagTypeTrue;
|
return type == kTagTypeTrue;
|
||||||
@ -230,29 +253,29 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convenience method
|
// Convenience method
|
||||||
bool isTrue()
|
bool isTrue() const
|
||||||
{
|
{
|
||||||
if ( isBool() ) return boolValue();
|
if ( isBool() ) return boolValue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isFalse()
|
bool isFalse() const
|
||||||
{
|
{
|
||||||
if ( isBool() ) return !boolValue();
|
if ( isBool() ) return !boolValue();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isTrueOrYy()
|
bool isTrueOrYy() const
|
||||||
{
|
{
|
||||||
if ( isBool() ) return boolValue();
|
if ( isBool() ) return boolValue();
|
||||||
if ( isString() && stringValue().notEmpty() && (stringValue()[0] == 'y' || stringValue()[0] == 'Y') ) return true;
|
if ( isString() && stringValue().notEmpty() && (stringValue()[0] == 'y' || stringValue()[0] == 'Y') ) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isTrueOrYes()
|
bool isTrueOrYes() const
|
||||||
{
|
{
|
||||||
if ( isBool() ) return boolValue();
|
if ( isBool() ) return boolValue();
|
||||||
if ( isString() && stringValue().equal("Yes"_XS8) ) return true;
|
if ( isString() && stringValue().equal("Yes"_XS8) ) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isFalseOrNn()
|
bool isFalseOrNn() const
|
||||||
{
|
{
|
||||||
if ( isBool() ) return !boolValue();
|
if ( isBool() ) return !boolValue();
|
||||||
if ( isString() && stringValue().notEmpty() && (stringValue()[0] == 'n' || stringValue()[0] == 'N') ) return true;
|
if ( isString() && stringValue().notEmpty() && (stringValue()[0] == 'n' || stringValue()[0] == 'N') ) return true;
|
||||||
@ -266,15 +289,13 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef TagStruct* TagPtr;
|
//typedef union {
|
||||||
|
// struct {
|
||||||
typedef union {
|
// float fNum; //4 bytes
|
||||||
struct {
|
// UINT32 pad; // else 4
|
||||||
float fNum; //4 bytes
|
// } B;
|
||||||
UINT32 pad; // else 4
|
// CHAR8 *string;
|
||||||
} B;
|
//} FlMix;
|
||||||
CHAR8 *string;
|
|
||||||
} FlMix;
|
|
||||||
|
|
||||||
|
|
||||||
CHAR8*
|
CHAR8*
|
||||||
@ -285,29 +306,24 @@ XMLDecode (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ParseXML(
|
ParseXML(
|
||||||
CONST CHAR8 *buffer,
|
CONST CHAR8 *buffer,
|
||||||
TagPtr *dict,
|
TagStruct* *dict,
|
||||||
UINT32 bufSize
|
UINT32 bufSize
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//VOID RenderSVGfont(NSVGfont *fontSVG);
|
//VOID RenderSVGfont(NSVGfont *fontSVG);
|
||||||
|
|
||||||
TagPtr
|
const TagStruct*
|
||||||
GetProperty(
|
GetProperty(
|
||||||
TagPtr dict,
|
const TagStruct* dict,
|
||||||
CONST CHAR8* key
|
CONST CHAR8* key
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
TagStruct* NewTag( void );
|
||||||
XMLParseNextTag (
|
|
||||||
CHAR8 *buffer,
|
|
||||||
TagPtr *tag,
|
|
||||||
UINT32 *lenPtr
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FreeTag (
|
FreeTag (
|
||||||
TagPtr tag
|
TagStruct* tag
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -320,33 +336,33 @@ GetNextTag (
|
|||||||
|
|
||||||
INTN
|
INTN
|
||||||
GetTagCount (
|
GetTagCount (
|
||||||
TagPtr dict
|
const TagStruct* dict
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetElement(
|
GetElement(
|
||||||
TagPtr dict,
|
const TagStruct* dict,
|
||||||
INTN id,
|
INTN id,
|
||||||
TagPtr *dict1
|
const TagStruct** dict1
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPropertyTrue(
|
IsPropertyTrue(
|
||||||
TagPtr Prop
|
const TagStruct* Prop
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsPropertyFalse(
|
IsPropertyFalse(
|
||||||
TagPtr Prop
|
const TagStruct* Prop
|
||||||
);
|
);
|
||||||
|
|
||||||
INTN
|
INTN
|
||||||
GetPropertyInteger(
|
GetPropertyInteger(
|
||||||
TagPtr Prop,
|
const TagStruct* Prop,
|
||||||
INTN Default
|
INTN Default
|
||||||
);
|
);
|
||||||
|
|
||||||
float GetPropertyFloat (TagPtr Prop, float Default);
|
float GetPropertyFloat (const TagStruct* Prop, float Default);
|
||||||
|
|
||||||
|
|
||||||
#endif /* PLATFORM_PLIST_H_ */
|
#endif /* PLATFORM_PLIST_H_ */
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include "XIcon.h"
|
#include "XIcon.h"
|
||||||
#include "XCinema.h"
|
#include "XCinema.h"
|
||||||
|
|
||||||
|
class TagStruct;
|
||||||
|
|
||||||
#define INDICATOR_SIZE (52)
|
#define INDICATOR_SIZE (52)
|
||||||
|
|
||||||
class XTheme
|
class XTheme
|
||||||
@ -141,11 +143,11 @@ public:
|
|||||||
// void AddIcon(XIcon& NewIcon); //return EFI_STATUS?
|
// void AddIcon(XIcon& NewIcon); //return EFI_STATUS?
|
||||||
void FillByEmbedded();
|
void FillByEmbedded();
|
||||||
void FillByDir();
|
void FillByDir();
|
||||||
EFI_STATUS GetThemeTagSettings(void* DictPointer);
|
EFI_STATUS GetThemeTagSettings(const TagStruct* DictPointer);
|
||||||
void parseTheme(void* p, const char** dict); //in nano project
|
void parseTheme(void* p, const char** dict); //in nano project
|
||||||
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
|
EFI_STATUS ParseSVGXTheme(const CHAR8* buffer); // in VectorTheme
|
||||||
EFI_STATUS ParseSVGXIcon(INTN Id, const XString8& IconNameX, XImage* Image, void **SVGIcon);
|
EFI_STATUS ParseSVGXIcon(INTN Id, const XString8& IconNameX, XImage* Image, void **SVGIcon);
|
||||||
void* LoadTheme(const XStringW& TestTheme); //return TagPtr why?
|
TagStruct* LoadTheme(const XStringW& TestTheme); //return TagStruct* why?
|
||||||
EFI_STATUS LoadSvgFrame(INTN i, OUT XImage* XFrame); // for animation
|
EFI_STATUS LoadSvgFrame(INTN i, OUT XImage* XFrame); // for animation
|
||||||
|
|
||||||
//screen operations
|
//screen operations
|
||||||
|
@ -571,7 +571,7 @@ VOID LOADER_ENTRY::StartLoader()
|
|||||||
EFI_HANDLE ImageHandle = NULL;
|
EFI_HANDLE ImageHandle = NULL;
|
||||||
EFI_LOADED_IMAGE *LoadedImage = NULL;
|
EFI_LOADED_IMAGE *LoadedImage = NULL;
|
||||||
CONST CHAR8 *InstallerVersion;
|
CONST CHAR8 *InstallerVersion;
|
||||||
TagPtr dict = NULL;
|
TagStruct* dict = NULL;
|
||||||
UINTN i;
|
UINTN i;
|
||||||
NSVGfont *font; // , *nextFont;
|
NSVGfont *font; // , *nextFont;
|
||||||
|
|
||||||
@ -1801,8 +1801,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
//UINT64 TscRemainder = 0;
|
//UINT64 TscRemainder = 0;
|
||||||
// LOADER_ENTRY *LoaderEntry;
|
// LOADER_ENTRY *LoaderEntry;
|
||||||
XStringW ConfName;
|
XStringW ConfName;
|
||||||
TagPtr smbiosTags = NULL;
|
TagStruct* smbiosTags = NULL;
|
||||||
TagPtr UniteTag = NULL;
|
|
||||||
BOOLEAN UniteConfigs = FALSE;
|
BOOLEAN UniteConfigs = FALSE;
|
||||||
EFI_TIME Now;
|
EFI_TIME Now;
|
||||||
BOOLEAN HaveDefaultVolume;
|
BOOLEAN HaveDefaultVolume;
|
||||||
@ -1953,7 +1952,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gConfigDict[1]) {
|
if (gConfigDict[1]) {
|
||||||
UniteTag = GetProperty(gConfigDict[1], "Unite");
|
const TagStruct* UniteTag = GetProperty(gConfigDict[1], "Unite");
|
||||||
if(UniteTag) {
|
if(UniteTag) {
|
||||||
UniteConfigs = UniteTag->isTrueOrYy();
|
UniteConfigs = UniteTag->isTrueOrYy();
|
||||||
DBG("UniteConfigs = %ls", UniteConfigs ? L"TRUE\n": L"FALSE\n" );
|
DBG("UniteConfigs = %ls", UniteConfigs ? L"TRUE\n": L"FALSE\n" );
|
||||||
@ -2219,7 +2218,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
|||||||
// }
|
// }
|
||||||
// Load any extra SMBIOS information
|
// Load any extra SMBIOS information
|
||||||
if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios"_XSW, &smbiosTags)) && (smbiosTags != NULL)) {
|
if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios"_XSW, &smbiosTags)) && (smbiosTags != NULL)) {
|
||||||
TagPtr dictPointer = GetProperty(smbiosTags,"SMBIOS");
|
const TagStruct* dictPointer = GetProperty(smbiosTags,"SMBIOS");
|
||||||
if (dictPointer) {
|
if (dictPointer) {
|
||||||
ParseSMBIOSSettings(dictPointer);
|
ParseSMBIOSSettings(dictPointer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -474,7 +474,7 @@ VOID ApplyInputs(VOID)
|
|||||||
// UINT32 k;
|
// UINT32 k;
|
||||||
CHAR16 *ch;
|
CHAR16 *ch;
|
||||||
CHAR8 AString[256];
|
CHAR8 AString[256];
|
||||||
TagPtr dict;
|
|
||||||
// DBG("ApplyInputs\n");
|
// DBG("ApplyInputs\n");
|
||||||
if (InputItems[i].Valid) {
|
if (InputItems[i].Valid) {
|
||||||
ZeroMem(&gSettings.BootArgs, 256);
|
ZeroMem(&gSettings.BootArgs, 256);
|
||||||
@ -863,6 +863,7 @@ VOID ApplyInputs(VOID)
|
|||||||
|
|
||||||
i++; //90
|
i++; //90
|
||||||
if (InputItems[i].Valid) {
|
if (InputItems[i].Valid) {
|
||||||
|
TagStruct* dict;
|
||||||
Status = LoadUserSettings(SelfRootDir, XStringW(ConfigsList[OldChosenConfig]), &dict);
|
Status = LoadUserSettings(SelfRootDir, XStringW(ConfigsList[OldChosenConfig]), &dict);
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
gBootChanged = TRUE;
|
gBootChanged = TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user