Plan Phase 8: Windows XP compatibility (net40/x86 + vJoy dual-target)

One codebase, two flavors: Win10/11 stays net48/x64 with ViGEm/RioGamepad
and remains the authoring platform; XP SP3 gets a net40/x86 runtime with
vJoy (full 96-button fidelity), pre-rendered wallpapers (PNG converted to
BMP at apply), Newtonsoft JSON shared by both flavors, Bcl.Async + small
compat shims, and a .bat-only installer. Grounded in a source audit:
about 20 Span/Memory uses in the 9600-baud serial path, 6 modern Task
calls, 1 HashCode.Combine, System.Text.Json in two stores.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-11 19:55:38 -05:00
co-authored by Claude Fable 5
parent 2ac3188528
commit 39d79e1fb1
+55
View File
@@ -294,6 +294,61 @@ Replaces the legacy Google-Sheet → `.data` → GIMP → Script-Fu pipeline
- To confirm at Phase 7: target wallpaper resolution(s); static wallpaper vs. - To confirm at Phase 7: target wallpaper resolution(s); static wallpaper vs.
live overlay (e.g. lit-button highlighting mirroring lamp state). live overlay (e.g. lit-button highlighting mirroring lamp state).
### Phase 8 — Windows XP compatibility (dual-target) — planned
Bring RIOJoy back to the original XP-era cabinets (x86, XP SP3) **without
regressing Windows 10/11**. Strategy: one codebase, two flavors — modern
machines stay the *authoring* platform (editor + wallpaper maker + packaging);
XP gets the full *runtime* (serial, mapping, vJoy joystick, keyboard/mouse,
lamps, plasma, wallpaper apply).
| | Windows 10/11 (unchanged) | Windows XP SP3 |
|---|---|---|
| TFM / arch | net48, x64 | **net40, x86** (.NET 4.0 is XP's ceiling; 4.5+ needs Vista) |
| Virtual joystick | ViGEm → RioGamepad → vJoy → none | **vJoy 2.0.x** (last XP driver line) — full 6-axis/96-button fidelity |
| Overlay render | SkiaSharp (generate + apply) | consume pre-rendered wallpaper only (**PNG→BMP** — XP's `SystemParametersInfo` takes BMP only) |
| Editor | full (incl. wallpaper maker) | mapping editor only (pure WinForms/GDI+); wallpaper maker gated (Skia) |
| JSON | System.Text.Json → **Newtonsoft 13** | Newtonsoft 13 (STJ needs net461+; one serializer for both flavors) |
| Install scripts | PowerShell | **.bat only** (XP has no in-box PowerShell) |
- **8A — Core retarget** (`net48;net40` multi-target): de-Span the
protocol/serial layer (≈20 uses / 11 files → `byte[]`/`ArraySegment`;
System.Memory doesn't go below net45, and at 9600 baud Span buys nothing);
swap System.Text.Json → Newtonsoft in `ConfigStore`/`OverlayTemplateStore`
(both TFMs, so the config format can't drift); async on net40 via
**Microsoft.Bcl.Async** + a `Compat/TaskCompat` shim (6 call sites:
Task.Run/Delay/WhenAny/WhenAll → TaskEx; XP prereq: KB2468871, bundle it);
shim the one `HashCode.Combine`; `#if`-gate the net48-only sinks
(`ViGEmJoystickSink`, `HidFeederJoystickSink`, `Hid/`).
*Risk fallback:* if Bcl.Async misbehaves on real XP, the receive loop
reverts to a dedicated thread (the legacy `CommWatchProc` shape) for net40.
- **8B — vJoy sink (both flavors):** `VJoyJoystickSink : IJoystickSink`
P/Invoking `vJoyInterface.dll` (SDK already on hand in docs/vJoy_SDK/);
arch-matched DLL load; report packing pure + unit-tested. Acquisition
order — net48: ViGEm → RioGamepad → **vJoy** → Null (a signed 96-button
option on 10/11 for free); net40: vJoy → Null. Pin installers:
2.0.5 (XP) / 2.1.9.1 (signed, 10/11) in `deploy/vendor/`.
- **8C — Tray on net40/x86:** multi-target `RioJoy.Tray` (net40 drops the
ViGEm + RioJoy.Overlay references); gate `WallpaperMakerForm` + overlay
generation; `WallpaperApplier` converts PNG→BMP via GDI+ before
`SystemParametersInfo` (harmless on 10/11, required on XP); profile editor
stays (Segoe UI falls back to Tahoma). XP cabinets consume wallpapers
pre-rendered on a modern machine (`RioProfile.WallpaperPath` travels with
the config).
- **8D — Packaging:** `build-package.ps1 -Flavor XP`
`RIOJoy-XP-<ver>.zip` (net40/x86 publish, vJoy 2.0.5 installer,
`.bat` install/uninstall, README-DEPLOY-XP: prereqs XP SP3 + .NET 4.0 Full
+ KB2468871). Modern zip unchanged; release both to Gitea.
- **8E — Verification:** full suite stays net48-hosted (xUnit needs
net452+; shared sources are what's tested) + a tiny net40 console
self-test for the shims, run on XP. Ladder: net40/x86 binary boots on
Win10 → XP VM with vRIO over a virtual COM pair → real cabinet
(joy.cpl shows 6 axes + 96 buttons, SendInput into a game, lamps,
plasma, auto-switch yield, BMP wallpaper).
- **To confirm before starting:** (1) keep the mapping editor on XP or ship
runtime-only? (2) is vJoy acceptable as the 10/11 full-fidelity fallback
(96 buttons without the custom driver)? (3) which XP cabinets / how do
files get onto them (drives the .bat installer shape)?
--- ---
## Open items / risks ## Open items / risks