diff --git a/CHANGELOG.md b/CHANGELOG.md index c9c56758b..749421f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # OpenCore Legacy Patcher changelog ## 0.0.12 +- Convert OpenCore-Patcher binary to OpenCore-Patcher.app +- Add Backlight patches for modded Nvidia GPUs in iMac10,x-12,x ## 0.0.11 - Re-add OpenCore GUI diff --git a/OpenCore-Patcher.command b/OpenCore-Patcher.command index 0de49110d..f7c6e6392 100755 --- a/OpenCore-Patcher.command +++ b/OpenCore-Patcher.command @@ -6,8 +6,6 @@ import subprocess, sys, time from Resources import build, ModelArray, Constants, utilities -PATCHER_VERSION = "0.0.11" - class OpenCoreLegacyPatcher(): def __init__(self): diff --git a/Resources/Constants.py b/Resources/Constants.py index 1b8657cbd..970a61042 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -25,6 +25,7 @@ class Constants: self.voodoohda_version = "296" self.restrictevents_version = "1.0.0" self.piixata_version = "1.0.0" + self.backlight_version = "1.0.0" # Get resource path self.current_path = Path(__file__).parent.parent.resolve() @@ -32,6 +33,8 @@ class Constants: self.custom_model: str = None self.custom_mxm_gpu: str = None + self.current_gpuv: str = None + self.current_gpud: str = None # Payload Location # OpenCore @property @@ -78,6 +81,8 @@ class Constants: def voodoohda_path(self): return self.payload_kexts_path / Path(f"Audio/VoodooHDA-v{self.voodoohda_version}.zip") @property def piixata_path(self): return self.payload_kexts_path / Path(f"Misc/AppleIntelPIIXATA-v{self.piixata_version}.zip") + @property + def backlight_path(self): return self.payload_kexts_path / Path(f"Misc/AppleBacklightFixup-v{self.backlight_version}.zip") # Build Location @property diff --git a/Resources/build.py b/Resources/build.py index 005b3afec..b4a3a0c0f 100644 --- a/Resources/build.py +++ b/Resources/build.py @@ -153,19 +153,21 @@ class BuildOpenCore: # Check GPU Vendor if self.constants.custom_model == "None": current_gpu: str = subprocess.run("system_profiler SPDisplaysDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode() - current_gpuv = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Vendor"))][0] - current_gpud = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Device ID"))][0] - print(f"- Detected GPU: {current_gpuv} {current_gpud}") - if (current_gpuv == "AMD (0x1002)") & (current_gpud in ModelArray.AMDMXMGPUs): + self.constants.current_gpuv = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Vendor"))][0] + self.constants.current_gpud = [line.strip().split(": ", 1)[1] for line in current_gpu.split("\n") if line.strip().startswith(("Device ID"))][0] + print(f"- Detected GPU: {self.constants.current_gpuv} {self.constants.current_gpud}") + if (self.constants.current_gpuv == "AMD (0x1002)") & (self.constants.current_gpud in ModelArray.AMDMXMGPUs): self.constants.custom_mxm_gpu = True print("- Adding AMD DRM patches") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=80 unfairgva=1" - elif (current_gpuv == "NVIDIA (0x10de)") & (current_gpud in ModelArray.NVIDIAMXMGPUs): + elif (self.constants.current_gpuv == "NVIDIA (0x10de)") & (self.constants.current_gpud in ModelArray.NVIDIAMXMGPUs): self.constants.custom_mxm_gpu = True print("- Adding Brightness Control patches") if self.model in ["iMac11,1", "iMac11,2", "iMac11,3"]: backlight_path = "PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)" self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")} + shutil.copy(self.constants.backlight_path, self.constants.kexts_path) + self.get_kext_by_bundle_path("AppleBacklightFixup.kext")["Enabled"] = True elif self.model in ["iMac12,1", "iMac12,2"]: backlight_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)" self.config["DeviceProperties"]["Add"][backlight_path] = {"@0,backlight-control": binascii.unhexlify("01000000"), "@0,built-in": binascii.unhexlify("01000000")} @@ -200,7 +202,12 @@ class BuildOpenCore: spoofed_model = "Macmini7,1" spoofed_board = "Mac-35C5E08120C7EEAF" elif self.model in ModelArray.iMac151: - if self.constants.custom_mxm_gpu == True: + # Check for upgraded GPUs on iMacs + if (self.constants.current_gpuv == "AMD (0x1002)") & (self.constants.current_gpud in ModelArray.AMDMXMGPUs) & (self.constants.custom_model == "None"): + print("- Spoofing to iMacPro1,1") + spoofed_model = "iMacPro1,1" + spoofed_board = "Mac-7BA5B2D9E42DDD94" + elif (self.constants.current_gpuv == "NVIDIA (0x10de)") & (self.constants.current_gpud in ModelArray.NVIDIAMXMGPUs) & (self.constants.custom_model == "None"): print("- Spoofing to iMacPro1,1") spoofed_model = "iMacPro1,1" spoofed_board = "Mac-7BA5B2D9E42DDD94" @@ -244,7 +251,6 @@ class BuildOpenCore: smbios_mod = True # USB Map - usb_map_path = Path(self.constants.current_path) / Path(f"payloads/Kexts/Maps/Universal/Info.plist") self.new_map_ls = Path(self.constants.map_contents_folder) / Path(f"Info.plist") self.map_config = plistlib.load(Path(self.new_map_ls).open("rb")) diff --git a/payloads/Config/v0.6.7/config.plist b/payloads/Config/v0.6.7/config.plist index a3a0b8f17..c258642fc 100644 --- a/payloads/Config/v0.6.7/config.plist +++ b/payloads/Config/v0.6.7/config.plist @@ -494,6 +494,24 @@ PlistPath Contents/Info.plist + + Arch + x86_64 + Comment + AppleBacklightFixup - Modded Nvidia GPUs + Enabled + + MaxKernel + + MinKernel + + BundlePath + AppleBacklightFixup.kext + ExecutablePath + Contents/MacOS/AppleBacklightFixup + PlistPath + Contents/Info.plist + Arch x86_64 diff --git a/payloads/Kexts/Misc/AppleBacklightFixup-v1.0.0.zip b/payloads/Kexts/Misc/AppleBacklightFixup-v1.0.0.zip new file mode 100644 index 000000000..f72624bd4 Binary files /dev/null and b/payloads/Kexts/Misc/AppleBacklightFixup-v1.0.0.zip differ