mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-22 02:50:15 +10:00
Add USB mappings for macOS 26
This commit is contained in:
@@ -689,10 +689,18 @@ class Constants:
|
|||||||
def map_kext_folder(self):
|
def map_kext_folder(self):
|
||||||
return self.kexts_path / Path("USB-Map.kext")
|
return self.kexts_path / Path("USB-Map.kext")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def map_kext_folder_tahoe(self):
|
||||||
|
return self.kexts_path / Path("USB-Map-Tahoe.kext")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def map_contents_folder(self):
|
def map_contents_folder(self):
|
||||||
return self.map_kext_folder / Path("Contents")
|
return self.map_kext_folder / Path("Contents")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def map_contents_folder_tahoe(self):
|
||||||
|
return self.map_kext_folder_tahoe / Path("Contents")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def pp_kext_folder(self):
|
def pp_kext_folder(self):
|
||||||
return self.kexts_path / Path("CPUFriendDataProvider.kext")
|
return self.kexts_path / Path("CPUFriendDataProvider.kext")
|
||||||
|
|||||||
@@ -285,19 +285,26 @@ xw
|
|||||||
|
|
||||||
# USB Map
|
# USB Map
|
||||||
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
|
usb_map_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info.plist")
|
||||||
|
usb_map_tahoe_path = Path(self.constants.plist_folder_path) / Path("AppleUSBMaps/Info-Tahoe.plist")
|
||||||
if (
|
if (
|
||||||
usb_map_path.exists()
|
usb_map_path.exists()
|
||||||
|
and usb_map_tahoe_path.exists()
|
||||||
and (self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True)
|
and (self.constants.allow_oc_everywhere is False or self.constants.allow_native_spoofs is True)
|
||||||
and self.model not in ["Xserve2,1", "Dortania1,1"]
|
and self.model not in ["Xserve2,1", "Dortania1,1"]
|
||||||
and (
|
and (
|
||||||
(self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura)
|
(self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura)
|
||||||
or self.constants.serial_settings in ["Moderate", "Advanced"])
|
or self.constants.serial_settings in ["Moderate", "Advanced"])
|
||||||
):
|
):
|
||||||
logging.info("- Adding USB-Map.kext")
|
logging.info("- Adding USB-Map.kext and USB-Map-Tahoe.kext")
|
||||||
Path(self.constants.map_kext_folder).mkdir()
|
Path(self.constants.map_kext_folder).mkdir()
|
||||||
|
Path(self.constants.map_kext_folder_tahoe).mkdir()
|
||||||
Path(self.constants.map_contents_folder).mkdir()
|
Path(self.constants.map_contents_folder).mkdir()
|
||||||
|
Path(self.constants.map_contents_folder_tahoe).mkdir()
|
||||||
shutil.copy(usb_map_path, self.constants.map_contents_folder)
|
shutil.copy(usb_map_path, self.constants.map_contents_folder)
|
||||||
|
# for the tahoe, need to copy but rename to Info.plist
|
||||||
|
shutil.copy(usb_map_tahoe_path, self.constants.map_contents_folder_tahoe / Path("Info.plist"))
|
||||||
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["Enabled"] = True
|
||||||
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map-Tahoe.kext")["Enabled"] = True
|
||||||
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
|
if self.model in model_array.Missing_USB_Map_Ventura and self.constants.serial_settings not in ["Moderate", "Advanced"]:
|
||||||
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"
|
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB-Map.kext")["MinKernel"] = "22.0.0"
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,24 @@ class BuildSMBIOS:
|
|||||||
logging.info("- Adding -no_compat_check")
|
logging.info("- Adding -no_compat_check")
|
||||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -no_compat_check"
|
||||||
|
|
||||||
|
def _strip_usb_map(self, map_path, model, spoofed_model, serial_settings):
|
||||||
|
config = plistlib.load(Path(map_path).open("rb"))
|
||||||
|
for entry in list(config["IOKitPersonalities_x86_64"]):
|
||||||
|
if not entry.startswith(model):
|
||||||
|
config["IOKitPersonalities_x86_64"].pop(entry)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
config["IOKitPersonalities_x86_64"][entry]["model"] = spoofed_model
|
||||||
|
if serial_settings in ["Minimal", "None"]:
|
||||||
|
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH01":
|
||||||
|
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC1"
|
||||||
|
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH02":
|
||||||
|
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC2"
|
||||||
|
if config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "SHC1":
|
||||||
|
config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "XHC1"
|
||||||
|
except KeyError:
|
||||||
|
continue
|
||||||
|
plistlib.dump(config, Path(map_path).open("wb"), sort_keys=True)
|
||||||
|
|
||||||
def set_smbios(self) -> None:
|
def set_smbios(self) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -142,24 +160,10 @@ class BuildSMBIOS:
|
|||||||
and ((self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura) or self.constants.serial_settings in ["Moderate", "Advanced"])
|
and ((self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura) or self.constants.serial_settings in ["Moderate", "Advanced"])
|
||||||
):
|
):
|
||||||
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
|
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
|
||||||
map_config = plistlib.load(Path(new_map_ls).open("rb"))
|
new_map_ls_tahoe = Path(self.constants.map_contents_folder_tahoe) / Path("Info.plist")
|
||||||
# Strip unused USB maps
|
self._strip_usb_map(new_map_ls, self.model, self.spoofed_model, self.constants.serial_settings)
|
||||||
for entry in list(map_config["IOKitPersonalities_x86_64"]):
|
self._strip_usb_map(new_map_ls_tahoe, self.model, self.spoofed_model, self.constants.serial_settings)
|
||||||
if not entry.startswith(self.model):
|
|
||||||
map_config["IOKitPersonalities_x86_64"].pop(entry)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
map_config["IOKitPersonalities_x86_64"][entry]["model"] = self.spoofed_model
|
|
||||||
if self.constants.serial_settings in ["Minimal", "None"]:
|
|
||||||
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH01":
|
|
||||||
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC1"
|
|
||||||
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "EH02":
|
|
||||||
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "EHC2"
|
|
||||||
if map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] == "SHC1":
|
|
||||||
map_config["IOKitPersonalities_x86_64"][entry]["IONameMatch"] = "XHC1"
|
|
||||||
except KeyError:
|
|
||||||
continue
|
|
||||||
plistlib.dump(map_config, Path(new_map_ls).open("wb"), sort_keys=True)
|
|
||||||
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
|
if self.constants.allow_oc_everywhere is False and self.model not in ["iMac7,1", "Xserve2,1", "Dortania1,1"] and self.constants.disallow_cpufriend is False and self.constants.serial_settings != "None":
|
||||||
# Adjust CPU Friend Data to correct SMBIOS
|
# Adjust CPU Friend Data to correct SMBIOS
|
||||||
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")
|
new_cpu_ls = Path(self.constants.pp_contents_folder) / Path("Info.plist")
|
||||||
|
|||||||
@@ -763,6 +763,24 @@
|
|||||||
<key>PlistPath</key>
|
<key>PlistPath</key>
|
||||||
<string>Contents/Info.plist</string>
|
<string>Contents/Info.plist</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>Arch</key>
|
||||||
|
<string>x86_64</string>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>USB Map for Tahoe</string>
|
||||||
|
<key>Enabled</key>
|
||||||
|
<false/>
|
||||||
|
<key>MaxKernel</key>
|
||||||
|
<string></string>
|
||||||
|
<key>MinKernel</key>
|
||||||
|
<string>25.0.0</string>
|
||||||
|
<key>BundlePath</key>
|
||||||
|
<string>USB-Map-Tahoe.kext</string>
|
||||||
|
<key>ExecutablePath</key>
|
||||||
|
<string></string>
|
||||||
|
<key>PlistPath</key>
|
||||||
|
<string>Contents/Info.plist</string>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Arch</key>
|
<key>Arch</key>
|
||||||
<string>x86_64</string>
|
<string>x86_64</string>
|
||||||
|
|||||||
10655
payloads/Kexts/Plists/AppleUSBMaps/Info-Tahoe.plist
Normal file
10655
payloads/Kexts/Plists/AppleUSBMaps/Info-Tahoe.plist
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user