Einhänder - native recompilation

Einhänder - native recompilation is a native PC port of Einhänder for PlayStation that re-renders graphics at higher resolution and adds controller vibration.

README

Einhänder - native recompilation

A static recompilation of Einhänder (PlayStation, NTSC-U, SCUS-94243, Squaresoft, 1998) to native code. The game's two MIPS executables (SCUS_942.43, which boots and LoadExec()s SYS.EXE) and its 23 code overlays (entries of the BINPACK*.BIN archives) are translated to C++ and run on Windows (and Linux) with a runtime that replaces the PlayStation hardware and BIOS. Graphics are re-rendered with OpenGL at higher resolution.

No game data is included. You need your own copy of the game as a disc image (.chd, or .cue + .bin).

Status

  • Boots through the Sony/Squaresoft logos, the memory card check, the intro movie, the title screen, fighter and arm selection, and into Stage 1 gameplay, entirely in recompiled code.
  • Verified on the headless Linux test build against a reference emulator. The Windows build is produced by CI.

See NOTES.md for the technical write-up.

Running (Windows)

  1. Download the latest Einhander-<version>-win64.zip from Releases (or the einhander-win64 artifact of any Build Windows run on the Actions tab) and unzip it.

  2. First run only: put your disc image (Einhander.chd, or a .cue + its .bin) next to einhander.exe or in a game folder beside it, then run einhander.exe - or drag the image onto it.

  3. The disc is imported once into assets.dat (about 300 MB, under a minute) and checked sector by sector to be an exact copy. From then on the game runs from assets.dat and the disc image can be deleted. The finished install is just:

    einhander.exe  SDL2.dll  assets.dat  (memcard1.mcd, einhander.ini once created)
    

einhander.exe --import <image> [out.dat] builds the file without starting the game.

Saves go to memcard1.mcd next to the exe - a standard 128 KB PlayStation memory card image, so saves can be copied to and from emulators. Settings are in einhander.ini.

In-game settings (F1 or Esc, Start+Select on a controller)
SettingOptions
Resolution1x (original) to 6x internal resolution (restart); the window follows it (240 lines x the setting, shrunk to fit the desktop)
Widescreen 16:9wider view of the 3D world (Einhander: the extra width shows enemies entering and leaving at the edges; off by default)
VSync, Fullscreen (F11 / Alt+Enter)
Scalingsharp or smooth
Texture filteringoff (original), smooth 3D (2D art and text stay sharp), smooth everything - bilinear on the palette-decoded texels, so transparent edges stay clean
Colourtrue colour, or the original 15-bit colour with the PlayStation's dither pattern
Precise geometrysub-pixel polygon positions and perspective-correct textures (no wobble or texture warping), PGXP-style
Screen filteroff, scanlines, CRT (scanlines + aperture grille + glow; needs a window 600+ pixels tall)
Audio resamplingstandard, or high quality (windowed-sinc) for the streamed XA music and voices
Vibrationnew in this port (the original has none): off, hits and explosions, or also when firing; strength 25-100%
Swap A/B and X/Yface buttons by position
Fast CD loadinglevels load faster; music and movies stay real-time
Game speed1x-8x fast-forward (hold Tab for a burst)
Frame rate displaygame frames per second and emulation speed (100% = a real console)
Keyboard keysrebind every PlayStation button (or reset to defaults)
Controller buttonsrebind every PlayStation button to controller buttons, triggers or stick directions
Controls

Any XInput/SDL gamepad works. Einhander reads only the d-pad and buttons, so the left stick also drives the d-pad. The original game has no vibration (it never sends motor data, and a reference emulator with a DualShock attached never rumbles either); this port adds it - see Vibration above. Controllers SDL has no mapping for are used as generic joysticks (buttons, hats, axes), and a gamecontrollerdb.txt next to the exe adds more mappings. Start+Select opens the settings menu. Keyboard defaults: arrows = d-pad, X = Cross, Z = Circle, A = Square, S = Triangle, Q/W = L1/R1, 1/2 = L2/R2, Enter = Start, Backspace = Select, I/J/K/L = right stick, Tab = fast-forward (hold). Change them in the F1 menu under Keyboard keys (saved in einhander.ini).

Layout

PathWhat it is
src/recomp.py, src/mips.pyRecompiler: the two executables + 23 overlays -> src/gen/*.cpp (one C++ function per MIPS function)
src/gen/Generated code (committed so CI can build without the disc)
src/runtime/Runtime: memory map, HLE BIOS (events, threads, interrupts, memory cards), GTE, GPU -> OpenGL, SPU, CD-ROM (XA/CD-DA), MDEC, controllers, timers, DMA
config/images.txtThe code images: executables and the BINPACK overlay entries with their load addresses
config/functions.txtExtra entry points and functions that run in the interpreter
config/hle.txtGuest functions replaced by host code
config/psyq.txtPsyQ library names found by signature
tools/Disc preparation, disassembler, signature matcher, reference STR/BS decoder

Regenerating the code

python3 tools/prepare_disc.py Einhander.cue game     # executables, archives, overlays (a .chd needs chdman)
python3 src/recomp.py game config src/gen 300

Building

Linux headless test build (EGL, screenshots): cmake -S src -B build -G Ninja && ninja -C build, then SHOT_DIR=shots SHOT_EVERY=60 FRAMES=3000 ./build/einhander Einhander.chd.

Windows (cross-compiled with mingw-w64): see .github/workflows/build-windows.yml.

Disclaimer

This is an unofficial fan project. It is not affiliated with, endorsed by, or sponsored by Square Enix, Sony Interactive Entertainment or any of their affiliates. Einhänder and all related names and marks belong to their respective owners. This repository and its releases contain no game data (graphics, sound, music, movies): those come from your own legally obtained disc image. The recompiled source and the release exe contain code machine-translated from the game's executables.

License

The project's own code is released under the MIT License. Third-party components keep their own licenses; see THIRD_PARTY_NOTICES.md.