mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 22:50:51 +10:00
sys_patch_helpers.py: Add Metal libary patching
Resolves many 3rd party apps crashing on 13.3 when trying to invoke Metal directly
This commit is contained in:
+4
-1
@@ -16,6 +16,9 @@
|
|||||||
- Resolve accidental CPU renaming with RestrictEvents
|
- Resolve accidental CPU renaming with RestrictEvents
|
||||||
- Resolve backlight and internal display support for AMD Navi MXM GPUs
|
- Resolve backlight and internal display support for AMD Navi MXM GPUs
|
||||||
- Credit to [@Ausdauersportler](https://github.com/Ausdauersportler) for bug fix
|
- Credit to [@Ausdauersportler](https://github.com/Ausdauersportler) for bug fix
|
||||||
|
- Resolve 3rd Party Apps erroring on Metal with macOS 13.3
|
||||||
|
- Applicable Software: Applications directly using Metal (ex. Blender, Parallels Desktop)
|
||||||
|
- Applicable Hardware: 3802-based GPUs (ie. Intel Ivy Bridge and Haswell iGPUs, Nvidia Kepler dGPUs)
|
||||||
- Backend changes:
|
- Backend changes:
|
||||||
- Use `.AppleSystemUIFont` for wxPython text rendering (thanks [@jazzzny](https://github.com/Jazzzny))
|
- Use `.AppleSystemUIFont` for wxPython text rendering (thanks [@jazzzny](https://github.com/Jazzzny))
|
||||||
- Add extra error handling for network errors:
|
- Add extra error handling for network errors:
|
||||||
@@ -25,7 +28,7 @@
|
|||||||
- Implemented Object-Oriented design
|
- Implemented Object-Oriented design
|
||||||
- Reduced disk I/O and main thread monopolization
|
- Reduced disk I/O and main thread monopolization
|
||||||
- Increment Binaries:
|
- Increment Binaries:
|
||||||
- PatcherSupportPkg 0.9.2 - release
|
- PatcherSupportPkg 0.9.3 - release
|
||||||
- OpenCorePkg 0.9.1 - release
|
- OpenCorePkg 0.9.1 - release
|
||||||
- AirPortBrcmFixup 2.1.7 - release
|
- AirPortBrcmFixup 2.1.7 - release
|
||||||
- RestrictEvents 1.1.0 - release
|
- RestrictEvents 1.1.0 - release
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Constants:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
# Patcher Versioning
|
# Patcher Versioning
|
||||||
self.patcher_version: str = "0.6.3" # OpenCore-Legacy-Patcher
|
self.patcher_version: str = "0.6.3" # OpenCore-Legacy-Patcher
|
||||||
self.patcher_support_pkg_version: str = "0.9.2" # PatcherSupportPkg
|
self.patcher_support_pkg_version: str = "0.9.3" # PatcherSupportPkg
|
||||||
self.copyright_date: str = "Copyright © 2020-2023 Dortania"
|
self.copyright_date: str = "Copyright © 2020-2023 Dortania"
|
||||||
|
|
||||||
# URLs
|
# URLs
|
||||||
|
|||||||
@@ -721,6 +721,8 @@ class PatchSysVolume:
|
|||||||
sys_patch_helpers.SysPatchHelpers(self.constants).disable_window_server_caching()
|
sys_patch_helpers.SysPatchHelpers(self.constants).disable_window_server_caching()
|
||||||
if any(x in required_patches for x in ["Intel Ivy Bridge", "Intel Haswell"]):
|
if any(x in required_patches for x in ["Intel Ivy Bridge", "Intel Haswell"]):
|
||||||
sys_patch_helpers.SysPatchHelpers(self.constants).remove_news_widgets()
|
sys_patch_helpers.SysPatchHelpers(self.constants).remove_news_widgets()
|
||||||
|
if "Metal 3802 Common Extended" in required_patches:
|
||||||
|
sys_patch_helpers.SysPatchHelpers(self.constants).patch_gpu_compiler_libraries(mount_point=self.mount_location)
|
||||||
|
|
||||||
self._write_patchset(required_patches)
|
self._write_patchset(required_patches)
|
||||||
|
|
||||||
|
|||||||
@@ -211,3 +211,65 @@ class SysPatchHelpers:
|
|||||||
result = utilities.elevated([self.constants.rsrrepair_userspace_path, "--install"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
result = utilities.elevated([self.constants.rsrrepair_userspace_path, "--install"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
logging.info(f" - Failed to install RSRRepair: {result.stdout.decode()}")
|
logging.info(f" - Failed to install RSRRepair: {result.stdout.decode()}")
|
||||||
|
|
||||||
|
|
||||||
|
def patch_gpu_compiler_libraries(self, mount_point: str | Path):
|
||||||
|
"""
|
||||||
|
Fix GPUCompiler.framework's libraries to resolve linking issues
|
||||||
|
|
||||||
|
On 13.3 with 3802 GPUs, OCLP will downgrade GPUCompiler to resolve
|
||||||
|
graphics support. However the binary hardcodes the library names,
|
||||||
|
and thus we need to adjust the libraries to match (31001.669)
|
||||||
|
|
||||||
|
Important portions of the library will be downgraded to 31001.669,
|
||||||
|
and the remaining bins will be copied over (via CoW to reduce waste)
|
||||||
|
|
||||||
|
Primary folders to merge:
|
||||||
|
- 31001.XXX: (current OS version)
|
||||||
|
- include:
|
||||||
|
- module.modulemap
|
||||||
|
- opencl-c.h
|
||||||
|
- lib (entire directory)
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
mount_point: The mount point of the target volume
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self.constants.detected_os < os_data.os_data.ventura:
|
||||||
|
return
|
||||||
|
if self.constants.detected_os == os_data.os_data.ventura:
|
||||||
|
if self.constants.detected_os_minor < 4:
|
||||||
|
return
|
||||||
|
|
||||||
|
LIBRARY_DIR = f"{mount_point}/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/31001/Libraries/lib/clang"
|
||||||
|
GPU_VERSION = "31001.669"
|
||||||
|
|
||||||
|
DEST_DIR = f"{LIBRARY_DIR}/{GPU_VERSION}"
|
||||||
|
|
||||||
|
if not Path(DEST_DIR).exists():
|
||||||
|
return
|
||||||
|
|
||||||
|
for file in Path(LIBRARY_DIR).iterdir():
|
||||||
|
if file.is_file():
|
||||||
|
continue
|
||||||
|
if file.name == GPU_VERSION:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Partial match as each OS can increment the version
|
||||||
|
if not file.name.startswith("31001."):
|
||||||
|
continue
|
||||||
|
|
||||||
|
logging.info(f"- Merging GPUCompiler.framework libraries to match binary")
|
||||||
|
|
||||||
|
src_dir = f"{LIBRARY_DIR}/{file.name}"
|
||||||
|
for file in ["module.modulemap", "opencl-c.h"]:
|
||||||
|
# Copy on Write to reduce disk usage
|
||||||
|
dst_path = f"{DEST_DIR}/include/{file}"
|
||||||
|
if Path(dst_path).exists():
|
||||||
|
continue
|
||||||
|
utilities.process_status(utilities.elevated(["cp", "-c", dst_path, f"{DEST_DIR}/include/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
|
if not Path(f"{DEST_DIR}/lib").exists():
|
||||||
|
utilities.process_status(utilities.elevated(["cp", "-cR", f"{src_dir}/lib", f"{DEST_DIR}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
|
||||||
|
|
||||||
|
break
|
||||||
Reference in New Issue
Block a user