Add PatcherSupportPkg

This commit is contained in:
Mykola Grymalyuk
2021-06-18 12:53:07 -06:00
parent 4b35681b5f
commit 84d0272eda
3 changed files with 25 additions and 46 deletions

View File

@@ -2,7 +2,11 @@
## 0.2.0
- Refactor device probe logic
- Implement PatcherSupportPkg v0.0.3
- Reduces binary sizes depending on OS
- Deprecates Apple-Binaries-OCLP
- Fix full screen and Airplay to Mac support for Intel HD4000 iGPUs
## 0.1.9
- Fix incorrect AMFI and SIP detection

View File

@@ -45,6 +45,7 @@ class Constants:
self.innie_version = "1.3.0"
self.fw_kext = "1.0.0"
self.payload_version = "0.0.18" # Apple-Binaries-OCLP
self.patcher_support_pkg_version = "0.0.2" # PatcherSupportPkg
# Get resource path
self.current_path = Path(__file__).parent.parent.resolve()
@@ -133,6 +134,7 @@ class Constants:
# External Files
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/tags/"
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
# Payload Location
# OpenCore
@@ -424,9 +426,6 @@ class Constants:
return self.payload_path / Path("Icon/Resources.zip")
# Apple Payloads Paths
@property
def payload_apple_root_path_unzip(self):
return self.payload_path / Path(f"Apple-Binaries-OCLP-{self.payload_version}")
@property
def payload_apple_root_path_zip(self):
@@ -450,7 +449,7 @@ class Constants:
@property
def payload_apple_frameworks_path_accel_ts2(self):
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration-TS2")
return self.payload_apple_frameworks_path / Path("Graphics-Acceleration-TeraScale-2")
@property
def payload_apple_lauchd_path(self):
@@ -470,7 +469,7 @@ class Constants:
@property
def payload_apple_private_frameworks_path_accel_ts2(self):
return self.payload_apple_private_frameworks_path / Path("Graphics-Acceleration-TS2")
return self.payload_apple_private_frameworks_path / Path("Graphics-Acceleration-TeraScale-2")
@property
def payload_apple_private_frameworks_path_brightness(self):
@@ -487,10 +486,6 @@ class Constants:
def legacy_graphics(self):
return self.payload_apple_kexts_path / Path("Graphics-Acceleration")
@property
def legacy_graphics_ts2(self):
return self.payload_apple_kexts_path / Path("Graphics-Acceleration-TS2")
@property
def legacy_nvidia_path(self):
return self.legacy_graphics / Path("Nvidia-Tesla-Fermi")
@@ -501,11 +496,11 @@ class Constants:
@property
def legacy_amd_path(self):
return self.legacy_graphics / Path("AMD-ATI")
return self.legacy_graphics / Path("AMD-TeraScale")
@property
def legacy_amd_path_ts2(self):
return self.legacy_graphics / Path("ATI-TS2")
return self.legacy_graphics / Path("AMD-TeraScale-2")
@property
def legacy_intel_gen1_path(self):
@@ -527,37 +522,6 @@ class Constants:
def legacy_brightness(self):
return self.payload_apple_kexts_path / Path("Brightness-Control")
# Apple Frameworks
@property
def coredisplay_path(self):
return self.payload_apple_frameworks_path_accel / Path("CoreDisplay.framework")
@property
def iosurface_f_path(self):
return self.payload_apple_frameworks_path_accel / Path("IOSurface.framework")
@property
def opengl_path(self):
return self.payload_apple_frameworks_path_accel / Path("OpenGL.framework")
# Apple LaunchDaemons
@property
def hiddhack_path(self):
return self.payload_apple_lauchd_path_accel / Path("IOHID-Fixup.plist")
@property
def legacy_hiddhack_path(self):
return self.payload_apple_lauchd_path_accel / Path("HiddHack.plist")
# Apple PrivateFrameworks
@property
def gpusupport_path(self):
return self.payload_apple_private_frameworks_path_accel / Path("GPUSupport.framework")
@property
def skylight_path(self):
return self.payload_apple_private_frameworks_path_accel / Path("SkyLight.framework")
csr_values = {
"CSR_ALLOW_UNTRUSTED_KEXTS": False, # 0x1 - Allows Unsigned Kexts - Introduced in El Capitan # noqa: E241
"CSR_ALLOW_UNRESTRICTED_FS": False, # 0x2 - File System Access - Introduced in El Capitan # noqa: E241

View File

@@ -197,6 +197,8 @@ class PatchSysVolume:
def gpu_framebuffer_ivybridge(self):
self.add_new_binaries(SysPatchArray.AddIntelGen3Accel, self.constants.legacy_intel_gen3_path)
print("- Fixing Acceleration in CoreMedia")
self.elevated(["defaults", "write", "com.apple.coremedia", "hardwareVideoDecoder", "-string", "disable"], stdout=subprocess.PIPE).stdout.decode().strip().encode()
def gpu_accel_legacy_extended(self):
print("- Merging general legacy Frameworks")
@@ -309,10 +311,19 @@ class PatchSysVolume:
self.download_files()
def download_files(self):
if self.constants.detected_os == self.constants.monterey:
os_ver = "12-Monterey"
elif self.constants.detected_os == self.constants.big_sur:
os_ver = "11-Big-Sur"
elif self.constants.detected_os == self.constants.catalina:
os_ver = "10.15-Catalina"
elif self.constants.detected_os == self.constants.mojave:
os_ver = "10.14-Mojave"
link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/{os_ver}.zip"
Utilities.cls()
print("- Downloading Apple binaries")
popen_oclp = subprocess.Popen(
["curl", "-S", "-L", f"{self.constants.url_apple_binaries}{self.constants.payload_version}.zip", "--output", self.constants.payload_apple_root_path_zip],
["curl", "-S", "-L", link, "--output", self.constants.payload_apple_root_path_zip],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
@@ -327,7 +338,7 @@ class PatchSysVolume:
try:
subprocess.run(["unzip", self.constants.payload_apple_root_path_zip], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.constants.payload_path).stdout.decode()
print("- Renaming folder")
os.rename(self.constants.payload_apple_root_path_unzip, self.constants.payload_apple_root_path)
os.rename(self.constants.payload_path / Path(os_ver), self.constants.payload_apple_root_path)
print("- Binaries downloaded to:")
print(self.constants.payload_path)
if self.constants.gui_mode is False:
@@ -337,7 +348,7 @@ class PatchSysVolume:
os.remove(self.constants.payload_apple_root_path_zip)
else:
print("- Download failed, please verify the below link works:")
print(f"{self.constants.url_apple_binaries}{self.constants.payload_version}")
print(link)
def detect_gpus(self):
dgpu = self.constants.computer.dgpu