Skip to content

Commit b7c1dd0

Browse files
committed
kern_start.cpp: Add VMM patching in Ventura
1 parent 66ce42b commit b7c1dd0

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FeatureUnlock Changelog
22
======================
33
### v1.0.9
44
- Added constants for macOS 13 support
5+
- Added AirPlay to Mac unlocking for systems with `kern.hv_vmm_present` set to `1` in Ventura
56

67
### v1.0.8
78
- Add AirPlay to Mac patching for Macmini8,1

FeatureUnlock/kern_dyld_patch.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static const uint8_t kSidecariPadModelPatched[] = {
228228
0x68, 0x50, 0x61, 0x64, 0x36, 0x2C, 0x31, 0x32
229229
};
230230

231-
// AirPlayCore.framework
231+
// AirPlaySupport.framework
232232
// Replaces Mac with Nac
233233
static const uint8_t kMacModelAirplayExtendedOriginal[] = {
234234
// iMac17,1 iMac18,1 iMac18,2 iMac18,3
@@ -264,6 +264,18 @@ static const uint8_t kMacModelAirplayExtendedPatched[] = {
264264
0x4E, 0x61, 0x63, // 0x4E, 0x69, 0x6E, 0x69, 0x38, 0x2C, 0x31 // 12.0 - 12.3 B1 is MacMini8,1, 12.3 B2+ is Macmini8,1
265265
};
266266

267+
static const uint8_t kAirPlayVmmOriginal[] = {
268+
// p2pAllow kern.hv_vmm_present
269+
0x70, 0x32, 0x70, 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x00,
270+
0x6B, 0x65, 0x72, 0x6E, 0x2E, 0x68, 0x76, 0x5F, 0x76, 0x6D, 0x6D, 0x5F, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6E, 0x74
271+
};
272+
273+
static const uint8_t kAirPlayVmmPatched[] = {
274+
// p2pAllow kern.hv_acidanthera
275+
0x70, 0x32, 0x70, 0x41, 0x6C, 0x6C, 0x6F, 0x77, 0x00,
276+
0x6B, 0x65, 0x72, 0x6E, 0x2E, 0x68, 0x76, 0x5F, 0x61, 0x63, 0x69, 0x64, 0x61, 0x6E, 0x74, 0x68, 0x65, 0x72, 0x61
277+
};
278+
267279
#pragma mark - NightShift Patch Set
268280

269281
// CoreBrightness.framework

FeatureUnlock/kern_start.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ bool os_supports_nightshift_old;
2626
bool os_supports_nightshift_new;
2727
bool os_supports_sidecar;
2828
bool os_supports_airplay_to_mac;
29+
bool os_supports_airplay_to_mac_vmm_checks;
2930
bool os_supports_universal_control;
3031

3132
bool model_is_iMac;
@@ -128,6 +129,9 @@ static void patched_cs_validate_page(vnode_t vp, memory_object_t pager, memory_o
128129
if (os_supports_airplay_to_mac && (model_is_MacBookPro_2016_2017 || model_is_iMac_2015_17 || model_is_Macmini_2018)) {
129130
searchAndPatch(data, PAGE_SIZE, path, kMacModelAirplayExtendedOriginal, kMacModelAirplayExtendedPatched, "AirPlay to Mac (Extended)", true);
130131
}
132+
if (os_supports_airplay_to_mac_vmm_checks) {
133+
searchAndPatch(data, PAGE_SIZE, path, kAirPlayVmmOriginal, kAirPlayVmmPatched, "AirPlay to Mac (VMM)", true);
134+
}
131135
}
132136
if (allow_sidecar_ipad && os_supports_sidecar) {
133137
searchAndPatch(data, PAGE_SIZE, path, kSidecariPadModelOriginal, kSidecariPadModelPatched, "Sidecar (iPad)", true);
@@ -239,6 +243,10 @@ static void detectSupportedPatchSets() {
239243
os_supports_universal_control = true;
240244
}
241245
}
246+
if (getKernelVersion() >= KernelVersion::Ventura) {
247+
// Apple added kern.hv_vmm_present checks in Ventura, in addition to their normal model checks...
248+
os_supports_airplay_to_mac_vmm_checks = true;
249+
}
242250
}
243251

244252
static void detectNumberOfPatches() {
@@ -257,6 +265,9 @@ static void detectNumberOfPatches() {
257265
if (!disable_universal_control && os_supports_universal_control && model_needs_uc_patch) {
258266
total_allowed_loops++;
259267
}
268+
if (os_supports_airplay_to_mac_vmm_checks) {
269+
total_allowed_loops++;
270+
}
260271
}
261272
}
262273
if (allow_sidecar_ipad) {

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ MacBookPro9,x - MacBookPro14,x
2929
Macmini6,x - Macmini8,1
3030
MacPro5,1 - MacPro6,1
3131
iMac13,x - iMac18,x
32+
Systems with 'kern.hv_vmm_present' set to as 1 (Ventura and newer)
3233

3334
# NightShift Unlock
3435
MacBook1,1 - MacBook7,1

0 commit comments

Comments
 (0)