mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 04:38:20 +10:00
Support custom CPU names in About This Mac
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- Fix MacBookPro5,4 audio support
|
||||
- Increment binaries
|
||||
- AppleALC f2889fc (1.6.1 rolling - 05-03-2021)
|
||||
- Support custom CPU names in About This Mac
|
||||
|
||||
## 0.1.2
|
||||
- Fix IDE support on 2008 era MacBooks, iMacs and Xserves
|
||||
|
||||
@@ -59,6 +59,18 @@ class OpenCoreLegacyPatcher():
|
||||
if not true_model.startswith("Unknown"):
|
||||
self.current_model = true_model
|
||||
|
||||
custom_cpu_model_value: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:revcpuname".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
if not custom_cpu_model_value.startswith("nvram: Error getting variable"):
|
||||
custom_cpu_model= [line.strip().split(":revcpu ", 1)[1] for line in custom_cpu_model_value.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
|
||||
custom_cpu_model_value = [line.strip().split(":revcpuname ", 1)[1] for line in custom_cpu_model_value.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
|
||||
if custom_cpu_model.split("%00")[0] == "%01%00%00%00":
|
||||
self.constants.custom_cpu_model = 1
|
||||
elif custom_cpu_model.split("%00")[0] == "%00%00%00%00":
|
||||
self.constants.custom_cpu_model = 0
|
||||
if custom_cpu_model_value.split("%00")[0] != "":
|
||||
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
# Generic building args
|
||||
|
||||
@@ -55,6 +55,18 @@ class OpenCoreLegacyPatcher():
|
||||
print(f"True Model: {true_model}")
|
||||
if not true_model.startswith("Unknown"):
|
||||
self.current_model = true_model
|
||||
|
||||
custom_cpu_model_value: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:revcpuname".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
|
||||
if not custom_cpu_model_value.startswith("nvram: Error getting variable"):
|
||||
custom_cpu_model= [line.strip().split(":revcpu ", 1)[1] for line in custom_cpu_model_value.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
|
||||
custom_cpu_model_value = [line.strip().split(":revcpuname ", 1)[1] for line in custom_cpu_model_value.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
|
||||
if custom_cpu_model.split("%00")[0] == "%01%00%00%00":
|
||||
self.constants.custom_cpu_model = 1
|
||||
elif custom_cpu_model.split("%00")[0] == "%00%00%00%00":
|
||||
self.constants.custom_cpu_model = 0
|
||||
if custom_cpu_model_value.split("%00")[0] != "":
|
||||
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
|
||||
|
||||
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]
|
||||
@@ -111,6 +123,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
[f"Set Acceleration Patches:\t\t{self.constants.legacy_acceleration_patch}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).accel_setting],
|
||||
[f"Assume Legacy GPU:\t\t\t{self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting],
|
||||
[f"Allow OpenCore on native Models:\t{self.constants.allow_oc_everywhere}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).allow_native_models],
|
||||
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
|
||||
@@ -137,7 +137,6 @@ class BuildOpenCore:
|
||||
if self.constants.allow_oc_everywhere is False:
|
||||
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.driver.AppleSMC")["Enabled"] = True
|
||||
|
||||
|
||||
if not self.constants.custom_model:
|
||||
nvme_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||
nvme_devices = [i for i in nvme_devices if i.get("IORegistryEntryChildren", None) and i["vendor-id"] != binascii.unhexlify("6B100000") and i["IORegistryEntryChildren"][0]["IORegistryEntryName"] == "IONVMeController"]
|
||||
@@ -536,7 +535,15 @@ class BuildOpenCore:
|
||||
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "XHC1 to SHC1")["Enabled"] = True
|
||||
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC1 to EH01")["Enabled"] = True
|
||||
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "EHC2 to EH02")["Enabled"] = True
|
||||
|
||||
if self.constants.custom_cpu_model == 0 or self.constants.custom_cpu_model == 1:
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpu"] = self.constants.custom_cpu_model
|
||||
if self.constants.custom_cpu_model_value != "":
|
||||
print(f"- Adding custom CPU Name: {self.constants.custom_cpu_model_value}")
|
||||
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revcpuname"] = self.constants.custom_cpu_model_value
|
||||
else:
|
||||
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)
|
||||
|
||||
def set_smbios(self):
|
||||
spoofed_model = self.model
|
||||
|
||||
@@ -328,5 +328,35 @@ power usage.
|
||||
elif change_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.allow_oc_everywhere = False
|
||||
self.constants.serial_settings = "Minimal"
|
||||
else:
|
||||
print("Invalid option")
|
||||
|
||||
def custom_cpu(self):
|
||||
Utilities.cls()
|
||||
Utilities.header(["Set custom CPU Model Name"])
|
||||
print("""Change reported CPU Model name in About This Mac
|
||||
Custom names will report as follows:
|
||||
|
||||
1: Original Name: 2.5 Ghz Dual-Core Intel Core i5
|
||||
2. CPU name: Intel(R) Core(TM) i5-3210M CPU @ 2.50Ghz
|
||||
3. Custom Name: 2.5Ghz Cotton Candy (example)
|
||||
""")
|
||||
if self.constants.custom_cpu_model_value == "":
|
||||
if self.constants.custom_cpu_model == 0:
|
||||
print("Currently using original name")
|
||||
else:
|
||||
print("Currently using CPU name")
|
||||
else:
|
||||
print(f"Custom CPU name currently: {self.constants.custom_cpu_model_value}")
|
||||
change_menu = input("Set custom CPU Name(1,2,3): ")
|
||||
if change_menu == "1":
|
||||
self.constants.custom_cpu_model = 2
|
||||
self.constants.custom_cpu_model_value = ""
|
||||
elif change_menu == "2":
|
||||
self.constants.custom_cpu_model = 0
|
||||
self.constants.custom_cpu_model_value = ""
|
||||
elif change_menu == "3":
|
||||
self.constants.custom_cpu_model = 1
|
||||
self.constants.custom_cpu_model_value = input("Enter new CPU Name: ")
|
||||
else:
|
||||
print("Invalid option")
|
||||
@@ -76,6 +76,8 @@ class Constants:
|
||||
self.legacy_acceleration_patch = True
|
||||
self.assume_legacy = False
|
||||
self.allow_oc_everywhere = False
|
||||
self.custom_cpu_model = 2
|
||||
self.custom_cpu_model_value = ""
|
||||
|
||||
# OS Versions
|
||||
self.tiger = 8
|
||||
@@ -100,7 +102,6 @@ class Constants:
|
||||
self.pci_atheros = "168C"
|
||||
self.pci_apple = "106B"
|
||||
|
||||
|
||||
# Class Codes
|
||||
# https://pci-ids.ucw.cz/read/PD
|
||||
self.classcode_sata = "01060100"
|
||||
|
||||
@@ -965,11 +965,11 @@ DeleteAMDAccel11 = [
|
||||
"AMDRadeonX6000.kext",
|
||||
"AMDRadeonX6000Framebuffer.kext",
|
||||
"AMDRadeonX6000HWServices.kext",
|
||||
"AMD7000Controller.kext", # AMDSupport Dependancy
|
||||
"AMD8000Controller.kext", # AMDSupport Dependancy
|
||||
"AMD9000Controller.kext", # AMDSupport Dependancy
|
||||
"AMD9500Controller.kext", # AMDSupport Dependancy
|
||||
"AMD10000Controller.kext", # AMDSupport Dependancy
|
||||
"AMD7000Controller.kext", # AMDSupport Dependency
|
||||
"AMD8000Controller.kext", # AMDSupport Dependency
|
||||
"AMD9000Controller.kext", # AMDSupport Dependency
|
||||
"AMD9500Controller.kext", # AMDSupport Dependency
|
||||
"AMD10000Controller.kext", # AMDSupport Dependency
|
||||
"AppleIntelBDWGraphics.kext",
|
||||
"AppleIntelBDWGraphicsFramebuffer.kext",
|
||||
"AppleIntelCFLGraphicsFramebuffer.kext",
|
||||
|
||||
@@ -1114,10 +1114,6 @@
|
||||
<dict>
|
||||
<key>OCLP-Version</key>
|
||||
<string></string>
|
||||
<key>revcpu</key>
|
||||
<string></string>
|
||||
<key>revcpuname</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<key>7C436110-AB2A-4BBB-A880-FE41995C9F82</key>
|
||||
<dict>
|
||||
|
||||
Reference in New Issue
Block a user