Remember TeraScale 2 Setting on MacBookPro8,2/3

This commit is contained in:
Mykola Grymalyuk
2022-04-02 20:02:42 -06:00
parent fae2f0058d
commit 8b98be5189
4 changed files with 13 additions and 1 deletions

View File

@@ -4,6 +4,8 @@
- Lower SIP requirement for Root Patching
- Sets to 0x802 (previously 0xA03)
- Drops `CSR_ALLOW_UNTRUSTED_KEXTS` and `CSR_ALLOW_UNAPPROVED_KEXTS`
- Remember TeraScale 2 Setting on MacBookPro8,2/3
- Avoids requiring toggling after first time
## 0.4.3
- Increment Binaries:

View File

@@ -1923,9 +1923,11 @@ class wx_python_gui:
def ts2_accel_click(self, event=None):
if self.set_terascale_accel_checkbox.GetValue():
print("TS2 Acceleration Enabled")
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel", "-bool", "TRUE"])
self.constants.allow_ts2_accel = True
else:
print("TS2 Acceleration Disabled")
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel", "-bool", "FALSE"])
self.constants.allow_ts2_accel = False
def windows_gmux_click(self, event=None):

View File

@@ -690,8 +690,10 @@ handle acceleration tasks.
change_menu = input("Allow TeraScale 2 Acceleration?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel", "-bool", "TRUE"])
self.constants.allow_ts2_accel = True
elif change_menu in {"n", "N", "no", "No"}:
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel", "-bool", "FALSE"])
self.constants.allow_ts2_accel = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")

View File

@@ -108,7 +108,13 @@ class generate_defaults:
if model in ["MacBookPro8,2", "MacBookPro8,3"]:
# Users disabling TS2 most likely have a faulty dGPU
# users can override this in settings
settings.allow_ts2_accel = False
ts2_status = subprocess.run(["defaults", "read", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if ts2_status in ["1", "true"]:
self.constants.allow_ts2_accel = True
else:
subprocess.run(["defaults", "write", "com.dortania.opencore-legacy-patcher", "MacBookPro_TeraScale_2_Accel", "-bool", "TRUE"])
self.constants.allow_ts2_accel = False
try:
if smbios_data.smbios_dictionary[model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value and model != "MacPro5,1":
# Sidecar and AirPlay to Mac only blacklist Ivy and newer (as well as MacPro5,1)