mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-22 11:25:42 +01:00
Fix a wrong cast in XImage.
Fix bug about padding StartMask, MaskFind, Replace, MaskReplace Move IgPlatform in GlobalConfig. Improve panic message. Fix bug in XMLDecode.
This commit is contained in:
parent
4269083faa
commit
23b39364d2
@ -1051,10 +1051,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
TmpData = GetDataSetting (Prop2, "MaskStart", &ReplaceLen);
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
if (FindLen != 0) {
|
||||
newKextPatch.StartMask.memset(0xFF, FindLen);
|
||||
if (TmpData != NULL) {
|
||||
newKextPatch.StartMask.ncpy(TmpData, ReplaceLen);
|
||||
}
|
||||
if (TmpData != NULL) newKextPatch.StartMask.ncpy(TmpData, ReplaceLen); // KextsToPatch
|
||||
newKextPatch.StartMask.setSize(FindLen, 0xFF);
|
||||
}
|
||||
if (TmpData != NULL) {
|
||||
FreePool(TmpData);
|
||||
@ -1085,14 +1083,14 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newKextPatch.MaskFind.memset(0xFF, FindLen);
|
||||
newKextPatch.MaskFind.ncpy(TmpData, MaskLen);
|
||||
newKextPatch.MaskFind.setSize(FindLen, 0xFF);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
// take into account a possibility to set ReplaceLen < FindLen. In this case assumes MaskReplace = 0 for the rest of bytes
|
||||
newKextPatch.Replace.memset(0, FindLen);
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
newKextPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
newKextPatch.Replace.setSize(FindLen, 0);
|
||||
FreePool(TmpPatch);
|
||||
|
||||
MaskLen = 0;
|
||||
@ -1100,8 +1098,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
MaskLen = MIN(ReplaceLen, MaskLen);
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newKextPatch.MaskReplace.memset(0, FindLen);
|
||||
newKextPatch.MaskReplace.ncpy(TmpData, MaskLen); //other bytes are zeros, means no replace
|
||||
newKextPatch.MaskReplace.setSize(FindLen, 0);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
|
||||
@ -1203,10 +1201,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
TmpData = GetDataSetting (Prop2, "MaskStart", &ReplaceLen);
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
if (FindLen != 0) {
|
||||
newKernelPatch.StartMask.memset(0xFF, FindLen);
|
||||
if (TmpData != NULL) {
|
||||
newKernelPatch.StartMask.ncpy(TmpData, ReplaceLen);
|
||||
}
|
||||
if (TmpData != NULL) newKernelPatch.StartMask.ncpy(TmpData, ReplaceLen); // KernelToPatch
|
||||
newKernelPatch.StartMask.setSize(FindLen, 0xFF);
|
||||
}
|
||||
if (TmpData != NULL) {
|
||||
FreePool(TmpData);
|
||||
@ -1237,22 +1233,22 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newKernelPatch.MaskFind.memset(0xFF, FindLen);
|
||||
newKernelPatch.MaskFind.ncpy(TmpData, MaskLen);
|
||||
newKernelPatch.MaskFind.setSize(FindLen, 0xFF);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
// this is "Replace" string len of ReplaceLen
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
newKernelPatch.Replace.memset(0, FindLen);
|
||||
newKernelPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
newKernelPatch.Replace.setSize(FindLen, 0);
|
||||
FreePool(TmpPatch);
|
||||
MaskLen = 0;
|
||||
TmpData = GetDataSetting (Prop2, "MaskReplace", &MaskLen); //reuse MaskLen
|
||||
MaskLen = MIN(ReplaceLen, MaskLen);
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newKernelPatch.MaskReplace.memset(0, FindLen);
|
||||
newKernelPatch.MaskReplace.ncpy(TmpData, MaskLen);
|
||||
newKernelPatch.MaskReplace.setSize(FindLen, 0);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
newKernelPatch.Count = 0;
|
||||
@ -1337,10 +1333,10 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
TmpData = GetDataSetting (Prop2, "MaskStart", &ReplaceLen);
|
||||
ReplaceLen = MIN(ReplaceLen, FindLen);
|
||||
if (FindLen != 0) {
|
||||
newBootPatch.StartMask.memset(0xFF, FindLen);
|
||||
if (TmpData != NULL) {
|
||||
newBootPatch.StartMask.ncpy(TmpData, ReplaceLen);
|
||||
}
|
||||
newBootPatch.StartMask.setSize(FindLen, 0xFF);
|
||||
}
|
||||
if (TmpData != NULL) {
|
||||
FreePool(TmpData);
|
||||
@ -1361,20 +1357,20 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
MaskLen = MIN(FindLen, MaskLen);
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newBootPatch.MaskFind.memset(0xFF, FindLen);
|
||||
newBootPatch.MaskFind.ncpy(TmpData, MaskLen);
|
||||
newBootPatch.MaskFind.setSize(FindLen, 0xFF);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
newBootPatch.Replace.memset(0, FindLen);
|
||||
newBootPatch.Replace.ncpy(TmpPatch, ReplaceLen);
|
||||
newBootPatch.Replace.setSize(FindLen, 0);
|
||||
FreePool(TmpPatch);
|
||||
MaskLen = 0;
|
||||
TmpData = GetDataSetting(Prop2, "MaskReplace", &MaskLen);
|
||||
MaskLen = MIN(ReplaceLen, MaskLen);
|
||||
if (TmpData == NULL || MaskLen == 0) {
|
||||
} else {
|
||||
newBootPatch.MaskReplace.memset(0, FindLen);
|
||||
newBootPatch.MaskReplace.ncpy(TmpData, MaskLen);
|
||||
newBootPatch.MaskReplace.setSize(FindLen, 0);
|
||||
}
|
||||
FreePool(TmpData);
|
||||
newBootPatch.Count = 0;
|
||||
@ -4644,7 +4640,7 @@ void SETTINGS_DATA::DevicesClass::FillDevicePropertiesOld(SETTINGS_DATA& gSettin
|
||||
|
||||
//Special case. In future there must be more such cases
|
||||
if ((AsciiStrStr(gSettings.Devices.ArbProperties->Key, "-platform-id") != NULL)) {
|
||||
CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, gSettings.Devices.ArbProperties->Value, 4);
|
||||
CopyMem((CHAR8*)&gSettings.Graphics._IgPlatform, gSettings.Devices.ArbProperties->Value, 4);
|
||||
}
|
||||
} //for() device properties
|
||||
}
|
||||
@ -4799,10 +4795,10 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
gSettings.Graphics.NvidiaSingle = IsPropertyNotNullAndTrue(Prop);
|
||||
|
||||
Prop = GraphicsDict->propertyForKey("ig-platform-id");
|
||||
gSettings.Graphics.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.Graphics.IgPlatform);
|
||||
gSettings.Graphics._IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.Graphics._IgPlatform);
|
||||
|
||||
Prop = GraphicsDict->propertyForKey("snb-platform-id");
|
||||
gSettings.Graphics.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.Graphics.IgPlatform);
|
||||
gSettings.Graphics._IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.Graphics._IgPlatform);
|
||||
|
||||
FillCardList(GraphicsDict, gSettings); //#@ Getcardslist
|
||||
}
|
||||
@ -5060,9 +5056,9 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
|
||||
}
|
||||
|
||||
//Special case. In future there must be more such cases
|
||||
if ( newDevProp->Key.contains("-platform-id") ) {
|
||||
CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, newDevProp->Value.data(), 4);
|
||||
}
|
||||
// if ( newDevProp->Key.contains("-platform-id") ) {
|
||||
// CopyMem((CHAR8*)&gSettings.Graphics.IgPlatform, newDevProp->Value.data(), 4);
|
||||
// }
|
||||
if ( arbProp == NULL ) {
|
||||
arbProp = new SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass();
|
||||
arbProp->Device = (UINT32)DeviceAddr;
|
||||
@ -6911,10 +6907,10 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
const SETTINGS_DATA::DevicesClass::SimplePropertyClass& Prop2 = Prop.propertiesArray[jdx];
|
||||
if (Prop2.MenuItem.BValue) {
|
||||
if ( Prop2.Key.contains("-platform-id") ) {
|
||||
if ( gSettings.Graphics.IgPlatform == 0 && Prop2.Value.size() == sizeof(gSettings.Graphics.IgPlatform) ) {
|
||||
CopyMem((UINT8*)&gSettings.Graphics.IgPlatform, Prop2.Value.data(), sizeof(gSettings.Graphics.IgPlatform));
|
||||
if ( GlobalConfig.IgPlatform == 0 && Prop2.Value.size() == sizeof(GlobalConfig.IgPlatform) ) {
|
||||
CopyMem((UINT8*)&GlobalConfig.IgPlatform, Prop2.Value.data(), sizeof(GlobalConfig.IgPlatform));
|
||||
}
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&GlobalConfig.IgPlatform, 4);
|
||||
DBG(" Add key=%s valuelen=%zu\n", Prop2.Key.c_str(), Prop2.Value.size());
|
||||
} else if ( (Prop2.Key.contains("override-no-edid") || Prop2.Key.contains("override-no-connect"))
|
||||
&& gSettings.Graphics.EDID.InjectEDID && gSettings.Graphics.EDID.CustomEDID.notEmpty()) {
|
||||
@ -6984,7 +6980,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
//special corrections
|
||||
if (Prop2.MenuItem.BValue) {
|
||||
if ( Prop2.Key.contains("-platform-id") ) {
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&gSettings.Graphics.IgPlatform, sizeof(gSettings.Graphics.IgPlatform));
|
||||
devprop_add_value(device, Prop2.Key.c_str(), (UINT8*)&GlobalConfig.IgPlatform, sizeof(GlobalConfig.IgPlatform));
|
||||
} else {
|
||||
devprop_add_value(device, Prop2.Key, Prop2.Value);
|
||||
}
|
||||
@ -7148,8 +7144,8 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
case 0x0116: // "Intel HD Graphics 3000"
|
||||
case 0x0122: // "Intel HD Graphics 3000"
|
||||
case 0x0126: // "Intel HD Graphics 3000"
|
||||
if (gSettings.Graphics.IgPlatform) {
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
if (GlobalConfig.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x00030010:
|
||||
case (UINT32)0x00050000:
|
||||
FBLEVX = 0xFFFF;
|
||||
@ -7194,8 +7190,8 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
case 0x0D2A: // "Intel Iris Pro Graphics 5200"
|
||||
case 0x0D2B: // "Intel Iris Pro Graphics 5200"
|
||||
case 0x0D2E: // "Intel Iris Pro Graphics 5200"
|
||||
if (gSettings.Graphics.IgPlatform) {
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
if (GlobalConfig.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x04060000:
|
||||
case (UINT32)0x0c060000:
|
||||
case (UINT32)0x04160000:
|
||||
@ -7255,8 +7251,8 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
case 0x162D: // "Intel Iris Pro Graphics P6300"
|
||||
case 0x1622: // "Intel Iris Pro Graphics 6200"
|
||||
case 0x162A: // "Intel Iris Pro Graphics P6300"
|
||||
if (gSettings.Graphics.IgPlatform) {
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
if (GlobalConfig.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x16060000:
|
||||
case (UINT32)0x160e0000:
|
||||
case (UINT32)0x16160000:
|
||||
@ -7322,8 +7318,8 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
case 0x193A: // "Intel Iris Pro Graphics P580"
|
||||
case 0x193B: // "Intel Iris Pro Graphics 580"
|
||||
case 0x193D: // "Intel Iris Pro Graphics P580"
|
||||
if (gSettings.Graphics.IgPlatform) {
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
if (GlobalConfig.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x19120001:
|
||||
FBLEVX = 0xFFFF;
|
||||
break;
|
||||
|
@ -1174,7 +1174,7 @@ public:
|
||||
XArray<UINT8> NVCAP = XArray<UINT8>();
|
||||
INT8 BootDisplay = INT8();
|
||||
UINT32 DualLink = UINT32();
|
||||
UINT32 IgPlatform = UINT32(); //could also be snb-platform-id
|
||||
UINT32 _IgPlatform = UINT32(); //could also be snb-platform-id
|
||||
EDIDClass EDID = EDIDClass();
|
||||
InjectAsDictClass InjectAsDict = InjectAsDictClass();
|
||||
XObjArray<GRAPHIC_CARD> ATICardList = XObjArray<GRAPHIC_CARD>();
|
||||
@ -1207,7 +1207,7 @@ public:
|
||||
if ( !(NVCAP == other.NVCAP) ) return false;
|
||||
if ( !(BootDisplay == other.BootDisplay) ) return false;
|
||||
if ( !(DualLink == other.DualLink) ) return false;
|
||||
if ( !(IgPlatform == other.IgPlatform) ) return false;
|
||||
if ( !(_IgPlatform == other._IgPlatform) ) return false;
|
||||
if ( !EDID.isEqual(other.EDID) ) return false;
|
||||
if ( !InjectAsDict.isEqual(other.InjectAsDict) ) return false;
|
||||
if ( !ATICardList.isEqual(other.ATICardList) ) return false;
|
||||
@ -2246,6 +2246,8 @@ public:
|
||||
UINT8 flagstate[32] = {0};
|
||||
MACHINE_TYPES CurrentModel = MaxMachineType;
|
||||
|
||||
UINT32 IgPlatform = UINT32(); //could also be snb-platform-id
|
||||
|
||||
|
||||
REFIT_CONFIG() {};
|
||||
REFIT_CONFIG(const REFIT_CONFIG& other) = delete; // Can be defined if needed
|
||||
|
@ -1481,18 +1481,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
case 0x0116: // "Intel HD Graphics 3000"
|
||||
case 0x0122: // "Intel HD Graphics 3000"
|
||||
case 0x0126: // "Intel HD Graphics 3000"
|
||||
if (gSettings.Graphics.IgPlatform != 0) {
|
||||
devprop_add_value(device, "AAPL,snb-platform-id", (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
MsgLog(" snb-platform-id = 0x%08x\n", gSettings.Graphics.IgPlatform);
|
||||
if (GlobalConfig.IgPlatform != 0) {
|
||||
devprop_add_value(device, "AAPL,snb-platform-id", (UINT8*)&GlobalConfig.IgPlatform, 4);
|
||||
MsgLog(" snb-platform-id = 0x%08x\n", GlobalConfig.IgPlatform);
|
||||
SetSnb = TRUE;
|
||||
} else {
|
||||
DBG(" snb-platform-id: not set\n");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gSettings.Graphics.IgPlatform != 0) {
|
||||
devprop_add_value(device, "AAPL,ig-platform-id", (UINT8*)&gSettings.Graphics.IgPlatform, 4);
|
||||
MsgLog(" ig-platform-id = 0x%08x\n", gSettings.Graphics.IgPlatform);
|
||||
if (GlobalConfig.IgPlatform != 0) {
|
||||
devprop_add_value(device, "AAPL,ig-platform-id", (UINT8*)&GlobalConfig.IgPlatform, 4);
|
||||
MsgLog(" ig-platform-id = 0x%08x\n", GlobalConfig.IgPlatform);
|
||||
SetIg = TRUE;
|
||||
} else {
|
||||
DBG(" ig-platform-id: not set\n");
|
||||
@ -1909,7 +1909,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x00030030:
|
||||
case (UINT32)0x00050000:
|
||||
break;
|
||||
@ -2033,7 +2033,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x01620006:
|
||||
case (UINT32)0x01620007:
|
||||
break;
|
||||
@ -2194,7 +2194,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x04120004:
|
||||
case (UINT32)0x0412000B:
|
||||
break;
|
||||
@ -2511,7 +2511,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x19020001:
|
||||
case (UINT32)0x19120001:
|
||||
case (UINT32)0x19170001:
|
||||
@ -2869,7 +2869,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x59120003:
|
||||
case (UINT32)0x59180002:
|
||||
break;
|
||||
@ -3116,7 +3116,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (gSettings.Graphics.IgPlatform) {
|
||||
switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x3E910003:
|
||||
case (UINT32)0x3E920003:
|
||||
case (UINT32)0x3E980003:
|
||||
@ -3284,7 +3284,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/*switch (gSettings.Graphics.IgPlatform) {
|
||||
/*switch (GlobalConfig.IgPlatform) {
|
||||
case (UINT32)0x5A510003:
|
||||
case (UINT32)0x5A520003:
|
||||
break;
|
||||
|
@ -80,6 +80,7 @@ size_t XMLDecode(const char* src, size_t srclen, char* out, size_t outlen)
|
||||
char* o;
|
||||
|
||||
if (!src) {
|
||||
if ( outlen > 0 ) *out = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -89,8 +90,8 @@ size_t XMLDecode(const char* src, size_t srclen, char* out, size_t outlen)
|
||||
while (s < src+srclen) /* Make sure the terminator is also copied */
|
||||
{
|
||||
if ( *s == '&' ) {
|
||||
UINTN i;
|
||||
s++;
|
||||
size_t i;
|
||||
for (i = 0; i < sizeof(ents)/sizeof(ents[0]); i++) {
|
||||
if ( ents[i].name.strncmp(s, ents[i].nameLen) == 0 ) {
|
||||
if ( uintptr_t(o)-uintptr_t(out) >= outlen ) return uintptr_t(o)-uintptr_t(out);
|
||||
@ -99,6 +100,7 @@ size_t XMLDecode(const char* src, size_t srclen, char* out, size_t outlen)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( i < sizeof(ents)/sizeof(ents[0]) ) continue; // if entity is found, let's go up to the beginning of the loop and avoid inserting thenext char without checking if it's another entity
|
||||
}
|
||||
if ( uintptr_t(o)-uintptr_t(out) >= outlen ) return uintptr_t(o)-uintptr_t(out);
|
||||
*o++ = *s++;
|
||||
|
@ -1689,15 +1689,16 @@ void ScanLoader(void)
|
||||
if ( loaderEntry1.LoaderType == OSTYPE_OSX && (loaderEntry1.Volume->ApfsRole & APPLE_APFS_VOLUME_ROLE_PREBOOT) != 0 )
|
||||
{
|
||||
size_t prebootIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
#ifdef DEBUG
|
||||
if ( prebootIdx == SIZE_T_MAX ) panic ("bug");
|
||||
#endif
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX && idxMain != prebootIdx+1 ) {
|
||||
DBG("Move preboot entry %zu before system %zu\n", prebootIdx, idxMain);
|
||||
MainMenu.Entries.moveBefore(prebootIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
if ( prebootIdx == SIZE_T_MAX ) {
|
||||
panic_ask ("%s : prebootIdx == SIZE_T_MAX", __PRETTY_FUNCTION__);
|
||||
}else{
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX && idxMain != prebootIdx+1 ) {
|
||||
DBG("Move preboot entry %zu before system %zu\n", prebootIdx, idxMain);
|
||||
MainMenu.Entries.moveBefore(prebootIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
++idx;
|
||||
@ -1720,26 +1721,27 @@ void ScanLoader(void)
|
||||
if ( loaderEntry1.LoaderType == OSTYPE_OSX_INSTALLER )
|
||||
{
|
||||
size_t installerIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
#ifdef DEBUG
|
||||
if ( installerIdx == SIZE_T_MAX ) panic ("bug");
|
||||
#endif
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot != installerIdx + 1 ) {
|
||||
DBG("Move installer entry %zu before preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
MainMenu.Entries.moveBefore(installerIdx, idxPreboot); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
if ( installerIdx == SIZE_T_MAX ) {
|
||||
panic_ask("%s : installerIdx == SIZE_T_MAX", __PRETTY_FUNCTION__);
|
||||
}else{
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain != installerIdx+1 ) {
|
||||
DBG("Move installer entry %zu before system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
MainMenu.Entries.moveBefore(installerIdx, idxMain); // this will move preboot entry just before main
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot != installerIdx + 1 ) {
|
||||
DBG("Move installer entry %zu before preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
MainMenu.Entries.moveBefore(installerIdx, idxPreboot); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}else{
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain != installerIdx+1 ) {
|
||||
DBG("Move installer entry %zu before system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
MainMenu.Entries.moveBefore(installerIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1763,26 +1765,27 @@ void ScanLoader(void)
|
||||
if ( loaderEntry1.LoaderType == OSTYPE_RECOVERY && (loaderEntry1.Volume->ApfsRole & APPLE_APFS_VOLUME_ROLE_RECOVERY) != 0 )
|
||||
{
|
||||
size_t recoveryIdx = MainMenu.Entries.getIdx(loaderEntry1Ptr);
|
||||
#ifdef DEBUG
|
||||
if ( recoveryIdx == SIZE_T_MAX ) panic ("bug");
|
||||
#endif
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
MainMenu.Entries.moveAfter(recoveryIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
if ( recoveryIdx == SIZE_T_MAX ) {
|
||||
panic_ask ("%s : recoveryIdx == SIZE_T_MAX", __PRETTY_FUNCTION__);
|
||||
}else{
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
MainMenu.Entries.moveAfter(recoveryIdx, idxPreboot); // this will move preboot entry just before main
|
||||
size_t idxMain = MainMenu.Entries.getApfsLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxMain != SIZE_T_MAX ) {
|
||||
if ( idxMain + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after system %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxMain);
|
||||
MainMenu.Entries.moveAfter(recoveryIdx, idxMain); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}else{
|
||||
size_t idxPreboot = MainMenu.Entries.getApfsPrebootLoaderIdx(loaderEntry1.Volume->ApfsContainerUUID, loaderEntry1.APFSTargetUUID, OSTYPE_OSX);
|
||||
if ( idxPreboot != SIZE_T_MAX ) {
|
||||
if ( idxPreboot + 1 != recoveryIdx ) {
|
||||
DBG("Move recovery entry %zu after preboot %zu\n", EntriesArrayTmp.ElementAt(idx).idx, idxPreboot);
|
||||
MainMenu.Entries.moveAfter(recoveryIdx, idxPreboot); // this will move preboot entry just before main
|
||||
EntriesArrayTmp.RemoveAtIndex(idx);
|
||||
hasMovedSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void XImage::Fill(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color)
|
||||
|
||||
void XImage::Fill(const EG_PIXEL* Color)
|
||||
{
|
||||
Fill((const EFI_GRAPHICS_OUTPUT_BLT_PIXEL&)Color);
|
||||
Fill( *(const EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)Color );
|
||||
}
|
||||
|
||||
void XImage::FillArea(const EG_PIXEL* Color, EG_RECT& Rect)
|
||||
|
@ -559,12 +559,12 @@ NullConOutOutputString(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *, IN CONST CHAR16 *)
|
||||
|
||||
void CheckEmptyFB()
|
||||
{
|
||||
BOOLEAN EmptyFB = (gSettings.Graphics.IgPlatform == 0x00050000) ||
|
||||
(gSettings.Graphics.IgPlatform == 0x01620007) ||
|
||||
(gSettings.Graphics.IgPlatform == 0x04120004) ||
|
||||
(gSettings.Graphics.IgPlatform == 0x19120001) ||
|
||||
(gSettings.Graphics.IgPlatform == 0x59120003) ||
|
||||
(gSettings.Graphics.IgPlatform == 0x3E910003);
|
||||
BOOLEAN EmptyFB = (GlobalConfig.IgPlatform == 0x00050000) ||
|
||||
(GlobalConfig.IgPlatform == 0x01620007) ||
|
||||
(GlobalConfig.IgPlatform == 0x04120004) ||
|
||||
(GlobalConfig.IgPlatform == 0x19120001) ||
|
||||
(GlobalConfig.IgPlatform == 0x59120003) ||
|
||||
(GlobalConfig.IgPlatform == 0x3E910003);
|
||||
if (EmptyFB) {
|
||||
gSettings.Smbios.gPlatformFeature |= PT_FEATURE_HAS_HEADLESS_GPU;
|
||||
} else {
|
||||
@ -2793,7 +2793,16 @@ void afterGetUserSettings(SETTINGS_DATA& gSettings)
|
||||
}
|
||||
}
|
||||
//---------
|
||||
|
||||
GlobalConfig.IgPlatform = gSettings.Graphics._IgPlatform;
|
||||
for ( size_t idx = 0 ; idx < gSettings.Devices.ArbitraryArray.size() ; ++idx ) {
|
||||
const SETTINGS_DATA::DevicesClass::ArbitraryPropertyClass& arbitraryProperty = gSettings.Devices.ArbitraryArray[idx];
|
||||
for ( size_t jdx = 0 ; jdx < arbitraryProperty.CustomPropertyArray.size() ; ++jdx ) {
|
||||
const SETTINGS_DATA::DevicesClass::SimplePropertyClass& customProperty = arbitraryProperty.CustomPropertyArray[jdx];
|
||||
if ( customProperty.Key.contains("-platform-id") ) {
|
||||
memcpy(&GlobalConfig.IgPlatform, customProperty.Key.data(), 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -2843,10 +2852,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
/*Status = */EfiGetSystemConfigurationTable (&gEfiDxeServicesTableGuid, (void **) &gDS);
|
||||
|
||||
ConsoleInHandle = SystemTable->ConsoleInHandle;
|
||||
|
||||
//#define DEBUG_ERALY_CRASH
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Start");
|
||||
PauseForKey(L"1) press any key\n");
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step1");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ON_SERIAL_PORT
|
||||
@ -2857,12 +2866,21 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
EFI_LOADED_IMAGE* LoadedImage;
|
||||
Status = gBS->HandleProtocol(gImageHandle, &gEfiLoadedImageProtocolGuid, (void **) &LoadedImage);
|
||||
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step2");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
|
||||
// if ( !EFI_ERROR(Status) ) {
|
||||
// XString8 msg = S8Printf("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
|
||||
// SerialPortWrite((UINT8*)msg.c_str(), msg.length());
|
||||
// }
|
||||
if ( !EFI_ERROR(Status) ) {
|
||||
DBG("CloverX64 : Image base = 0x%llX\n", (uintptr_t)LoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step3");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
}
|
||||
#ifdef JIEF_DEBUG
|
||||
gBS->Stall(2500000); // to give time to gdb to connect
|
||||
@ -2870,10 +2888,20 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step4");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
|
||||
#ifdef CLOVER_BUILD
|
||||
construct_globals_objects(gImageHandle); // do this after self.getSelfLoadedImage() is initialized
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step5");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
// all_tests();
|
||||
// PauseForKey(L"press\n");
|
||||
@ -2881,10 +2909,15 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
|
||||
gRT->GetTime(&Now, NULL);
|
||||
|
||||
Status = InitRefitLib(gImageHandle);
|
||||
Status = InitRefitLib(gImageHandle); // From here, debug.log starts to be saved because InitRefitLib call self.initialize()
|
||||
if (EFI_ERROR(Status))
|
||||
return Status;
|
||||
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Step6");
|
||||
PauseForKey(L"press any key\n");
|
||||
#endif
|
||||
|
||||
// firmware detection
|
||||
gFirmwareClover = StrCmp(gST->FirmwareVendor, L"CLOVER") == 0;
|
||||
if (!gFirmwareRevision) {
|
||||
@ -3138,10 +3171,6 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
gEmuVariableControl->InstallEmulation(gEmuVariableControl);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ERALY_CRASH
|
||||
PauseForKey(L"2) press any key\n");
|
||||
#endif
|
||||
|
||||
DbgHeader("InitScreen");
|
||||
|
||||
if (!GlobalConfig.isFastBoot()) {
|
||||
|
@ -217,7 +217,7 @@ void FillInputs(BOOLEAN New)
|
||||
InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6
|
||||
InputItems[InputItemsCount++].BValue = gSettings.Graphics.InjectAsDict.InjectIntel;
|
||||
InputItems[InputItemsCount].ItemType = Hex; //22+6i
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.Graphics.IgPlatform);
|
||||
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", GlobalConfig.IgPlatform);
|
||||
// InputItemsCount += 3;
|
||||
// continue;
|
||||
}
|
||||
@ -594,12 +594,12 @@ void ApplyInputs(void)
|
||||
hex2bin(InputItems[i].SValue, (UINT8*)&gSettings.Graphics.Dcfg[0], sizeof(gSettings.Graphics.Dcfg));
|
||||
} else if (gGraphics[j].Vendor == Intel) {
|
||||
//ig-platform-id for Ivy+ and snb-platform-id for Sandy
|
||||
gSettings.Graphics.IgPlatform = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
DBG("applied *-platform-id=0x%X\n", gSettings.Graphics.IgPlatform);
|
||||
GlobalConfig.IgPlatform = (UINT32)StrHexToUint64(InputItems[i].SValue.wc_str());
|
||||
DBG("applied *-platform-id=0x%X\n", GlobalConfig.IgPlatform);
|
||||
}
|
||||
}
|
||||
|
||||
if (gGraphics[i].Vendor == Intel) {
|
||||
if (gGraphics[j].Vendor == Intel) {
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user