mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Refactor RT_VARIABLES as a class and RtVariables as a XObjArray.
Renamed RtVariables to BlockRtVariableArray.
This commit is contained in:
parent
babba4de6e
commit
823e0efc9f
@ -67,7 +67,6 @@ EFI_GUID gDataHubPlatformGuid = {
|
||||
|
||||
extern EFI_GUID gDataHubPlatformGuid;
|
||||
extern APPLE_SMC_IO_PROTOCOL *gAppleSmc;
|
||||
extern UINTN RtVariablesNum;
|
||||
|
||||
|
||||
typedef union {
|
||||
@ -175,11 +174,11 @@ OvrSetVariable(
|
||||
EFI_STATUS Status;
|
||||
UINTN i;
|
||||
|
||||
for (i = 0; i < RtVariablesNum; i++) {
|
||||
if (!CompareGuid(&RtVariables[i].VarGuid, VendorGuid)) {
|
||||
for (i = 0; i < BlockRtVariableArray.size(); i++) {
|
||||
if (!CompareGuid(&BlockRtVariableArray[i].VarGuid, VendorGuid)) {
|
||||
continue;
|
||||
}
|
||||
if (!RtVariables[i].Name || RtVariables[i].Name[0] == L'*' || StrCmp(VariableName, RtVariables[i].Name) == 0) {
|
||||
if (BlockRtVariableArray[i].Name.isEmpty() || BlockRtVariableArray[i].Name[0] == L'*' || BlockRtVariableArray[i].Name == LStringW(VariableName) ) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -218,7 +217,7 @@ SetVariablesForOSX(LOADER_ENTRY *Entry)
|
||||
//
|
||||
// firmware Variables
|
||||
//
|
||||
if (RtVariablesNum > 0) {
|
||||
if (BlockRtVariableArray.size() > 0) {
|
||||
OvrRuntimeServices(gRT);
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,7 @@ UINTN DsdtsNum = 0;
|
||||
CHAR16 *DsdtsList[20];
|
||||
UINTN AudioNum;
|
||||
HDA_OUTPUTS AudioList[20];
|
||||
UINTN RtVariablesNum;
|
||||
RT_VARIABLES *RtVariables;
|
||||
XObjArray<RT_VARIABLES> BlockRtVariableArray;
|
||||
|
||||
// firmware
|
||||
BOOLEAN gFirmwareClover = FALSE;
|
||||
@ -5808,8 +5807,9 @@ GetUserSettings(const TagDict* CfgDict)
|
||||
if (BlockArray != NULL) {
|
||||
INTN i;
|
||||
INTN Count = BlockArray->arrayContent().size();
|
||||
RtVariablesNum = 0;
|
||||
RtVariables = (__typeof__(RtVariables))AllocateZeroPool(Count * sizeof(RT_VARIABLES));
|
||||
BlockRtVariableArray.setEmpty();
|
||||
RT_VARIABLES* RtVariablePtr = new RT_VARIABLES();
|
||||
RT_VARIABLES& RtVariable = *RtVariablePtr;
|
||||
for (i = 0; i < Count; i++) {
|
||||
CfgDict = BlockArray->dictElementAt(i, "Block"_XS8);
|
||||
const TagStruct* Prop2 = CfgDict->propertyForKey("Comment");
|
||||
@ -5833,7 +5833,7 @@ GetUserSettings(const TagDict* CfgDict)
|
||||
}else{
|
||||
if( Prop2->getString()->stringValue().notEmpty() ) {
|
||||
if (IsValidGuidAsciiString(Prop2->getString()->stringValue())) {
|
||||
StrToGuidLE(Prop2->getString()->stringValue(), &RtVariables[RtVariablesNum].VarGuid);
|
||||
StrToGuidLE(Prop2->getString()->stringValue(), &RtVariable.VarGuid);
|
||||
}else{
|
||||
DBG("Error: invalid GUID for RT var '%s' - should be in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n", Prop->getString()->stringValue().c_str());
|
||||
}
|
||||
@ -5842,17 +5842,17 @@ GetUserSettings(const TagDict* CfgDict)
|
||||
}
|
||||
|
||||
Prop2 = CfgDict->propertyForKey("Name");
|
||||
RtVariables[RtVariablesNum].Name = NULL;
|
||||
RtVariable.Name.setEmpty();
|
||||
if ( Prop2 != NULL ) {
|
||||
if ( !Prop2->isString() ) {
|
||||
MsgLog("ATTENTION : property not string in Block/Name\n");
|
||||
}else{
|
||||
if( Prop2->getString()->stringValue().notEmpty() ) {
|
||||
snwprintf(RtVariables[RtVariablesNum].Name, 64, "%s", Prop2->getString()->stringValue().c_str());
|
||||
RtVariable.Name = Prop2->getString()->stringValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
RtVariablesNum++;
|
||||
BlockRtVariableArray.AddReference(RtVariablePtr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -702,13 +702,21 @@ public:
|
||||
~SIDELOAD_KEXT() { delete Next; delete PlugInList; }
|
||||
};
|
||||
|
||||
typedef struct RT_VARIABLES RT_VARIABLES;
|
||||
struct RT_VARIABLES {
|
||||
// BOOLEAN Disabled;
|
||||
CHAR16 *Name;
|
||||
class RT_VARIABLES
|
||||
{
|
||||
public:
|
||||
XStringW Name;
|
||||
EFI_GUID VarGuid;
|
||||
|
||||
RT_VARIABLES() : Name(), VarGuid{0} {};
|
||||
RT_VARIABLES(const RT_VARIABLES& other) = delete; // Can be defined if needed
|
||||
const RT_VARIABLES& operator = ( const RT_VARIABLES & ) = delete; // Can be defined if needed
|
||||
~RT_VARIABLES() { }
|
||||
};
|
||||
extern RT_VARIABLES *RtVariables;
|
||||
|
||||
|
||||
|
||||
extern XObjArray<RT_VARIABLES> BlockRtVariableArray;
|
||||
|
||||
extern UINTN AudioNum;
|
||||
extern HDA_OUTPUTS AudioList[20];
|
||||
|
@ -8,7 +8,8 @@ const char* config_all =
|
||||
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"> \
|
||||
<plist version=\"1.0\"> \
|
||||
<dict> \
|
||||
<key>ACPI</key> \
|
||||
<key>Test null data</key> \
|
||||
<data></data> \
|
||||
<dict> \
|
||||
<key>AutoMerge</key> \
|
||||
<true/> \
|
||||
|
Loading…
Reference in New Issue
Block a user