| name | wine-api-comparison-test |
| description | Compare D3D8 API calls between original game EXE and reimplementation under Wine |
| tags | ["wine","d3d8","testing","comparison","hamsterball"] |
Wine API Comparison Test
Purpose
Run both the original Hamsterball EXE and our reimplementation under Wine with
API tracing to compare D3D8/DInput/DSound call sequences. This validates that our
reimplementation makes the same WinAPI calls as the original game.
Prerequisites
- Wine 9.0+ installed
- Xvfb for headless testing (no GPU needed for reimpl)
- Original EXE:
originals/installed/extracted/Hamsterball.exe
- Reimpl EXE:
reimpl/hamsterball.exe
- Test script:
scripts/test_api_compare.sh
Running the Comparison
Quick Test (Xvfb, headless)
Xvfb :99 -screen 0 1024x768x24 -ac &
sleep 2
DISPLAY=:99 ./scripts/test_api_compare.sh :99
Manual Original Game Test
cd ~/hamsterball-re/originals/installed/extracted
DISPLAY=:99 WINEDEBUG=+d3d8,+dinput wine Hamsterball.exe 2>&1 | tee /tmp/orig_trace.log
Manual Reimpl Test
cd ~/hamsterball-re/reimpl
DISPLAY=:99 wine ./hamsterball.exe 2>&1 | tee /tmp/reimpl_trace.log
Analyzing Traces
Key D3D8 Calls to Compare
- Direct3DCreate8 — SDK version must match
- GetAdapterDisplayMode — resolution/format query
- CreateDevice — compare params: DeviceType, BehaviorFlags, BackBufferWidth/Height
- SetRenderState — sequence of render states after device creation
- SetLight/LightEnable — light setup
- SetTransform — view/projection/world matrix setup
- CreateVertexBuffer — geometry buffer creation
- DrawPrimitive/DrawIndexedPrimitive — actual rendering calls
- Present — frame presentation
Extracting API Calls from Wine Trace
grep -i "trace:d3d8" /tmp/trace.log | head -100
grep -i "CreateDevice" /tmp/trace.log
grep -c "SetRenderState" /tmp/trace.log
Known Differences (Original vs Reimpl)
| Aspect | Original | Reimpl |
|---|
| CreateDevice | D3DCREATE_HARDWARE_VERTEXPROCESSING | Falls back to SOFTWARE_VERTEXPROCESSING |
| Window | Fullscreen 800x600 (original) | Windowed 1024x768 (our default) |
| Audio | BASS.dll for music, DirectSound for SFX | DirectSound stubbed (non-fatal) |
| Geometry | MESHWORLD vertex buffer rendering (SpawnPlatform 34v) | Placeholder sphere + colored cubes |
| Textures | D3DXCreateTextureFromFile (PNG/TGA) | No texture loading yet |
| Scene System | 8-pass render pipeline | Single-pass clear + ball + objects |
| Input | DInput8 + BASS for polling | DInput8 keyboard + mouse polling |
Screenshots
Screenshots are stored in analysis/screenshots/comparison/:
original_fullscreen.png — D3DERR_NOTAVAILABLE error dialog on Xvfb
reimpl.png — Clear color screen (purple-gray) with no geometry
- README.md — Detailed comparison notes
Full GPU Testing
For testing with real GPU rendering (original game works):
- Use a Windows machine with DirectX 8 runtime
- Or use GPU passthrough in a VM
- Or use a Linux system with Mesa D3D8 state tracker