Fix MacBookPro8,2/3 Hibernation wake

This commit is contained in:
Mykola Grymalyuk
2021-05-15 17:42:09 -06:00
parent f3734f9daa
commit abe865f999
5 changed files with 32 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
- Support space in path when downloading Root Patches
- Enable PanicNoKextDump by default
- Expand AppleGraphicsPowerManagement and AppleGraphicsDeviceControl Override support
- Fix MacBookPro8,2/3 Hibernation wake
## 0.1.4
- Fix Device Path formatting on 2012+ iMacs

View File

@@ -56,6 +56,15 @@ class OpenCoreLegacyPatcher():
self.constants.custom_cpu_model = 1
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
# Check if running in RecoveryOS
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
if root_partition_info["VolumeName"] == "macOS Base System" and \
root_partition_info["FilesystemType"] == "apfs" and \
root_partition_info["BusProtocol"] == "Disk Image":
self.constants.recovery_status = True
else:
self.constants.recovery_status = False
def hexswap(self, input_hex: str):
hex_pairs = [input_hex[i:i + 2] for i in range(0, len(input_hex), 2)]
hex_rev = hex_pairs[::-1]

View File

@@ -541,6 +541,8 @@ class BuildOpenCore:
print("- Adding CPU Name Patch")
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
self.enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
if self.model in ModelArray.AMCSupport:
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {"wegnoegpu": binascii.unhexlify("01000000")}
def set_smbios(self):
spoofed_model = self.model
@@ -761,8 +763,10 @@ class BuildOpenCore:
zip_file.extractall(self.constants.oc_folder)
item.unlink()
for i in self.constants.build_path.rglob("__MACOSX"):
shutil.rmtree(i)
if self.constants.recovery_status == False:
# Crashes in RecoveryOS for unknown reason
for i in self.constants.build_path.rglob("__MACOSX"):
shutil.rmtree(i)
Path(self.constants.opencore_zip_copied).unlink()
@@ -876,7 +880,7 @@ Please build OpenCore first!"""
" without altering line endings",
]
if self.constants.detected_os > self.constants.yosemite:
if self.constants.detected_os > self.constants.yosemite and self.constants.recovery_status == False:
result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
else:
result = subprocess.run(f"diskutil mount {disk_identifier}s{response}".split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)

View File

@@ -78,6 +78,7 @@ class Constants:
self.custom_color = ""
self.download_ram = False
self.disallow_cpufriend = False
self.recovery_status = False
# OS Versions
self.tiger = 8

View File

@@ -883,6 +883,13 @@ AGDPSupport = [
"iMac14,3",
]
AMCSupport = [
"MacBookPro8,2",
"MacBookPro8,3",
#"MacBookPro9,1",
#"MacBookPro10,1"
]
DeleteNvidiaAccel11 = [
"AMDRadeonX4000.kext",
"AMDRadeonX4000HWServices.kext",
@@ -1043,4 +1050,11 @@ DeleteVolumeControl = [
"AppleVirtualPlatform.kext",
"ApplePVPanic.kext",
"AppleVirtIOStorage.kext",
]
RecoveryIgnore = [
"Update",
"VM",
"Recovery",
"Preboot"
]