From ac9e3f47bdb5d296a65a1b0b0797ab2bd8d8ead4 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Thu, 10 Feb 2022 12:18:37 -0700 Subject: [PATCH] kern_start.cpp: Add force patching for UC Ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/948 --- Changelog.md | 4 ++++ FeatureUnlock/kern_start.cpp | 9 ++++++--- README.md | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9e2c466..86456a5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ FeatureUnlock Changelog ====================== +### v1.0.7 +- Add force patching for Universal Control via `-force_uni_control` + - Required for when a device in the chain is unsupported, as all parties perform support checks before pairing + ### v1.0.6 - Removed AssetCache Patch - Superseded by [RestrictEvents's `-revasset`](https://github.com/acidanthera/RestrictEvents) diff --git a/FeatureUnlock/kern_start.cpp b/FeatureUnlock/kern_start.cpp index 1848222..2351bd8 100644 --- a/FeatureUnlock/kern_start.cpp +++ b/FeatureUnlock/kern_start.cpp @@ -20,6 +20,7 @@ bool allow_sidecar_ipad; bool disable_sidecar_mac; bool disable_nightshift; bool disable_universal_control; +bool force_universal_control; bool os_supports_nightshift_old; bool os_supports_nightshift_new; @@ -133,14 +134,15 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o if (!disable_nightshift && (os_supports_nightshift_new || os_supports_nightshift_old)) { searchAndPatch(data, PAGE_SIZE, path, kNightShiftOriginal, kNightShiftPatched, "NightShift", true); } - if (!disable_universal_control && os_supports_universal_control && model_needs_uc_patch) { + if (!disable_universal_control && os_supports_universal_control && (model_needs_uc_patch or force_universal_control)) { searchAndPatch(data, PAGE_SIZE, path, kUniversalControlFind, kUniversalControlReplace, "Universal Control (dyld)", true); } } } - if (!disable_universal_control && os_supports_universal_control && model_needs_uc_patch) { + if (!disable_universal_control && os_supports_universal_control && (model_needs_uc_patch or force_universal_control)) { + // UniversalControl.app checks both the host and other devices before pairing + // Thus we patch when either the model is unsupported, or the user has requested UC support for other models if (UNLIKELY(strcmp(path, universalControlPath) == 0)) { - DBGLOG(MODULE_SHORT, "Detected Universal Control (app)"); searchAndPatch(data, PAGE_SIZE, path, kUniversalControlFind, kUniversalControlReplace, "Universal Control (app)", false); } } @@ -269,6 +271,7 @@ static void pluginStart() { disable_sidecar_mac = checkKernelArgument("-disable_sidecar_mac"); disable_nightshift = checkKernelArgument("-disable_nightshift"); disable_universal_control = checkKernelArgument("-disable_uni_control"); + force_universal_control = checkKernelArgument("-force_uni_control"); detectModel(); detectSupportedPatchSets(); detectNumberOfPatches(); diff --git a/README.md b/README.md index 84f0420..8ae6857 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,10 @@ iMac16,x * **Univeral Control** (macOS 12.3+) * Requires minimum of Wifi N and Bluetooth 4.0 for wireless, wired is supported between iPad and Mac as an alternative + * Note all parties check each other for compatibility, thus requiring FeatureUnlock on all models in the chain + * Seen as `Ineligible Device Found Md MacBookPro11,4, SV 340.17.2` in Console under `UniversalControl: com.apple.universalcontrol` + * Recommend using a different SMBIOS if possible, otherwise use `-force_uc_unlock` for machines that are not blacklisted but are connecting with a blacklisted model. + * Due to the nature of requiring FeatureUnlock for both models, Apple Silicon and iPads will not work * **Sidecar** (macOS 10.15.0+) * Requires minimum of Wifi N and Bluetooth 4.0 for wireless, wired is supported between iPad and Mac as an alternative @@ -73,6 +77,7 @@ defaults write com.apple.AppleGVA gvaForceAMDKE -boolean yes - `-disable_sidecar_mac` disables Sidecar/AirPlay patches - `-disable_nightshift` disables NightShift patches - `-disable_uni_control` disables Universal Control patches +- `-force_uni_control` forces Universal Control patching even when model doesn't require #### Credits