Skip to content

v.04.0: Speed and the Vita

Latest

Choose a tag to compare

@Owloeb Owloeb released this 14 Oct 02:07
· 34 commits to main since this release
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)