mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Rename ABSTRACT_PATCH Data & Patch, Find and Replace.
Create GetChassisTypeFromModel() and GetFwFeaturesMaskFromModel(). Ignore first '\' in ForceKextsToLoad. XString : Add a parameter to wc_str to access address of nth chars. XString : Add endWithOrEqualToIC. Create ConstXStringArray.
This commit is contained in:
parent
5d20632984
commit
2cf69b2b55
@ -22,8 +22,8 @@ class ABSTRACT_PATCH
|
||||
public:
|
||||
bool Disabled = bool();
|
||||
// XString8 Comment = XString8();
|
||||
XBuffer<UINT8> Data = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> Patch = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> Find = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> Replace = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> MaskFind = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> MaskReplace = XBuffer<UINT8> ();
|
||||
XBuffer<UINT8> StartPattern = XBuffer<UINT8> ();
|
||||
|
@ -967,16 +967,9 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Prop2->getString()->stringValue().notEmpty()) {
|
||||
const CHAR8* p = Prop2->getString()->stringValue().c_str();
|
||||
if (*p == '\\') {
|
||||
++p;
|
||||
}
|
||||
|
||||
if (strlen(p) > 1) {
|
||||
Patches->ForceKextsToLoad.Add(p);
|
||||
DBG(" - [%zu]: %ls\n", Patches->ForceKextsToLoad.size(), Patches->ForceKextsToLoad[Patches->ForceKextsToLoad.size()-1].wc_str());
|
||||
}
|
||||
if ( Prop2->getString()->stringValue().notEmpty() && Prop2->getString()->stringValue() != "\\"_XS8 ) {
|
||||
Patches->ForceKextsToLoad.Add(Prop2->getString()->stringValue());
|
||||
DBG(" - [%zu]: %ls\n", Patches->ForceKextsToLoad.size(), Patches->ForceKextsToLoad[Patches->ForceKextsToLoad.size()-1].wc_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1080,7 +1073,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
}
|
||||
|
||||
|
||||
newKextPatch.Data.stealValueFrom(TmpData, FindLen);
|
||||
newKextPatch.Find.stealValueFrom(TmpData, FindLen);
|
||||
|
||||
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
|
||||
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
|
||||
@ -1092,9 +1085,9 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
}
|
||||
FreePool(TmpData);
|
||||
// take into account a possibility to set ReplaceLen < FindLen. In this case assumes MaskReplace = 0 for the rest of bytes
|
||||
newKextPatch.Patch.memset(0, FindLen);
|
||||
newKextPatch.Replace.memset(0, FindLen);
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
newKextPatch.Patch.ncpy(TmpPatch, ReplaceLen);
|
||||
newKextPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
FreePool(TmpPatch);
|
||||
|
||||
MaskLen = 0;
|
||||
@ -1136,7 +1129,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
DBG(" :: BinPatch");
|
||||
}
|
||||
|
||||
DBG(" :: data len: %zu\n", newKextPatch.Data.size());
|
||||
DBG(" :: data len: %zu\n", newKextPatch.Find.size());
|
||||
if (!newKextPatch.MenuItem.BValue) {
|
||||
DBG(" patch disabled at config\n");
|
||||
}
|
||||
@ -1233,7 +1226,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
}
|
||||
|
||||
|
||||
newKernelPatch.Data.stealValueFrom(TmpData, FindLen);
|
||||
newKernelPatch.Find.stealValueFrom(TmpData, FindLen);
|
||||
|
||||
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
|
||||
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
|
||||
@ -1245,8 +1238,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
FreePool(TmpData);
|
||||
// this is "Replace" string len of ReplaceLen
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
newKernelPatch.Patch.memset(0, FindLen);
|
||||
newKernelPatch.Patch.ncpy(TmpPatch, ReplaceLen);
|
||||
newKernelPatch.Replace.memset(0, FindLen);
|
||||
newKernelPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
FreePool(TmpPatch);
|
||||
MaskLen = 0;
|
||||
TmpData = GetDataSetting (Prop2, "MaskReplace", &MaskLen); //reuse MaskLen
|
||||
@ -1276,7 +1269,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
newKernelPatch.MatchBuild = prop3->getString()->stringValue();
|
||||
DBG(" :: MatchBuild: %s", newKernelPatch.MatchBuild.c_str());
|
||||
}
|
||||
DBG(" :: data len: %zu\n", newKernelPatch.Data.size());
|
||||
DBG(" :: data len: %zu\n", newKernelPatch.Find.size());
|
||||
Patches->KernelPatches.AddReference(newKernelPatchPtr, true);
|
||||
}
|
||||
}
|
||||
@ -1356,7 +1349,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
continue;
|
||||
}
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
newBootPatch.Data.stealValueFrom(TmpData, FindLen);
|
||||
newBootPatch.Find.stealValueFrom(TmpData, FindLen);
|
||||
|
||||
MaskLen = 0;
|
||||
TmpData = GetDataSetting(Prop2, "MaskFind", &MaskLen);
|
||||
@ -1367,8 +1360,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
newBootPatch.MaskFind.ncpy(TmpData, MaskLen);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
newBootPatch.Patch.memset(0, FindLen);
|
||||
newBootPatch.Patch.ncpy(TmpPatch, ReplaceLen);
|
||||
newBootPatch.Replace.memset(0, FindLen);
|
||||
newBootPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
FreePool(TmpPatch);
|
||||
MaskLen = 0;
|
||||
TmpData = GetDataSetting(Prop2, "MaskReplace", &MaskLen);
|
||||
@ -1398,7 +1391,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
DBG(" :: MatchBuild: %s", newBootPatch.MatchBuild.c_str());
|
||||
}
|
||||
|
||||
DBG(" :: data len: %zu\n", newBootPatch.Data.size());
|
||||
DBG(" :: data len: %zu\n", newBootPatch.Find.size());
|
||||
Patches->BootPatches.AddReference(newBootPatchPtr, true);
|
||||
}
|
||||
}
|
||||
|
@ -2395,10 +2395,10 @@ LOADER_ENTRY::KernelUserPatch()
|
||||
DBG( " StartPattern found\n");
|
||||
Num = SearchAndReplaceMask(curs,
|
||||
procLen,
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].Data.data(),
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].Find.data(),
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].MaskFind.data(),
|
||||
KernelAndKextPatches.KernelPatches[i].Data.size(),
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].Patch.data(),
|
||||
KernelAndKextPatches.KernelPatches[i].Find.size(),
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].Replace.data(),
|
||||
(const UINT8*)KernelAndKextPatches.KernelPatches[i].MaskReplace.data(),
|
||||
KernelAndKextPatches.KernelPatches[i].Count,
|
||||
KernelAndKextPatches.KernelPatches[i].Skip);
|
||||
@ -2455,10 +2455,10 @@ LOADER_ENTRY::BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize)
|
||||
|
||||
Num = SearchAndReplaceMask(curs,
|
||||
SearchLen,
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].Data.data(),
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].Find.data(),
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].MaskFind.data(),
|
||||
KernelAndKextPatches.BootPatches[i].Data.size(),
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].Patch.data(),
|
||||
KernelAndKextPatches.BootPatches[i].Find.size(),
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].Replace.data(),
|
||||
(const UINT8*)KernelAndKextPatches.BootPatches[i].MaskReplace.data(),
|
||||
KernelAndKextPatches.BootPatches[i].Count,
|
||||
KernelAndKextPatches.BootPatches[i].Skip);
|
||||
|
@ -202,6 +202,7 @@ XString8 LOADER_ENTRY::getKextExecPath(const XStringW& dirPath, const SIDELOAD_
|
||||
}
|
||||
|
||||
//it seems no more used? Or???
|
||||
// FileName is better as a XString8 instead of XStringW because _BooterKextFileInfo will need an utf8.
|
||||
EFI_STATUS LOADER_ENTRY::LoadKext(const EFI_FILE *RootDir, const XString8& FileName, IN cpu_type_t archCpuType, IN OUT void *kext_v)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@ -451,8 +452,8 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
XStringW SrcDir;
|
||||
REFIT_DIR_ITER PlugInIter;
|
||||
EFI_FILE_INFO *PlugInFile;
|
||||
XString8 FileName;
|
||||
XString8 PlugIns;
|
||||
// XString8 FileName;
|
||||
// XString8 PlugIns;
|
||||
// CONST CHAR16 *Arch = NULL;
|
||||
// CONST CHAR16 *Ptr = NULL;
|
||||
|
||||
@ -491,24 +492,25 @@ void LOADER_ENTRY::AddKextsInArray(XObjArray<SIDELOAD_KEXT>* kextArray)
|
||||
MsgLog(" Force kext: %ls\n", KernelAndKextPatches.ForceKextsToLoad[i].wc_str());
|
||||
if (Volume && Volume->RootDir) {
|
||||
// Check if the entry is a directory
|
||||
if (StrStr(KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), L".kext") == NULL) {
|
||||
DirIterOpen(Volume->RootDir, KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), &PlugInIter);
|
||||
const wchar_t* p;
|
||||
if ( KernelAndKextPatches.ForceKextsToLoad[i].startWith('\\') ) p = KernelAndKextPatches.ForceKextsToLoad[i].wc_str(1);
|
||||
else p = KernelAndKextPatches.ForceKextsToLoad[i].wc_str();
|
||||
if (StrStr(p, L".kext") == NULL) {
|
||||
DirIterOpen(Volume->RootDir, p, &PlugInIter);
|
||||
while (DirIterNext(&PlugInIter, 1, L"*.kext", &PlugInFile)) {
|
||||
if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL)
|
||||
continue; // skip this
|
||||
FileName = SWPrintf("%ls\\%ls", KernelAndKextPatches.ForceKextsToLoad[i].wc_str(), PlugInFile->FileName);
|
||||
// snwprintf(FileName, 512, "%s\\%s", KernelAndKextPatches.ForceKexts[i], PlugInFile->FileName);
|
||||
XString8 FileName = S8Printf("%ls\\%ls", p, PlugInFile->FileName);
|
||||
MsgLog(" Force kext: %s\n", FileName.c_str());
|
||||
AddKext( Volume->RootDir, FileName, archCpuType);
|
||||
PlugIns = SWPrintf("%s\\Contents\\PlugIns", FileName.c_str());
|
||||
// snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", FileName);
|
||||
XString8 PlugIns = S8Printf("%s\\Contents\\PlugIns", FileName.c_str());
|
||||
LoadPlugInKexts(Volume->RootDir, PlugIns, archCpuType, TRUE);
|
||||
}
|
||||
DirIterClose(&PlugInIter);
|
||||
} else {
|
||||
AddKext( Volume->RootDir, KernelAndKextPatches.ForceKextsToLoad[i], archCpuType);
|
||||
PlugIns = SWPrintf("%ls\\Contents\\PlugIns", KernelAndKextPatches.ForceKextsToLoad[i].wc_str());
|
||||
// snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", KernelAndKextPatches.ForceKexts[i]);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -916,7 +918,7 @@ EFI_STATUS LOADER_ENTRY::InjectKexts(IN UINT32 deviceTreeP, IN UINT32* deviceTre
|
||||
InfoPlist[drvinfo->infoDictLength] = '\0';
|
||||
// KernelAndKextPatcherInit();
|
||||
for (size_t i = 0; i < KernelAndKextPatches.KextPatches.size(); i++) {
|
||||
if ((KernelAndKextPatches.KextPatches[i].Data.size() > 0) &&
|
||||
if ((KernelAndKextPatches.KextPatches[i].Find.size() > 0) &&
|
||||
(AsciiStrStr(InfoPlist, KernelAndKextPatches.KextPatches[i].Name.c_str()) != NULL)) {
|
||||
AnyKextPatch(
|
||||
(UINT8*)(UINTN)drvinfo->executablePhysAddr,
|
||||
|
@ -980,10 +980,10 @@ void LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPli
|
||||
|
||||
Num = SearchAndReplaceMask(curs,
|
||||
procLen,
|
||||
kextpatch.Data.data(),
|
||||
kextpatch.Find.data(),
|
||||
kextpatch.MaskFind.data(),
|
||||
kextpatch.Data.size(),
|
||||
kextpatch.Patch.data(),
|
||||
kextpatch.Find.size(),
|
||||
kextpatch.Replace.data(),
|
||||
kextpatch.MaskReplace.data(),
|
||||
kextpatch.Count,
|
||||
kextpatch.Skip);
|
||||
@ -1000,21 +1000,21 @@ void LOADER_ENTRY::AnyKextPatch(UINT8 *Driver, UINT32 DriverSize, CHAR8 *InfoPli
|
||||
} else {
|
||||
// Info plist patch
|
||||
DBG_RT("Info.plist data : '");
|
||||
for (size_t Ind = 0; Ind < kextpatch.Data.size(); Ind++) {
|
||||
DBG_RT("%c", kextpatch.Data[Ind]);
|
||||
for (size_t Ind = 0; Ind < kextpatch.Find.size(); Ind++) {
|
||||
DBG_RT("%c", kextpatch.Find[Ind]);
|
||||
}
|
||||
DBG_RT("' ->\n");
|
||||
DBG_RT("Info.plist patch: '");
|
||||
for (size_t Ind = 0; Ind < kextpatch.Data.size(); Ind++) {
|
||||
DBG_RT("%c", kextpatch.Patch[Ind]);
|
||||
for (size_t Ind = 0; Ind < kextpatch.Find.size(); Ind++) {
|
||||
DBG_RT("%c", kextpatch.Replace[Ind]);
|
||||
}
|
||||
DBG_RT("' \n");
|
||||
|
||||
Num = SearchAndReplaceTxt((UINT8*)InfoPlist,
|
||||
InfoPlistSize,
|
||||
kextpatch.Data.data(),
|
||||
kextpatch.Data.size(),
|
||||
kextpatch.Patch.data(),
|
||||
kextpatch.Find.data(),
|
||||
kextpatch.Find.size(),
|
||||
kextpatch.Replace.data(),
|
||||
-1);
|
||||
}
|
||||
|
||||
@ -1123,7 +1123,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(".");
|
||||
if ((KernelAndKextPatches.KextPatches[i].Data.size() > 0) &&
|
||||
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)) {
|
||||
DBG_RT("\n\nPatch kext: %s\n", KernelAndKextPatches.KextPatches[i].Name.c_str());
|
||||
|
@ -31,44 +31,6 @@
|
||||
|
||||
// Refactored to single data structure by RehabMan
|
||||
|
||||
class PLATFORMDATA
|
||||
{
|
||||
public:
|
||||
const LString8 productName;
|
||||
const LString8 firmwareVersion;
|
||||
const LString8 efiversion;
|
||||
const LString8 boardID;
|
||||
const LString8 productFamily;
|
||||
const LString8 systemVersion;
|
||||
const LString8 serialNumber;
|
||||
const LString8 chassisAsset;
|
||||
UINT8 smcRevision[6];
|
||||
const LString8 smcBranch;
|
||||
const LString8 smcPlatform;
|
||||
UINT32 smcConfig;
|
||||
|
||||
//PLATFORMDATA() : productName(), firmwareVersion(), efiversion(), boardID(), productFamily(), systemVersion(), serialNumber(), chassisAsset(), smcRevision{0,0,0,0,0,0}, smcBranch(), smcPlatform(), smcConfig() { }
|
||||
PLATFORMDATA(const LString8& _productName, const LString8& _firmwareVersion, const LString8& _efiversion, const LString8& _boardID, const LString8& _productFamily,
|
||||
const LString8& _systemVersion, const LString8& _serialNumber, const LString8& _chassisAsset,
|
||||
UINT8 _smcRevision0, UINT8 _smcRevision1, UINT8 _smcRevision2, UINT8 _smcRevision3, UINT8 _smcRevision4, UINT8 _smcRevision5,
|
||||
const LString8& _smcBranch, const LString8& _smcPlatform, UINT32 _smcConfig)
|
||||
: productName(_productName), firmwareVersion(_firmwareVersion), efiversion(_efiversion), boardID(_boardID), productFamily(_productFamily),
|
||||
systemVersion(_systemVersion), serialNumber(_serialNumber), chassisAsset(_chassisAsset), smcRevision{0},
|
||||
smcBranch(_smcBranch), smcPlatform(_smcPlatform), smcConfig(_smcConfig)
|
||||
{
|
||||
smcRevision[0] = _smcRevision0;
|
||||
smcRevision[1] = _smcRevision1;
|
||||
smcRevision[2] = _smcRevision2;
|
||||
smcRevision[3] = _smcRevision3;
|
||||
smcRevision[4] = _smcRevision4;
|
||||
smcRevision[5] = _smcRevision5;
|
||||
}
|
||||
|
||||
// Not sure if default are valid. Delete them. If needed, proper ones can be created
|
||||
PLATFORMDATA(const PLATFORMDATA&) = delete;
|
||||
PLATFORMDATA& operator=(const PLATFORMDATA&) = delete;
|
||||
} ;
|
||||
|
||||
//--------------------------
|
||||
/* AppleGraphicsDevicePolicy.kext in 10.14.6 contains follow board-id to choose from graphics config
|
||||
none:
|
||||
@ -848,115 +810,7 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
}
|
||||
|
||||
// FirmwareFeaturesMask
|
||||
switch (Model) {
|
||||
// Verified list from Firmware
|
||||
case MacBookPro91:
|
||||
case MacBookPro92:
|
||||
case MacBookPro101:
|
||||
case MacBookPro102:
|
||||
case MacBookPro111:
|
||||
case MacBookPro112:
|
||||
case MacBookPro113:
|
||||
case MacBookPro114:
|
||||
case MacBookPro115:
|
||||
case MacBookAir41:
|
||||
case MacBookAir42:
|
||||
case MacBookAir51:
|
||||
case MacBookAir52:
|
||||
case MacBookAir61:
|
||||
case MacBookAir62:
|
||||
case MacMini51:
|
||||
case MacMini52:
|
||||
case MacMini53:
|
||||
case MacMini61:
|
||||
case MacMini62:
|
||||
case iMac131:
|
||||
case iMac132:
|
||||
case iMac133:
|
||||
case iMac141:
|
||||
case iMac142:
|
||||
case iMac143:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF3F;
|
||||
break;
|
||||
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
case MacBookPro131:
|
||||
case MacBookPro132:
|
||||
case MacBookPro133:
|
||||
case MacBookPro141:
|
||||
case MacBookPro142:
|
||||
case MacBookPro143:
|
||||
case iMac144:
|
||||
case iMac151:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case MacPro61:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF7F;
|
||||
break;
|
||||
case iMacPro11:
|
||||
case MacBookAir91:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFF9FFF3F;
|
||||
break;
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case MacMini81:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFFDFFF7F;
|
||||
break;
|
||||
case MacBookPro162:
|
||||
case MacBookPro163:
|
||||
case MacBookPro164:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFFFFFF7F;
|
||||
break;
|
||||
|
||||
// Verified list from Users
|
||||
case MacBook61:
|
||||
case MacBook71:
|
||||
case MacBook81:
|
||||
case MacBookPro61:
|
||||
case MacBookPro62:
|
||||
case MacBookPro71:
|
||||
case MacBookPro81:
|
||||
case MacBookPro82:
|
||||
case MacBookPro83:
|
||||
case MacBookPro121:
|
||||
case MacBookPro151:
|
||||
case MacBookPro152:
|
||||
case MacBookPro153:
|
||||
case MacBookPro154:
|
||||
case MacBookPro161:
|
||||
case MacBookAir31:
|
||||
case MacBookAir32:
|
||||
case MacBookAir71:
|
||||
case MacBookAir72:
|
||||
case MacBookAir81:
|
||||
case MacBookAir82:
|
||||
case MacMini41:
|
||||
case MacMini71:
|
||||
case iMac101:
|
||||
case iMac111:
|
||||
case iMac112:
|
||||
case iMac113:
|
||||
case iMac121:
|
||||
case iMac122:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case MacPro51:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFF1FFF3F;
|
||||
break;
|
||||
|
||||
case MacPro71:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFF9FFF3F;
|
||||
break;
|
||||
|
||||
default:
|
||||
gSettings.Smbios.gFwFeaturesMask = 0xFFFFFFFF; //unknown - use oem SMBIOS value to be default
|
||||
break;
|
||||
}
|
||||
gSettings.Smbios.gFwFeaturesMask = GetFwFeaturesMaskFromModel(Model);
|
||||
|
||||
// PlatformFeature
|
||||
// the memory tab in About This Mac
|
||||
@ -1054,7 +908,8 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
gSettings.Smbios.BoardType = BaseBoardTypeMotherBoard; //0xA;
|
||||
}
|
||||
|
||||
// MiscChassisType
|
||||
gSettings.Smbios.ChassisType = GetChassisTypeFromModel(Model);
|
||||
|
||||
// Mobile: the battery tab in Energy Saver
|
||||
switch (Model) {
|
||||
case MacBook11:
|
||||
@ -1065,6 +920,10 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case MacBook52:
|
||||
case MacBook61:
|
||||
case MacBook71:
|
||||
case MacBook81:
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
|
||||
case MacBookAir11:
|
||||
case MacBookAir21:
|
||||
case MacBookAir31:
|
||||
@ -1075,6 +934,21 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case MacBookAir52:
|
||||
case MacBookAir61:
|
||||
case MacBookAir62:
|
||||
|
||||
case MacBookPro11:
|
||||
case MacBookPro12:
|
||||
case MacBookPro21:
|
||||
case MacBookPro22:
|
||||
case MacBookPro31:
|
||||
case MacBookPro41:
|
||||
case MacBookPro51:
|
||||
case MacBookPro52:
|
||||
case MacBookPro53:
|
||||
case MacBookPro54:
|
||||
case MacBookPro55:
|
||||
case MacBookPro61:
|
||||
case MacBookPro62:
|
||||
case MacBookPro71:
|
||||
case MacBookPro81:
|
||||
case MacBookPro82:
|
||||
case MacBookPro83:
|
||||
@ -1087,21 +961,6 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case MacBookPro113:
|
||||
case MacBookPro114:
|
||||
case MacBookPro115:
|
||||
case MacMini71:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeNotebook; //0x0A;
|
||||
switch (Model) {
|
||||
case MacMini71:
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
default:
|
||||
gSettings.Smbios.Mobile = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MacBook81:
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
case MacBookPro121:
|
||||
case MacBookPro131:
|
||||
case MacBookPro132:
|
||||
@ -1122,55 +981,6 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case MacBookAir81:
|
||||
case MacBookAir82:
|
||||
case MacBookAir91:
|
||||
case MacMini81:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case iMacPro11:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeLapTop; //0x09;
|
||||
switch (Model) {
|
||||
case MacMini81:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case iMacPro11:
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
default:
|
||||
gSettings.Smbios.Mobile = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MacBookPro11:
|
||||
case MacBookPro12:
|
||||
case MacBookPro21:
|
||||
case MacBookPro22:
|
||||
case MacBookPro31:
|
||||
case MacBookPro41:
|
||||
case MacBookPro51:
|
||||
case MacBookPro52:
|
||||
case MacBookPro53:
|
||||
case MacBookPro54:
|
||||
case MacBookPro55:
|
||||
case MacBookPro61:
|
||||
case MacBookPro62:
|
||||
case MacBookPro71:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypePortable; //0x08;
|
||||
gSettings.Smbios.Mobile = TRUE;
|
||||
break;
|
||||
|
||||
@ -1196,16 +1006,22 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case iMac143:
|
||||
case iMac144:
|
||||
case iMac151:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeAllInOne; //0x0D;
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case iMacPro11:
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
case MacMini11:
|
||||
case MacMini21:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeLowProfileDesktop; //0x04;
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
case MacMini31:
|
||||
case MacMini41:
|
||||
case MacMini51:
|
||||
@ -1213,40 +1029,29 @@ void SetDMISettingsForModel(SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLE
|
||||
case MacMini53:
|
||||
case MacMini61:
|
||||
case MacMini62:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeLunchBox; //0x10;
|
||||
case MacMini71:
|
||||
case MacMini81:
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
case MacPro41:
|
||||
case MacPro51:
|
||||
case MacPro71:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeTower; //0x07;
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
case MacPro11:
|
||||
case MacPro21:
|
||||
case MacPro31:
|
||||
case MacPro61:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeUnknown; //0x02; this is a joke but think different!
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
case Xserve11:
|
||||
case Xserve21:
|
||||
case Xserve31:
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeRackMountChassis; //0x17;
|
||||
gSettings.Smbios.Mobile = FALSE;
|
||||
break;
|
||||
|
||||
default: //unknown - use oem SMBIOS value to be default
|
||||
gSettings.Smbios.Mobile = gMobile;
|
||||
gSettings.Smbios.ChassisType = 0; //let SMBIOS value to be
|
||||
/*if (gMobile) {
|
||||
gSettings.Smbios.ChassisType = 10; //notebook
|
||||
} else {
|
||||
gSettings.Smbios.ChassisType = MiscChassisTypeDeskTop; //0x03;
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1503,3 +1308,320 @@ void GetDefaultCpuSettings(SETTINGS_DATA& gSettings)
|
||||
gSettings.CPU.UseARTFreq = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t GetChassisTypeFromModel(MACHINE_TYPES Model)
|
||||
{
|
||||
|
||||
// MiscChassisType
|
||||
// Mobile: the battery tab in Energy Saver
|
||||
switch (Model) {
|
||||
case MacBook11:
|
||||
case MacBook21:
|
||||
case MacBook31:
|
||||
case MacBook41:
|
||||
case MacBook51:
|
||||
case MacBook52:
|
||||
case MacBook61:
|
||||
case MacBook71:
|
||||
case MacBookAir11:
|
||||
case MacBookAir21:
|
||||
case MacBookAir31:
|
||||
case MacBookAir32:
|
||||
case MacBookAir41:
|
||||
case MacBookAir42:
|
||||
case MacBookAir51:
|
||||
case MacBookAir52:
|
||||
case MacBookAir61:
|
||||
case MacBookAir62:
|
||||
case MacBookPro81:
|
||||
case MacBookPro82:
|
||||
case MacBookPro83:
|
||||
case MacBookPro91:
|
||||
case MacBookPro92:
|
||||
case MacBookPro101:
|
||||
case MacBookPro102:
|
||||
case MacBookPro111:
|
||||
case MacBookPro112:
|
||||
case MacBookPro113:
|
||||
case MacBookPro114:
|
||||
case MacBookPro115:
|
||||
case MacMini71:
|
||||
return MiscChassisTypeNotebook; //0x0A;
|
||||
|
||||
case MacBook81:
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
case MacBookPro121:
|
||||
case MacBookPro131:
|
||||
case MacBookPro132:
|
||||
case MacBookPro133:
|
||||
case MacBookPro141:
|
||||
case MacBookPro142:
|
||||
case MacBookPro143:
|
||||
case MacBookPro151:
|
||||
case MacBookPro152:
|
||||
case MacBookPro153:
|
||||
case MacBookPro154:
|
||||
case MacBookPro161:
|
||||
case MacBookPro162:
|
||||
case MacBookPro163:
|
||||
case MacBookPro164:
|
||||
case MacBookAir71:
|
||||
case MacBookAir72:
|
||||
case MacBookAir81:
|
||||
case MacBookAir82:
|
||||
case MacBookAir91:
|
||||
case MacMini81:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case iMacPro11:
|
||||
return MiscChassisTypeLapTop; //0x09;
|
||||
|
||||
case MacBookPro11:
|
||||
case MacBookPro12:
|
||||
case MacBookPro21:
|
||||
case MacBookPro22:
|
||||
case MacBookPro31:
|
||||
case MacBookPro41:
|
||||
case MacBookPro51:
|
||||
case MacBookPro52:
|
||||
case MacBookPro53:
|
||||
case MacBookPro54:
|
||||
case MacBookPro55:
|
||||
case MacBookPro61:
|
||||
case MacBookPro62:
|
||||
case MacBookPro71:
|
||||
return MiscChassisTypePortable; //0x08;
|
||||
|
||||
case iMac41:
|
||||
case iMac42:
|
||||
case iMac51:
|
||||
case iMac52:
|
||||
case iMac61:
|
||||
case iMac71:
|
||||
case iMac81:
|
||||
case iMac91:
|
||||
case iMac101:
|
||||
case iMac111:
|
||||
case iMac112:
|
||||
case iMac113:
|
||||
case iMac121:
|
||||
case iMac122:
|
||||
case iMac131:
|
||||
case iMac132:
|
||||
case iMac133:
|
||||
case iMac141:
|
||||
case iMac142:
|
||||
case iMac143:
|
||||
case iMac144:
|
||||
case iMac151:
|
||||
return MiscChassisTypeAllInOne; //0x0D;
|
||||
|
||||
case MacMini11:
|
||||
case MacMini21:
|
||||
return MiscChassisTypeLowProfileDesktop; //0x04;
|
||||
|
||||
case MacMini31:
|
||||
case MacMini41:
|
||||
case MacMini51:
|
||||
case MacMini52:
|
||||
case MacMini53:
|
||||
case MacMini61:
|
||||
case MacMini62:
|
||||
return MiscChassisTypeLunchBox; //0x10;
|
||||
break;
|
||||
|
||||
case MacPro41:
|
||||
case MacPro51:
|
||||
case MacPro71:
|
||||
return MiscChassisTypeTower; //0x07;
|
||||
|
||||
case MacPro11:
|
||||
case MacPro21:
|
||||
case MacPro31:
|
||||
case MacPro61:
|
||||
return MiscChassisTypeUnknown; //0x02; this is a joke but think different!
|
||||
|
||||
case Xserve11:
|
||||
case Xserve21:
|
||||
case Xserve31:
|
||||
return MiscChassisTypeRackMountChassis; //0x17;
|
||||
|
||||
default: //unknown - use oem SMBIOS value to be default
|
||||
/*if (gMobile) {
|
||||
return 10; //notebook
|
||||
} else {
|
||||
return MiscChassisTypeDeskTop; //0x03;
|
||||
}*/
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//gFwFeaturesMask
|
||||
|
||||
|
||||
uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model)
|
||||
{
|
||||
|
||||
// FirmwareFeaturesMask
|
||||
switch (Model) {
|
||||
// Verified list from Firmware
|
||||
case MacBookPro91:
|
||||
case MacBookPro92:
|
||||
case MacBookPro101:
|
||||
case MacBookPro102:
|
||||
case MacBookPro111:
|
||||
case MacBookPro112:
|
||||
case MacBookPro113:
|
||||
case MacBookPro114:
|
||||
case MacBookPro115:
|
||||
case MacBookAir41:
|
||||
case MacBookAir42:
|
||||
case MacBookAir51:
|
||||
case MacBookAir52:
|
||||
case MacBookAir61:
|
||||
case MacBookAir62:
|
||||
case MacMini51:
|
||||
case MacMini52:
|
||||
case MacMini53:
|
||||
case MacMini61:
|
||||
case MacMini62:
|
||||
case iMac131:
|
||||
case iMac132:
|
||||
case iMac133:
|
||||
case iMac141:
|
||||
case iMac142:
|
||||
case iMac143:
|
||||
return 0xFF1FFF3F;
|
||||
break;
|
||||
|
||||
case MacBook91:
|
||||
case MacBook101:
|
||||
case MacBookPro131:
|
||||
case MacBookPro132:
|
||||
case MacBookPro133:
|
||||
case MacBookPro141:
|
||||
case MacBookPro142:
|
||||
case MacBookPro143:
|
||||
case iMac144:
|
||||
case iMac151:
|
||||
case iMac171:
|
||||
case iMac181:
|
||||
case iMac182:
|
||||
case iMac183:
|
||||
case MacPro61:
|
||||
return 0xFF1FFF7F;
|
||||
break;
|
||||
case iMacPro11:
|
||||
case MacBookAir91:
|
||||
return 0xFF9FFF3F;
|
||||
break;
|
||||
case iMac191:
|
||||
case iMac192:
|
||||
case iMac201:
|
||||
case iMac202:
|
||||
case MacMini81:
|
||||
return 0xFFDFFF7F;
|
||||
break;
|
||||
case MacBookPro162:
|
||||
case MacBookPro163:
|
||||
case MacBookPro164:
|
||||
return 0xFFFFFF7F;
|
||||
break;
|
||||
|
||||
// Verified list from Users
|
||||
case MacBook61:
|
||||
case MacBook71:
|
||||
case MacBook81:
|
||||
case MacBookPro61:
|
||||
case MacBookPro62:
|
||||
case MacBookPro71:
|
||||
case MacBookPro81:
|
||||
case MacBookPro82:
|
||||
case MacBookPro83:
|
||||
case MacBookPro121:
|
||||
case MacBookPro151:
|
||||
case MacBookPro152:
|
||||
case MacBookPro153:
|
||||
case MacBookPro154:
|
||||
case MacBookPro161:
|
||||
case MacBookAir31:
|
||||
case MacBookAir32:
|
||||
case MacBookAir71:
|
||||
case MacBookAir72:
|
||||
case MacBookAir81:
|
||||
case MacBookAir82:
|
||||
case MacMini41:
|
||||
case MacMini71:
|
||||
case iMac101:
|
||||
case iMac111:
|
||||
case iMac112:
|
||||
case iMac113:
|
||||
case iMac121:
|
||||
case iMac122:
|
||||
case iMac161:
|
||||
case iMac162:
|
||||
case MacPro51:
|
||||
return 0xFF1FFF3F;
|
||||
break;
|
||||
|
||||
case MacPro71:
|
||||
return 0xFF9FFF3F;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0xFFFFFFFF; //unknown - use oem SMBIOS value to be default
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -149,20 +149,52 @@ constexpr LString8 AppleBoardSN = "C02140302D5DMT31M";
|
||||
constexpr LString8 AppleBoardLocation = "Part Component";
|
||||
|
||||
|
||||
void
|
||||
SetDMISettingsForModel (SETTINGS_DATA& gSettings,
|
||||
MACHINE_TYPES Model,
|
||||
BOOLEAN Redefine
|
||||
);
|
||||
class PLATFORMDATA
|
||||
{
|
||||
public:
|
||||
const LString8 productName;
|
||||
const LString8 firmwareVersion;
|
||||
const LString8 efiversion;
|
||||
const LString8 boardID;
|
||||
const LString8 productFamily;
|
||||
const LString8 systemVersion;
|
||||
const XString8 serialNumber;
|
||||
const LString8 chassisAsset;
|
||||
UINT8 smcRevision[6];
|
||||
const LString8 smcBranch;
|
||||
const LString8 smcPlatform;
|
||||
UINT32 smcConfig;
|
||||
|
||||
//PLATFORMDATA() : productName(), firmwareVersion(), efiversion(), boardID(), productFamily(), systemVersion(), serialNumber(), chassisAsset(), smcRevision{0,0,0,0,0,0}, smcBranch(), smcPlatform(), smcConfig() { }
|
||||
PLATFORMDATA(const LString8& _productName, const LString8& _firmwareVersion, const LString8& _efiversion, const LString8& _boardID, const LString8& _productFamily,
|
||||
const LString8& _systemVersion, const LString8& _serialNumber, const LString8& _chassisAsset,
|
||||
UINT8 _smcRevision0, UINT8 _smcRevision1, UINT8 _smcRevision2, UINT8 _smcRevision3, UINT8 _smcRevision4, UINT8 _smcRevision5,
|
||||
const LString8& _smcBranch, const LString8& _smcPlatform, UINT32 _smcConfig)
|
||||
: productName(_productName), firmwareVersion(_firmwareVersion), efiversion(_efiversion), boardID(_boardID), productFamily(_productFamily),
|
||||
systemVersion(_systemVersion), serialNumber(_serialNumber), chassisAsset(_chassisAsset), smcRevision{0},
|
||||
smcBranch(_smcBranch), smcPlatform(_smcPlatform), smcConfig(_smcConfig)
|
||||
{
|
||||
smcRevision[0] = _smcRevision0;
|
||||
smcRevision[1] = _smcRevision1;
|
||||
smcRevision[2] = _smcRevision2;
|
||||
smcRevision[3] = _smcRevision3;
|
||||
smcRevision[4] = _smcRevision4;
|
||||
smcRevision[5] = _smcRevision5;
|
||||
}
|
||||
|
||||
MACHINE_TYPES GetModelFromString (
|
||||
const XString8& ProductName
|
||||
);
|
||||
// Not sure if default are valid. Delete them. If needed, proper ones can be created
|
||||
PLATFORMDATA(const PLATFORMDATA&) = delete;
|
||||
PLATFORMDATA& operator=(const PLATFORMDATA&) = delete;
|
||||
} ;
|
||||
|
||||
void
|
||||
GetDefaultSettings(void);
|
||||
|
||||
void
|
||||
GetDefaultCpuSettings(SETTINGS_DATA& gSettings);
|
||||
extern PLATFORMDATA ApplePlatformData[];
|
||||
|
||||
void SetDMISettingsForModel (SETTINGS_DATA& gSettings, MACHINE_TYPES Model, BOOLEAN Redefine);
|
||||
MACHINE_TYPES GetModelFromString (const XString8& ProductName);
|
||||
void GetDefaultSettings(void);
|
||||
void GetDefaultCpuSettings(SETTINGS_DATA& gSettings);
|
||||
uint8_t GetChassisTypeFromModel(MACHINE_TYPES Model);
|
||||
uint32_t GetFwFeaturesMaskFromModel(MACHINE_TYPES Model);
|
||||
|
||||
#endif /* PLATFORM_PLATFORMDATA_H_ */
|
||||
|
@ -9,6 +9,8 @@
|
||||
#ifndef Platform_h_h
|
||||
#define Platform_h_h
|
||||
|
||||
#define _UINTPTR_T
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
@ -80,6 +82,15 @@ typedef unsigned long long uintptr_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define _MACH_H_
|
||||
#define __DEBUGGING__
|
||||
#import <Foundation/Foundation.h>
|
||||
#undef CMASK
|
||||
#endif
|
||||
|
||||
|
||||
// to be able to compile AutoGen.c
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -23,6 +23,7 @@ void panic(void)
|
||||
;
|
||||
#endif
|
||||
|
||||
#if !defined(_MACH_H_)
|
||||
#if !defined(PANIC_CAN_RETURN) && defined(_MSC_VER)
|
||||
__declspec(noreturn)
|
||||
#endif
|
||||
@ -31,6 +32,7 @@ void panic(const char* format, ...) __attribute__((__format__(__printf__, 1, 2))
|
||||
__attribute__ ((noreturn))
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define assert(expr) _assert(expr, "Expression \"%s\" failed in %s", #expr, __FUNCSIG__)
|
||||
|
@ -169,7 +169,10 @@ public:
|
||||
|
||||
using XStringAbstract<wchar_t, XStringW>::operator =;
|
||||
|
||||
const wchar_t* wc_str() const { return m_data; }
|
||||
const wchar_t* wc_str() const { return m_data; }
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
const wchar_t* wc_str(IntegralType idx) const { return data(idx); }
|
||||
|
||||
protected:
|
||||
static void transmitSWPrintf(const wchar_t* buf, unsigned int nbchar, void* context)
|
||||
|
@ -452,6 +452,9 @@ public:
|
||||
template<typename O>
|
||||
bool startWithOrEqualToIC(const O* other) const { return XStringAbstract__startWithOrEqualTo(m_data, other, true); }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool endWithOrEqualToIC(const __String<O, OtherXStringClass>& otherS) const { if ( length() < otherS.length() ) return false; return XStringAbstract__rindexOf(m_data, SIZE_T_MAX-1, otherS.data(), true) == length() - otherS.length(); }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
ThisXStringClass basename() const
|
||||
|
@ -10,3 +10,6 @@
|
||||
|
||||
const XString8Array NullXString8Array;
|
||||
const XStringWArray NullXStringWArray;
|
||||
|
||||
const ConstXString8Array NullConstXString8Array;
|
||||
const ConstXStringWArray NullConstXStringWArray;
|
||||
|
@ -57,7 +57,7 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
XStringClass ConcatAll(const Type1& Separator, const Type2& Prefix, const Type3& Suffix) const
|
||||
{
|
||||
size_t i;
|
||||
XStringClass s;
|
||||
remove_const(XStringClass) s;
|
||||
|
||||
if ( array.size() > 0 ) {
|
||||
s.takeValueFrom(Prefix);
|
||||
@ -165,15 +165,15 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
const wchar_t *p;
|
||||
|
||||
{
|
||||
XStringClass* newS = new XStringClass;
|
||||
remove_const(XStringClass)* newS = new remove_const(XStringClass);
|
||||
newS->takeValueFrom(Val1);
|
||||
AddReference(newS, true);
|
||||
}
|
||||
XTOOLS_VA_START(va, Val1);
|
||||
p = VA_ARG(va, const CharType*);
|
||||
while ( p != nullptr ) {
|
||||
XStringClass* newS = new XStringClass;
|
||||
newS->takeValueFrom(Val1);
|
||||
remove_const(XStringClass)* newS = new remove_const(XStringClass);
|
||||
newS->takeValueFrom(p);
|
||||
AddReference(newS, true);
|
||||
p = VA_ARG(va, const CharType*);
|
||||
}
|
||||
@ -186,7 +186,7 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
template<typename CharType, enable_if(is_char(CharType))>
|
||||
void Add(const CharType* s)
|
||||
{
|
||||
XStringClass* xstr = new XStringClass;
|
||||
remove_const(XStringClass)* xstr = new remove_const(XStringClass);
|
||||
xstr->strcpy(s);
|
||||
array.AddReference(xstr, true);
|
||||
}
|
||||
@ -195,7 +195,7 @@ class XStringArray_/* : public XStringArraySuper*/
|
||||
void Add(const XStringClass1 &aString) { Add(aString.s()); }
|
||||
|
||||
template<typename XStringClass1, enable_if(is___String(XStringClass1))>
|
||||
void insertAtPos(const XStringClass1 &aString, size_t pos) { array.InsertRef(new XStringClass1(aString), pos, true); }
|
||||
void insertAtPos(const XStringClass1 &aString, size_t pos) { array.InsertRef(new remove_const(XStringClass1)(aString), pos, true); }
|
||||
|
||||
void AddReference(XStringClass* newElement, bool FreeIt) { array.AddReference(newElement, FreeIt); }
|
||||
void insertReferenceAtPos(XStringClass* newElement, size_t pos, bool FreeIt) { array.InsertRef(newElement, pos, FreeIt); }
|
||||
@ -288,6 +288,17 @@ class XStringWArray : public XStringArray_<XStringW, XStringWArray>
|
||||
extern const XStringWArray NullXStringWArray;
|
||||
|
||||
|
||||
class ConstXString8Array : public XStringArray_<const XString8, ConstXString8Array>
|
||||
{
|
||||
};
|
||||
extern const ConstXString8Array NullConstXString8Array;
|
||||
|
||||
class ConstXStringWArray : public XStringArray_<const XStringW, ConstXStringWArray>
|
||||
{
|
||||
};
|
||||
extern const ConstXStringWArray NullConstXStringWArray;
|
||||
|
||||
|
||||
//
|
||||
//template<class XStringArrayClass, class XStringClass1, enable_if(!is_char(XStringClass1) && !is_char_ptr(XStringClass1))>
|
||||
//XStringArrayClass Split(const XStringClass1& S)
|
||||
|
@ -715,13 +715,13 @@ void LOADER_ENTRY::DelegateKernelPatches()
|
||||
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Count = (UINT32)kextPatch.Count;
|
||||
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Enabled = 1;
|
||||
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Find, kextPatch.Data.data(), kextPatch.Data.size());
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Find, kextPatch.Find.data(), kextPatch.Find.size());
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Identifier, kextPatch.Name.c_str());
|
||||
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Limit = (UINT32)kextPatch.SearchLen;
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Mask, kextPatch.MaskFind.vdata(), kextPatch.MaskFind.size());
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->MaxKernel, ""); // it has been filtered, so we don't need to set Min and MaxKernel
|
||||
OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->MinKernel, "");
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Replace, kextPatch.Patch.vdata(), kextPatch.Patch.size());
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Replace, kextPatch.Replace.vdata(), kextPatch.Replace.size());
|
||||
OC_STRING_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->ReplaceMask, kextPatch.MaskReplace.vdata(), kextPatch.MaskReplace.size());
|
||||
mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Skip = (UINT32)kextPatch.Skip;
|
||||
#ifdef JIEF_DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user