Initial RetroNFS95 Win9x VxD prototype

This commit is contained in:
2026-10-12 12:59:15 +00:00
commit 908ece2cc8
51 changed files with 3266 additions and 0 deletions

166
docs/BUILD_TOOLCHAIN.md Normal file
View File

@@ -0,0 +1,166 @@
# Build Toolchains For RetroNFS95
There are two different build problems:
1. Win32 user-mode pieces:
- `bin/retronfs95.exe`
- `provider/RETRONP.DLL`
- `mounter/RetroMap95.exe`
2. Win95/98 ring-0 VxD:
- `vxd/RETROVXD.VXD`
Do not use one modern default Windows compiler for everything. Modern MinGW and
MSVC builds often import APIs or CRT startup code that Windows 95/98 cannot
load.
## Recommended Setup
### User-Mode EXE/DLL
Best options:
- old MinGW 3.x/4.x targeting `msvcrt`
- MinGW Lite with a Win95/98 profile
- Open Watcom v2 targeting Win32
Avoid:
- UCRT builds
- x86_64 builds
- binaries that depend on APIs newer than Win98
For the current Makefiles, a suitable MinGW command set is:
```sh
mingw32-g++ --version
```
or, on Linux:
```sh
i586-mingw32msvc-g++ --version
i686-w64-mingw32-g++ --version
```
The safest CRT target is old `msvcrt.dll`, not UCRT.
### VxD
Best options:
1. Windows 98 DDK in a Windows 98/2000/XP VM
- most historically accurate
- least surprise
2. Linux cross build with:
- Open Watcom v2
- JWasm/UASM
- Windows 98 DDK headers/libs/includes
- custom linker command file
Open Watcom's linker has VxD output support, but VxD builds still depend on DDK
headers, segment layout, control procedure glue, and import definitions.
## Practical Recommendation
Use two build environments:
```text
Linux host
builds and tests portable NFS core
builds Win32 EXE/DLL if MinGW-Lite or old MinGW is installed
Win98/XP VM with Win98 DDK
builds RETROVXD.VXD
tests driver loading and IFSMgr behavior
```
This avoids spending days fighting linker/segment issues before the redirector
logic itself is working.
## Linux Package Names To Look For
Depending on distribution:
```text
openwatcom-v2
jwasm or uasm
mingw-w64-i686
wine
dosbox-x
qemu-system-i386
```
For true Win95 compatibility, prefer a dedicated Win95/98-capable MinGW build
over a modern distro default.
## Suggested Build Order
1. Build portable NFS core:
```sh
make -f Makefile.posix
```
2. Build Win32 mapping app and provider:
```sh
tools/build-win32-mingw.sh
```
The script rebuilds `retronfs95.exe`, `RetroMap95.exe`, and `RETRONP.DLL`,
then refreshes `dist/RetroNFS95-win32-artifacts.zip` and
`dist/SHA256SUMS.txt`.
3. Build VxD in DDK environment:
```bat
cd vxd
build
```
or with an Open Watcom/JWasm cross setup once DDK includes are available:
```sh
tools/build-vxd-watcom.sh /path/to/win98ddk
```
The script prefers `jwasm` when available and assembles the control stub with
MASM-compatible options:
```sh
jwasm -nologo -c -omf -Cp -Zm -3p -I/path/to/win98ddk/inc ...
```
`-Cp` preserves symbol case, `-Zm` enables MASM compatibility, and `-omf` is the
default because Open Watcom `wlink` expects OMF objects for this VxD flow. COFF
can be tested explicitly:
```sh
VXD_OBJ_FORMAT=coff tools/build-vxd-watcom.sh /path/to/win98ddk
```
The VxD build enables the real IFSMgr registration service call by default:
```sh
make -C vxd VXD_IFSMGR_REGISTER=real
```
For safer load/debug cycles where the FSD entry should only be prepared and
reported through `/status`, use:
```sh
make -C vxd VXD_IFSMGR_REGISTER=prepared
```
The Linux DDK include tree may contain both uppercase and lowercase copies such
as `VMM.INC` and `vmm.inc`. The current `vxd/retroctrl.asm` avoids that macro
path completely: it carries the small DDB/control-dispatch subset needed by
RetroNFS95, because the stock Win98 DDK `vmm.inc` MakeCodeSeg macro uses old
MASM concatenation syntax that JWasm rejects.
That script is still not a substitute for a real Win95/98 test machine. It
builds a loadable-format `RETROVXD.VXD`; runtime loading, MPR interaction, and
IFSMgr file-operation dispatch still need to be tested and completed under
Windows 95/98.