diff --git a/CHANGELOG.md b/CHANGELOG.md index 7733f83d8..3f3762285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ - Applicable to systems with 2 (or more) USB Installers with the same name plugged in - Resolve payloads path being mis-routed during CLI calls - Add UI when fetching root patches for host + - Remove progress bar work-around for non-Metal in Monterey and later + - Requires host to have been patched with PatcherSupportPkg 1.1.2 or newer - Increment Binaries: - PatcherSupportPkg 1.1.2 - release diff --git a/resources/wx_gui/gui_support.py b/resources/wx_gui/gui_support.py index 08c84166e..c3a54a2fb 100644 --- a/resources/wx_gui/gui_support.py +++ b/resources/wx_gui/gui_support.py @@ -3,10 +3,13 @@ import os import sys import time import logging +import plistlib import threading import subprocess import applescript +import packaging.version + from pathlib import Path from resources.wx_gui import gui_about @@ -52,6 +55,8 @@ class GaugePulseCallback: """ Uses an alternative Pulse() method for wx.Gauge() on macOS Monterey+ with non-Metal GPUs Dirty hack, however better to display some form of animation than none at all + + Note: This work-around is no longer needed on hosts using PatcherSupportPkg 1.1.2 or newer """ def __init__(self, global_constants: constants.Constants, gauge: wx.Gauge) -> None: @@ -65,8 +70,10 @@ class GaugePulseCallback: self.max_value: int = gauge.GetRange() - # self.non_metal_alternative: bool = CheckProperties(global_constants).host_is_non_metal() - self.non_metal_alternative: bool = False + self.non_metal_alternative: bool = CheckProperties(global_constants).host_is_non_metal() + if self.non_metal_alternative is True: + if CheckProperties(global_constants).host_psp_version() >= packaging.version.Version("1.1.2"): + self.non_metal_alternative = False def start_pulse(self) -> None: @@ -140,6 +147,7 @@ class CheckProperties: return True + def host_has_cpu_gen(self, gen: int) -> bool: """ Check if host has a CPU generation equal to or greater than the specified generation @@ -151,6 +159,24 @@ class CheckProperties: return False + def host_psp_version(self) -> packaging.version.Version: + """ + Grab PatcherSupportPkg version from OpenCore-Legacy-Patcher.plist + """ + oclp_plist_path = "/System/Library/CoreServices/OpenCore-Legacy-Patcher.plist" + if not Path(oclp_plist_path).exists(): + return packaging.version.Version("0.0.0") + + oclp_plist = plistlib.load(open(oclp_plist_path, "rb")) + if "PatcherSupportPkg" not in oclp_plist: + return packaging.version.Version("0.0.0") + + if oclp_plist["PatcherSupportPkg"].startswith("v"): + oclp_plist["PatcherSupportPkg"] = oclp_plist["PatcherSupportPkg"][1:] + + return packaging.version.parse(oclp_plist["PatcherSupportPkg"]) + + class PayloadMount: def __init__(self, global_constants: constants.Constants, frame: wx.Frame) -> None: