Browse Source

config(qemu): more sane defaults for legacy pc hardware

Should be compatible with Windows 9x
osy 1 week ago
parent
commit
1330cc4356

+ 4 - 2
Configuration/UTMQemuConfigurationDisplay.swift

@@ -77,10 +77,12 @@ extension UTMQemuConfigurationDisplay {
     init?(forArchitecture architecture: QEMUArchitecture, target: any QEMUTarget) {
         self.init()
         let rawTarget = target.rawValue
-        if !architecture.hasAgentSupport || rawTarget == "isapc" {
+        if !architecture.hasAgentSupport || rawTarget.hasPrefix("pc") || rawTarget == "isapc" {
             isDynamicResolution = false
         }
-        if rawTarget.hasPrefix("pc") || rawTarget.hasPrefix("q35") {
+        if rawTarget.hasPrefix("pc") {
+            hardware = QEMUDisplayDevice_i386.cirrus_vga
+        } else if rawTarget.hasPrefix("q35") {
             hardware = QEMUDisplayDevice_x86_64.virtio_vga
         } else if rawTarget == "isapc" {
             hardware = QEMUDisplayDevice_x86_64.isa_vga

+ 5 - 1
Configuration/UTMQemuConfigurationNetwork.swift

@@ -162,7 +162,11 @@ extension UTMQemuConfigurationNetwork {
         self.init()
         let rawTarget = target.rawValue
         if rawTarget.hasPrefix("pc") {
-            hardware = QEMUNetworkDevice_x86_64.rtl8139
+            if architecture == .i386 {
+                hardware = QEMUNetworkDevice_i386.ne2k_isa
+            } else {
+                hardware = QEMUNetworkDevice_x86_64.rtl8139
+            }
         } else if rawTarget.hasPrefix("q35") {
             hardware = QEMUNetworkDevice_x86_64.e1000
         } else if rawTarget == "isapc" {

+ 3 - 1
Configuration/UTMQemuConfigurationSound.swift

@@ -47,7 +47,9 @@ extension UTMQemuConfigurationSound {
     init?(forArchitecture architecture: QEMUArchitecture, target: any QEMUTarget) {
         self.init()
         let rawTarget = target.rawValue
-        if rawTarget.hasPrefix("pc") || rawTarget.hasPrefix("pseries") {
+        if rawTarget.hasPrefix("pc") || rawTarget == "isapc" {
+            hardware = QEMUSoundDevice_i386.sb16
+        } else if rawTarget.hasPrefix("pc") || rawTarget.hasPrefix("pseries") {
             hardware = QEMUSoundDevice_x86_64.AC97
         } else if rawTarget.hasPrefix("q35") || rawTarget.hasPrefix("virt-") || rawTarget == "virt" {
             hardware = QEMUSoundDevice_x86_64.intel_hda