mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
Enforce Snake Style naming scheme for files
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class bluetooth_data:
|
||||
import enum
|
||||
|
||||
class bluetooth_data(enum.IntEnum):
|
||||
# Bluetooth Chipsets
|
||||
NonApplicable = 0
|
||||
BRCM2045 = 1 # TODO: Rename chipset, currently guessing MacPro1,1-3,1 name
|
||||
@@ -8,4 +10,5 @@ class bluetooth_data:
|
||||
BRCM20702_v2 = 5 # BT 4.0 - 2013+
|
||||
BRCM20703 = 6 # BT 4.2
|
||||
BRCM20703_UART = 9 # BRCM20703 over UART, BT 4.2
|
||||
UART = 10
|
||||
UART = 10 # T2
|
||||
PCIe = 20 # Apple Silicon
|
||||
@@ -1,4 +1,6 @@
|
||||
class cpu_data:
|
||||
import enum
|
||||
|
||||
class cpu_data(enum.IntEnum):
|
||||
pentium_4 = 0
|
||||
yonah = 1
|
||||
conroe = 2
|
||||
@@ -13,3 +15,8 @@ class cpu_data:
|
||||
coffee_lake = 11 # 8000
|
||||
comet_lake = 12 # 9000
|
||||
ice_lake = 13 # 10000
|
||||
|
||||
|
||||
apple_dtk = 112 # A12
|
||||
apple_m1 = 114 # A14
|
||||
apple_m2 = 115 # A15
|
||||
@@ -1,4 +1,6 @@
|
||||
class os_data:
|
||||
import enum
|
||||
|
||||
class os_data(enum.IntEnum):
|
||||
# OS Versions, Based off Major Kernel Version
|
||||
tiger = 8
|
||||
leopard = 9
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
# Lists Root patches used by SysPatch.py
|
||||
# Lists Root patches used by sys_patch.py
|
||||
# Copyright (C) 2020-2021, Dhinak G, Mykola Grymalyuk
|
||||
DeleteNvidiaAccel11 = [
|
||||
"AMDRadeonX4000.kext",
|
||||
@@ -7,7 +7,7 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from Resources import Build, CliMenu, Constants, ModelArray, SysPatch, Utilities, device_probe, os_probe, defaults, arguments
|
||||
from Resources import Build, cli_menu, Constants, ModelArray, sys_patch, Utilities, device_probe, os_probe, defaults, arguments
|
||||
from Data import smbios_data, cpu_data
|
||||
|
||||
class OpenCoreLegacyPatcher:
|
||||
@@ -43,156 +43,6 @@ class OpenCoreLegacyPatcher:
|
||||
def install_opencore(self):
|
||||
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
|
||||
|
||||
def patcher_settings(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Patcher Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
["Debug Settings", self.patcher_setting_debug],
|
||||
["Security Settings", self.patcher_settings_security],
|
||||
["SMBIOS Settings", self.patcher_settings_smbios],
|
||||
["Boot Volume Settings", self.patcher_settings_boot],
|
||||
["Miscellaneous Settings", self.patcher_settings_misc],
|
||||
["Dump detected hardware", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).dump_hardware],
|
||||
[
|
||||
f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_moj_cat_patch,
|
||||
],
|
||||
[
|
||||
f"Allow OpenCore on native Models:\tCurrently {self.constants.allow_oc_everywhere}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_native_models,
|
||||
],
|
||||
["Advanced Settings, for developers only", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).advanced_patcher_settings],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_setting_debug(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Debug Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Enable Verbose Mode:\tCurrently {self.constants.verbose_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_verbose],
|
||||
[f"Enable OpenCore DEBUG:\tCurrently {self.constants.opencore_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_oc],
|
||||
[f"Enable Kext DEBUG:\t\tCurrently {self.constants.kext_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_kext],
|
||||
] + (
|
||||
[
|
||||
[f"Set SurPlus Settings:\tCurrently {self.constants.force_surplus}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_surplus]
|
||||
]
|
||||
if (smbios_data.smbios_dictionary[self.constants.custom_model or self.computer.real_model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge)
|
||||
else []
|
||||
)
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_security(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Security Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
# [
|
||||
# f"Set Apple Mobile File Integrity (AMFI):\tCurrently {self.constants.amfi_status}",
|
||||
# CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_amfi,
|
||||
# ],
|
||||
[
|
||||
f"Set System Intrgity Protection (SIP):\tCurrently {self.constants.sip_status}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_sip,
|
||||
],
|
||||
[
|
||||
f"Set Secure Boot Model (SBM):\t\tCurrently {self.constants.secure_status}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_sbm,
|
||||
],
|
||||
[f"Set Vault Mode:\t\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_vault],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_smbios(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust SMBIOS Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set SMBIOS Spoof Level:\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_serial],
|
||||
[f"Set SMBIOS Spoof Model:\tCurrently {self.constants.override_smbios}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).set_smbios],
|
||||
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).custom_cpu],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_boot(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Bootable Volume Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set FireWire Boot:\tCurrently {self.constants.firewire_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_firewire],
|
||||
[f"Set NVMe Boot:\tCurrently {self.constants.nvme_boot}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_nvme],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_misc(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Miscellaneous Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set ShowPicker Mode:\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_showpicker],
|
||||
[f"Set Wake on WLAN:\t\tCurrently {self.constants.enable_wake_on_wlan}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_wowl],
|
||||
[f"Set Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).allow_ivy],
|
||||
[f"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).terascale_2_accel],
|
||||
[
|
||||
f"Disable Thunderbolt:\tCurrently {self.constants.disable_tb}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_tb,
|
||||
],
|
||||
[f"Set AppleALC Usage:\t\tCurrently {self.constants.set_alc_usage}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).applealc_support],
|
||||
[f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).dGPU_switch_support],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def advanced_patcher_settings(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Advanced Patcher Settings, for developers ONLY"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set Metal GPU Status:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_metal],
|
||||
[f"Set DRM Preferences:\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).drm_setting],
|
||||
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).bootstrap_setting],
|
||||
[
|
||||
f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}",
|
||||
CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).disable_cpufriend,
|
||||
],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def main_menu(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
@@ -228,10 +78,10 @@ class OpenCoreLegacyPatcher:
|
||||
else []
|
||||
) + [
|
||||
["Install OpenCore to USB/internal drive", self.install_opencore],
|
||||
["Post-Install Volume Patch", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).PatchVolume],
|
||||
["Change Model", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_model],
|
||||
["Patcher Settings", self.patcher_settings],
|
||||
["Credits", CliMenu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).credits],
|
||||
["Post-Install Volume Patch", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).PatchVolume],
|
||||
["Change Model", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_model],
|
||||
["Patcher Settings", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).patcher_settings],
|
||||
["Credits", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).credits],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
|
||||
@@ -105,8 +105,8 @@ class BuildOpenCore:
|
||||
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False),
|
||||
# CPU patches
|
||||
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: self.model.startswith("MacPro") or self.model.startswith("Xserve")),
|
||||
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn),
|
||||
("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn),
|
||||
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
|
||||
("telemetrap.kext", self.constants.telemetrap_version, self.constants.telemetrap_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
|
||||
(
|
||||
"CPUFriend.kext",
|
||||
self.constants.cpufriend_version,
|
||||
@@ -121,7 +121,7 @@ class BuildOpenCore:
|
||||
# IDE patch
|
||||
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in ModelArray.IDEPatch),
|
||||
# Misc
|
||||
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake),
|
||||
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake.value),
|
||||
("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path, lambda: self.constants.kext_debug is True),
|
||||
("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path, lambda: self.model in ["MacBook4,1", "MacBook5,2"]),
|
||||
]:
|
||||
@@ -132,7 +132,7 @@ class BuildOpenCore:
|
||||
|
||||
# Ethernet Patch Sets
|
||||
if smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Broadcom":
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge:
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
|
||||
# Required due to Big Sur's BCM5701 requiring VT-x support
|
||||
# Applicable for pre-Ivy Bridge models
|
||||
self.enable_kext("CatalinaBCM5701Ethernet.kext", self.constants.bcm570_version, self.constants.bcm570_path)
|
||||
@@ -144,7 +144,7 @@ class BuildOpenCore:
|
||||
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 smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge:
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:
|
||||
# Ref: https://github.com/reenigneorcim/SurPlus
|
||||
# Enable for all systems missing RDRAND support
|
||||
print("- Adding SurPlus Patch for Race Condition")
|
||||
@@ -301,18 +301,18 @@ class BuildOpenCore:
|
||||
self.get_kext_by_bundle_path("CPUFriendDataProvider.kext")["Enabled"] = True
|
||||
|
||||
# HID patches
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn:
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
|
||||
print("- Adding IOHIDFamily patch")
|
||||
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
|
||||
|
||||
# SSDT patches
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.cpu_data.nehalem.value and not (self.model.startswith("MacPro") or self.model.startswith("Xserve")):
|
||||
# Applicable for consumer Nehalem
|
||||
print("- Adding SSDT-CPBG.aml")
|
||||
self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-CPBG.aml")["Enabled"] = True
|
||||
shutil.copy(self.constants.pci_ssdt_path, self.constants.acpi_path)
|
||||
|
||||
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge:
|
||||
if cpu_data.cpu_data.sandy_bridge <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
|
||||
# Based on: https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/
|
||||
# Applicable for Sandy and Ivy Bridge Macs
|
||||
print("- Enabling Windows 10 UEFI Audio support")
|
||||
@@ -422,7 +422,7 @@ class BuildOpenCore:
|
||||
if model.startswith("MacBook"):
|
||||
return False
|
||||
elif model.startswith("MacBookAir"):
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge:
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -589,14 +589,14 @@ class BuildOpenCore:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||
elif self.computer.bluetooth_chipset == "BRCM20702 Hub" and smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] == bluetooth_data.bluetooth_data.BRCM20702_v1:
|
||||
elif self.computer.bluetooth_chipset == "BRCM20702 Hub" and smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] == bluetooth_data.bluetooth_data.BRCM20702_v1.value:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
# smbios_data.smbios_dictionary[self.model]["Bluetooth Model"]
|
||||
elif smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1:
|
||||
elif smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM20702_v1.value:
|
||||
print("- Fixing Legacy Bluetooth for macOS Monterey")
|
||||
self.enable_kext("BlueToolFixup.kext", self.constants.bluetool_version, self.constants.bluetool_path)
|
||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070:
|
||||
if smbios_data.smbios_dictionary[self.model]["Bluetooth Model"] <= bluetooth_data.bluetooth_data.BRCM2070.value:
|
||||
self.enable_kext("Bluetooth-Spoof.kext", self.constants.btspoof_version, self.constants.btspoof_path)
|
||||
|
||||
if self.constants.nvme_boot is True:
|
||||
@@ -612,7 +612,7 @@ class BuildOpenCore:
|
||||
self.get_efi_binary_by_path("OpenRuntime.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
self.get_efi_binary_by_path("OpenLinuxBoot.efi", "UEFI", "Drivers")["Enabled"] = True
|
||||
# Exfat check
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge:
|
||||
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] < cpu_data.cpu_data.sandy_bridge.value:
|
||||
# Sandy Bridge and newer Macs natively support ExFat
|
||||
print("- Adding ExFatDxeLegacy.efi")
|
||||
shutil.copy(self.constants.exfat_legacy_driver_path, self.constants.drivers_path)
|
||||
@@ -706,7 +706,7 @@ class BuildOpenCore:
|
||||
# Note this function was added in 11.3 (20E232, 20.4), older builds do not support this (ie. 11.2.3)
|
||||
print("- Allowing FileVault on Root Patched systems")
|
||||
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
|
||||
# Lets us check in SysPatch.py if config supports FileVault
|
||||
# Lets us check in sys_patch.py if config supports FileVault
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
|
||||
|
||||
def set_smbios(self):
|
||||
|
||||
@@ -658,13 +658,4 @@ class Constants:
|
||||
"Mac-937CB26E2E02BB01", # MacBookAir7,2
|
||||
"Mac-35C5E08120C7EEAF", # Macmini7,1
|
||||
"Mac-7BA5B2D9E42DDD94", # iMacPro1,1
|
||||
]
|
||||
|
||||
target_type = {
|
||||
"ADP3,2": "J273",
|
||||
"MacBookAir10,1": "J313",
|
||||
"MacBookPro17,1": "J293",
|
||||
"Macmini9,1": "J274",
|
||||
"iMac21,1": "J256",
|
||||
"iMac21,2": "J257",
|
||||
}
|
||||
]
|
||||
@@ -1,7 +1,8 @@
|
||||
import argparse
|
||||
import sys
|
||||
import subprocess
|
||||
from Resources import ModelArray, defaults, Build, ModelExample
|
||||
from Resources import ModelArray, defaults, Build
|
||||
from Data import example_data
|
||||
|
||||
# Generic building args
|
||||
class arguments:
|
||||
@@ -30,7 +31,7 @@ class arguments:
|
||||
parser.add_argument("--disk", action="store", help="Specifies disk to install to", required=False)
|
||||
parser.add_argument("--smbios_spoof", action="store", help="Set SMBIOS patching mode", required=False)
|
||||
|
||||
# SysPatch args
|
||||
# sys_patch args
|
||||
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
|
||||
parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
|
||||
parser.add_argument("--validate", help="Runs Validation Tests for CI", action="store_true", required=False)
|
||||
@@ -38,10 +39,7 @@ class arguments:
|
||||
|
||||
def check_cli(self):
|
||||
# If no core arguments are present, assume we're running in TUI
|
||||
# - build
|
||||
# - patch_sys_vol
|
||||
# - unpatch_sys_vol
|
||||
# - validate
|
||||
# build, patch_sys_vol, unpatch_sys_vol, validate
|
||||
if not(
|
||||
self.args.build or self.args.patch_sys_vol or self.args.unpatch_sys_vol or self.args.validate
|
||||
):
|
||||
@@ -50,6 +48,22 @@ class arguments:
|
||||
return True
|
||||
|
||||
def parse_arguments(self, settings):
|
||||
if self.args.model:
|
||||
if self.args.model:
|
||||
print(f"- Using custom model: {self.args.model}")
|
||||
settings.custom_model = self.args.model
|
||||
defaults.generate_defaults.probe(settings.custom_model, False, settings)
|
||||
elif settings.computer.real_model not in ModelArray.SupportedSMBIOS and settings.allow_oc_everywhere is False:
|
||||
print(
|
||||
"""Your model is not supported by this patcher for running unsupported OSes!"
|
||||
|
||||
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f"- Using detected model: {settings.computer.real_model}")
|
||||
defaults.generate_defaults.probe(settings.custom_model, True, settings)
|
||||
|
||||
if self.args.disk:
|
||||
print(f"- Install Disk set: {self.args.disk}")
|
||||
settings.disk = self.args.disk
|
||||
@@ -58,6 +72,8 @@ class arguments:
|
||||
if self.args.verbose:
|
||||
print("- Set verbose configuration")
|
||||
settings.verbose_debug = True
|
||||
else:
|
||||
settings.verbose_debug = False # Override Defaults detected
|
||||
if self.args.debug_oc:
|
||||
print("- Set OpenCore DEBUG configuration")
|
||||
settings.opencore_debug = True
|
||||
@@ -71,9 +87,13 @@ class arguments:
|
||||
if self.args.disable_sip:
|
||||
print("- Set Disable SIP configuration")
|
||||
settings.sip_status = False
|
||||
else:
|
||||
settings.sip_status = True # Override Defaults detected
|
||||
if self.args.disable_smb:
|
||||
print("- Set Disable SecureBootModel configuration")
|
||||
settings.secure_status = False
|
||||
else:
|
||||
settings.secure_status = True # Override Defaults detected
|
||||
if self.args.vault:
|
||||
print("- Set Vault configuration")
|
||||
settings.vault = True
|
||||
@@ -113,28 +133,10 @@ class arguments:
|
||||
settings.allow_oc_everywhere = True
|
||||
settings.serial_settings = "None"
|
||||
|
||||
# Avoid running the root patcher if we're just building
|
||||
if self.args.build:
|
||||
if self.args.model:
|
||||
print(f"- Using custom model: {self.args.model}")
|
||||
settings.custom_model = self.args.model
|
||||
#self.set_defaults(settings.custom_model, False)
|
||||
defaults.generate_defaults.probe(settings.custom_model, False, settings)
|
||||
#self.build_opencore()
|
||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||
elif settings.computer.real_model not in ModelArray.SupportedSMBIOS and settings.allow_oc_everywhere is False:
|
||||
print(
|
||||
"""Your model is not supported by this patcher for running unsupported OSes!"
|
||||
|
||||
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
|
||||
)
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f"- Using detected model: {settings.computer.real_model}")
|
||||
#self.set_defaults(settings.custom_model, True)
|
||||
defaults.generate_defaults.probe(settings.custom_model, True, settings)
|
||||
# self.build_opencore()
|
||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||
if self.args.patch_sys_vol:
|
||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||
elif self.args.patch_sys_vol:
|
||||
if self.args.moj_cat_accel:
|
||||
print("- Set Mojave/Catalina root patch configuration")
|
||||
settings.moj_cat_accel = True
|
||||
@@ -148,48 +150,68 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
||||
# Runs through ocvalidate to check for errors
|
||||
|
||||
valid_dumps = [
|
||||
# ModelExample.MacBookPro.MacBookPro92_Stock,
|
||||
# ModelExample.MacBookPro.MacBookPro171_Stock,
|
||||
# ModelExample.Macmini.Macmini91_Stock,
|
||||
#ModelExample.iMac.iMac81_Stock,
|
||||
ModelExample.iMac.iMac112_Stock,
|
||||
#ModelExample.iMac.iMac122_Upgraded,
|
||||
ModelExample.MacPro.MacPro31_Stock,
|
||||
ModelExample.MacPro.MacPro31_Upgrade,
|
||||
ModelExample.MacPro.MacPro31_Modern_AMD,
|
||||
ModelExample.MacPro.MacPro31_Modern_Kepler,
|
||||
ModelExample.MacPro.MacPro41_Upgrade,
|
||||
ModelExample.MacPro.MacPro41_Modern_AMD,
|
||||
ModelExample.MacPro.MacPro41_51__Flashed_Modern_AMD,
|
||||
example_data.MacBookPro.MacBookPro92_Stock,
|
||||
# example_data.MacBookPro.MacBookPro171_Stock,
|
||||
# example_data.Macmini.Macmini91_Stock,
|
||||
example_data.iMac.iMac81_Stock,
|
||||
example_data.iMac.iMac112_Stock,
|
||||
example_data.iMac.iMac122_Upgraded,
|
||||
example_data.MacPro.MacPro31_Stock,
|
||||
example_data.MacPro.MacPro31_Upgrade,
|
||||
example_data.MacPro.MacPro31_Modern_AMD,
|
||||
example_data.MacPro.MacPro31_Modern_Kepler,
|
||||
example_data.MacPro.MacPro41_Upgrade,
|
||||
example_data.MacPro.MacPro41_Modern_AMD,
|
||||
example_data.MacPro.MacPro41_51__Flashed_Modern_AMD,
|
||||
]
|
||||
settings.validate = True
|
||||
def build_prebuilt():
|
||||
for model in ModelArray.SupportedSMBIOS:
|
||||
print(f"Validating predefined model: {model}")
|
||||
settings.custom_model = model
|
||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if result.returncode != 0:
|
||||
print("Error on build!")
|
||||
print(result.stdout.decode())
|
||||
raise Exception(f"Validation failed for predefined model: {model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {model}")
|
||||
|
||||
def build_dumps():
|
||||
for model in valid_dumps:
|
||||
settings.computer = model
|
||||
settings.custom_model = ""
|
||||
print(f"Validating dumped model: {settings.computer.real_model}")
|
||||
Build.BuildOpenCore(settings.computer.real_model, settings).build_opencore()
|
||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if result.returncode != 0:
|
||||
print("Error on build!")
|
||||
print(result.stdout.decode())
|
||||
raise Exception(f"Validation failed for predefined model: {settings.computer.real_model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {settings.computer.real_model}")
|
||||
|
||||
# First run is with default settings
|
||||
build_prebuilt()
|
||||
build_dumps()
|
||||
# Second run, flip all settings
|
||||
settings.verbose_debug = True
|
||||
settings.opencore_debug = True
|
||||
settings.opencore_build = "DEBUG"
|
||||
settings.kext_debug = True
|
||||
settings.showpicker = False
|
||||
settings.sip_status = False
|
||||
settings.secure_status = True
|
||||
settings.firewire_boot = True
|
||||
settings.nvme_boot = True
|
||||
settings.enable_wake_on_wlan = True
|
||||
settings.disable_tb = True
|
||||
settings.force_surplus = True
|
||||
build_prebuilt()
|
||||
build_dumps()
|
||||
|
||||
|
||||
for model in ModelArray.SupportedSMBIOS:
|
||||
print(f"Validating predefined model: {model}")
|
||||
settings.custom_model = model
|
||||
# self.build_opencore()
|
||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if result.returncode != 0:
|
||||
print("Error on build!")
|
||||
print(result.stdout.decode())
|
||||
raise Exception(f"Validation failed for predefined model: {model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {model}")
|
||||
|
||||
for model in valid_dumps:
|
||||
settings.computer = model
|
||||
|
||||
# self.computer = settings.computer
|
||||
settings.custom_model = ""
|
||||
print(f"Validating dumped model: {settings.computer.real_model}")
|
||||
# self.build_opencore()
|
||||
Build.BuildOpenCore(settings.computer.real_model, settings).build_opencore()
|
||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if result.returncode != 0:
|
||||
print("Error on build!")
|
||||
print(result.stdout.decode())
|
||||
raise Exception(f"Validation failed for predefined model: {settings.computer.real_model}")
|
||||
else:
|
||||
print(f"Validation succeeded for predefined model: {settings.computer.real_model}")
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
from __future__ import print_function
|
||||
import subprocess
|
||||
|
||||
from Resources import Constants, Utilities, defaults, ModelArray, SysPatch
|
||||
from Resources import Constants, Utilities, defaults, ModelArray, sys_patch
|
||||
from Data import cpu_data, smbios_data
|
||||
|
||||
|
||||
class MenuOptions:
|
||||
@@ -760,9 +761,9 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
no_patch = True
|
||||
change_menu = input("Patch System Volume?: ")
|
||||
if no_patch is not True and change_menu == "1":
|
||||
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
|
||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_patch()
|
||||
elif no_patch is not True and change_menu == "2":
|
||||
SysPatch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
|
||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants).start_unpatch()
|
||||
else:
|
||||
print("Returning to main menu")
|
||||
|
||||
@@ -785,6 +786,159 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
|
||||
def patcher_settings(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Patcher Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
["Debug Settings", self.patcher_setting_debug],
|
||||
["Security Settings", self.patcher_settings_security],
|
||||
["SMBIOS Settings", self.patcher_settings_smbios],
|
||||
["Boot Volume Settings", self.patcher_settings_boot],
|
||||
["Miscellaneous Settings", self.patcher_settings_misc],
|
||||
["Dump detected hardware", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dump_hardware],
|
||||
[
|
||||
f"Allow Accel on Mojave/Catalina:\tCurrently {self.constants.moj_cat_accel}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_moj_cat_patch,
|
||||
],
|
||||
[
|
||||
f"Allow OpenCore on native Models:\tCurrently {self.constants.allow_oc_everywhere}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_native_models,
|
||||
],
|
||||
["Advanced Settings, for developers only", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).advanced_patcher_settings],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_setting_debug(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Debug Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Enable Verbose Mode:\tCurrently {self.constants.verbose_debug}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_verbose],
|
||||
[f"Enable OpenCore DEBUG:\tCurrently {self.constants.opencore_debug}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_oc],
|
||||
[f"Enable Kext DEBUG:\t\tCurrently {self.constants.kext_debug}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_kext],
|
||||
] + (
|
||||
[
|
||||
[f"Set SurPlus Settings:\tCurrently {self.constants.force_surplus}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_surplus]
|
||||
]
|
||||
if (smbios_data.smbios_dictionary[self.constants.custom_model or self.constants.computer.real_model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge)
|
||||
else []
|
||||
)
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_security(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Security Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
# [
|
||||
# f"Set Apple Mobile File Integrity (AMFI):\tCurrently {self.constants.amfi_status}",
|
||||
# MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_amfi,
|
||||
# ],
|
||||
[
|
||||
f"Set System Intrgity Protection (SIP):\tCurrently {self.constants.sip_status}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_sip,
|
||||
],
|
||||
[
|
||||
f"Set Secure Boot Model (SBM):\t\tCurrently {self.constants.secure_status}",
|
||||
MenuOptions(self.constants.custom_model or self.constant.computer.real_model, self.constants).change_sbm,
|
||||
],
|
||||
[f"Set Vault Mode:\t\t\t\tCurrently {self.constants.vault}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_vault],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_smbios(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust SMBIOS Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set SMBIOS Spoof Level:\tCurrently {self.constants.serial_settings}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_serial],
|
||||
[f"Set SMBIOS Spoof Model:\tCurrently {self.constants.override_smbios}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_smbios],
|
||||
[f"Set Custom name {self.constants.custom_cpu_model_value}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).custom_cpu],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_boot(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Bootable Volume Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set FireWire Boot:\tCurrently {self.constants.firewire_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_firewire],
|
||||
[f"Set NVMe Boot:\tCurrently {self.constants.nvme_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_nvme],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def patcher_settings_misc(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Miscellaneous Settings"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set ShowPicker Mode:\tCurrently {self.constants.showpicker}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_showpicker],
|
||||
[f"Set Wake on WLAN:\t\tCurrently {self.constants.enable_wake_on_wlan}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_wowl],
|
||||
[f"Set Ivy iMac iGPU:\t\tCurrently {self.constants.allow_ivy_igpu}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_ivy],
|
||||
[f"Set TeraScale 2 Accel:\tCurrently {self.constants.allow_ts2_accel}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).terascale_2_accel],
|
||||
[
|
||||
f"Disable Thunderbolt:\tCurrently {self.constants.disable_tb}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).disable_tb,
|
||||
],
|
||||
[f"Set AppleALC Usage:\t\tCurrently {self.constants.set_alc_usage}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).applealc_support],
|
||||
[f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
def advanced_patcher_settings(self):
|
||||
response = None
|
||||
while not (response and response == -1):
|
||||
title = ["Adjust Advanced Patcher Settings, for developers ONLY"]
|
||||
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set Metal GPU Status:\t\tCurrently {self.constants.imac_vendor}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).change_metal],
|
||||
[f"Set DRM Preferences:\t\tCurrently {self.constants.drm_support}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).drm_setting],
|
||||
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).bootstrap_setting],
|
||||
[
|
||||
f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}",
|
||||
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).disable_cpufriend,
|
||||
],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
menu.add_menu_option(option[0], function=option[1])
|
||||
|
||||
response = menu.start()
|
||||
|
||||
|
||||
|
||||
|
||||
big_sur = """Patches Root volume to fix misc issues such as:
|
||||
@@ -11,8 +11,8 @@ import subprocess
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from Resources import Constants, device_probe, ModelArray, SysPatchArray, Utilities
|
||||
from Data import sip_data
|
||||
from Resources import Constants, device_probe, ModelArray, Utilities
|
||||
from Data import sip_data, sys_patch_data
|
||||
|
||||
|
||||
class PatchSysVolume:
|
||||
@@ -109,7 +109,7 @@ class PatchSysVolume:
|
||||
input("- Press [ENTER] to exit: ")
|
||||
|
||||
def backup_volume(self):
|
||||
for location in SysPatchArray.BackupLocations:
|
||||
for location in sys_patch_data.BackupLocations:
|
||||
Utilities.cls()
|
||||
print("Backing up root volume before patching (This may take some time)")
|
||||
print(f"- Attempting to backup {location}")
|
||||
@@ -155,7 +155,7 @@ class PatchSysVolume:
|
||||
if (Path(self.mount_location) / Path("/System/Library/Extensions-Backup.zip")).exists():
|
||||
print("- Verified manual unpatching is available")
|
||||
|
||||
for location in SysPatchArray.BackupLocations:
|
||||
for location in sys_patch_data.BackupLocations:
|
||||
Utilities.cls()
|
||||
print("Reverting root volume patches (This may take some time)")
|
||||
|
||||
@@ -290,18 +290,18 @@ set million colour before rebooting"""
|
||||
Utilities.process_status(self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
def add_brightness_patch(self):
|
||||
self.delete_old_binaries(SysPatchArray.DeleteBrightness)
|
||||
self.add_new_binaries(SysPatchArray.AddBrightness, self.constants.legacy_brightness)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
|
||||
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
|
||||
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_brightness}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
|
||||
Utilities.process_status(self.elevated(["chmod", "-Rf", "755", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
Utilities.process_status(self.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_private_frameworks}/DisplayServices.framework"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
def add_audio_patch(self):
|
||||
if self.model in ["iMac7,1", "iMac8,1"]:
|
||||
self.delete_old_binaries(SysPatchArray.DeleteVolumeControl)
|
||||
self.add_new_binaries(SysPatchArray.AddVolumeControl, self.constants.audio_path)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteVolumeControl)
|
||||
self.add_new_binaries(sys_patch_data.AddVolumeControl, self.constants.audio_path)
|
||||
else:
|
||||
self.add_new_binaries(SysPatchArray.AddVolumeControlv2, self.constants.audio_v2_path)
|
||||
self.add_new_binaries(sys_patch_data.AddVolumeControlv2, self.constants.audio_v2_path)
|
||||
|
||||
def add_wifi_patch(self):
|
||||
print("- Merging Wireless CoreSerices patches")
|
||||
@@ -314,103 +314,103 @@ set million colour before rebooting"""
|
||||
Utilities.process_status(self.elevated(["chown", "root:wheel", f"{self.mount_libexec}/airportd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
def add_legacy_mux_patch(self):
|
||||
self.delete_old_binaries(SysPatchArray.DeleteDemux)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteDemux)
|
||||
print("- Merging Legacy Mux Kext patches")
|
||||
Utilities.process_status(self.elevated(["cp", "-R", f"{self.constants.legacy_mux_path}/AppleMuxControl.kext", self.mount_extensions_mux], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
|
||||
def gpu_accel_legacy(self):
|
||||
if self.constants.detected_os == self.constants.mojave:
|
||||
print("- Installing General Acceleration Kext patches for Mojave")
|
||||
self.add_new_binaries(SysPatchArray.AddGeneralAccelMojave, self.constants.legacy_general_path)
|
||||
self.add_new_binaries(sys_patch_data.AddGeneralAccelMojave, self.constants.legacy_general_path)
|
||||
elif self.constants.detected_os == self.constants.catalina:
|
||||
print("- Installing General Acceleration Kext patches for Catalina")
|
||||
self.add_new_binaries(SysPatchArray.AddGeneralAccelCatalina, self.constants.legacy_general_path)
|
||||
self.add_new_binaries(sys_patch_data.AddGeneralAccelCatalina, self.constants.legacy_general_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
|
||||
print("- Installing General Acceleration Kext patches for Big Sur/Monterey")
|
||||
self.add_new_binaries(SysPatchArray.AddGeneralAccel, self.constants.legacy_general_path)
|
||||
self.add_new_binaries(sys_patch_data.AddGeneralAccel, self.constants.legacy_general_path)
|
||||
|
||||
# Nvidia
|
||||
def gpu_accel_legacy_nvidia_master(self):
|
||||
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
|
||||
print("- Installing Nvidia Acceleration Kext patches for Mojave/Catalina")
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaAccelLegacy, self.constants.legacy_nvidia_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
|
||||
print("- Installing Nvidia Acceleration Kext patches for Big Sur/Monterey")
|
||||
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaAccel11, self.constants.legacy_nvidia_path)
|
||||
if self.constants.detected_os == self.constants.monterey and self.constants.detected_os_minor > 0:
|
||||
# Beta 7+ removes NVDAStartup
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaTeslaAccel12, self.constants.legacy_nvidia_kepler_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaTeslaAccel12, self.constants.legacy_nvidia_kepler_path)
|
||||
else:
|
||||
print("- Installing basic Nvidia Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaBrightness, self.constants.legacy_nvidia_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaBrightness, self.constants.legacy_nvidia_path)
|
||||
|
||||
# AMD/ATI
|
||||
def gpu_accel_legacy_ts1_master(self):
|
||||
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
|
||||
print("- Installing TeraScale 1 Acceleration Kext patches for Mojave/Catalina")
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
|
||||
print("- Installing TeraScale 1 Acceleration Kext patches for Big Sur/Monterey")
|
||||
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDAccel11, self.constants.legacy_amd_path)
|
||||
else:
|
||||
print("- Installing basic TeraScale 1 Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDBrightness, self.constants.legacy_amd_path)
|
||||
|
||||
def gpu_accel_legacy_ts2_master(self):
|
||||
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina] and self.constants.allow_ts2_accel is True:
|
||||
print("- Installing TeraScale 2 Acceleration Kext patches for Mojave/Catalina")
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDAccelLegacy, self.constants.legacy_amd_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey] and self.constants.allow_ts2_accel is True:
|
||||
# TODO: Enable for Monterey when acceleration patches proress
|
||||
print("- Installing TeraScale 2 Acceleration Kext patches for Big Sur")
|
||||
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11)
|
||||
self.delete_old_binaries(SysPatchArray.DeleteAMDAccel11TS2)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteAMDAccel11TS2)
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddAMDAccel11, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDAccel11, self.constants.legacy_amd_path)
|
||||
else:
|
||||
print("- Installing basic TeraScale 2 Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddAMDBrightness, self.constants.legacy_amd_path)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDBrightness, self.constants.legacy_amd_path)
|
||||
|
||||
# Intel
|
||||
def gpu_accel_legacy_ironlake_master(self):
|
||||
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
|
||||
print("- Installing Ironlake Acceleration Kext patches for Mojave/Catalina")
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
|
||||
print("- Installing Ironlake Acceleration Kext patches for Big Sur/Monterey")
|
||||
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
else:
|
||||
print("- Installing basic Ironlake Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen1Accel, self.constants.legacy_intel_gen1_path)
|
||||
|
||||
def gpu_accel_legacy_sandybridge_master(self):
|
||||
if self.constants.detected_os in [self.constants.mojave, self.constants.catalina]:
|
||||
print("- Installing Sandy Bridge Acceleration Kext patches for Mojave/Catalina")
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
elif self.constants.detected_os in [self.constants.big_sur, self.constants.monterey]:
|
||||
print("- Installing Sandy Bridge Acceleration Kext patches for Big Sur/Monterey")
|
||||
self.delete_old_binaries(SysPatchArray.DeleteNvidiaAccel11)
|
||||
self.delete_old_binaries(sys_patch_data.DeleteNvidiaAccel11)
|
||||
self.gpu_accel_legacy()
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
else:
|
||||
print("- Installing basic Sandy Bridge Framebuffer Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen2Accel, self.constants.legacy_intel_gen2_path)
|
||||
|
||||
def gpu_framebuffer_ivybridge_master(self):
|
||||
if self.constants.detected_os == self.constants.monterey:
|
||||
print("- Installing IvyBridge Acceleration Kext patches for Monterey")
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
|
||||
if self.validate is False:
|
||||
print("- Fixing Acceleration in CoreMedia")
|
||||
Utilities.process_status(subprocess.run(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "enable"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||
@@ -420,15 +420,15 @@ set million colour before rebooting"""
|
||||
self.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.payload_apple_private_frameworks_path_accel_ivy}/", self.mount_private_frameworks], stdout=subprocess.PIPE)
|
||||
else:
|
||||
print("- Installing basic Ivy Bridge Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
|
||||
self.add_new_binaries(sys_patch_data.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
|
||||
|
||||
def gpu_framebuffer_kepler_master(self):
|
||||
if self.constants.detected_os == self.constants.monterey:
|
||||
print("- Installing Kepler Acceleration Kext patches for Monterey")
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||
else:
|
||||
print("- Installing Kepler Kext patches for generic OS")
|
||||
self.add_new_binaries(SysPatchArray.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||
self.add_new_binaries(sys_patch_data.AddNvidiaKeplerAccel11, self.constants.legacy_nvidia_kepler_path)
|
||||
|
||||
def gpu_accel_legacy_extended(self):
|
||||
print("- Merging general legacy Frameworks")
|
||||
@@ -532,7 +532,7 @@ set million colour before rebooting"""
|
||||
|
||||
if self.amd_ts2 is True and self.constants.detected_os in self.constants.legacy_accel_support and self.constants.allow_ts2_accel is True:
|
||||
# TeraScale 2 patches must be installed after Intel HD3000
|
||||
self.add_new_binaries(SysPatchArray.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
|
||||
self.add_new_binaries(sys_patch_data.AddAMDAccel11TS2, self.constants.legacy_amd_path_ts2)
|
||||
|
||||
if self.added_legacy_kexts is True and self.constants.detected_os in self.constants.legacy_accel_support:
|
||||
self.gpu_accel_legacy_extended()
|
||||
Reference in New Issue
Block a user