Skip to content

Commit

Permalink
kern_start: Patch ControlCenter.app
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Dec 16, 2022
1 parent edf3706 commit 94e29ce
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 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.1.2
- Add AirPlay to Mac unlocking inside Control Center.app
- Applicable for macOS Ventura

### v1.1.1
- Resolved Macmini8,1 patch regression from 1.1.0
- Resolved iPad Sidecar patch regression from 1.1.0
Expand Down
10 changes: 10 additions & 0 deletions FeatureUnlock/kern_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ bool has_applied_nightshift_patch;
bool has_applied_airplay_to_mac_vmm_patch;
bool has_applied_iPad_sidecar_patch;
bool has_applied_uc_app_patch;
bool has_applied_cc_app_patch;


// Misc variables
Expand Down Expand Up @@ -324,6 +325,15 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
}
}
}
if (!has_applied_cc_app_patch && host_needs_airplay_to_mac_vmm_patch) {
if (UNLIKELY(strcmp(path, controlCenterPath) == 0)) {
patch_result = searchAndPatch(data, PAGE_SIZE, path, kGenericVmmOriginal, kGenericVmmPatched, "Control Center (app)", false);
if (patch_result) {
has_applied_cc_app_patch = true;
return;
}
}
}
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions FeatureUnlock/kern_usr_patch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ static const uint8_t kUniversalControlReplace[] = {
0x4E, 0x61, 0x63, 0x6D, 0x69, 0x6E, 0x69, 0x37, 0x2C, 0x31, 0x00,
0x4E, 0x61, 0x63, 0x50, 0x72, 0x6F, 0x36, 0x2C, 0x31
};

#pragma mark - ControlCenter Patch Set

// With macOS 13.0, Apple added additional AirPlay to Mac blacklists inside of ControlCenter.app
// Specifically a kern.hv_vmm_present check
static const char *controlCenterPath = "/System/Library/CoreServices/ControlCenter.app/Contents/MacOS/ControlCenter";

static const uint8_t kGenericVmmOriginal[] = {
// kern.hv_vmm_present
0x6B, 0x65, 0x72, 0x6E, 0x2E, 0x68, 0x76, 0x5F, 0x76, 0x6D, 0x6D, 0x5F, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6E, 0x74
};

static const uint8_t kGenericVmmPatched[] = {
// kern.hv_acidanthera
0x6B, 0x65, 0x72, 0x6E, 0x2E, 0x68, 0x76, 0x5F, 0x61, 0x63, 0x69, 0x64, 0x61, 0x6E, 0x74, 0x68, 0x65, 0x72, 0x61
};

0 comments on commit 94e29ce

Please sign in to comment.