Skip to content

Commit

Permalink
kern_start.cpp: Add force patching for UC
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Feb 10, 2022
1 parent 93e95de commit ac9e3f4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
9 changes: 6 additions & 3 deletions FeatureUnlock/kern_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit ac9e3f4

Please sign in to comment.