diff --git a/Scripting/UTM.sdef b/Scripting/UTM.sdef
index 726b35b19..234408ce4 100644
--- a/Scripting/UTM.sdef
+++ b/Scripting/UTM.sdef
@@ -444,6 +444,11 @@
description="List of serial configuration.">
+
+
+
+
@@ -553,6 +558,11 @@
description="The port number to listen on when the interface is a TCP server."/>
+
+
+
+
diff --git a/Scripting/UTMScriptingConfigImpl.swift b/Scripting/UTMScriptingConfigImpl.swift
index 7c83a3ca5..b00edca15 100644
--- a/Scripting/UTMScriptingConfigImpl.swift
+++ b/Scripting/UTMScriptingConfigImpl.swift
@@ -107,6 +107,7 @@ extension UTMScriptingConfigImpl {
"drives": config.drives.map({ serializeQemuDriveExisting($0) }),
"networkInterfaces": config.networks.enumerated().map({ serializeQemuNetwork($1, index: $0) }),
"serialPorts": config.serials.enumerated().map({ serializeQemuSerial($1, index: $0) }),
+ "qemuAdditionalArguments": config.qemu.additionalArguments.map({ serializeQemuAdditionalArgument($0)}),
]
}
@@ -188,6 +189,14 @@ extension UTMScriptingConfigImpl {
]
}
+ private func serializeQemuAdditionalArgument(_ argument: QEMUArgument) -> [AnyHashable: Any] {
+ var serializedArgument: [AnyHashable: Any] = [
+ "argumentString": argument.string
+ ]
+
+ return serializedArgument
+ }
+
private func serializeAppleConfiguration(_ config: UTMAppleConfiguration) -> [AnyHashable : Any] {
[
"name": config.information.name,
@@ -338,6 +347,9 @@ extension UTMScriptingConfigImpl {
if let serialPorts = record["serialPorts"] as? [[AnyHashable : Any]] {
try updateQemuSerials(from: serialPorts)
}
+ if let qemuAdditionalArguments = record["qemuAdditionalArguments"] as? [[AnyHashable: Any]] {
+ try updateQemuAdditionalArguments(from: qemuAdditionalArguments)
+ }
}
private func parseQemuDriveInterface(_ value: AEKeyword?) -> QEMUDriveInterface? {
@@ -500,6 +512,19 @@ extension UTMScriptingConfigImpl {
}
}
+ private func updateQemuAdditionalArguments(from records: [[AnyHashable: Any]]) throws {
+ let config = config as! UTMQemuConfiguration
+ let additionalArguments = records.compactMap { record -> QEMUArgument? in
+ guard let argumentString = record["argumentString"] as? String else { return nil }
+ var argument = QEMUArgument(argumentString)
+
+ return argument
+ }
+ // Update entire additional arguments with new one.
+ config.qemu.additionalArguments = additionalArguments
+ }
+
+
private func updateAppleConfiguration(from record: [AnyHashable : Any]) throws {
let config = config as! UTMAppleConfiguration
if let name = record["name"] as? String, !name.isEmpty {