Skip to content

Commit

Permalink
VMware 3D support, QEMU basic support, disabled SIMD95 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JHRobotics committed Jul 9, 2023
1 parent 05db745 commit 6c94233
Show file tree
Hide file tree
Showing 28 changed files with 565 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# generated and temporary files
*.o
*.bak
*.backup
*.tmp
*.gen
*.exe
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EXE_NAME = softgpu
EXE_SUFFIX = .exe
LDFLAGS=-static
LIBS=-lsetupapi -lgdi32 -luser32 -ladvapi32 -lsetupapi -lkernel32 -lshell32 -Wl,-subsystem,windows
#LIBS=-lsetupapi -lgdi32 -luser32 -ladvapi32 -lsetupapi -lkernel32 -lshell32 -Wl,-subsystem,console

SOFTGPU_PATCH=2023

Expand Down
157 changes: 153 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SoftGPU: SW and HW accelerated driver for Windows 9x Virtual Machines

![SoftGPU animated logo](/resource/softgpu.webp)
![SoftGPU animated logo](resource/softgpu.webp)

This is ready-to-use compilation of my 4 projects:
- VMDisp9x: https://github.com/JHRobotics/vmdisp9x
Expand All @@ -19,6 +19,18 @@ This is ready-to-use compilation of my 4 projects:
- Visual C runtime (version 6 included in package)
- OpenGL 95 for versions without `opengl32.dll` (included in package)

## Feature support

| Hypervisor | Version | Adapter | VGA driver | 32 bpp | 16 bpp | 8 bpp | HW 3D | Sound drivers |
| :----------------- | :--------: | :-----: | :---------: | :----: | :----: | :----: | :-----: | :---------------- |
| Oracle VirtualBox | 6.1, 7.0 | VboxVGA |||||| SB16, AC97 |
| Oracle VirtualBox | 6.1, 7.0 | VboxSVGA |||||| SB16, AC97 |
| Oracle VirtualBox | 6.1, 7.0 | VMSVGA |||||| SB16, AC97 |
| VMware Workstation | 17 | - |||||| SBPCI128 |
| QEMU | 7.x, 8.0 | std |||||| adlib, SB16, AC97 |
| QEMU | 7.x, 8.0 | vmware |||||| adlib, SB16, AC97 |


## Download
ISO image or ZIP package can be downloaded on release page: https://github.com/JHRobotics/softgpu/releases/

Expand All @@ -27,8 +39,8 @@ ISO image or ZIP package can be downloaded on release page: https://github.com/J
1) Copy installation files on formatted HDD and apply **patcher9x** [Optional but recommended]
2) Install the Windows 95/98/Me [Windows 98 SE is recommended]
3) Run setup with `softgpu.exe`
4) [optional] Install audio drivers (if using AC97 soundcard) and USB (if you added USB controller)
5) [only if you have AC97 soundcard] Reinstall DirectX again = AC97 replacing some DX files, but they are not working with newer DX versions
4) [optional] Install audio drivers (if using AC97 sound card) and USB (if you added USB controller)
5) [only if you have AC97 sound card] Reinstall DirectX again = AC97 replacing some DX files, but they are not working with newer DX versions
6) Have fun!

## VirtualBox VM setup with HW acceleration
Expand Down Expand Up @@ -73,6 +85,101 @@ VBoxManage setextradata "My Windows 98" "VBoxInternal/Devices/vga/0/Config/VMSVG
- On Me you can still run **dxdiag**, but you can only check DX8 and DX9, because we cannot easily replace system `DDRAW.DLL`. But DX6 and DX7 games should usually run without problems
- On 95 you can still run **dxdiag**, but if you run test, you only see black screens, but again, games (if supporting 95) games should usually run

## WMware Workstation setup with HW acceleration
SoftGPU with HW acceleration was tested only with lasted version of VMware Workstation (17.0.0 build-20800274), if you'll be successful with older version or free VMware player, please let me know.

### General information
- Use **Windows 98 SE**, newer Mesa is not currently working in 95 and Windows 98 FE (first edition) hasn't supporting WDM sound cards so you might have a problem with sound.
- **Fresh install**, Windows 9x doesn't like hardware changes and if you import import VM from somewhere, strange problems may occur.
- **no VMware additions**, because they only contain basic display driver, mouse integration driver and tray program which immediately replaces display driver with VMware one. If you want mouse integration driver (but is useless for gaming with mouse) alone driver is listed below.
- set as hardware compatibility **Workstation 9.x** and VM type **Windows 2000 Server**. VMware in other cases is comparing installed addition tools version and features with hypervisor version and if they don't match refuses to expose SVGA 3D commands to guest.

### Step by step guide
1) Create new VM - from menu File->New Virtual Machine
2) In wizard choose *Custom (advanced)* click on next:
- As *Hardware compatibility* select **Workstation 9.x** (important)

![](resource/docs/vmw-setup-1.png)

- Select *I will install the operating system later.*
- As *Guest operating system* choice **Microsoft Windows** and as *Version* select **Windows 2000 Server** (important)

![](resource/docs/vmw-setup-2.png)

- Type VM name and number of processors keep on *1*
- Set the memory to 512 MB (but without additional patches not more!)
- Network choice is your own (default NAT should work all cases) and SCSI Controller keep on **BusLogic**
- set *Virtual disk type* to **IDE** (important)
- create new virtual disk and set space at last at 20 GB (but lower than 127 GB without extra patches!)
- type or keep HDD file name and at last page before finish click on *Customize Hardware*
3) Now VM needs to be a bit reconfigure:
- click on *Add...* and **Floppy drive**

![](resource/docs/vmw-setup-3.png)

- click on *USB Controller* and set *USB compatibility* to **USB 1.1** or remove USB controller completely
- click on *Display* and check **Accelerate 3D graphics**

![](resource/docs/vmw-setup-4.png)

- (optional) click on *Printer* and click *Remove* (if you don't plan to use this feature, you'll save yourself from a pointless warning message)
- click on *New CD/DVD (IDE)* and point *Use ISO image file* to your Windows 98 installation CD ISO.
- (optional) click on Floppy and point *Use floppy image file* to your boot floppy (only if you plan boot floppy)
4) Click on *Close*, *Finish* and Power on machine
- TIP: if you wish customize boot order, right click on the new VM, choose *Power* and *Power on to Firmware* - VM will boot to environment very close to common PC BIOS.

![](resource/docs/vmw-bios.png)

5) Install the Windows 98 - this step is really pain, VMware VM in BIOS VGA mode is hyper slow and mouse isn't usable - you have navigate through installation by keyboard (`TAB`, `Shift`+`TAB`, cursor keys, `Enter`).
- TIP: apply [patcher9x](https://github.com/JHRobotics/patcher9x). If you have Intel 11th gen. CPU or newer or AMD Ryzen (any model) or other AMD ZEN architecture CPU and newer, this is necessary.
6) After installation isn't system very usable until you'll install GPU driver! So, insert **SoftGPU iso** (can be downloaded in Releases) and run `softgpu.exe`.
7) Click on *Install!*
8) You maybe need some reboots (after MSVCRT and DX installation) and run `softgpu.exe` again.
9) After complete and final reboot system should start in 640x480 in 32 bits per pixel colors.
10) If you have still mouse trouble, open *Device Manager* (by cursor keys select *My Computer* and press `Alt`+`Enter` to open properties), then disable all *HID-compliant mouse*. Reboot VM after done!

![VMware HID devices disabled](resource/docs/vmw-hid.png)

11) Use `glchecker.exe` to verify settings

## QEMU
Hardware 3D support isn't available yet with QEMU. 2D driver now works with QEMU `-vga std` or `-vga vmware`. But main problem with QEMU is bad detection of a PCI bus. If the PCI bus is detected badly, system won't enumerate most of device - VGA adapter, sound and network card and even IDE bus.

### PCI bus detection fix
1) Open Device Manager and locate *Plug and Play BIOS* (Exclamation mark should be on it)

![QEMU PCI: Plug and Play BIOS](resource/docs/qemu-pci-1.png)

2) With this device selected click on *Properties*, select *Driver* tab and click on *Update driver*

![QEMU PCI: Plug and Play BIOS properties](resource/docs/qemu-pci-2.png)

3) In Wizard select second option (*Display a list of all drivers in specific location, ...*)

![QEMU PCI: list drivers](resource/docs/qemu-pci-3.png)

4) Select *Show all hadrware* and from models list choose **PCI bus**, click on *next*, confirm
warning message and reboot computer.

![QEMU PCI: select PCI bus](resource/docs/qemu-pci-4.png)
![QEMU PCI: warning message](resource/docs/qemu-pci-5.png)

5) After reboot, system will ask you for drive on every new discovered device. All you need to do, is select *Search for the best driver...* and clicking on *next*. Please don't select new or updated drivers here - you can do it later. You may need reboot computer several times.

![QEMU PCI: new PCI device](resource/docs/qemu-pci-6.png)
![QEMU PCI: select best driver](resource/docs/qemu-pci-7.png)

6) You will be asked for VGA driver and unknown device drivers. Still select default generic driver here!

![QEMU PCI: standard PCI VGA](resource/docs/qemu-pci-8.png)
![QEMU PCI: unknown device](resource/docs/qemu-pci-9.png)

7) After last reboot open *Device manager* again - as you see, you have 2 VGA cards now, so select *Standard Display Adapter (VGA)* (the working one) and click on *Remove*.

![QEMU PCI: 2 VGA adapters](resource/docs/qemu-vga.png)

8) After reboot (again), you have working system now and you can install SoftGPU and other drivers.

## Bugs
Currently there are known these limitations:

Expand All @@ -87,11 +194,53 @@ There are many bugs in individual components, please post them to individual rep

But still, please be patient. SoftGPU compatibility target is about a decade of intensive HW and SW development (from DOS direct VGA/VESA access, SW rendering through GDI, DirectDraw, OpenGL, Glide, DirectX, OpenGL again). After all, there will still applications that cannot be run anyway because there are written for very individual SW/HW combinations.

## General tips
There are some tips without direct relation to SoftGPU but they can improve the user experience with MS Windows 9x OS.

### Fresh install
Prefer new installation over copy older installations done on different (even virtual) HW.

### Copy Installation to HDD before run setup
If you installed Windows 9x from CD, on near every system change your will be asked to insert Install CD. You can avoid it if you prepare HDD manually, copy installation from CD and run `setup.exe` from `C:` drive.

All utilities you need are on [patcher9x](https://github.com/JHRobotics/patcher9x) boot floppy. The short procedure follows:

- insert *patcher9x* floppy to floppy driver and Windows Installation CD to CD driver. Boot from floppy drive
- run `fdisk` and create primary dos partition (it wizard type program, just keep pressing `1`, `Y` and finally `ESC`).
- reboot after `fdisk` finish
- format HDD, copy files, install necessary patches and run the setup using following commands:
```
format C:
xcopy /v D:\win98\ C:\install\win98\
patch9x C:\install\win98 -auto
C:
cd install\win98
setup /ie /nm
```
Explanation: The `/v` switch with `xcopy` means *verify*. The `/ie` switch with `setup` means *skip recovery floppy creation* and `/nm` means *no machine check* - this is necessary because in Patcher9x boot floppy is using FreeDOS and MS setup program cannot determine RAM size without MS memory manager.

Now *setup* automatically runs `scandisk` and after complete it you can continue with installer GUI. You can also remove floppy and CD from drive at this point.

### Turn on DMA
Windows by default using interrupts to access HDD and CD drive. This is especially slow in the HW accelerated virtual machines because every interrupt will stop executing visualisation engine and hand over access to hypervisor to solve it and after that it'll be need to restart visualisation engine again. Time consumed by interrupts depends on visualization technology for example in QEMU + kvm is HDD access very slow equally VirtualBox + Hyper-V and combination QEMU + Hyper-V is downright painful. Fortunately there is DMA transfer of whole memory block instead of individual bytes. Unfortunately you have to enable it manually.

You can turn it on in Device Manager on HDD properties enable `DMA` checkbox. Do it the same for CD driver and reboot VM for applying changes.

![setting DMA access to HDD](resource/docs/dma.png)


### Change logon to Windows Logon

After install network card you are asked every time to enter the credentials - but this is not credentials to the computer but to the network (you can also skip this by press `ESC`). If you don't plan to install NT server as other VM and runs ancient network sharing, this is only annoying thing. You can turn it off in *Control panel* -> *Network* and change *Primary network logon* to **Windows Logon**.

![Windows logon switch](resource/docs/windows-logon.png)


## Compilation from source
1) You need MINGW and *GNU make* to build *softgpu.exe*
2) You need all development tool to compile all other component (see README.md in individual repositories)
3) Compile softgpu.exe by type `make`
4) Compile VMDisp9x and copy files `boxvmini.drv`, `vmwsmini.drv`, `vmwsmini.vxd`, `vmdisp9x.inf` and place them to `driver/win95` and `driver/win98me` folder
4) Compile VMDisp9x and copy files `boxvmini.drv`, `vmwsmini.drv`, `qemumini.drv`, `vmwsmini.vxd`, `vmdisp9x.inf` and place them to `driver/win95` and `driver/win98me` folder
5) Compile Mesa9x for Windows 95 (e.g., without SSE) and copy and rename files to following schema
- `vmwsgl32.dll` => `driver/win95/vmwsgl32.dll`
- `opengl32.w98me.dll` => `driver/win95/extra/opengl32.dll`
Expand Down
97 changes: 87 additions & 10 deletions actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ BOOL proc_wait(HWND hwnd)

extern version_t sysver;
extern version_t WINVER98SE;
extern version_t WINVER98;

void install_infobox(HWND hwnd, const char *name)
{
Expand Down Expand Up @@ -375,9 +376,16 @@ BOOL setup_end(HWND hwnd)
BOOL driver_without_setupapi(HWND hwnd)
{
static char mgsbuf[512];
sprintf(mgsbuf, "Automatic instalation isn't possible, because it is unsupported on this system. You have to install driver manually!\n\nDriver files are located here: %s", install_path);

MessageBoxA(hwnd, mgsbuf, "No automatic driver install", MB_ICONWARNING);
if(version_compare(&sysver, &WINVER98) >= 0)
{
sprintf(mgsbuf, "Driver files are located here: %s", install_path);
MessageBoxA(hwnd, mgsbuf, "No automatic driver install", MB_ICONWARNING);
}
else
{
sprintf(mgsbuf, "Automatic instalation isn't possible, because it is unsupported on this system. You have to install driver manually!\n\nDriver files are located here: %s", install_path);
MessageBoxA(hwnd, mgsbuf, "No automatic driver install", MB_ICONWARNING);
}

return TRUE;
}
Expand Down Expand Up @@ -464,6 +472,10 @@ BOOL filescopy_result(HWND hwnd)

BOOL install_wine = FALSE;
BOOL install_glide = FALSE;
BOOL install_res_qxga = FALSE;
BOOL install_res_1440 = FALSE;
BOOL install_res_4k = FALSE;
BOOL install_res_5k = FALSE;

BOOL setLineSvga(char *buf, size_t bufs)
{
Expand Down Expand Up @@ -501,15 +513,44 @@ BOOL setLineVbox(char *buf, size_t bufs)
return TRUE;
}

BOOL setLineQemu(char *buf, size_t bufs)
{
(void)bufs;

strcpy(buf, "CopyFiles=Qemu.Copy");
if(install_wine)
{
strcat(buf, ",Dx.Copy,DX.CopyBackup");
}

if(install_glide)
{
strcat(buf, ",Voodoo.Copy");
}

return TRUE;
}

BOOL setLineSvgaReg(char *buf, size_t bufs)
{
(void)bufs;

strcpy(buf, "AddReg=VMSvga.AddReg,VM.AddReg");

if(install_wine)
{
strcat(buf, ",DX.addReg");
}

if(install_res_qxga)
strcat(buf, ",VM.QXGA");

if(install_res_1440)
strcat(buf, ",VM.WQHD");

if(install_res_4k)
strcat(buf, ",VM.UHD");

if(install_res_5k)
strcat(buf, ",VM.R5K");

return TRUE;
}
Expand All @@ -520,18 +561,53 @@ BOOL setLineVboxReg(char *buf, size_t bufs)

strcpy(buf, "AddReg=VBox.AddReg,VM.AddReg");
if(install_wine)
{
strcat(buf, ",DX.addReg");
}

if(install_res_qxga)
strcat(buf, ",VM.QXGA");

if(install_res_1440)
strcat(buf, ",VM.WQHD");

if(install_res_4k)
strcat(buf, ",VM.UHD");

if(install_res_5k)
strcat(buf, ",VM.R5K");

return TRUE;
}

BOOL setLineQemuReg(char *buf, size_t bufs)
{
(void)bufs;

strcpy(buf, "AddReg=Qemu.AddReg,VM.AddReg");
if(install_wine)
strcat(buf, ",DX.addReg");

if(install_res_qxga)
strcat(buf, ",VM.QXGA");

if(install_res_1440)
strcat(buf, ",VM.WQHD");

if(install_res_4k)
strcat(buf, ",VM.UHD");

if(install_res_5k)
strcat(buf, ",VM.R5K");

return TRUE;
}

linerRule_t infFixRules[] = {
{"CopyFiles=VBox.Copy,Dx.Copy,DX.CopyBackup,Voodoo.Copy", TRUE, TRUE, setLineVbox},
{"CopyFiles=VBox.Copy,Dx.Copy,DX.CopyBackup,Voodoo.Copy", TRUE, TRUE, setLineVbox},
{"CopyFiles=VMSvga.Copy,Dx.Copy,DX.CopyBackup,Voodoo.Copy", TRUE, TRUE, setLineSvga},
{"AddReg=VBox.AddReg,VM.AddReg,DX.addReg", TRUE, TRUE, setLineVboxReg},
{"AddReg=VMSvga.AddReg,VM.AddReg,DX.addReg", TRUE, TRUE, setLineSvgaReg},
{"CopyFiles=Qemu.Copy,Dx.Copy,DX.CopyBackup,Voodoo.Copy", TRUE, TRUE, setLineQemu},
{"AddReg=VBox.AddReg,VM.AddReg,DX.addReg", TRUE, TRUE, setLineVboxReg},
{"AddReg=VMSvga.AddReg,VM.AddReg,DX.addReg", TRUE, TRUE, setLineSvgaReg},
{"AddReg=Qemu.AddReg,VM.AddReg,DX.addReg", TRUE, TRUE, setLineQemuReg},
{NULL, FALSE, FALSE, NULL}
};

Expand Down Expand Up @@ -581,6 +657,7 @@ BOOL simd95(HWND hwnd)
liner("C:\\autoexec.bak", "C:\\autoexec.bat", simd95rules);
}

addLine("C:\\autoexec.bat", "REM Added by SOFTGPU = simd95.com = enable SSE/AVX\r\n");
addLine("C:\\autoexec.bat", "C:\\simd95.com\r\n");
}

Expand Down
4 changes: 4 additions & 0 deletions actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ BOOL filescopy_result(HWND hwnd);

extern BOOL install_wine;
extern BOOL install_glide;
extern BOOL install_res_qxga;
extern BOOL install_res_1440;
extern BOOL install_res_4k;
extern BOOL install_res_5k;

BOOL simd95(HWND hwnd);
BOOL infFixer(HWND hwnd);
Expand Down
10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
0.4.2023.13
! QEMU display driver works
- Mesa 21.3.8
- VMware 3D support (see README)
- optimalizations in VMware SVGA driver
- frame buffer fixes (fewer black screens when switching color depth)
- fixed memory allocator
- SIMD95 is disabled by default
- Optional resolution above FullHD sets

0.4.2023.11
! R5G6B5 surface workaround - fixed black screen on (mostly) NVIDIA GPUs
- large Wine (DirectX) update
Expand Down
Binary file added resource/docs/dma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-pci-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/qemu-vga.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-bios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-hid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-setup-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-setup-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-setup-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/vmw-setup-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resource/docs/windows-logon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6c94233

Please sign in to comment.