-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
virtualization_13_arm64.m
89 lines (83 loc) · 3.18 KB
/
virtualization_13_arm64.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// virtualization_13_arm64.m
//
// Created by codehex.
//
#import "virtualization_13_arm64.h"
/*!
@abstract Initialize a Rosetta directory share if Rosetta support for Linux binaries is installed.
@param error Error object to store the error, if an error exists.
@discussion The call returns an error if Rosetta is not available for a directory share. To install Rosetta support, use +[VZLinuxRosettaDirectoryShare installRosettaWithCompletionHandler:].
*/
void *newVZLinuxRosettaDirectoryShare(void **error)
{
#ifdef INCLUDE_TARGET_OSX_13
if (@available(macOS 13, *)) {
return [[VZLinuxRosettaDirectoryShare alloc] initWithError:(NSError *_Nullable *_Nullable)error];
}
#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
/*!
@abstract Download and install Rosetta support for Linux binaries if necessary.
@param completionHandler The completion handler gets called with a valid error on failure and a nil error on success. It will also be invoked on an arbitrary queue.
@discussion
The call prompts the user through the download and install flow for Rosetta. This call is successful if the error is nil.
@see +[VZLinuxRosettaDirectoryShare availability]
*/
void linuxInstallRosetta(uintptr_t cgoHandle)
{
#ifdef INCLUDE_TARGET_OSX_13
if (@available(macOS 13, *)) {
[VZLinuxRosettaDirectoryShare installRosettaWithCompletionHandler:^(NSError *error) {
linuxInstallRosettaWithCompletionHandler(cgoHandle, error);
}];
return;
}
#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
/*!
@abstract Check the availability of Rosetta support for the directory share.
*/
int availabilityVZLinuxRosettaDirectoryShare()
{
#ifdef INCLUDE_TARGET_OSX_13
if (@available(macOS 13, *)) {
return (int)[VZLinuxRosettaDirectoryShare availability];
}
#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
/*!
@abstract Options controlling startup behavior of a virtual machine using VZMacOSBootLoader.
*/
void *newVZMacOSVirtualMachineStartOptions(bool startUpFromMacOSRecovery)
{
#ifdef INCLUDE_TARGET_OSX_13
if (@available(macOS 13, *)) {
VZMacOSVirtualMachineStartOptions *opts = [[VZMacOSVirtualMachineStartOptions alloc] init];
[opts setStartUpFromMacOSRecovery:(BOOL)startUpFromMacOSRecovery];
return opts;
}
#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}
/*!
@abstract Configuration for a Mac trackpad.
@discussion
This device can be used by VZVirtualMachineView to send pointer events and multi-touch trackpad gestures to the virtual machine.
Note: this device is only recognized by virtual machines running macOS 13.0 and later. In order to support both macOS 13.0 and earlier
guests, VZVirtualMachineConfiguration.pointingDevices can be set to an array containing both a VZMacTrackpadConfiguration and
a VZUSBScreenCoordinatePointingDeviceConfiguration object. macOS 13.0 and later guests will use the multi-touch trackpad device,
while earlier versions of macOS will use the USB pointing device.
*/
void *newVZMacTrackpadConfiguration()
{
#ifdef INCLUDE_TARGET_OSX_13
if (@available(macOS 13, *)) {
return [[VZMacTrackpadConfiguration alloc] init];
}
#endif
RAISE_UNSUPPORTED_MACOS_EXCEPTION();
}