Skip to content

Releases

v.04.0: Speed and the Vita

Choose a tag to compare

@Owloeb Owloeb released this 14 Oct 02:07
1fd62bd

v0.4.0: Speed, and System Shock 2 on the PS Vita

Tools only, as always: no game code and no executables are included. You build everything from your own copy of System Shock 2 (NewDark 2.48). The default output is unchanged; everything new for speed is opt-in.

PS Vita backend (new)

Faster generated code (port/build.py --cache-regs, opt-in)

  • Guest registers live in C locals instead of the CPU struct. Indirect calls and imports are held to the calling convention, a new proof (lift_preserve.py) works out which registers each function preserves, and the x87 stack moves into C locals too (lift_x87.py, about 1.5x on float-heavy code). Indirect calls go through a per-thread cache of recent targets.
  • Verified at run time with --abi-check: every call that relies on an assumption checks it and logs any violation. Full play sessions on Linux and the Vita reported none. There are new tests with negative controls (harness/abi_test/run.sh) and random-program fuzzing (csmith_fuzz.py, integer and floating point). How it works: [docs/RECOMPILER.md](https://github.com/Owloeb/NewDarkRecompiled/blob/v0.4.0/docs/RECOMPILER.md#register-caching---cache-regs).

Portable host

  • Render thread: the renderer can run on its own core, together with the Direct3D per-vertex work (transform, lighting, fog), at most one frame behind the game. On by default on the Vita; SS2PORT_RENDER_THREAD=1 on the desktop. Ports now implement one extra call, plat_gfx_deferred.
  • Fast paths (--fastpaths): native C for the hottest engine functions: string and key hashes, the hash-table lookups behind object queries, _ftol/_ftol2 and a bitmap copy. Each one is checked against the game's own instructions in an x86 emulator (port/tests/fastpaths/check.py).
  • Buffered file writes: level changes were slow under WSL because every small write went straight to disk. They're now fast.
  • File reads no longer hold the guest lock, so other guest threads keep running during slow I/O.
  • Sampling profiler: --prof, plus tools/fnprof.py to summarise it.
  • --guest-backed for platforms without lazy memory commit, and --symbols for named crash reports.

Naming the engine

  • Play-session recorder (host/build_win.py --record) and tools/suggest_names.py: play the game and get a work list of which functions run for which activity.
  • The engine's console command table is harvested automatically (106 commands, tools/annotate.py); hand-verified key handlers and the AI message factories are in symbols/manual.sym.

Documentation

Tests

  • Conformance: 509 checks headless, 536 with pixel-exact rendering (also with the render thread on), plain and --cache-regs with --abi-check.
  • New suites: render-thread stress test (600,000 random calls, ThreadSanitizer), Vita sound cache, fast paths against the game's own code, and --cache-regs end to end.

Full changelog: [v0.3.0...v0.4.0](v0.3.0...v0.4.0)

v0.3.0: Portable Host (To Linux, and Beyond!)

Choose a tag to compare

@Owloeb Owloeb released this 08 Oct 05:15
f3852f2

v0.3.0: Portable Host (To Linux, and Beyond!)

  • New port/: a platform layer that runs the recompiled game with no Windows and no x86 CPU. Win32, the C runtime, Direct3D 9, DirectSound and DirectInput are implemented on top of one small interface, port/include/plat.h. A port to a new platform writes a backend for that interface and nothing else.
  • Backends included: POSIX, Windows (development and test target), SDL2 (OpenGL 2.1 and OpenGL ES 2.0), and a headless one.
  • One-command build: python3 port/build.py "<SS2.exe>". See the Linux quick start in port/README.md.
  • Plays through Rickenbacker and Body of the Many on Linux (WSL) and as a 64-bit Windows build. Experimental: mouselook on native Linux is untested (WSLg cannot capture the pointer).
  • Known gaps: shaders and cube/volume textures (the game falls back to fixed-function; screen-distortion and blur effects are missing), C++ exceptions, fmsel.dll on the portable host.
  • READMEs restructured; recompiler notes moved to docs/RECOMPILER.md.

v0.2.0: Built-in portable cutscene decoder in place of ffmpeg.dll

Choose a tag to compare

@Owloeb Owloeb released this 06 Oct 21:56

v0.2.0: all .osms recompiled, built in cutscene decoder

  • Cutscenes are decoded by a built-in portable C decoder (video/). lgvid.dll runs unchanged on top of it. The decoder reads AVI files with Indeo 5 video and PCM audio, which is everything the game ships.
  • ffmpeg.dll is no longer loaded. This removes the heap-corruption workaround and its leaks.
  • darkrecomp_native_ffmpeg.txt next to the exe brings back the original ffmpeg.dll, for cutscene mods in other formats.
  • The Indeo 5 decoder in video/ffmpeg/ is FFmpeg's, unmodified and LGPL 2.1. Everything else stays MIT.
  • Since v0.1.0, allobjs.osm, Squirrel.osm, lgvid.dll and fmsel.dll are all recompiled too, and the build names about a third of the functions from your own exe.

v0.1.0

Choose a tag to compare

@Owloeb Owloeb released this 03 Oct 03:23

First experimental release: tools only. This is for people who want to try it or poke at it. Expect rough edges.

What you get

The recompiler, the Windows host and a one-command build script. No game code and no exe are included: you generate everything from your own copy of System Shock 2 (NewDark 2.48).

Try it (Windows, PowerShell)

python -m pip install pefile capstone ziglang
python host\build_win.py "C:\path\to\System Shock 2\SS2.exe" --install

First build takes about 20 minutes. Then run ss2_native.exe from your System Shock 2 folder instead of SS2.exe. See the README for details and the optional switch files.

State of things

  • Playable on a flat screen: menus, character creation, level changes, save/load, HUD, audio, input, fullscreen, cutscenes.
  • Cutscenes rely on a workaround for invalid frees inside the original ffmpeg.dll (root cause not yet understood).
  • The original Looking Glass DLLs and .osm scripts still run natively.
  • Windows only; tested with NewDark 2.48 on one NVIDIA machine, so reports from other setups are very welcome.

Goal

A VR version of System Shock 2 (OpenXR) built on the recompiled engine. VR code is not in this release.

If it crashes, ss2_native.log (next to the exe) contains a crash report; attach it to an issue.