feat: Default to SVGA device for Windows 95/98/ME (#2194)

This commit is contained in:
Kroese
2026-08-26 03:43:28 +02:00
committed by GitHub
parent 66998948c3
commit 09ed611a7f
2 changed files with 99 additions and 2 deletions
+98 -1
View File
@@ -138,6 +138,7 @@ Win9xInstall() {
local display="$win9x/vmdisp9x" local display="$win9x/vmdisp9x"
local audio95="$win9x/alcx95" local audio95="$win9x/alcx95"
local audiowdm="$win9x/alcxwdm" local audiowdm="$win9x/alcxwdm"
local vmware_display="$win9x/vmsvga"
extractDrivers "$drivers" || return 1 extractDrivers "$drivers" || return 1
@@ -171,7 +172,7 @@ Win9xInstall() {
return 1 return 1
fi fi
if ! patchWin9xSetupFiles "$id" "$target" "$desc" "$patcher" "$qemouse" "$display"; then if ! patchWin9xSetupFiles "$id" "$target" "$desc" "$patcher" "$qemouse" "$display" "$vmware_display"; then
rm -rf "$drivers" || : rm -rf "$drivers" || :
return 1 return 1
fi fi
@@ -556,6 +557,7 @@ patchWin9xSetupFiles() {
local patcher="$4" local patcher="$4"
local qemouse="$5" local qemouse="$5"
local display="$6" local display="$6"
local vmware_display="$7"
chmod 755 "$patcher" || { chmod 755 "$patcher" || {
error "Failed to make Patcher9x executable!" error "Failed to make Patcher9x executable!"
@@ -580,6 +582,7 @@ patchWin9xSetupFiles() {
fi fi
stageWin9xDisplayDriver "$target" "$display" "$desc" || return 1 stageWin9xDisplayDriver "$target" "$display" "$desc" || return 1
stageWin9xVMwareDriver "$target" "$vmware_display" "$desc" || return 1
if ! mv -f -- \ if ! mv -f -- \
"$target/VMDISP9X/vmdisp9x.inf" \ "$target/VMDISP9X/vmdisp9x.inf" \
@@ -1176,6 +1179,100 @@ stageWin9xDisplayDriver() {
return 1 return 1
fi fi
# Keep VMDisp9x available for QEMU STD VGA, but let the official VMware
# driver own VMware SVGA-II. Comment only the matching model in our staged
# INF so the original driver archive remains untouched.
if ! python3 - "$dest/vmdisp9x.inf" <<'PY'
from pathlib import Path
import sys
path = Path(sys.argv[1])
lines = path.read_bytes().splitlines(keepends=True)
needle = br'PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD'
matches = []
for index, line in enumerate(lines):
stripped = line.lstrip(b' \t')
if stripped.startswith(b';'):
continue
if needle in stripped.upper():
matches.append(index)
if len(matches) != 1:
raise SystemExit(f'expected exactly one active VMware SVGA-II model, found {len(matches)}')
index = matches[0]
indent = len(lines[index]) - len(lines[index].lstrip(b' \t'))
lines[index] = lines[index][:indent] + b'; ' + lines[index][indent:]
path.write_bytes(b''.join(lines))
PY
then
error "Failed to reserve VMware SVGA-II for the official VMware driver!"
return 1
fi
if grep -iF 'PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD' "$dest/vmdisp9x.inf" |
grep -Ev '^[[:space:]]*;' >/dev/null; then
error "Failed to remove the active VMware SVGA-II VMDisp9x model!"
return 1
fi
if ! grep -iF 'PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD' "$dest/vmdisp9x.inf" |
grep -Eq '^[[:space:]]*;'; then
error "Failed to verify the VMware SVGA-II VMDisp9x model change!"
return 1
fi
return 0
}
stageWin9xVMwareDriver() {
local target="$1"
local source="$2"
local desc="$3"
local file
for file in \
vmx_svga.inf \
VMX_SVGA.DRV \
VMX_SVGA.vxd; do
if [ ! -s "$source/$file" ]; then
error "Failed to locate required VMware SVGA driver file: $file"
return 1
fi
done
if ! cp -f -- \
"$source/vmx_svga.inf" \
"$source/VMX_SVGA.DRV" \
"$source/VMX_SVGA.vxd" \
"$target/"; then
error "Failed to add the VMware SVGA driver to $desc setup files!"
return 1
fi
for file in \
vmx_svga.inf \
VMX_SVGA.DRV \
VMX_SVGA.vxd; do
if ! cmp -s -- "$source/$file" "$target/$file"; then
error "Failed to verify the staged VMware SVGA driver file: $file"
return 1
fi
done
if ! grep -Fqi 'PCI\VEN_15AD&DEV_0405' "$target/vmx_svga.inf"; then
error "Failed to verify the VMware SVGA-II hardware ID!"
return 1
fi
return 0 return 0
} }
+1 -1
View File
@@ -31,7 +31,7 @@ setMachine() {
"winnt4" ) "winnt4" )
writeState "vga" "cirrus" || return 1 ;; writeState "vga" "cirrus" || return 1 ;;
"win2k"* | "winxp"* | "win2003"* ) "win9"* | "win2k"* | "winxp"* | "win2003"* )
writeState "vga" "vmware" || return 1 ;; writeState "vga" "vmware" || return 1 ;;
*) writeState "vga" "std" || return 1 ;; *) writeState "vga" "std" || return 1 ;;