mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 12:48:18 +10:00
Merge branch 'main' into sonoma-development
This commit is contained in:
@@ -3,26 +3,16 @@
|
||||
# Used when supplying data to sys_patch.py
|
||||
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import plistlib
|
||||
import logging
|
||||
import py_sip_xnu
|
||||
import plistlib
|
||||
from pathlib import Path
|
||||
|
||||
from resources import (
|
||||
constants,
|
||||
device_probe,
|
||||
utilities,
|
||||
amfi_detect,
|
||||
network_handler,
|
||||
kdk_handler
|
||||
)
|
||||
from data import (
|
||||
model_array,
|
||||
os_data,
|
||||
sip_data,
|
||||
smbios_data,
|
||||
cpu_data
|
||||
)
|
||||
import packaging.version
|
||||
import py_sip_xnu
|
||||
|
||||
from data import cpu_data, model_array, os_data, sip_data, smbios_data
|
||||
from resources import (amfi_detect, constants, device_probe, kdk_handler,
|
||||
network_handler, utilities)
|
||||
|
||||
|
||||
class DetectRootPatch:
|
||||
@@ -78,6 +68,7 @@ class DetectRootPatch:
|
||||
self.dosdude_patched = False
|
||||
self.missing_kdk = False
|
||||
self.has_network = False
|
||||
self.unsupported_os = False
|
||||
|
||||
self.missing_whatever_green = False
|
||||
self.missing_nv_web_nvram = False
|
||||
@@ -441,7 +432,18 @@ class DetectRootPatch:
|
||||
bool: True if loaded, False otherwise
|
||||
"""
|
||||
|
||||
return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os)
|
||||
return utilities.check_kext_loaded("as.vit9696.WhateverGreen")
|
||||
|
||||
|
||||
def _check_os_compat(self) -> bool:
|
||||
"""
|
||||
Base check to ensure patcher is compatible with host OS
|
||||
"""
|
||||
min_os = os_data.os_data.big_sur
|
||||
max_os = os_data.os_data.ventura
|
||||
if self.constants.detected_os < min_os or self.constants.detected_os > max_os:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _check_kdk(self):
|
||||
@@ -546,7 +548,7 @@ class DetectRootPatch:
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
self.brightness_legacy = True
|
||||
|
||||
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
|
||||
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("as.vit9696.AppleALC") is False):
|
||||
# Special hack for systems with botched GOPs
|
||||
# TL;DR: No Boot Screen breaks Lilu, therefore breaking audio
|
||||
if self.constants.detected_os > os_data.os_data.catalina:
|
||||
@@ -618,6 +620,7 @@ class DetectRootPatch:
|
||||
"Settings: Kernel Debug Kit missing": self.missing_kdk if self.constants.detected_os >= os_data.os_data.ventura.value else False,
|
||||
"Validation: Patching Possible": self.verify_patch_allowed(),
|
||||
"Validation: Unpatching Possible": self._verify_unpatch_allowed(),
|
||||
f"Validation: Unsupported Host OS": self.unsupported_os,
|
||||
f"Validation: SIP is enabled (Required: {self._check_sip()[2]} or higher)": self.sip_enabled,
|
||||
f"Validation: Currently Booted SIP: ({hex(py_sip_xnu.SipXnu().get_sip_status().value)})": self.sip_enabled,
|
||||
"Validation: SecureBootModel is enabled": self.sbm_enabled,
|
||||
@@ -648,6 +651,12 @@ class DetectRootPatch:
|
||||
if self.constants.detected_os < os_data.os_data.big_sur:
|
||||
return amfi_detect.AmfiConfigDetectLevel.NO_CHECK
|
||||
|
||||
amfipass_version = utilities.check_kext_loaded("com.dhinakg.AMFIPass")
|
||||
if amfipass_version:
|
||||
if packaging.version.parse(amfipass_version) >= packaging.version.parse(self.constants.amfipass_compatibility_version):
|
||||
# If AMFIPass is loaded, our binaries will work
|
||||
return amfi_detect.AmfiConfigDetectLevel.NO_CHECK
|
||||
|
||||
if self.constants.detected_os >= os_data.os_data.ventura:
|
||||
if self.amfi_shim_bins is True:
|
||||
# Currently we require AMFI outright disabled
|
||||
@@ -675,6 +684,8 @@ class DetectRootPatch:
|
||||
self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os)
|
||||
self.amfi_enabled = not amfi_detect.AmfiConfigurationDetection().check_config(self._get_amfi_level_needed())
|
||||
|
||||
self.unsupported_os = not self._check_os_compat()
|
||||
|
||||
if self.nvidia_web is True:
|
||||
self.missing_nv_web_nvram = not self._check_nv_web_nvram()
|
||||
self.missing_nv_web_opengl = not self._check_nv_web_opengl()
|
||||
@@ -728,10 +739,14 @@ class DetectRootPatch:
|
||||
logging.info("\nCannot patch! Network Connection Required")
|
||||
logging.info("Please ensure you have an active internet connection")
|
||||
|
||||
if self.unsupported_os is True:
|
||||
logging.info("\nCannot patch! Unsupported Host OS")
|
||||
logging.info("Please ensure you are running a patcher-supported OS")
|
||||
|
||||
if any(
|
||||
[
|
||||
# General patch checks
|
||||
self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched,
|
||||
self.sip_enabled, self.sbm_enabled, self.fv_enabled, self.dosdude_patched, self.unsupported_os,
|
||||
|
||||
# non-Metal specific
|
||||
self.amfi_enabled if self.amfi_must_disable is True else False,
|
||||
|
||||
Reference in New Issue
Block a user